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
f337c6ee
Commit
f337c6ee
authored
May 30, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JopAxisArc position adjustments
parent
9dc551bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
java/jpwr/jop/src/JopAxisarc.java
java/jpwr/jop/src/JopAxisarc.java
+14
-17
No files found.
java/jpwr/jop/src/JopAxisarc.java
View file @
f337c6ee
...
...
@@ -52,6 +52,7 @@ public class JopAxisarc extends JComponent {
int
lines
=
11
;
int
longQuotient
=
1
;
int
valueQuotient
=
1
;
int
textCnt
=
0
;
GeCFormat
cFormat
;
Font
font
;
public
void
setAngle1
(
float
angle1
)
{
...
...
@@ -154,8 +155,6 @@ public class JopAxisarc extends JComponent {
float
value
;
boolean
drawText
=
(
minValue
!=
maxValue
);
System
.
out
.
println
(
"w: "
+
width
+
" h: "
+
height
+
" Lines "
+
lines
+
" Len "
+
lineLength
);
if
(
widthOrig
==
0
)
widthOrig
=
width
;
...
...
@@ -167,6 +166,7 @@ public class JopAxisarc extends JComponent {
shapes
=
new
Shape
[
1
];
FontRenderContext
frc
=
g
.
getFontRenderContext
();
textCnt
=
0
;
if
(
lines
>
0
)
{
hLines
=
new
Line2D
.
Float
[
lines
];
...
...
@@ -177,7 +177,7 @@ public class JopAxisarc extends JComponent {
}
shapes
[
0
]
=
new
Arc2D
.
Float
(
0
F
,
0
F
,
width
,
height
,
angle1
,
angle2
,
Arc2D
.
PIE
);
shapes
[
0
]
=
new
Arc2D
.
Float
(
0
F
,
0
F
,
width
,
height
,
angle1
,
angle2
,
Arc2D
.
OPEN
);
float
line_angle
=
angle2
/
(
lines
-
1
);
for
(
i
=
0
;
i
<
lines
;
i
++)
{
float
sin1
=
(
float
)
Math
.
sin
(
(
angle1
+
i
*
line_angle
)
/
180
*
Math
.
PI
);
...
...
@@ -198,10 +198,11 @@ public class JopAxisarc extends JComponent {
hLines
[
i
]
=
new
Line2D
.
Float
(
x1
,
y1
,
x2
,
y2
);
if
(
drawText
&&
i
%
valueQuotient
==
0
)
{
if
(
maxValue
>
minValue
)
value
=
maxValue
-
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
else
value
=
(
minValue
-
maxValue
)
/
(
lines
-
1
)
*
i
;
value
=
minValue
+
(
maxValue
-
minValue
)
/
(
lines
-
1
)
*
i
;
// if ( maxValue > minValue)
// value = maxValue - (maxValue - minValue) / ( lines - 1) * i;
// else
// value = (minValue - maxValue) / ( lines - 1) * i;
hText
[
i
/
valueQuotient
]
=
cFormat
.
format
(
value
,
new
StringBuffer
()).
toString
();
Rectangle2D
textBounds
=
...
...
@@ -209,9 +210,8 @@ public class JopAxisarc extends JComponent {
float
textHeight
=
(
float
)
textBounds
.
getHeight
();
float
textWidth
=
(
float
)
textBounds
.
getWidth
();
yt
=
height
/
2
*
(
-
sin1
*
(
1
F
-
lineLen
)
+
1
)
+
sin1
*
textHeight
;
xt
=
width
/
2
*
(
cos1
*
(
1
F
-
lineLen
)
+
1
)
+
cos1
*
textWidth
/
2
;
xt
=
width
/
2
*
(
cos1
*
(
1
F
-
lineLen
)
+
1
)
-
cos1
*
textWidth
/
2
;
float
increment
=
(
maxValue
-
minValue
)
/
(
lines
-
1
);
System
.
out
.
println
(
"Text w: "
+
textWidth
+
" h: "
+
textHeight
);
if
(
i
%
valueQuotient
==
0
&&
!(
angle2
==
360
&&
...
...
@@ -227,11 +227,11 @@ public class JopAxisarc extends JComponent {
yt
=
yt
+
textHeight
/
2
;
xt
=
xt
-
textWidth
/
2
;
}
hTextPosY
[
i
/
valueQuotient
]
=
yt
;
hTextPosX
[
i
/
valueQuotient
]
=
xt
;
hTextPosY
[
textCnt
]
=
yt
;
hTextPosX
[
textCnt
]
=
xt
;
textCnt
++;
}
}
System
.
out
.
println
(
"Line ("
+
x1
+
","
+
y1
+
") ("
+
x2
+
","
+
y2
+
") ("
+
xt
+
","
+
yt
+
")"
);
}
}
}
...
...
@@ -243,11 +243,8 @@ public class JopAxisarc extends JComponent {
for
(
i
=
0
;
i
<
lines
;
i
++)
g
.
draw
(
hLines
[
i
]);
if
(
drawText
)
{
for
(
i
=
0
;
i
<
lines
;
i
++)
{
if
(
i
%
valueQuotient
==
0
)
{
g
.
drawString
(
hText
[
i
/
valueQuotient
],
hTextPosX
[
i
/
valueQuotient
],
hTextPosY
[
i
/
valueQuotient
]);
}
for
(
i
=
0
;
i
<
textCnt
;
i
++)
{
g
.
drawString
(
hText
[
i
],
hTextPosX
[
i
],
hTextPosY
[
i
]);
}
}
oldWidth
=
width
;
...
...
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