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
e0b7ed8e
Commit
e0b7ed8e
authored
Nov 04, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapted to resizable frame
parent
2526faff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
58 deletions
+94
-58
java/jpwr/jop/src/GeDynMove.java
java/jpwr/jop/src/GeDynMove.java
+20
-12
java/jpwr/jop/src/JopAxis.java
java/jpwr/jop/src/JopAxis.java
+27
-17
src/jpwr/jop/src/GeDynMove.java
src/jpwr/jop/src/GeDynMove.java
+20
-12
src/jpwr/jop/src/JopAxis.java
src/jpwr/jop/src/JopAxis.java
+27
-17
No files found.
java/jpwr/jop/src/GeDynMove.java
View file @
e0b7ed8e
/*
* Proview $Id: GeDynMove.java,v 1.
4 2005-09-01 14:57:50
claes Exp $
* Proview $Id: GeDynMove.java,v 1.
5 2005-11-04 11:41:52
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -48,12 +48,15 @@ public String moveYAttribute;
float
moveYOldValue
;
float
scaleXOldValue
;
float
scaleYOldValue
;
public
double
xOrig
;
public
double
yOrig
;
public
double
xOrig
;
public
double
yOrig
;
public
double
wOrig
;
public
double
hOrig
;
public
double
xScale
=
1
;
public
double
yScale
=
1
;
public
double
wRootOrig
;
public
double
wRootOld
;
public
double
xScale
=
1
;
public
double
yScale
=
1
;
JRootPane
rootpane
;
boolean
firstScan
=
true
;
public
GeDynMove
(
GeDyn
dyn
,
String
moveXAttribute
,
String
moveYAttribute
,
...
...
@@ -135,10 +138,15 @@ public String moveYAttribute;
Dimension
size
=
((
JComponent
)
dyn
.
comp
).
getSize
();
wOrig
=
(
double
)
size
.
width
;
hOrig
=
(
double
)
size
.
height
;
rootpane
=
((
JComponent
)
dyn
.
comp
).
getRootPane
();
wRootOrig
=
(
double
)
rootpane
.
getWidth
();
}
double
wRoot
=
(
double
)
rootpane
.
getWidth
();
if
(
attrMoveXFound
||
attrMoveYFound
)
{
// Move
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
Dimension
size
=
((
JComponent
)
dyn
.
comp
).
getSize
();
float
valueMoveX
=
0
;
...
...
@@ -160,11 +168,11 @@ public String moveYAttribute;
}
if
(
repaintNow
)
{
if
(
attrMoveXFound
){
double
xRatio
=(
size
.
width
/
wOrig
)
;
double
xRatio
=
wRoot
/
wRootOrig
;
loc
.
x
=
(
int
)
((
xOrig
+
(
valueMoveX
-
xOffset
)
*
factor
)
*
xRatio
);
}
if
(
attrMoveYFound
){
double
yRatio
=(
size
.
height
/
hOrig
)
;
double
yRatio
=
wRoot
/
wRootOrig
;
loc
.
y
=
(
int
)
((
yOrig
+
(
valueMoveY
-
yOffset
)
*
factor
)
*
yRatio
);
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
...
...
@@ -181,14 +189,14 @@ public String moveYAttribute;
if
(
attrScaleXFound
)
{
valueScaleX
=
(
float
)
(
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
scaleXp
)
*
scaleFactor
);
if
(
valueScaleX
!=
scaleXOldValue
||
firstScan
)
{
if
(
valueScaleX
!=
scaleXOldValue
||
firstScan
||
wRoot
!=
wRootOld
)
{
repaintNow
=
true
;
scaleXOldValue
=
valueScaleX
;
}
}
if
(
attrScaleYFound
)
{
valueScaleY
=
(
float
)
(
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
scaleYp
)
*
scaleFactor
);
if
(
valueScaleY
!=
scaleYOldValue
||
firstScan
)
{
if
(
valueScaleY
!=
scaleYOldValue
||
firstScan
||
wRoot
!=
wRootOld
)
{
repaintNow
=
true
;
scaleYOldValue
=
valueScaleY
;
}
...
...
@@ -196,19 +204,19 @@ public String moveYAttribute;
if
(
repaintNow
)
{
Rectangle
rect
=
((
JComponent
)
dyn
.
comp
).
getBounds
();
if
(
attrScaleXFound
)
{
rect
.
width
=
(
int
)
(
xScale
*
valueScaleX
);
rect
.
width
=
(
int
)
(
xScale
*
valueScaleX
*
wRoot
/
wRootOrig
);
if
(
rect
.
width
<
1
)
rect
.
width
=
1
;
}
if
(
attrScaleYFound
)
{
rect
.
height
=
(
int
)
(
yScale
*
valueScaleY
);
rect
.
height
=
(
int
)
(
yScale
*
valueScaleY
*
wRoot
/
wRootOrig
);
if
(
rect
.
height
<
1
)
rect
.
height
=
1
;
}
((
JComponent
)
dyn
.
comp
).
setBounds
(
rect
);
}
}
wRootOld
=
wRoot
;
if
(
firstScan
)
firstScan
=
false
;
}
...
...
java/jpwr/jop/src/JopAxis.java
View file @
e0b7ed8e
/*
* Proview $Id: JopAxis.java,v 1.
3 2005-09-01 14:57:50
claes Exp $
* Proview $Id: JopAxis.java,v 1.
4 2005-11-04 11:42:05
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -114,10 +114,7 @@ public class JopAxis extends JComponent {
public
void
setRotate
(
double
rotate
)
{
this
.
rotate
=
rotate
;}
public
double
getRotate
()
{
return
rotate
;}
Shape
[]
shapes
=
null
;
GeneralPath
[]
curve
=
new
GeneralPath
[
2
];
Line2D
.
Float
[]
hLines
;
float
[][]
y_values
=
new
float
[
2
][];
float
[][]
x_values
=
new
float
[
2
][];
public
void
paint
(
Graphics
g1
)
{
super
.
paint
(
g1
);
Graphics2D
g
=
(
Graphics2D
)
g1
;
...
...
@@ -137,6 +134,8 @@ public class JopAxis extends JComponent {
float
hTextPosX
[];
float
hTextPosY
[];
String
hText
[];
float
oldWidth
;
float
widthOrig
=
0
;
public
void
paintComponent
(
Graphics
g1
)
{
int
i
,
j
;
Graphics2D
g
=
(
Graphics2D
)
g1
;
...
...
@@ -145,19 +144,27 @@ public class JopAxis extends JComponent {
AffineTransform
save
=
g
.
getTransform
();
float
delta
;
float
value
;
boolean
drawText
=
(
minValue
!=
maxValue
);
g
.
setFont
(
font
);
if
(
widthOrig
==
0
)
widthOrig
=
width
;
if
(
shapes
==
null
)
{
//g.setFont( font);
g
.
setFont
(
font
.
deriveFont
(
width
/
widthOrig
*
font
.
getSize
()));
if
(
shapes
==
null
||
width
!=
oldWidth
)
{
float
lineLength
=
this
.
lineLength
*
width
/
widthOrig
;
shapes
=
new
Shape
[
1
];
FontRenderContext
frc
=
g
.
getFontRenderContext
();
if
(
lines
>
0
)
{
hLines
=
new
Line2D
.
Float
[
lines
];
hText
=
new
String
[
lines
/
valueQuotient
+
1
];
hTextPosY
=
new
float
[
lines
/
valueQuotient
+
1
];
hTextPosX
=
new
float
[
lines
/
valueQuotient
+
1
];
if
(
drawText
)
{
hText
=
new
String
[
lines
/
valueQuotient
+
1
];
hTextPosY
=
new
float
[
lines
/
valueQuotient
+
1
];
hTextPosX
=
new
float
[
lines
/
valueQuotient
+
1
];
}
if
(
315
<=
rotate
||
rotate
<
45.0
)
{
shapes
[
0
]
=
new
Line2D
.
Float
(
width
,
0
F
,
width
,
height
);
...
...
@@ -169,7 +176,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
width
-
2
F
/
3
F
*
lineLength
,
delta
*
i
,
width
,
delta
*
i
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
maxValue
-
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -199,7 +206,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
delta
*
i
,
height
-
2
F
/
3
F
*
lineLength
,
delta
*
i
,
height
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -230,7 +237,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
0
F
,
delta
*
i
,
2
F
/
3
F
*
lineLength
,
delta
*
i
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -260,7 +267,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
delta
*
i
,
0
F
,
delta
*
i
,
2
F
/
3
F
*
lineLength
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
maxValue
-
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -307,12 +314,15 @@ public class JopAxis extends JComponent {
g
.
draw
(
shapes
[
0
]);
for
(
i
=
0
;
i
<
lines
;
i
++)
g
.
draw
(
hLines
[
i
]);
for
(
i
=
0
;
i
<
lines
;
i
++)
{
if
(
i
%
valueQuotient
==
0
)
{
g
.
drawString
(
hText
[
i
/
valueQuotient
],
hTextPosX
[
i
/
valueQuotient
],
hTextPosY
[
i
/
valueQuotient
]);
if
(
drawText
)
{
for
(
i
=
0
;
i
<
lines
;
i
++)
{
if
(
i
%
valueQuotient
==
0
)
{
g
.
drawString
(
hText
[
i
/
valueQuotient
],
hTextPosX
[
i
/
valueQuotient
],
hTextPosY
[
i
/
valueQuotient
]);
}
}
}
oldWidth
=
width
;
}
public
Dimension
getPreferredSize
()
{
return
size
;}
public
Dimension
getMinimumSize
()
{
return
size
;}
...
...
src/jpwr/jop/src/GeDynMove.java
View file @
e0b7ed8e
/*
* Proview $Id: GeDynMove.java,v 1.
4 2005-09-01 14:57:50
claes Exp $
* Proview $Id: GeDynMove.java,v 1.
5 2005-11-04 11:41:52
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -48,12 +48,15 @@ public String moveYAttribute;
float
moveYOldValue
;
float
scaleXOldValue
;
float
scaleYOldValue
;
public
double
xOrig
;
public
double
yOrig
;
public
double
xOrig
;
public
double
yOrig
;
public
double
wOrig
;
public
double
hOrig
;
public
double
xScale
=
1
;
public
double
yScale
=
1
;
public
double
wRootOrig
;
public
double
wRootOld
;
public
double
xScale
=
1
;
public
double
yScale
=
1
;
JRootPane
rootpane
;
boolean
firstScan
=
true
;
public
GeDynMove
(
GeDyn
dyn
,
String
moveXAttribute
,
String
moveYAttribute
,
...
...
@@ -135,10 +138,15 @@ public String moveYAttribute;
Dimension
size
=
((
JComponent
)
dyn
.
comp
).
getSize
();
wOrig
=
(
double
)
size
.
width
;
hOrig
=
(
double
)
size
.
height
;
rootpane
=
((
JComponent
)
dyn
.
comp
).
getRootPane
();
wRootOrig
=
(
double
)
rootpane
.
getWidth
();
}
double
wRoot
=
(
double
)
rootpane
.
getWidth
();
if
(
attrMoveXFound
||
attrMoveYFound
)
{
// Move
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
Dimension
size
=
((
JComponent
)
dyn
.
comp
).
getSize
();
float
valueMoveX
=
0
;
...
...
@@ -160,11 +168,11 @@ public String moveYAttribute;
}
if
(
repaintNow
)
{
if
(
attrMoveXFound
){
double
xRatio
=(
size
.
width
/
wOrig
)
;
double
xRatio
=
wRoot
/
wRootOrig
;
loc
.
x
=
(
int
)
((
xOrig
+
(
valueMoveX
-
xOffset
)
*
factor
)
*
xRatio
);
}
if
(
attrMoveYFound
){
double
yRatio
=(
size
.
height
/
hOrig
)
;
double
yRatio
=
wRoot
/
wRootOrig
;
loc
.
y
=
(
int
)
((
yOrig
+
(
valueMoveY
-
yOffset
)
*
factor
)
*
yRatio
);
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
...
...
@@ -181,14 +189,14 @@ public String moveYAttribute;
if
(
attrScaleXFound
)
{
valueScaleX
=
(
float
)
(
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
scaleXp
)
*
scaleFactor
);
if
(
valueScaleX
!=
scaleXOldValue
||
firstScan
)
{
if
(
valueScaleX
!=
scaleXOldValue
||
firstScan
||
wRoot
!=
wRootOld
)
{
repaintNow
=
true
;
scaleXOldValue
=
valueScaleX
;
}
}
if
(
attrScaleYFound
)
{
valueScaleY
=
(
float
)
(
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
scaleYp
)
*
scaleFactor
);
if
(
valueScaleY
!=
scaleYOldValue
||
firstScan
)
{
if
(
valueScaleY
!=
scaleYOldValue
||
firstScan
||
wRoot
!=
wRootOld
)
{
repaintNow
=
true
;
scaleYOldValue
=
valueScaleY
;
}
...
...
@@ -196,19 +204,19 @@ public String moveYAttribute;
if
(
repaintNow
)
{
Rectangle
rect
=
((
JComponent
)
dyn
.
comp
).
getBounds
();
if
(
attrScaleXFound
)
{
rect
.
width
=
(
int
)
(
xScale
*
valueScaleX
);
rect
.
width
=
(
int
)
(
xScale
*
valueScaleX
*
wRoot
/
wRootOrig
);
if
(
rect
.
width
<
1
)
rect
.
width
=
1
;
}
if
(
attrScaleYFound
)
{
rect
.
height
=
(
int
)
(
yScale
*
valueScaleY
);
rect
.
height
=
(
int
)
(
yScale
*
valueScaleY
*
wRoot
/
wRootOrig
);
if
(
rect
.
height
<
1
)
rect
.
height
=
1
;
}
((
JComponent
)
dyn
.
comp
).
setBounds
(
rect
);
}
}
wRootOld
=
wRoot
;
if
(
firstScan
)
firstScan
=
false
;
}
...
...
src/jpwr/jop/src/JopAxis.java
View file @
e0b7ed8e
/*
* Proview $Id: JopAxis.java,v 1.
3 2005-09-01 14:57:50
claes Exp $
* Proview $Id: JopAxis.java,v 1.
4 2005-11-04 11:42:05
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -114,10 +114,7 @@ public class JopAxis extends JComponent {
public
void
setRotate
(
double
rotate
)
{
this
.
rotate
=
rotate
;}
public
double
getRotate
()
{
return
rotate
;}
Shape
[]
shapes
=
null
;
GeneralPath
[]
curve
=
new
GeneralPath
[
2
];
Line2D
.
Float
[]
hLines
;
float
[][]
y_values
=
new
float
[
2
][];
float
[][]
x_values
=
new
float
[
2
][];
public
void
paint
(
Graphics
g1
)
{
super
.
paint
(
g1
);
Graphics2D
g
=
(
Graphics2D
)
g1
;
...
...
@@ -137,6 +134,8 @@ public class JopAxis extends JComponent {
float
hTextPosX
[];
float
hTextPosY
[];
String
hText
[];
float
oldWidth
;
float
widthOrig
=
0
;
public
void
paintComponent
(
Graphics
g1
)
{
int
i
,
j
;
Graphics2D
g
=
(
Graphics2D
)
g1
;
...
...
@@ -145,19 +144,27 @@ public class JopAxis extends JComponent {
AffineTransform
save
=
g
.
getTransform
();
float
delta
;
float
value
;
boolean
drawText
=
(
minValue
!=
maxValue
);
g
.
setFont
(
font
);
if
(
widthOrig
==
0
)
widthOrig
=
width
;
if
(
shapes
==
null
)
{
//g.setFont( font);
g
.
setFont
(
font
.
deriveFont
(
width
/
widthOrig
*
font
.
getSize
()));
if
(
shapes
==
null
||
width
!=
oldWidth
)
{
float
lineLength
=
this
.
lineLength
*
width
/
widthOrig
;
shapes
=
new
Shape
[
1
];
FontRenderContext
frc
=
g
.
getFontRenderContext
();
if
(
lines
>
0
)
{
hLines
=
new
Line2D
.
Float
[
lines
];
hText
=
new
String
[
lines
/
valueQuotient
+
1
];
hTextPosY
=
new
float
[
lines
/
valueQuotient
+
1
];
hTextPosX
=
new
float
[
lines
/
valueQuotient
+
1
];
if
(
drawText
)
{
hText
=
new
String
[
lines
/
valueQuotient
+
1
];
hTextPosY
=
new
float
[
lines
/
valueQuotient
+
1
];
hTextPosX
=
new
float
[
lines
/
valueQuotient
+
1
];
}
if
(
315
<=
rotate
||
rotate
<
45.0
)
{
shapes
[
0
]
=
new
Line2D
.
Float
(
width
,
0
F
,
width
,
height
);
...
...
@@ -169,7 +176,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
width
-
2
F
/
3
F
*
lineLength
,
delta
*
i
,
width
,
delta
*
i
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
maxValue
-
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -199,7 +206,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
delta
*
i
,
height
-
2
F
/
3
F
*
lineLength
,
delta
*
i
,
height
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -230,7 +237,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
0
F
,
delta
*
i
,
2
F
/
3
F
*
lineLength
,
delta
*
i
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -260,7 +267,7 @@ public class JopAxis extends JComponent {
else
hLines
[
i
]
=
new
Line2D
.
Float
(
delta
*
i
,
0
F
,
delta
*
i
,
2
F
/
3
F
*
lineLength
);
if
(
i
%
valueQuotient
==
0
)
{
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
maxValue
-
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
...
...
@@ -307,12 +314,15 @@ public class JopAxis extends JComponent {
g
.
draw
(
shapes
[
0
]);
for
(
i
=
0
;
i
<
lines
;
i
++)
g
.
draw
(
hLines
[
i
]);
for
(
i
=
0
;
i
<
lines
;
i
++)
{
if
(
i
%
valueQuotient
==
0
)
{
g
.
drawString
(
hText
[
i
/
valueQuotient
],
hTextPosX
[
i
/
valueQuotient
],
hTextPosY
[
i
/
valueQuotient
]);
if
(
drawText
)
{
for
(
i
=
0
;
i
<
lines
;
i
++)
{
if
(
i
%
valueQuotient
==
0
)
{
g
.
drawString
(
hText
[
i
/
valueQuotient
],
hTextPosX
[
i
/
valueQuotient
],
hTextPosY
[
i
/
valueQuotient
]);
}
}
}
oldWidth
=
width
;
}
public
Dimension
getPreferredSize
()
{
return
size
;}
public
Dimension
getMinimumSize
()
{
return
size
;}
...
...
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