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
ea385221
Commit
ea385221
authored
May 20, 2015
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java AxisArc and dynamics for Axis added
parent
1d7aa0b9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1083 additions
and
52 deletions
+1083
-52
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+402
-49
java/jpwr/jopg/src/GlowVector.java
java/jpwr/jopg/src/GlowVector.java
+6
-0
java/jpwr/jopg/src/GrowAxis.java
java/jpwr/jopg/src/GrowAxis.java
+162
-0
java/jpwr/jopg/src/GrowAxisArc.java
java/jpwr/jopg/src/GrowAxisArc.java
+503
-0
java/jpwr/jopg/src/GrowCtx.java
java/jpwr/jopg/src/GrowCtx.java
+9
-3
java/jpwr/jopg/src/os_templ/hw_templ/makefile
java/jpwr/jopg/src/os_templ/hw_templ/makefile
+1
-0
No files found.
java/jpwr/jopg/src/Dyn.java
View file @
ea385221
...
...
@@ -124,6 +124,7 @@ public class Dyn {
public
static
final
int
mDynType2_Axis
=
1
<<
0
;
public
static
final
int
mDynType2_DigTextColor
=
1
<<
1
;
public
static
final
int
mDynType2_TimeoutColor
=
1
<<
2
;
public
static
final
int
mDynType2_DigFourShift
=
1
<<
3
;
public
static
final
int
mActionType1_No
=
0
;
public
static
final
int
mActionType1_Inherit
=
1
<<
0
;
...
...
@@ -174,40 +175,41 @@ public class Dyn {
public
static
final
int
eDynPrio_Move
=
17
;
public
static
final
int
eDynPrio_AnalogShift
=
18
;
public
static
final
int
eDynPrio_DigShift
=
19
;
public
static
final
int
eDynPrio_Animation
=
20
;
public
static
final
int
eDynPrio_Bar
=
21
;
public
static
final
int
eDynPrio_Trend
=
22
;
public
static
final
int
eDynPrio_FastCurve
=
23
;
public
static
final
int
eDynPrio_XY_Curve
=
24
;
public
static
final
int
eDynPrio_AnalogText
=
25
;
public
static
final
int
eDynPrio_Table
=
26
;
public
static
final
int
eDynPrio_SliderBackground
=
27
;
public
static
final
int
eDynPrio_Video
=
28
;
public
static
final
int
eDynPrio_StatusColor
=
29
;
public
static
final
int
eDynPrio_PopupMenu
=
30
;
public
static
final
int
eDynPrio_Confirm
=
31
;
public
static
final
int
eDynPrio_SetDig
=
32
;
public
static
final
int
eDynPrio_ResetDig
=
33
;
public
static
final
int
eDynPrio_ToggleDig
=
34
;
public
static
final
int
eDynPrio_StoDig
=
35
;
public
static
final
int
eDynPrio_Help
=
36
;
public
static
final
int
eDynPrio_OpenGraph
=
37
;
public
static
final
int
eDynPrio_OpenURL
=
38
;
public
static
final
int
eDynPrio_CommandDoubleClick
=
39
;
public
static
final
int
eDynPrio_IncrAnalog
=
40
;
public
static
final
int
eDynPrio_RadioButton
=
41
;
public
static
final
int
eDynPrio_Slider
=
42
;
public
static
final
int
eDynPrio_TipText
=
43
;
public
static
final
int
eDynPrio_PulldownMenu
=
44
;
public
static
final
int
eDynPrio_OptionMenu
=
45
;
public
static
final
int
eDynPrio_InputFocus
=
46
;
public
static
final
int
eDynPrio_DigCommand
=
47
;
public
static
final
int
eDynPrio_SetValue
=
48
;
public
static
final
int
eDynPrio_Pie
=
49
;
public
static
final
int
eDynPrio_BarChart
=
50
;
public
static
final
int
eDynPrio_Axis
=
51
;
public
static
final
int
eDynPrio_MethodToolbar
=
52
;
public
static
final
int
eDynPrio_MethodPulldownMenu
=
53
;
public
static
final
int
eDynPrio_DigFourShift
=
20
;
public
static
final
int
eDynPrio_Animation
=
21
;
public
static
final
int
eDynPrio_Bar
=
22
;
public
static
final
int
eDynPrio_Trend
=
23
;
public
static
final
int
eDynPrio_FastCurve
=
24
;
public
static
final
int
eDynPrio_XY_Curve
=
25
;
public
static
final
int
eDynPrio_AnalogText
=
26
;
public
static
final
int
eDynPrio_Table
=
27
;
public
static
final
int
eDynPrio_SliderBackground
=
28
;
public
static
final
int
eDynPrio_Video
=
29
;
public
static
final
int
eDynPrio_StatusColor
=
30
;
public
static
final
int
eDynPrio_PopupMenu
=
31
;
public
static
final
int
eDynPrio_Confirm
=
32
;
public
static
final
int
eDynPrio_SetDig
=
33
;
public
static
final
int
eDynPrio_ResetDig
=
34
;
public
static
final
int
eDynPrio_ToggleDig
=
35
;
public
static
final
int
eDynPrio_StoDig
=
36
;
public
static
final
int
eDynPrio_Help
=
37
;
public
static
final
int
eDynPrio_OpenGraph
=
38
;
public
static
final
int
eDynPrio_OpenURL
=
39
;
public
static
final
int
eDynPrio_CommandDoubleClick
=
40
;
public
static
final
int
eDynPrio_IncrAnalog
=
41
;
public
static
final
int
eDynPrio_RadioButton
=
42
;
public
static
final
int
eDynPrio_Slider
=
43
;
public
static
final
int
eDynPrio_TipText
=
44
;
public
static
final
int
eDynPrio_PulldownMenu
=
45
;
public
static
final
int
eDynPrio_OptionMenu
=
46
;
public
static
final
int
eDynPrio_InputFocus
=
47
;
public
static
final
int
eDynPrio_DigCommand
=
48
;
public
static
final
int
eDynPrio_SetValue
=
49
;
public
static
final
int
eDynPrio_Pie
=
50
;
public
static
final
int
eDynPrio_BarChart
=
51
;
public
static
final
int
eDynPrio_Axis
=
52
;
public
static
final
int
eDynPrio_MethodToolbar
=
53
;
public
static
final
int
eDynPrio_MethodPulldownMenu
=
54
;
public
static
final
int
eDynPrio_Command
=
9999
;
public
static
final
int
eDynPrio_CloseGraph
=
10000
;
...
...
@@ -245,6 +247,7 @@ public class Dyn {
public
static
final
int
eSave_Axis
=
38
;
public
static
final
int
eSave_DigTextColor
=
39
;
public
static
final
int
eSave_TimeoutColor
=
40
;
public
static
final
int
eSave_DigFourShift
=
41
;
public
static
final
int
eSave_PopupMenu
=
50
;
public
static
final
int
eSave_SetDig
=
51
;
public
static
final
int
eSave_ResetDig
=
52
;
...
...
@@ -447,10 +450,14 @@ public class Dyn {
public
static
final
int
eSave_BarChart_fix_range
=
3712
;
public
static
final
int
eSave_Axis_minvalue_attr
=
3800
;
public
static
final
int
eSave_Axis_maxvalue_attr
=
3801
;
public
static
final
int
eSave_Axis_keep_settings
=
3802
;
public
static
final
int
eSave_DigTextColor_attribute
=
3900
;
public
static
final
int
eSave_DigTextColor_color
=
3901
;
public
static
final
int
eSave_TimeoutColor_time
=
4000
;
public
static
final
int
eSave_TimeoutColor_color
=
4001
;
public
static
final
int
eSave_DigFourShift_attribute1
=
4100
;
public
static
final
int
eSave_DigFourShift_attribute2
=
4101
;
public
static
final
int
eSave_DigFourShift_attribute3
=
4102
;
public
static
final
int
eSave_PopupMenu_ref_object
=
5000
;
public
static
final
int
eSave_SetDig_attribute
=
5100
;
public
static
final
int
eSave_SetDig_instance
=
5101
;
...
...
@@ -650,7 +657,7 @@ public class Dyn {
public
static
final
int
ePwrStatus_Error
=
3
;
public
static
final
int
ePwrStatus_Fatal
=
4
;
public
static
final
boolean
debug
=
fals
e
;
public
static
final
boolean
debug
=
tru
e
;
Vector
<
DynElem
>
elements
=
new
Vector
<
DynElem
>();
GraphIfc
graph
;
...
...
@@ -757,6 +764,8 @@ public class Dyn {
e
=
new
DynDigTextColor
((
DynDigTextColor
)
x
.
elements
.
get
(
i
));
break
;
case
Dyn
.
mDynType2_TimeoutColor
:
e
=
new
DynTimeoutColor
((
DynTimeoutColor
)
x
.
elements
.
get
(
i
));
break
;
case
Dyn
.
mDynType2_DigFourShift
:
e
=
new
DynDigFourShift
((
DynDigFourShift
)
x
.
elements
.
get
(
i
));
break
;
default
:
;
}
switch
(
x
.
elements
.
get
(
i
).
action_type1
)
{
...
...
@@ -1003,6 +1012,9 @@ public class Dyn {
case
mDynType2_TimeoutColor:
e
=
(
DynElem
)
new
DynTimeoutColor
((
DynTimeoutColor
)
x
);
break
;
case
mDynType2_DigFourShift:
e
=
(
DynElem
)
new
DynDigFourShift
((
DynDigFourShift
)
x
);
break
;
default
:
;
}
}
...
...
@@ -1122,6 +1134,9 @@ public class Dyn {
case
Dyn
.
eSave_DigShift
:
elem
=
(
DynElem
)
new
DynDigShift
(
this
);
break
;
case
Dyn
.
eSave_DigFourShift
:
elem
=
(
DynElem
)
new
DynDigFourShift
(
this
);
break
;
case
Dyn
.
eSave_Animation
:
elem
=
(
DynElem
)
new
DynAnimation
(
this
);
break
;
...
...
@@ -4554,7 +4569,7 @@ public class Dyn {
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"Dig
LowColor
: "
+
attribute
);
System
.
out
.
println
(
"Dig
Shift
: "
+
attribute
);
return
1
;
}
...
...
@@ -4636,6 +4651,233 @@ public class Dyn {
}
public
class
DynDigFourShift
extends
DynElem
{
String
attribute1
;
String
attribute2
;
String
attribute3
;
PwrtRefId
subid1
;
int
p1
;
int
database1
;
boolean
inverted1
;
boolean
attrFound1
=
false
;
int
bitmask1
;
int
a_typeid1
;
boolean
oldValue1
;
PwrtRefId
subid2
;
int
p2
;
int
database2
;
boolean
inverted2
;
boolean
attrFound2
=
false
;
int
bitmask2
;
int
a_typeid2
;
boolean
oldValue2
;
PwrtRefId
subid3
;
int
p3
;
int
database3
;
boolean
inverted3
;
boolean
attrFound3
=
false
;
int
bitmask3
;
int
a_typeid3
;
boolean
oldValue3
;
boolean
firstScan
=
true
;
public
DynDigFourShift
(
Dyn
dyn
)
{
super
(
dyn
,
Dyn
.
mDynType2_DigFourShift
,
0
,
0
,
0
,
Dyn
.
eDynPrio_DigFourShift
);
}
public
DynDigFourShift
(
DynDigFourShift
x
)
{
super
(
x
);
attribute1
=
x
.
attribute1
;
attribute2
=
x
.
attribute2
;
attribute3
=
x
.
attribute3
;
}
public
int
connect
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
attribute1
);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
return
1
;
GdhrRefObjectInfo
ret
=
null
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
break
;
case
GraphIfc
.
eDatabase_Ccm
:
// TODO
break
;
default
:
ret
=
null
;
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"DigFourShift: "
+
attribute1
);
return
1
;
}
p1
=
ret
.
id
;
subid1
=
ret
.
refid
;
inverted1
=
pname
.
inverted
;
a_typeid1
=
pname
.
type
;
bitmask1
=
pname
.
bitmask
;
database1
=
pname
.
database
;
attrFound1
=
true
;
pname
=
dyn
.
parseAttrName
(
attribute2
);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
return
1
;
ret
=
null
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
break
;
case
GraphIfc
.
eDatabase_Ccm
:
// TODO
break
;
default
:
ret
=
null
;
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"DigFourShift: "
+
attribute2
);
return
1
;
}
p2
=
ret
.
id
;
subid2
=
ret
.
refid
;
inverted2
=
pname
.
inverted
;
a_typeid2
=
pname
.
type
;
bitmask2
=
pname
.
bitmask
;
database2
=
pname
.
database
;
attrFound2
=
true
;
pname
=
dyn
.
parseAttrName
(
attribute3
);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
return
1
;
ret
=
null
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
break
;
case
GraphIfc
.
eDatabase_Ccm
:
// TODO
break
;
default
:
ret
=
null
;
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"DigFourShift: "
+
attribute3
);
return
1
;
}
p3
=
ret
.
id
;
subid3
=
ret
.
refid
;
inverted3
=
pname
.
inverted
;
a_typeid3
=
pname
.
type
;
bitmask3
=
pname
.
bitmask
;
database3
=
pname
.
database
;
attrFound3
=
true
;
return
1
;
}
public
void
disconnect
()
{
if
(
attrFound1
&&
database1
==
GraphIfc
.
eDatabase_Gdh
)
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
subid1
);
if
(
attrFound2
&&
database2
==
GraphIfc
.
eDatabase_Gdh
)
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
subid2
);
if
(
attrFound3
&&
database3
==
GraphIfc
.
eDatabase_Gdh
)
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
subid3
);
}
public
void
scan
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
if
(
!
attrFound1
||
!
attrFound2
||
!
attrFound3
)
return
;
boolean
value1
=
dyn
.
getDig
(
p1
,
a_typeid1
,
bitmask1
,
database1
);
boolean
value2
=
dyn
.
getDig
(
p2
,
a_typeid2
,
bitmask2
,
database2
);
boolean
value3
=
dyn
.
getDig
(
p3
,
a_typeid3
,
bitmask3
,
database3
);
if
(
inverted1
)
value1
=
!
value1
;
if
(
inverted2
)
value2
=
!
value2
;
if
(
inverted3
)
value3
=
!
value3
;
if
(
!
firstScan
)
{
if
(
oldValue1
==
value1
&&
oldValue2
==
value2
&&
oldValue3
==
value3
)
return
;
}
else
firstScan
=
false
;
if
(
value3
)
object
.
set_nodeclass_by_index
(
2
);
else
if
(
value2
)
object
.
set_nodeclass_by_index
(
1
);
else
if
(
value1
)
object
.
set_root_nodeclass
();
else
object
.
set_last_nodeclass
();
oldValue1
=
value1
;
oldValue2
=
value2
;
oldValue3
=
value3
;
}
public
void
open
(
BufferedReader
reader
)
{
String
line
;
StringTokenizer
token
;
boolean
end_found
=
false
;
try
{
while
(
(
line
=
reader
.
readLine
())
!=
null
)
{
token
=
new
StringTokenizer
(
line
);
int
key
=
Integer
.
valueOf
(
token
.
nextToken
());
if
(
Dyn
.
debug
)
System
.
out
.
println
(
"DynDigFourShift : "
+
line
);
switch
(
key
)
{
case
Dyn
.
eSave_DigFourShift
:
break
;
case
Dyn
.
eSave_DigFourShift_attribute1
:
if
(
token
.
hasMoreTokens
())
attribute1
=
token
.
nextToken
();
break
;
case
Dyn
.
eSave_DigFourShift_attribute2
:
if
(
token
.
hasMoreTokens
())
attribute2
=
token
.
nextToken
();
break
;
case
Dyn
.
eSave_DigFourShift_attribute3
:
if
(
token
.
hasMoreTokens
())
attribute3
=
token
.
nextToken
();
break
;
case
Dyn
.
eSave_End
:
end_found
=
true
;
break
;
default
:
System
.
out
.
println
(
"Syntax error in DynDigFourShift"
);
break
;
}
if
(
end_found
)
break
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"IOException DynDigFourShift"
);
}
}
}
public
class
DynAnimation
extends
DynElem
{
String
attribute
;
int
sequence
;
...
...
@@ -5527,7 +5769,7 @@ public class Dyn {
m
=
m
>>
1
;
curve_number
++;
}
System
.
out
.
println
(
"Curve number "
+
curve_number
+
" color "
+
curve_color
+
" fillcolor "
+
fill_color
);
// Get number of curves
if
(
instance
==
mInstance_1
)
{
m
=
instance_mask
;
...
...
@@ -6961,18 +7203,22 @@ public class Dyn {
if
(
!
firstScan
)
{
int
update
=
0
;
for
(
int
i
=
0
;
i
<
barsegments
&&
valueF
[
i
]
!=
null
;
i
++)
{
for
(
int
j
=
0
;
j
<
bars
;
j
++)
{
if
(
Math
.
abs
(
oldValueF
[
i
][
j
]
-
valueF
[
i
][
j
])
>
Float
.
MIN_VALUE
)
{
update
=
1
;
if
(
oldValueF
!=
null
)
{
for
(
int
i
=
0
;
i
<
barsegments
&&
valueF
[
i
]
!=
null
;
i
++)
{
if
(
oldValueF
[
i
]
==
null
||
valueF
[
i
]
==
null
)
break
;
for
(
int
j
=
0
;
j
<
bars
;
j
++)
{
if
(
Math
.
abs
(
oldValueF
[
i
][
j
]
-
valueF
[
i
][
j
])
>
Float
.
MIN_VALUE
)
{
update
=
1
;
break
;
}
}
if
(
update
==
1
)
break
;
}
if
(
update
==
1
)
break
;
if
(
update
==
0
)
return
;
}
if
(
update
==
0
)
return
;
}
else
firstScan
=
false
;
...
...
@@ -6998,8 +7244,17 @@ public class Dyn {
public
class
DynAxis
extends
DynElem
{
String
minvalue_attr
;
String
maxvalue_attr
;
double
min_value
;
double
max_value
;
int
attr_type
;
int
min_value_p
;
int
max_value_p
;
float
old_min_value
;
float
old_max_value
;
boolean
minvalueAttrFound
=
false
;
boolean
maxvalueAttrFound
=
false
;
boolean
firstScan
=
true
;
PwrtRefId
minvalueSubid
;
PwrtRefId
maxvalueSubid
;
int
keep_settings
=
0
;
public
DynAxis
(
Dyn
dyn
)
{
super
(
dyn
,
0
,
Dyn
.
mDynType2_Axis
,
0
,
0
,
Dyn
.
eDynPrio_Axis
);
...
...
@@ -7009,8 +7264,6 @@ public class Dyn {
super
(
x
);
minvalue_attr
=
x
.
minvalue_attr
;
maxvalue_attr
=
x
.
maxvalue_attr
;
min_value
=
x
.
min_value
;
max_value
=
x
.
max_value
;
}
public
void
open
(
BufferedReader
reader
)
{
...
...
@@ -7035,6 +7288,9 @@ public class Dyn {
if
(
token
.
hasMoreTokens
())
maxvalue_attr
=
token
.
nextToken
();
break
;
case
Dyn
.
eSave_Axis_keep_settings
:
keep_settings
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Dyn
.
eSave_End
:
end_found
=
true
;
break
;
...
...
@@ -7052,6 +7308,103 @@ public class Dyn {
}
}
public
int
connect
(
GlowArrayElem
o
)
{
int
attr_type_min
=
0
;
int
attr_type_max
=
0
;
min_value_p
=
-
1
;
max_value_p
=
-
1
;
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
minvalue_attr
);
if
(
pname
!=
null
&&
!
pname
.
name
.
equals
(
""
))
{
GdhrRefObjectInfo
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"Axis: "
+
pname
.
tname
);
else
{
minvalueAttrFound
=
true
;
min_value_p
=
ret
.
id
;
minvalueSubid
=
ret
.
refid
;
attr_type_min
=
ret
.
typeId
;
}
}
pname
=
dyn
.
parseAttrName
(
maxvalue_attr
);
if
(
pname
!=
null
&&
!
pname
.
name
.
equals
(
""
))
{
GdhrRefObjectInfo
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
if
(
ret
.
evenSts
())
System
.
out
.
println
(
"Axis: "
+
pname
.
tname
);
else
{
maxvalueAttrFound
=
true
;
max_value_p
=
ret
.
id
;
maxvalueSubid
=
ret
.
refid
;
attr_type_max
=
ret
.
typeId
;
}
}
if
(
minvalueAttrFound
&&
maxvalueAttrFound
)
{
if
(
attr_type_min
!=
attr_type_max
)
attr_type
=
0
;
else
attr_type
=
attr_type_max
;
}
else
if
(
maxvalueAttrFound
)
attr_type
=
attr_type_max
;
else
if
(
minvalueAttrFound
)
attr_type
=
attr_type_min
;
return
1
;
}
public
void
disconnect
()
{
if
(
minvalueAttrFound
)
{
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
minvalueSubid
);
min_value_p
=
-
1
;
}
if
(
maxvalueAttrFound
)
{
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
maxvalueSubid
);
max_value_p
=
-
1
;
}
return
;
}
public
void
scan
(
GlowArrayElem
o
)
{
switch
(
attr_type
)
{
case
Pwr
.
eType_Float32
:
{
if
(
!
maxvalueAttrFound
&&
!
minvalueAttrFound
)
return
;
float
min_value
=
0
;
float
max_value
=
0
;
if
(
minvalueAttrFound
)
min_value
=
dyn
.
graph
.
getGdh
().
getObjectRefInfoFloat
(
min_value_p
);
if
(
maxvalueAttrFound
)
max_value
=
dyn
.
graph
.
getGdh
().
getObjectRefInfoFloat
(
max_value_p
);
if
(
!(
firstScan
||
(
maxvalueAttrFound
&&
(
max_value
!=
old_max_value
))
||
(
minvalueAttrFound
&&
(
min_value
!=
old_min_value
))))
return
;
if
(
firstScan
)
firstScan
=
true
;
if
(
minvalueAttrFound
)
old_min_value
=
min_value
;
if
(
maxvalueAttrFound
)
old_max_value
=
max_value
;
if
(
o
.
type
()
==
Glow
.
eObjectType_GrowAxis
)
((
GrowAxis
)
o
).
set_range
(
min_value
,
max_value
,
keep_settings
);
else
if
(
o
.
type
()
==
Glow
.
eObjectType_GrowAxisArc
)
((
GrowAxisArc
)
o
).
set_range
(
min_value
,
max_value
,
keep_settings
);
break
;
}
default
:
;
}
return
;
}
}
public
class
DynTimeoutColor
extends
DynElem
{
...
...
java/jpwr/jopg/src/GlowVector.java
View file @
ea385221
...
...
@@ -225,6 +225,12 @@ public class GlowVector {
a
.
add
(
c
);
break
;
}
case
Glow
.
eSave_GrowAxisArc
:
{
GrowAxisArc
c
=
new
GrowAxisArc
(
cmn
);
c
.
open
(
reader
);
a
.
add
(
c
);
break
;
}
case
Glow
.
eSave_GrowImage
:
{
GrowImage
c
=
new
GrowImage
(
cmn
);
c
.
open
(
reader
);
...
...
java/jpwr/jopg/src/GrowAxis.java
View file @
ea385221
...
...
@@ -476,4 +476,166 @@ public class GrowAxis extends GrowRect {
return
userdata
;
}
public
class
Range
{
public
Range
(
int
lines
,
int
longq
,
int
vvalq
,
int
hvalq
,
String
format
)
{
this
.
lines
=
lines
;
this
.
longq
=
longq
;
this
.
vvalq
=
vvalq
;
this
.
hvalq
=
hvalq
;
this
.
format
=
format
;
}
int
lines
;
int
longq
;
int
vvalq
;
int
hvalq
;
String
format
;
}
public
void
set_range
(
double
minval
,
double
maxval
,
int
keep_settings
)
{
Range
[][]
rdata
=
new
Range
[][]
{
new
Range
[]
{
new
Range
(
26
,
5
,
5
,
10
,
"%3.1f"
),
// 1
new
Range
(
21
,
5
,
5
,
10
,
"%3.1f"
),
// 2
new
Range
(
31
,
5
,
10
,
10
,
"%3.1f"
),
// 3
new
Range
(
41
,
5
,
10
,
20
,
"%3.1f"
),
// 4
new
Range
(
26
,
5
,
5
,
10
,
"%1.0f"
),
// 5
new
Range
(
31
,
5
,
10
,
10
,
"%1.0f"
),
// 6
new
Range
(
36
,
5
,
10
,
10
,
"%1.0f"
),
// 7
new
Range
(
17
,
2
,
4
,
4
,
"%1.0f"
),
// 8
new
Range
(
19
,
2
,
4
,
4
,
"%1.0f"
),
// 9
new
Range
(
21
,
2
,
4
,
8
,
"%2.0f"
),
// 10
new
Range
(
23
,
2
,
4
,
8
,
"%2.0f"
),
// 11
new
Range
(
13
,
4
,
4
,
4
,
"%2.0f"
),
// 12
new
Range
(
14
,
4
,
4
,
4
,
"%2.0f"
),
// 13
new
Range
(
15
,
4
,
4
,
4
,
"%2.0f"
),
// 14
new
Range
(
16
,
5
,
5
,
5
,
"%2.0f"
),
// 15
new
Range
(
17
,
5
,
5
,
5
,
"%2.0f"
),
// 16
new
Range
(
18
,
5
,
5
,
5
,
"%2.0f"
),
// 17
new
Range
(
19
,
5
,
5
,
5
,
"%2.0f"
),
// 18
new
Range
(
20
,
5
,
5
,
5
,
"%2.0f"
),
// 19
new
Range
(
21
,
5
,
5
,
5
,
"%2.0f"
),
// 20
new
Range
(
22
,
5
,
5
,
5
,
"%2.0f"
),
// 21
new
Range
(
23
,
5
,
5
,
5
,
"%2.0f"
),
// 22
new
Range
(
24
,
5
,
5
,
5
,
"%2.0f"
),
// 23
new
Range
(
25
,
5
,
5
,
5
,
"%2.0f"
),
// 24
new
Range
(
26
,
5
,
5
,
10
,
"%2.0f"
)},
// 25
new
Range
[]
{
new
Range
(
101
,
5
,
10
,
20
,
"%3.1f"
),
// 1
new
Range
(
101
,
5
,
10
,
20
,
"%3.1f"
),
// 2
new
Range
(
61
,
10
,
10
,
20
,
"%3.1f"
),
// 3
new
Range
(
81
,
10
,
10
,
20
,
"%3.1f"
),
// 4
new
Range
(
101
,
10
,
20
,
20
,
"%1.0f"
),
// 5
new
Range
(
61
,
5
,
10
,
20
,
"%1.0f"
),
// 6
new
Range
(
71
,
5
,
10
,
20
,
"%1.0f"
),
// 7
new
Range
(
81
,
5
,
10
,
20
,
"%1.0f"
),
// 8
new
Range
(
91
,
5
,
10
,
20
,
"%1.0f"
),
// 9
new
Range
(
101
,
5
,
10
,
20
,
"%2.0f"
),
// 10
new
Range
(
56
,
5
,
5
,
5
,
"%2.0f"
),
// 11
new
Range
(
61
,
5
,
10
,
10
,
"%2.0f"
),
// 12
new
Range
(
66
,
5
,
10
,
20
,
"%2.0f"
),
// 13
new
Range
(
71
,
5
,
10
,
20
,
"%2.0f"
),
// 14
new
Range
(
76
,
5
,
10
,
20
,
"%2.0f"
),
// 15
new
Range
(
81
,
5
,
10
,
20
,
"%2.0f"
),
// 16
new
Range
(
86
,
5
,
10
,
20
,
"%2.0f"
),
// 17
new
Range
(
91
,
5
,
10
,
20
,
"%2.0f"
),
// 18
new
Range
(
96
,
5
,
10
,
20
,
"%2.0f"
),
// 19
new
Range
(
101
,
5
,
10
,
25
,
"%2.0f"
),
// 20
new
Range
(
43
,
2
,
6
,
6
,
"%2.0f"
),
// 21
new
Range
(
45
,
2
,
4
,
8
,
"%2.0f"
),
// 22
new
Range
(
47
,
2
,
4
,
8
,
"%2.0f"
),
// 23
new
Range
(
49
,
2
,
4
,
8
,
"%2.0f"
),
// 24
new
Range
(
26
,
5
,
5
,
5
,
"%2.0f"
)}};
// 25
max_value
=
maxval
;
min_value
=
minval
;
int
x1
=
(
int
)(
trf
.
x
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
int
y1
=
(
int
)(
trf
.
y
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
int
x2
=
(
int
)(
trf
.
x
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
int
y2
=
(
int
)(
trf
.
y
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
double
rotation
=
(
trf
.
rot
()
/
360
-
Math
.
floor
(
trf
.
rot
()
/
360
))
*
360
;
if
(
keep_settings
==
0
)
{
int
len
;
int
lix
;
int
di
;
int
horizontal
=
(
rotation
<
45
||
(
rotation
>
135
&&
rotation
<
225
)
||
rotation
>
315
)
?
0
:
1
;
if
(
horizontal
!=
0
)
len
=
Math
.
abs
(
x2
-
x1
);
else
len
=
Math
.
abs
(
y2
-
y1
);
if
(
len
<
150
)
lix
=
0
;
else
lix
=
1
;
double
d
=
Math
.
abs
(
maxval
-
minval
);
if
(
d
<
5
)
d
=
1000
*
d
;
di
=
(
int
)
(
d
+
0.5
);
while
(
di
>=
25
)
di
/=
10
;
if
(
di
>
0
&&
di
<=
25
)
{
lines
=
rdata
[
lix
][
di
-
1
].
lines
;
longquotient
=
rdata
[
lix
][
di
-
1
].
longq
;
if
(
horizontal
!=
0
)
valuequotient
=
rdata
[
lix
][
di
-
1
].
hvalq
;
else
valuequotient
=
rdata
[
lix
][
di
-
1
].
vvalq
;
}
double
m
=
Math
.
max
(
Math
.
abs
(
maxval
),
Math
.
abs
(
minval
));
switch
(
lix
)
{
case
0
:
{
if
(
m
<
0.01
)
format
=
"%g"
;
else
if
(
m
<
0.1
)
format
=
"%5.3f"
;
else
if
(
m
<
1
)
format
=
"%4.2f"
;
else
if
(
m
<
3
)
format
=
"%3.1f"
;
else
if
(
m
<=
20
)
format
=
"%2.0f"
;
else
if
(
m
<=
200
)
format
=
"%3.0f"
;
else
if
(
m
<
2000
)
format
=
"%4.0f"
;
else
if
(
m
<
20000
)
format
=
"%5.0f"
;
else
format
=
"%g"
;
break
;
}
case
1
:
{
if
(
m
<
0.01
)
format
=
"%g"
;
else
if
(
m
<
0.1
)
format
=
"%5.3f"
;
else
if
(
m
<
1
)
format
=
"%4.2f"
;
else
if
(
m
<=
4
)
format
=
"%3.1f"
;
else
if
(
m
<=
20
)
format
=
"%2.0f"
;
else
if
(
m
<=
200
)
format
=
"%3.0f"
;
else
if
(
m
<
2000
)
format
=
"%4.0f"
;
else
if
(
m
<
20000
)
format
=
"%5.0f"
;
else
format
=
"%g"
;
break
;
}
default
:
;
}
}
configure
();
draw
();
}
}
java/jpwr/jopg/src/GrowAxisArc.java
0 → 100644
View file @
ea385221
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package
jpwr.jopg
;
import
jpwr.rt.*
;
import
java.io.*
;
import
java.util.*
;
public
class
GrowAxisArc
extends
GrowArc
{
int
text_size
;
int
text_drawtype
;
int
text_color_drawtype
;
double
max_value
;
double
min_value
;
int
lines
;
double
linelength
;
int
longquotient
;
int
valuequotient
;
double
increment
;
String
format
;
Object
userdata
;
GlowCFormat
cFormat
;
StringBuffer
sb
=
new
StringBuffer
();
public
GrowAxisArc
(
GrowCmn
cmn
)
{
super
(
cmn
);
configure
();
}
public
int
type
()
{
return
Glow
.
eObjectType_GrowAxisArc
;
}
void
configure
()
{
if
(
lines
<=
1
)
lines
=
2
;
if
(
longquotient
<=
0
)
longquotient
=
1
;
if
(
valuequotient
<=
0
)
valuequotient
=
1
;
increment
=
(
max_value
-
min_value
)
/
(
lines
-
1
);
}
public
void
open
(
BufferedReader
reader
)
{
String
line
;
StringTokenizer
token
;
boolean
end_found
=
false
;
try
{
while
(
(
line
=
reader
.
readLine
())
!=
null
)
{
token
=
new
StringTokenizer
(
line
);
int
key
=
Integer
.
valueOf
(
token
.
nextToken
());
if
(
cmn
.
debug
)
System
.
out
.
println
(
"GrowAxisArc : "
+
line
);
switch
(
key
)
{
case
Glow
.
eSave_GrowAxisArc
:
break
;
case
Glow
.
eSave_GrowAxisArc_text_size
:
text_size
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_text_drawtype
:
text_drawtype
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_text_color_drawtype
:
text_color_drawtype
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_max_value
:
max_value
=
new
Double
(
token
.
nextToken
()).
doubleValue
();
break
;
case
Glow
.
eSave_GrowAxisArc_min_value
:
min_value
=
new
Double
(
token
.
nextToken
()).
doubleValue
();
break
;
case
Glow
.
eSave_GrowAxisArc_lines
:
lines
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_linelength
:
linelength
=
new
Double
(
token
.
nextToken
()).
doubleValue
();
break
;
case
Glow
.
eSave_GrowAxisArc_longquotient
:
longquotient
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_valuequotient
:
valuequotient
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Glow
.
eSave_GrowAxisArc_format
:
if
(
token
.
hasMoreTokens
())
format
=
token
.
nextToken
();
break
;
case
Glow
.
eSave_GrowAxisArc_arc_part
:
super
.
open
(
reader
);
break
;
case
Glow
.
eSave_GrowAxisArc_userdata_cb
:
if
(
cmn
.
appl
!=
null
)
userdata
=
cmn
.
appl
.
growUserdataOpen
(
reader
,
this
,
Glow
.
eUserdataCbType_Node
);
break
;
case
Glow
.
eSave_End
:
end_found
=
true
;
break
;
default
:
System
.
out
.
println
(
"Syntax error in GrowAxisArc"
);
break
;
}
if
(
end_found
)
break
;
}
configure
();
if
(
format
!=
null
)
cFormat
=
new
GlowCFormat
(
format
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"IOException GrowAxisArc"
);
}
}
public
void
draw
(
GlowTransform
t
,
int
highlight
,
int
hot
,
Object
node
,
Object
colornode
)
{
if
(
cmn
.
nodraw
!=
0
)
return
;
int
i
;
boolean
draw_text
=
(
Math
.
abs
(
increment
)
>
Double
.
MIN_VALUE
);
int
idx
;
int
x
,
y
;
String
text
;
int
line_length
;
int
x_text
,
y_text
;
int
z_height
=
0
,
z_width
,
z_descent
=
0
;
int
max_z_width
=
0
;
double
rotation
;
int
drawtype
;
int
text_idx
=
(
int
)(
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
text_size
+
4
)
-
4
);
double
tsize
=
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
8
+
2
*
text_size
);
text_idx
=
Math
.
min
(
text_idx
,
Glow
.
DRAW_TYPE_SIZE
-
1
);
if
(
node
!=
null
&&
((
GrowNode
)
node
).
line_width
!=
0
)
idx
=
(
int
)(
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
((
GrowNode
)
node
).
line_width
-
1
);
else
idx
=
(
int
)(
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
line_width
-
1
);
idx
+=
hot
;
idx
=
Math
.
max
(
0
,
idx
);
idx
=
Math
.
min
(
idx
,
Glow
.
DRAW_TYPE_SIZE
-
1
);
int
x1
,
y1
,
x2
,
y2
,
ll_x
,
ll_y
,
ur_x
,
ur_y
,
xt
,
yt
;
if
(
t
==
null
)
{
x1
=
(
int
)(
trf
.
x
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
trf
.
y
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
x2
=
(
int
)(
trf
.
x
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y2
=
(
int
)(
trf
.
y
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
rotation
=
(
trf
.
rot
()
/
360
-
Math
.
floor
(
trf
.
rot
()
/
360
))
*
360
;
}
else
{
x1
=
(
int
)(
trf
.
x
(
t
,
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
trf
.
y
(
t
,
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
x2
=
(
int
)(
trf
.
x
(
t
,
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y2
=
(
int
)(
trf
.
y
(
t
,
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
rotation
=
(
trf
.
rot
(
t
)
/
360
-
Math
.
floor
(
trf
.
rot
(
t
)
/
360
))
*
360
;
}
ll_x
=
Math
.
min
(
x1
,
x2
);
ur_x
=
Math
.
max
(
x1
,
x2
);
ll_y
=
Math
.
min
(
y1
,
y2
);
ur_y
=
Math
.
max
(
y1
,
y2
);
drawtype
=
GlowColor
.
get_drawtype
(
draw_type
,
Glow
.
eDrawType_LineHighlight
,
highlight
,
(
GrowNode
)
colornode
,
0
,
0
);
if
(
true
)
{
// Lines inwards
cmn
.
gdraw
.
arc
(
ll_x
,
ll_y
,
ur_x
-
ll_x
,
ur_y
-
ll_y
,
angle1
-
(
int
)
rotation
,
angle2
,
drawtype
,
idx
,
0
);
if
(
lines
==
1
)
return
;
if
(
increment
>
0
)
text
=
format_text
(
format
,
min_value
+
(
lines
-
2
)
*
increment
);
else
text
=
format_text
(
format
,
min_value
+
increment
);
GlowDimension
d
=
cmn
.
gdraw
.
getTextExtent
(
text
,
Math
.
max
(
0
,
text_idx
),
Glow
.
eFont_Helvetica
,
text_drawtype
);
z_width
=
d
.
width
;
z_height
=
d
.
height
;
z_descent
=
z_height
/
4
;
if
(
max_z_width
<
z_width
)
max_z_width
=
z_width
;
double
line_angle
=
(
double
)
angle2
/
(
lines
-
1
);
for
(
i
=
0
;
i
<
lines
;
i
++)
{
double
sin1
=
Math
.
sin
(
((
double
)
angle1
+
i
*
line_angle
)
/
180
*
Math
.
PI
);
double
cos1
=
Math
.
cos
(
((
double
)
angle1
+
i
*
line_angle
)
/
180
*
Math
.
PI
);
y1
=
(
int
)(
((
double
)
ur_y
-
ll_y
)
/
2
*
(
-
sin1
+
1
)
+
ll_y
);
x1
=
(
int
)(
((
double
)
ur_x
-
ll_x
)
/
2
*
(
cos1
+
1
)
+
ll_x
);
if
(
i
%
longquotient
==
0
)
{
y2
=
(
int
)(
((
double
)
ur_y
-
ll_y
)
/
2
*
(
-
sin1
*
(
1.0
-
linelength
)
+
1
)
+
ll_y
);
x2
=
(
int
)(
((
double
)
ur_x
-
ll_x
)
/
2
*
(
cos1
*
(
1.0
-
linelength
)
+
1
)
+
ll_x
);
}
else
{
y2
=
(
int
)(
((
double
)
ur_y
-
ll_y
)
/
2
*
(
-
sin1
*
(
1.0
-
linelength
/
2
)
+
1
)
+
ll_y
);
x2
=
(
int
)(
((
double
)
ur_x
-
ll_x
)
/
2
*
(
cos1
*
(
1.0
-
linelength
/
2
)
+
1
)
+
ll_x
);
}
yt
=
(
int
)(
((
double
)
ur_y
-
ll_y
)
/
2
*
(
-
sin1
*
(
1.0
-
linelength
)
+
1
)
+
ll_y
+
sin1
*
(
z_height
-
z_descent
)/
2
);
xt
=
(
int
)(
((
double
)
ur_x
-
ll_x
)
/
2
*
(
cos1
*
(
1.0
-
linelength
)
+
1
)
+
ll_x
-
cos1
*
z_width
/
2
);
cmn
.
gdraw
.
line
(
x1
,
y1
,
x2
,
y2
,
drawtype
,
idx
,
0
);
if
(
draw_text
)
{
if
(
text_idx
>=
0
&&
i
%
valuequotient
==
0
&&
!(
angle2
==
360
&&
((
increment
>
0
&&
i
==
lines
-
1
)
||
(
increment
<
0
&&
i
==
0
))))
{
text
=
format_text
(
format
,
min_value
+
i
*
increment
);
d
=
cmn
.
gdraw
.
getTextExtent
(
text
,
Math
.
max
(
0
,
text_idx
),
Glow
.
eFont_Helvetica
,
text_drawtype
);
z_width
=
d
.
width
;
z_height
=
d
.
height
;
z_descent
=
z_height
/
4
;
if
(
max_z_width
<
z_width
)
max_z_width
=
z_width
;
if
(
i
==
lines
-
1
&&
angle1
==
0
&&
angle2
==
180
)
{
xt
=
xt
-
z_width
/
2
;
}
else
if
(
i
==
0
&&
angle1
==
0
&&
angle2
!=
360
)
{
xt
=
xt
-
z_width
/
2
;
}
else
{
yt
=
yt
+
(
z_height
-
z_descent
)/
2
;
xt
=
xt
-
z_width
/
2
;
}
cmn
.
gdraw
.
text
(
xt
,
yt
,
text
,
text_drawtype
,
text_color_drawtype
,
text_idx
,
highlight
,
0
,
Glow
.
eFont_Helvetica
,
tsize
,
0
);
}
}
}
}
}
String
format_text
(
String
fmt
,
double
value
)
{
/*
if ( fmt.equals( "%1t")) {
// Hours, minutes and seconds, value in seconds
int val = (int) Math.nearbyint(value);
int hours = val / 3600;
int minutes = (val - hours * 3600) / 60;
int seconds = (val - hours * 3600 - minutes * 60);
sprintf( text, "%d:%02d:%02d", hours, minutes, seconds);
}
else if ( fmt.equals( "%2t")) {
// Hours and minutes, value in seconds
int val = (int) nearbyint(value);
int hours = val / 3600;
int minutes = (val - hours * 3600) / 60;
sprintf( text, "%d:%02d", hours, minutes);
}
else if ( fmt.equals( "%3t")) {
// Days, hours and minues, value in seconds
int val = (int) nearbyint(value);
int days = val / (24 * 3600);
int hours = (val - days * 24 * 3600) / 3600;
int minutes = (val - days * 24 * 3600 - hours * 3600) / 60;
sprintf( text, "%d %02d:%02d", days, hours, minutes);
}
else if ( fmt.equals( "%10t")) {
// Date
char timstr[40];
pwr_tTime t;
t.tv_sec = (int) nearbyint(value);
t.tv_nsec = 0;
time_AtoAscii( &t, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
timstr[19] = 0;
strcpy( text, timstr);
}
else if ( fmt.equals( "%11t")) {
// Date, no seconds
char timstr[40];
pwr_tTime t;
t.tv_sec = (int) nearbyint(value);
t.tv_nsec = 0;
time_AtoAscii( &t, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
timstr[16] = 0;
strcpy( text, timstr);
}
else {
*/
if
(
Math
.
abs
(
value
)
<
Double
.
MIN_VALUE
)
value
=
0
;
sb
=
cFormat
.
format
(
(
float
)
value
,
sb
);
return
new
String
(
sb
);
/*
}
*/
}
public
Object
getUserData
()
{
return
userdata
;
}
public
class
Range
{
public
Range
(
int
lines
,
int
longq
,
int
vvalq
,
int
hvalq
,
String
format
)
{
this
.
lines
=
lines
;
this
.
longq
=
longq
;
this
.
vvalq
=
vvalq
;
this
.
hvalq
=
hvalq
;
this
.
format
=
format
;
}
int
lines
;
int
longq
;
int
vvalq
;
int
hvalq
;
String
format
;
}
public
void
set_range
(
double
minval
,
double
maxval
,
int
keep_settings
)
{
Range
[][]
rdata
=
new
Range
[][]
{
new
Range
[]
{
new
Range
(
26
,
5
,
5
,
10
,
"%3.1f"
),
// 1
new
Range
(
21
,
5
,
5
,
10
,
"%3.1f"
),
// 2
new
Range
(
31
,
5
,
10
,
10
,
"%3.1f"
),
// 3
new
Range
(
41
,
5
,
10
,
20
,
"%3.1f"
),
// 4
new
Range
(
26
,
5
,
5
,
10
,
"%1.0f"
),
// 5
new
Range
(
31
,
5
,
10
,
10
,
"%1.0f"
),
// 6
new
Range
(
36
,
5
,
10
,
10
,
"%1.0f"
),
// 7
new
Range
(
17
,
2
,
4
,
4
,
"%1.0f"
),
// 8
new
Range
(
19
,
2
,
4
,
4
,
"%1.0f"
),
// 9
new
Range
(
21
,
2
,
4
,
8
,
"%2.0f"
),
// 10
new
Range
(
23
,
2
,
4
,
8
,
"%2.0f"
),
// 11
new
Range
(
13
,
4
,
4
,
4
,
"%2.0f"
),
// 12
new
Range
(
14
,
4
,
4
,
4
,
"%2.0f"
),
// 13
new
Range
(
15
,
4
,
4
,
4
,
"%2.0f"
),
// 14
new
Range
(
16
,
5
,
5
,
5
,
"%2.0f"
),
// 15
new
Range
(
17
,
5
,
5
,
5
,
"%2.0f"
),
// 16
new
Range
(
18
,
5
,
5
,
5
,
"%2.0f"
),
// 17
new
Range
(
19
,
5
,
5
,
5
,
"%2.0f"
),
// 18
new
Range
(
20
,
5
,
5
,
5
,
"%2.0f"
),
// 19
new
Range
(
21
,
5
,
5
,
5
,
"%2.0f"
),
// 20
new
Range
(
22
,
5
,
5
,
5
,
"%2.0f"
),
// 21
new
Range
(
23
,
5
,
5
,
5
,
"%2.0f"
),
// 22
new
Range
(
24
,
5
,
5
,
5
,
"%2.0f"
),
// 23
new
Range
(
25
,
5
,
5
,
5
,
"%2.0f"
),
// 24
new
Range
(
26
,
5
,
5
,
10
,
"%2.0f"
)},
// 25
new
Range
[]
{
new
Range
(
101
,
5
,
10
,
20
,
"%3.1f"
),
// 1
new
Range
(
101
,
5
,
10
,
20
,
"%3.1f"
),
// 2
new
Range
(
61
,
10
,
10
,
20
,
"%3.1f"
),
// 3
new
Range
(
81
,
10
,
10
,
20
,
"%3.1f"
),
// 4
new
Range
(
101
,
10
,
20
,
20
,
"%1.0f"
),
// 5
new
Range
(
61
,
5
,
10
,
20
,
"%1.0f"
),
// 6
new
Range
(
71
,
5
,
10
,
20
,
"%1.0f"
),
// 7
new
Range
(
81
,
5
,
10
,
20
,
"%1.0f"
),
// 8
new
Range
(
91
,
5
,
10
,
20
,
"%1.0f"
),
// 9
new
Range
(
101
,
5
,
10
,
20
,
"%2.0f"
),
// 10
new
Range
(
56
,
5
,
5
,
5
,
"%2.0f"
),
// 11
new
Range
(
61
,
5
,
10
,
10
,
"%2.0f"
),
// 12
new
Range
(
66
,
5
,
10
,
20
,
"%2.0f"
),
// 13
new
Range
(
71
,
5
,
10
,
20
,
"%2.0f"
),
// 14
new
Range
(
76
,
5
,
10
,
20
,
"%2.0f"
),
// 15
new
Range
(
81
,
5
,
10
,
20
,
"%2.0f"
),
// 16
new
Range
(
86
,
5
,
10
,
20
,
"%2.0f"
),
// 17
new
Range
(
91
,
5
,
10
,
20
,
"%2.0f"
),
// 18
new
Range
(
96
,
5
,
10
,
20
,
"%2.0f"
),
// 19
new
Range
(
101
,
5
,
10
,
25
,
"%2.0f"
),
// 20
new
Range
(
43
,
2
,
6
,
6
,
"%2.0f"
),
// 21
new
Range
(
45
,
2
,
4
,
8
,
"%2.0f"
),
// 22
new
Range
(
47
,
2
,
4
,
8
,
"%2.0f"
),
// 23
new
Range
(
49
,
2
,
4
,
8
,
"%2.0f"
),
// 24
new
Range
(
26
,
5
,
5
,
5
,
"%2.0f"
)}};
// 25
max_value
=
maxval
;
min_value
=
minval
;
int
x1
=
(
int
)(
trf
.
x
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
int
y1
=
(
int
)(
trf
.
y
(
ll
.
x
,
ll
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
int
x2
=
(
int
)(
trf
.
x
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
int
y2
=
(
int
)(
trf
.
y
(
ur
.
x
,
ur
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
double
rotation
=
(
trf
.
rot
()
/
360
-
Math
.
floor
(
trf
.
rot
()
/
360
))
*
360
;
if
(
keep_settings
==
0
)
{
int
len
;
int
lix
;
int
di
;
int
horizontal
=
(
rotation
<
45
||
(
rotation
>
135
&&
rotation
<
225
)
||
rotation
>
315
)
?
0
:
1
;
if
(
horizontal
!=
0
)
len
=
Math
.
abs
(
x2
-
x1
);
else
len
=
Math
.
abs
(
y2
-
y1
);
if
(
len
<
150
)
lix
=
0
;
else
lix
=
1
;
double
d
=
Math
.
abs
(
maxval
-
minval
);
if
(
d
<
5
)
d
=
1000
*
d
;
di
=
(
int
)
(
d
+
0.5
);
while
(
di
>=
25
)
di
/=
10
;
if
(
di
>
0
&&
di
<=
25
)
{
lines
=
rdata
[
lix
][
di
-
1
].
lines
;
longquotient
=
rdata
[
lix
][
di
-
1
].
longq
;
if
(
horizontal
!=
0
)
valuequotient
=
rdata
[
lix
][
di
-
1
].
hvalq
;
else
valuequotient
=
rdata
[
lix
][
di
-
1
].
vvalq
;
}
double
m
=
Math
.
max
(
Math
.
abs
(
maxval
),
Math
.
abs
(
minval
));
switch
(
lix
)
{
case
0
:
{
if
(
m
<
0.01
)
format
=
"%g"
;
else
if
(
m
<
0.1
)
format
=
"%5.3f"
;
else
if
(
m
<
1
)
format
=
"%4.2f"
;
else
if
(
m
<
3
)
format
=
"%3.1f"
;
else
if
(
m
<=
20
)
format
=
"%2.0f"
;
else
if
(
m
<=
200
)
format
=
"%3.0f"
;
else
if
(
m
<
2000
)
format
=
"%4.0f"
;
else
if
(
m
<
20000
)
format
=
"%5.0f"
;
else
format
=
"%g"
;
break
;
}
case
1
:
{
if
(
m
<
0.01
)
format
=
"%g"
;
else
if
(
m
<
0.1
)
format
=
"%5.3f"
;
else
if
(
m
<
1
)
format
=
"%4.2f"
;
else
if
(
m
<=
4
)
format
=
"%3.1f"
;
else
if
(
m
<=
20
)
format
=
"%2.0f"
;
else
if
(
m
<=
200
)
format
=
"%3.0f"
;
else
if
(
m
<
2000
)
format
=
"%4.0f"
;
else
if
(
m
<
20000
)
format
=
"%5.0f"
;
else
format
=
"%g"
;
break
;
}
default
:
;
}
}
configure
();
draw
();
}
}
java/jpwr/jopg/src/GrowCtx.java
View file @
ea385221
...
...
@@ -630,7 +630,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowXYCurve
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowPie
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowBarChart
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowToolbar
)
{
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowToolbar
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxis
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxisArc
)
{
cmn
.
appl
.
traceConnect
(
cmn
.
a
.
get
(
i
));
if
(
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowGroup
)
{
for
(
int
j
=
0
;
j
<
((
GrowNode
)
cmn
.
a
.
get
(
i
)).
nc
.
a
.
size
();
j
++)
{
...
...
@@ -665,7 +667,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowFolder
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowXYCurve
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowPie
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowBarChart
)
{
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowBarChart
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxis
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxisArc
)
{
cmn
.
appl
.
traceDisconnect
(
cmn
.
a
.
get
(
i
));
if
(
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowGroup
)
{
for
(
int
j
=
0
;
j
<
((
GrowNode
)
cmn
.
a
.
get
(
i
)).
nc
.
a
.
size
();
j
++)
{
...
...
@@ -697,7 +701,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowFolder
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowXYCurve
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowPie
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowBarChart
)
{
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowBarChart
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxis
||
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAxisArc
)
{
cmn
.
appl
.
traceScan
(
cmn
.
a
.
get
(
i
));
if
(
cmn
.
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowGroup
)
{
for
(
int
j
=
0
;
j
<
((
GrowNode
)
cmn
.
a
.
get
(
i
)).
nc
.
a
.
size
();
j
++)
{
...
...
java/jpwr/jopg/src/os_templ/hw_templ/makefile
View file @
ea385221
...
...
@@ -46,6 +46,7 @@ local_java_sources := \
GrowSlider.java,
\
GrowAxis.java,
\
GrowArc.java,
\
GrowAxisArc.java,
\
GrowLine.java,
\
GrowPolyline.java,
\
GrowText.java,
\
...
...
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