Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
0af7a185
Commit
0af7a185
authored
Feb 04, 2020
by
Julian Zobel
Browse files
Moved the name tag of attraction points above the ap radius in the GUI
parent
3b871511
Changes
1
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModelViz.java
View file @
0af7a185
...
...
@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm;
import
java.awt.AlphaComposite
;
import
java.awt.BasicStroke
;
import
java.awt.Color
;
import
java.awt.Composite
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Point
;
...
...
@@ -266,27 +267,30 @@ public class ModularMovementModelViz extends JComponent
*/
protected
void
drawAttractionPoints
(
Graphics2D
g2
)
{
Composite
gc
=
g2
.
getComposite
();
for
(
AttractionPoint
aPoint
:
movementModel
.
getAttractionPoints
())
{
Point
point
=
((
PositionVector
)
aPoint
).
asPoint
();
// draw border
g2
.
setColor
(
Color
.
BLACK
);
g2
.
setFont
(
VisualizationTopologyView
.
FONT_MEDIUM
);
g2
.
drawString
(
aPoint
.
getName
(),
VisualizationInjector
.
scaleValue
(
point
.
x
)
-
ATTR_PAD
,
VisualizationInjector
.
scaleValue
(
point
.
y
)
-
ATTR_PAD
);
g2
.
setColor
(
COLOR_ATTR_POINT
);
float
alpha
=
0.25f
+
(
float
)
(
aPoint
.
getWeight
()
/
2
);
g2
.
setComposite
(
AlphaComposite
.
getInstance
(
AlphaComposite
.
SRC_OVER
,
alpha
));
g2
.
fillOval
(
VisualizationInjector
.
scaleValue
(
point
.
x
)
-
ATTR_PAD
,
VisualizationInjector
.
scaleValue
(
point
.
y
)
-
ATTR_PAD
,
ATTR_PAD
*
2
+
1
,
ATTR_PAD
*
2
+
1
);
VisualizationInjector
.
scaleValue
(
point
.
x
)
-
g2
.
getFontMetrics
().
stringWidth
(
aPoint
.
getName
())
/
2
,
VisualizationInjector
.
scaleValue
(
point
.
y
-
aPoint
.
getRadius
()
-
5
)
-
ATTR_PAD
);
//
g2.setColor(COLOR_ATTR_POINT);
//
float alpha = 0.25f + (float) (aPoint.getWeight() / 2);
//
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
//
g2.fillOval(
//
VisualizationInjector.scaleValue(point.x) - ATTR_PAD,
//
VisualizationInjector.scaleValue(point.y) - ATTR_PAD,
//
ATTR_PAD * 2 + 1, ATTR_PAD * 2 + 1);
g2
.
setColor
(
COLOR_ATTR_POINT
);
int
radius
=
VisualizationInjector
.
scaleValue
(
aPoint
.
getRadius
())
+
ATTR_PAD
;
g2
.
drawOval
(
VisualizationInjector
.
scaleValue
(
point
.
x
)
-
radius
,
VisualizationInjector
.
scaleValue
(
point
.
y
)
-
radius
,
radius
*
2
+
1
,
radius
*
2
+
1
);
g2
.
setComposite
(
gc
);
}
}
...
...
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