1 package org.simantics.district.network.ui.nodes;
\r
3 import java.awt.Color;
\r
4 import java.awt.Graphics2D;
\r
5 import java.awt.RenderingHints;
\r
6 import java.awt.geom.AffineTransform;
\r
7 import java.awt.geom.Rectangle2D;
\r
9 import org.simantics.district.network.ui.adapters.DistrictNetworkVertex;
\r
10 import org.simantics.scenegraph.g2d.G2DNode;
\r
12 public class DistrictNetworkVertexNode extends G2DNode {
\r
14 private static final long serialVersionUID = -2641639101400236719L;
\r
15 private DistrictNetworkVertex vertex;
\r
18 public void render(Graphics2D g2d) {
\r
19 AffineTransform ot = null;
\r
20 AffineTransform t = getTransform();
\r
21 if (t != null && !t.isIdentity()) {
\r
22 ot = g2d.getTransform();
\r
23 g2d.transform(getTransform());
\r
26 Object aaHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
\r
27 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
\r
29 Color oldColor = g2d.getColor();
\r
30 g2d.setColor(Color.RED);
\r
33 Rectangle2D.Double rect = new Rectangle2D.Double(-0.5, -0.5, 1, 1);
\r
37 g2d.setColor(oldColor);
\r
39 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aaHint);
\r
42 g2d.setTransform(ot);
\r
46 public Rectangle2D getBoundsInLocal() {
\r
47 return new Rectangle2D.Double(-0.5, -0.5, 1, 1);
\r
50 public void setVertex(DistrictNetworkVertex vertex) {
\r
51 this.vertex = vertex;
\r