Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
001d4d17
Commit
001d4d17
authored
Sep 17, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for dynamic XY_Curve
parent
a21cc7e5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
731 additions
and
9 deletions
+731
-9
java/jpwr/jop/src/GeDyn.java
java/jpwr/jop/src/GeDyn.java
+33
-2
java/jpwr/jop/src/GeDynXYCurve.java
java/jpwr/jop/src/GeDynXYCurve.java
+323
-0
java/jpwr/jop/src/JopXYCurve.java
java/jpwr/jop/src/JopXYCurve.java
+182
-0
java/jpwr/jop/src/os_linux/hw_x86/makefile
java/jpwr/jop/src/os_linux/hw_x86/makefile
+2
-0
java/jpwr/rt/src/CdhrFloatArray.java
java/jpwr/rt/src/CdhrFloatArray.java
+43
-0
java/jpwr/rt/src/CdhrIntArray.java
java/jpwr/rt/src/CdhrIntArray.java
+43
-0
java/jpwr/rt/src/Gdh.java
java/jpwr/rt/src/Gdh.java
+3
-1
java/jpwr/rt/src/GdhServer.java
java/jpwr/rt/src/GdhServer.java
+47
-5
java/jpwr/rt/src/os_linux/hw_x86/makefile
java/jpwr/rt/src/os_linux/hw_x86/makefile
+2
-0
java/jpwr/rt_client/src/Gdh.java
java/jpwr/rt_client/src/Gdh.java
+53
-1
No files found.
java/jpwr/jop/src/GeDyn.java
View file @
001d4d17
/*
* Proview $Id: GeDyn.java,v 1.1
1 2007-05-23 08:05:19
claes Exp $
* Proview $Id: GeDyn.java,v 1.1
2 2007-09-17 15:35:28
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -50,6 +50,8 @@ public class GeDyn {
public
static
final
int
mDynType_Table
=
1
<<
24
;
public
static
final
int
mDynType_StatusColor
=
1
<<
25
;
public
static
final
int
mDynType_HostObject
=
1
<<
26
;
public
static
final
int
mDynType_DigSound
=
1
<<
27
;
public
static
final
int
mDynType_XY_Curve
=
1
<<
28
;
public
static
final
int
mActionType_No
=
0
;
public
static
final
int
mActionType_Inherit
=
1
<<
0
;
...
...
@@ -88,6 +90,10 @@ public class GeDyn {
public
static
final
int
eEvent_ValueChanged
=
5
;
public
static
final
int
eEvent_FocusLost
=
6
;
public
static
final
int
eCurveDataType_XYArrays
=
0
;
public
static
final
int
eCurveDataType_PointArray
=
1
;
public
static
final
int
eCurveDataType_TableObject
=
2
;
public
static
final
int
eType_Bit
=
(
1
<<
15
)
+
1
;
public
int
dynType
;
...
...
@@ -264,7 +270,9 @@ public class GeDyn {
String
suffix
;
int
idx1
=
s
.
indexOf
(
"##"
);
if
(
idx1
!=
-
1
)
{
int
idx2
=
s
.
indexOf
(
'['
);
int
idx2
=
s
.
indexOf
(
'#'
,
idx1
+
2
);
if
(
idx2
==
-
1
)
idx2
=
s
.
indexOf
(
'['
);
if
(
idx2
!=
-
1
)
suffix
=
s
.
substring
(
idx1
+
2
,
idx2
);
else
...
...
@@ -307,6 +315,29 @@ public class GeDyn {
return
GeDyn
.
eType_Bit
;
return
-
1
;
}
static
public
int
getAttrSize
(
String
s
)
{
String
sizestr
;
int
idx1
=
s
.
indexOf
(
"##"
);
if
(
idx1
==
-
1
)
return
-
1
;
int
idx2
=
s
.
indexOf
(
'#'
,
idx1
+
2
);
if
(
idx2
==
-
1
)
return
-
1
;
int
idx3
=
s
.
indexOf
(
'['
);
if
(
idx3
!=
-
1
)
sizestr
=
s
.
substring
(
idx2
+
1
,
idx2
);
else
sizestr
=
s
.
substring
(
idx2
+
1
);
try
{
Integer
i
=
new
Integer
(
sizestr
);
return
i
.
intValue
();
}
catch
(
Exception
e
)
{
}
return
-
1
;
}
boolean
isLocalDb
(
String
attribute
)
{
return
(
attribute
.
startsWith
(
"$local."
)
&&
en
.
ldb
!=
null
);
...
...
java/jpwr/jop/src/GeDynXYCurve.java
0 → 100644
View file @
001d4d17
/*
* Proview $Id: GeDynXYCurve.java,v 1.1 2007-09-17 15:35:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package
jpwr.jop
;
import
java.awt.*
;
import
java.awt.geom.*
;
import
java.awt.image.*
;
import
java.awt.font.*
;
import
javax.swing.*
;
import
jpwr.rt.*
;
public
class
GeDynXYCurve
extends
GeDynElem
{
String
x_attr
;
String
y_attr
;
String
y_minvalue_attr
;
String
y_maxvalue_attr
;
String
x_minvalue_attr
;
String
x_maxvalue_attr
;
String
noofpoints_attr
;
String
update_attr
;
float
y_min_value
;
float
y_max_value
;
float
x_min_value
;
float
x_max_value
;
int
datatype
;
public
int
curve_color
;
public
int
fill_color
;
public
int
fill_curve
;
int
noofpoints
;
int
noOfPoints
;
public
float
[]
curveX
;
public
float
[]
curveY
;
boolean
updateAttrFound
;
PwrtRefId
updateSubid
;
int
updateP
;
boolean
updateOldValue
;
boolean
noofpointsAttrFound
;
PwrtRefId
noofpointsSubid
;
int
noofpointsP
;
int
noofpointsOldValue
;
boolean
yMinvalueAttrFound
;
PwrtRefId
yMinvalueSubid
;
int
yMinvalueP
;
boolean
yMaxvalueAttrFound
;
PwrtRefId
yMaxvalueSubid
;
int
yMaxvalueP
;
boolean
xMinvalueAttrFound
;
PwrtRefId
xMinvalueSubid
;
int
xMinvalueP
;
boolean
xMaxvalueAttrFound
;
PwrtRefId
xMaxvalueSubid
;
int
xMaxvalueP
;
boolean
firstScan
=
true
;
public
GeDynXYCurve
(
GeDyn
dyn
,
String
x_attr
,
String
y_attr
,
String
y_minvalue_attr
,
String
y_maxvalue_attr
,
String
x_minvalue_attr
,
String
x_maxvalue_attr
,
String
noofpoints_attr
,
String
update_attr
,
float
y_min_value
,
float
y_max_value
,
float
x_min_value
,
float
x_max_value
,
int
noofpoints
,
int
datatype
,
int
curve_color
,
int
fill_color
,
int
fill_curve
)
{
super
(
dyn
,
GeDyn
.
mDynType_XY_Curve
,
GeDyn
.
mActionType_No
);
this
.
x_attr
=
x_attr
;
this
.
y_attr
=
y_attr
;
this
.
y_minvalue_attr
=
y_minvalue_attr
;
this
.
y_maxvalue_attr
=
y_maxvalue_attr
;
this
.
x_minvalue_attr
=
x_minvalue_attr
;
this
.
x_maxvalue_attr
=
x_maxvalue_attr
;
this
.
noofpoints_attr
=
noofpoints_attr
;
this
.
update_attr
=
update_attr
;
this
.
y_min_value
=
y_min_value
;
this
.
y_max_value
=
y_max_value
;
this
.
x_min_value
=
x_min_value
;
this
.
x_max_value
=
x_max_value
;
this
.
datatype
=
datatype
;
this
.
curve_color
=
curve_color
;
this
.
fill_color
=
fill_color
;
this
.
noofpoints
=
noofpoints
;
this
.
fill_curve
=
fill_curve
;
}
public
void
connect
()
{
String
attrName
=
dyn
.
getAttrName
(
update_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
updateAttrFound
=
true
;
updateP
=
ret
.
id
;
updateSubid
=
ret
.
refid
;
}
}
attrName
=
dyn
.
getAttrName
(
noofpoints_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
noofpointsAttrFound
=
true
;
noofpointsP
=
ret
.
id
;
noofpointsSubid
=
ret
.
refid
;
}
}
attrName
=
dyn
.
getAttrName
(
y_minvalue_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
yMinvalueAttrFound
=
true
;
yMinvalueP
=
ret
.
id
;
yMinvalueSubid
=
ret
.
refid
;
}
}
attrName
=
dyn
.
getAttrName
(
y_maxvalue_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
yMaxvalueAttrFound
=
true
;
yMaxvalueP
=
ret
.
id
;
yMaxvalueSubid
=
ret
.
refid
;
}
}
attrName
=
dyn
.
getAttrName
(
x_minvalue_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
xMinvalueAttrFound
=
true
;
xMinvalueP
=
ret
.
id
;
xMinvalueSubid
=
ret
.
refid
;
}
}
attrName
=
dyn
.
getAttrName
(
x_maxvalue_attr
);
if
(
attrName
.
compareTo
(
""
)
!=
0
)
{
GdhrRefObjectInfo
ret
=
dyn
.
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"XYCurve: "
+
attrName
);
else
{
xMaxvalueAttrFound
=
true
;
xMaxvalueP
=
ret
.
id
;
xMaxvalueSubid
=
ret
.
refid
;
}
}
}
public
void
disconnect
()
{
if
(
updateAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
updateSubid
);
if
(
noofpointsAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
noofpointsSubid
);
if
(
yMinvalueAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
yMinvalueSubid
);
if
(
yMaxvalueAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
yMaxvalueSubid
);
if
(
xMinvalueAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
xMinvalueSubid
);
if
(
xMaxvalueAttrFound
)
dyn
.
en
.
gdh
.
unrefObjectInfo
(
xMaxvalueSubid
);
}
public
void
scan
()
{
String
attrName
;
int
attrSize
;
boolean
update
=
false
;
int
size
=
1
;
noOfPoints
=
noofpoints
;
if
(
firstScan
)
update
=
true
;
if
(
updateAttrFound
)
{
boolean
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoBoolean
(
updateP
);
if
(
value
&&
!
updateOldValue
)
update
=
true
;
updateOldValue
=
value
;
}
if
(
noofpointsAttrFound
)
{
int
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoInt
(
updateP
);
if
(
value
!=
noofpointsOldValue
)
{
update
=
true
;
noOfPoints
=
value
;
noofpointsOldValue
=
value
;
}
}
if
(
yMinvalueAttrFound
)
{
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
yMinvalueP
);
if
(
value
!=
y_min_value
)
{
y_min_value
=
value
;
update
=
true
;
}
}
if
(
yMaxvalueAttrFound
)
{
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
yMaxvalueP
);
if
(
value
!=
y_max_value
)
{
y_max_value
=
value
;
update
=
true
;
}
}
if
(
xMinvalueAttrFound
)
{
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
xMinvalueP
);
if
(
value
!=
x_min_value
)
{
x_min_value
=
value
;
update
=
true
;
}
}
if
(
xMaxvalueAttrFound
)
{
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
xMaxvalueP
);
if
(
value
!=
x_max_value
)
{
x_max_value
=
value
;
update
=
true
;
}
}
if
(
update
)
{
attrName
=
dyn
.
getAttrName
(
x_attr
);
attrSize
=
GeDyn
.
getAttrSize
(
x_attr
);
if
(
attrSize
==
-
1
)
return
;
switch
(
datatype
)
{
case
GeDyn
.
eCurveDataType_XYArrays
:
if
(
attrSize
<
noOfPoints
)
noOfPoints
=
attrSize
;
size
=
noOfPoints
;
break
;
case
GeDyn
.
eCurveDataType_PointArray
:
if
(
attrSize
/
2
<
noOfPoints
)
noOfPoints
=
attrSize
/
2
;
size
=
noOfPoints
*
2
;
break
;
case
GeDyn
.
eCurveDataType_TableObject
:
if
(
(
attrSize
-
1
)/
2
<
noOfPoints
)
noOfPoints
=
(
attrSize
-
1
)/
2
;
size
=
noOfPoints
*
2
+
1
;
break
;
}
CdhrFloatArray
rx
=
dyn
.
en
.
gdh
.
getObjectInfoFloatArray
(
attrName
,
size
);
if
(
rx
.
evenSts
())
return
;
switch
(
datatype
)
{
case
GeDyn
.
eCurveDataType_XYArrays
:
attrName
=
dyn
.
getAttrName
(
y_attr
);
attrSize
=
GeDyn
.
getAttrSize
(
y_attr
);
if
(
attrSize
<
noOfPoints
)
noOfPoints
=
attrSize
;
CdhrFloatArray
ry
=
dyn
.
en
.
gdh
.
getObjectInfoFloatArray
(
attrName
,
noOfPoints
);
if
(
ry
.
evenSts
())
return
;
curveY
=
new
float
[
noOfPoints
];
curveX
=
new
float
[
noOfPoints
];
for
(
int
i
=
0
;
i
<
noOfPoints
;
i
++)
{
curveY
[
i
]
=
(
ry
.
value
[
i
]
-
y_min_value
)
/
(
y_max_value
-
y_min_value
);
curveX
[
i
]
=
(
rx
.
value
[
i
]
-
x_min_value
)
/
(
x_max_value
-
x_min_value
);
}
dyn
.
repaintNow
=
true
;
break
;
case
GeDyn
.
eCurveDataType_PointArray
:
curveY
=
new
float
[
noOfPoints
];
curveX
=
new
float
[
noOfPoints
];
for
(
int
i
=
0
;
i
<
noOfPoints
;
i
++)
{
curveX
[
i
]
=
(
rx
.
value
[
2
*
i
]
-
x_min_value
)
/
(
x_max_value
-
x_min_value
);
curveY
[
i
]
=
(
rx
.
value
[
2
*
i
+
1
]
-
y_min_value
)
/
(
y_max_value
-
y_min_value
);
}
dyn
.
repaintNow
=
true
;
break
;
case
GeDyn
.
eCurveDataType_TableObject
:
noOfPoints
=
(
int
)
rx
.
value
[
0
];
if
(
noOfPoints
>
noofpoints
)
noOfPoints
=
noofpoints
;
if
(
attrSize
<
noOfPoints
)
noOfPoints
=
attrSize
;
curveY
=
new
float
[
noOfPoints
];
curveX
=
new
float
[
noOfPoints
];
for
(
int
i
=
0
;
i
<
noOfPoints
;
i
++)
{
curveX
[
i
]
=
(
rx
.
value
[
2
*
i
+
1
]
-
x_min_value
)
/
(
x_max_value
-
x_min_value
);
curveY
[
i
]
=
(
rx
.
value
[
2
*
i
+
2
]
-
y_min_value
)
/
(
y_max_value
-
y_min_value
);
}
dyn
.
repaintNow
=
true
;
break
;
}
}
firstScan
=
false
;
}
}
java/jpwr/jop/src/JopXYCurve.java
0 → 100644
View file @
001d4d17
/*
* Proview $Id: JopXYCurve.java,v 1.1 2007-09-17 15:35:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package
jpwr.jop
;
import
java.awt.*
;
import
java.awt.geom.*
;
import
java.awt.image.*
;
import
java.awt.font.*
;
import
javax.swing.*
;
import
javax.swing.Timer
;
import
java.awt.event.*
;
import
jpwr.rt.*
;
public
class
JopXYCurve
extends
JopTrend
{
public
JopXYCurve
(
JopSession
session
)
{
super
(
session
);
}
public
void
dynamicOpen
()
{
if
(
en
.
isInstance
())
dd
.
setInstance
(
en
.
getInstance
());
dd
.
connect
();
}
public
void
dynamicClose
()
{
dd
.
disconnect
();
}
public
void
dynamicUpdate
(
boolean
animationOnly
)
{
dd
.
scan
();
}
public
void
paintComponent
(
Graphics
g1
)
{
int
i
,
j
;
Graphics2D
g
=
(
Graphics2D
)
g1
;
float
width
=
getWidth
();
float
height
=
getHeight
();
AffineTransform
save
=
g
.
getTransform
();
float
delta
;
if
(
shapes
==
null
)
{
original_width
=
width
;
original_height
=
height
;
shapes
=
new
Shape
[
1
];
shapes
[
0
]
=
new
Rectangle2D
.
Float
(
0
F
,
0
F
,
width
,
height
);
if
(
verticalLines
>
0
)
{
vLines
=
new
Line2D
.
Float
[
verticalLines
];
delta
=
width
/
(
verticalLines
+
1
);
for
(
i
=
0
;
i
<
verticalLines
;
i
++)
vLines
[
i
]
=
new
Line2D
.
Float
(
delta
*
(
i
+
1
),
0
F
,
delta
*
(
i
+
1
),
height
);
}
if
(
horizontalLines
>
0
)
{
hLines
=
new
Line2D
.
Float
[
horizontalLines
];
delta
=
height
/
(
horizontalLines
+
1
);
for
(
i
=
0
;
i
<
horizontalLines
;
i
++)
hLines
[
i
]
=
new
Line2D
.
Float
(
0
F
,
delta
*
(
i
+
1
),
width
,
delta
*
(
i
+
1
));
}
}
g
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
if
(
45.0
<=
rotate
&&
rotate
<
135.0
)
{
g
.
translate
(
width
,
0.0
);
g
.
rotate
(
Math
.
PI
*
rotate
/
180
,
0.0
,
0.0
);
g
.
transform
(
AffineTransform
.
getScaleInstance
(
height
/
original_width
,
width
/
original_height
));
}
else
if
(
135.0
<=
rotate
&&
rotate
<
225.0
)
{
g
.
rotate
(
Math
.
PI
*
rotate
/
180
,
width
/
2
,
height
/
2
);
g
.
transform
(
AffineTransform
.
getScaleInstance
(
width
/
original_width
,
height
/
original_height
));
}
else
if
(
225.0
<=
rotate
&&
rotate
<
315.0
)
{
g
.
translate
(
-
height
,
0.0
);
g
.
rotate
(
Math
.
PI
*
rotate
/
180
,
height
,
0.0
);
g
.
transform
(
AffineTransform
.
getScaleInstance
(
height
/
original_width
,
width
/
original_height
));
}
else
{
g
.
transform
(
AffineTransform
.
getScaleInstance
(
width
/
original_width
,
height
/
original_height
));
}
if
(
drawFill
==
1
)
{
g
.
setColor
(
GeColor
.
getColor
(
22
,
fillColor
));
g
.
fill
(
shapes
[
0
]);
}
AffineTransform
save2
=
g
.
getTransform
();
g
.
setTransform
(
save
);
Rectangle
r
=
getBounds
(
null
);
if
(
dd
.
elements
.
length
>
0
&&
dd
.
elements
[
0
]
instanceof
GeDynXYCurve
&&
((
GeDynXYCurve
)
dd
.
elements
[
0
]).
fill_curve
==
1
)
{
for
(
j
=
dd
.
elements
.
length
-
1
;
j
>=
0
;
j
--)
{
if
(
dd
.
elements
[
j
]
instanceof
GeDynXYCurve
)
{
GeDynXYCurve
elem
=
(
GeDynXYCurve
)
dd
.
elements
[
j
];
if
(
elem
.
noOfPoints
>
0
&&
elem
.
curveX
!=
null
&&
elem
.
curveY
!=
null
)
{
int
[]
intY
=
new
int
[
elem
.
noOfPoints
+
3
];
int
[]
intX
=
new
int
[
elem
.
noOfPoints
+
3
];
for
(
i
=
0
;
i
<
elem
.
noOfPoints
;
i
++)
{
intY
[
i
]
=
(
int
)(
r
.
height
-
elem
.
curveY
[
i
]
*
r
.
height
);
intX
[
i
]
=
(
int
)(
elem
.
curveX
[
i
]
*
r
.
width
);
}
intY
[
elem
.
noOfPoints
]
=
(
int
)(
r
.
height
);
intX
[
elem
.
noOfPoints
]
=
intX
[
elem
.
noOfPoints
-
1
];
intY
[
elem
.
noOfPoints
+
1
]
=
(
int
)(
r
.
height
);
intX
[
elem
.
noOfPoints
+
1
]
=
intX
[
0
];
intY
[
elem
.
noOfPoints
+
2
]
=
intY
[
0
];
intX
[
elem
.
noOfPoints
+
2
]
=
intX
[
0
];
Polygon
polygon
=
new
Polygon
(
intX
,
intY
,
elem
.
noOfPoints
+
3
);
g
.
setColor
(
GeColor
.
getColor
(
0
,
elem
.
fill_color
));
g
.
fill
(
polygon
);
}
}
}
}
g
.
setTransform
(
save2
);
g
.
setStroke
(
new
BasicStroke
((
float
)
lineWidth
));
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
for
(
i
=
0
;
i
<
verticalLines
;
i
++)
g
.
draw
(
vLines
[
i
]);
for
(
i
=
0
;
i
<
horizontalLines
;
i
++)
g
.
draw
(
hLines
[
i
]);
g
.
setStroke
(
new
BasicStroke
((
float
)
lineWidth
));
if
(
drawBorder
==
1
||
drawFill
==
0
)
{
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
0
]);
}
g
.
setTransform
(
save
);
for
(
j
=
0
;
j
<
dd
.
elements
.
length
;
j
++)
{
if
(
dd
.
elements
[
j
]
instanceof
GeDynXYCurve
)
{
GeDynXYCurve
elem
=
(
GeDynXYCurve
)
dd
.
elements
[
j
];
if
(
elem
.
curveX
!=
null
&&
elem
.
curveY
!=
null
)
{
float
pathX
,
pathY
;
GeneralPath
path
=
new
GeneralPath
(
GeneralPath
.
WIND_EVEN_ODD
);
path
.
reset
();
pathY
=
r
.
height
-
elem
.
curveY
[
0
]
*
r
.
height
;
pathX
=
elem
.
curveX
[
0
]
*
r
.
width
;
path
.
moveTo
(
pathX
,
pathY
);
int
psize
=
elem
.
noOfPoints
<
elem
.
curveX
.
length
?
elem
.
noOfPoints
:
elem
.
curveX
.
length
;
psize
=
psize
<
elem
.
curveY
.
length
?
psize
:
elem
.
curveY
.
length
;
for
(
i
=
1
;
i
<
psize
;
i
++)
{
pathY
=
r
.
height
-
elem
.
curveY
[
i
]
*
r
.
height
;
pathX
=
elem
.
curveX
[
i
]
*
r
.
width
;
path
.
lineTo
(
pathX
,
pathY
);
}
g
.
setColor
(
GeColor
.
getColor
(
0
,
elem
.
curve_color
));
g
.
draw
(
path
);
}
}
}
}
}
java/jpwr/jop/src/os_linux/hw_x86/makefile
View file @
001d4d17
...
...
@@ -67,6 +67,8 @@ local_java_sources := \
GeDynAnalogText.java
\
GeDynTable.java
\
GeDynHostObject.java
\
GeDynXYCurve.java
\
JopXYCurve.java
\
Proportion.java
\
RatioLayout.java
\
AspectRatioListener.java
\
...
...
java/jpwr/rt/src/CdhrFloatArray.java
0 → 100644
View file @
001d4d17
/*
* Proview $Id: CdhrFloatArray.java,v 1.1 2007-09-17 15:35:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* Title: <p>
* Description: <p>
* Copyright: <p>
* Company SSAB<p>
* @author CS
* @version 1.0
*/
package
jpwr.rt
;
import
java.io.Serializable
;
public
class
CdhrFloatArray
implements
Serializable
{
public
float
[]
value
;
public
int
sts
;
public
CdhrFloatArray
(
float
value
[],
int
sts
)
{
this
.
value
=
value
;
this
.
sts
=
sts
;
}
public
boolean
evenSts
()
{
return
(
sts
%
2
==
0
);}
public
boolean
oddSts
()
{
return
(
sts
%
2
==
1
);}
public
int
getSts
()
{
return
sts
;}
}
java/jpwr/rt/src/CdhrIntArray.java
0 → 100644
View file @
001d4d17
/*
* Proview $Id: CdhrIntArray.java,v 1.1 2007-09-17 15:35:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* Title: <p>
* Description: <p>
* Copyright: <p>
* Company SSAB<p>
* @author CS
* @version 1.0
*/
package
jpwr.rt
;
import
java.io.Serializable
;
public
class
CdhrIntArray
implements
Serializable
{
public
int
value
[];
public
int
sts
;
public
CdhrIntArray
(
int
value
[],
int
sts
)
{
this
.
value
=
value
;
this
.
sts
=
sts
;
}
public
boolean
evenSts
()
{
return
(
sts
%
2
==
0
);}
public
boolean
oddSts
()
{
return
(
sts
%
2
==
1
);}
public
int
getSts
()
{
return
sts
;}
}
java/jpwr/rt/src/Gdh.java
View file @
001d4d17
/*
* Proview $Id: Gdh.java,v 1.
9 2006-06-16 05:09:3
8 claes Exp $
* Proview $Id: Gdh.java,v 1.
10 2007-09-17 15:35:2
8 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -395,6 +395,8 @@ public class Gdh {
public
native
CdhrBoolean
getObjectInfoBoolean
(
String
attributeName
);
public
native
CdhrString
getObjectInfoString
(
String
attributeName
);
public
native
CdhrObjid
getObjectInfoObjid
(
String
attributeName
);
public
native
CdhrFloatArray
getObjectInfoFloatArray
(
String
attributeName
,
int
size
);
public
native
CdhrIntArray
getObjectInfoIntArray
(
String
attributeName
,
int
size
);
public
native
PwrtStatus
toggleObjectInfo
(
String
attributeName
);
public
native
GdhrRefObjectInfo
refObjectInfo
(
String
attributeName
);
...
...
java/jpwr/rt/src/GdhServer.java
View file @
001d4d17
/*
* Proview $Id: GdhServer.java,v 1.1
5 2006-06-16 05:09:3
8 claes Exp $
* Proview $Id: GdhServer.java,v 1.1
6 2007-09-17 15:35:2
8 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -92,6 +92,8 @@ public class GdhServer
public
final
static
int
GET_ATTRREF_TID
=
54
;
public
final
static
int
GET_SUPER_CLASS
=
55
;
public
final
static
int
GET_ALL_CLASS_ATTRIBUTES_STRING
=
56
;
public
final
static
int
GET_OBJECT_INFO_FLOAT_ARRAY
=
57
;
public
final
static
int
GET_OBJECT_INFO_INT_ARRAY
=
58
;
public
final
static
int
PORT
=
4445
;
...
...
@@ -123,6 +125,7 @@ public class GdhServer
*/
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"java.library.path = "
+
System
.
getProperty
(
"java.library.path"
));
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
args
[
i
].
equals
(
"-i"
))
...
...
@@ -474,7 +477,7 @@ public class GdhServer
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"
s
etObjectInfoBoolean: IO exception"
);
System
.
out
.
println
(
"
g
etObjectInfoBoolean: IO exception"
);
}
break
;
case
GET_OBJECT_INFO_INT:
...
...
@@ -493,7 +496,26 @@ public class GdhServer
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"setObjectInfoInt: IO exception"
);
System
.
out
.
println
(
"getObjectInfoInt: IO exception"
);
}
break
;
case
GET_OBJECT_INFO_INT_ARRAY:
try
{
String
attrName
=
in
.
readUTF
();
int
size
=
in
.
readInt
();
CdhrIntArray
ret
=
gdh
.
getObjectInfoIntArray
(
attrName
,
size
);
out
.
writeInt
(
ret
.
sts
);
//out.flush();
if
(
ret
.
oddSts
())
{
for
(
int
j
=
0
;
j
<
size
;
j
++)
out
.
writeInt
(
ret
.
value
[
j
]);
}
out
.
flush
();
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"getObjectInfoIntArray: IO exception"
);
}
break
;
case
GET_OBJECT_INFO_FLOAT:
...
...
@@ -503,7 +525,7 @@ public class GdhServer
CdhrFloat
ret
=
gdh
.
getObjectInfoFloat
(
attrName
);
out
.
writeInt
(
ret
.
sts
);
//out.flush();
if
(
ret
.
oddSts
())
if
(
ret
.
oddSts
())
{
out
.
writeFloat
(
ret
.
value
);
//out.flush();
...
...
@@ -512,7 +534,26 @@ public class GdhServer
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"setObjectInfoBoolean: IO exception"
);
System
.
out
.
println
(
"getObjectInfoFloat: IO exception"
);
}
break
;
case
GET_OBJECT_INFO_FLOAT_ARRAY:
try
{
String
attrName
=
in
.
readUTF
();
int
size
=
in
.
readInt
();
CdhrFloatArray
ret
=
gdh
.
getObjectInfoFloatArray
(
attrName
,
size
);
out
.
writeInt
(
ret
.
sts
);
//out.flush();
if
(
ret
.
oddSts
())
{
for
(
int
j
=
0
;
j
<
size
;
j
++)
out
.
writeFloat
(
ret
.
value
[
j
]);
}
out
.
flush
();
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"getObjectInfoFloatArray: IO exception"
);
}
break
;
case
GET_OBJECT_INFO_STRING:
...
...
@@ -602,6 +643,7 @@ public class GdhServer
String
attrName
=
in
.
readUTF
();
Sub
ret
=
this
.
refObjectInfo
(
attrName
,
threadNumber
);
thSub
.
add
(
ret
);
out
.
writeInt
(
ret
.
sts
);
//out.flush();
...
...
java/jpwr/rt/src/os_linux/hw_x86/makefile
View file @
001d4d17
...
...
@@ -16,6 +16,8 @@ local_java_sources = \
CdhrObjid.java
\
CdhrAttrRef.java
\
CdhrString.java
\
CdhrFloatArray.java
\
CdhrIntArray.java
\
Cdh.java
\
CliTable.java
\
Cli.java
\
...
...
java/jpwr/rt_client/src/Gdh.java
View file @
001d4d17
/*
* Proview $Id: Gdh.java,v 1.1
1 2006-06-16 05:09:3
8 claes Exp $
* Proview $Id: Gdh.java,v 1.1
2 2007-09-17 15:35:2
8 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -81,6 +81,8 @@ public class Gdh
public
final
static
int
GET_ATTRREF_TID
=
54
;
public
final
static
int
GET_SUPER_CLASS
=
55
;
public
final
static
int
GET_ALL_CLASS_ATTRIBUTES_STRING
=
56
;
public
final
static
int
GET_OBJECT_INFO_FLOAT_ARRAY
=
57
;
public
final
static
int
GET_OBJECT_INFO_INT_ARRAY
=
58
;
...
...
@@ -301,6 +303,31 @@ public class Gdh
}
}
public
CdhrIntArray
getObjectInfoIntArray
(
String
attributeName
,
int
size
)
{
try
{
out
.
writeInt
(
GET_OBJECT_INFO_INT_ARRAY
);
out
.
writeUTF
(
attributeName
);
out
.
writeInt
(
size
);
out
.
flush
();
int
sts
=
in
.
readInt
();
if
(
sts
%
2
==
0
)
{
return
new
CdhrIntArray
(
null
,
sts
);
}
int
[]
value
=
new
int
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
value
[
i
]
=
in
.
readInt
();
return
new
CdhrIntArray
(
value
,
sts
);
}
catch
(
IOException
e
)
{
return
new
CdhrIntArray
(
null
,
__IO_EXCEPTION
);
}
}
public
CdhrFloat
getObjectInfoFloat
(
String
attributeName
)
{
...
...
@@ -324,6 +351,31 @@ public class Gdh
}
}
public
CdhrFloatArray
getObjectInfoFloatArray
(
String
attributeName
,
int
size
)
{
try
{
out
.
writeInt
(
GET_OBJECT_INFO_FLOAT_ARRAY
);
out
.
writeUTF
(
attributeName
);
out
.
writeInt
(
size
);
out
.
flush
();
int
sts
=
in
.
readInt
();
if
(
sts
%
2
==
0
)
{
return
new
CdhrFloatArray
(
null
,
sts
);
}
float
[]
value
=
new
float
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
value
[
i
]
=
in
.
readFloat
();
return
new
CdhrFloatArray
(
value
,
sts
);
}
catch
(
IOException
e
)
{
return
new
CdhrFloatArray
(
null
,
__IO_EXCEPTION
);
}
}
public
CdhrString
getObjectInfoString
(
String
attributeName
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment