1 package org.simantics.district.network.ui.nodes;
3 import java.awt.BasicStroke;
5 import java.awt.geom.Rectangle2D;
7 import org.simantics.scenegraph.ParentNode;
8 import org.simantics.scenegraph.g2d.G2DNode;
9 import org.simantics.scenegraph.utils.GeometryUtils;
11 public class NotInSimulationNode extends G2DNode {
13 private static final BasicStroke STROKE = new BasicStroke(1.5f);
14 public static final String NODE_NAME = "notInSimulation";
16 private static final long serialVersionUID = 1503248449618244809L;
17 private boolean isInSimulation;
20 public Rectangle2D getBoundsInLocal() {
25 public Rectangle2D getBoundsInLocal(boolean b) {
30 public Rectangle2D getBounds() {
34 public void render(java.awt.Graphics2D g) {
35 if (!isInSimulation) {
36 ParentNode<?> parent = getParent();
37 if (!(parent instanceof DistrictNetworkVertexNode))
40 Rectangle2D bounds = ((DistrictNetworkVertexNode)parent).getBoundsInLocal();
41 Rectangle2D expandedBounds = GeometryUtils.expandRectangle( bounds, bounds.getWidth() / 2 );
43 g.setColor(Color.RED);
44 g.setStroke(GeometryUtils.scaleStroke(STROKE, 1.f / (float)g.getTransform().getScaleX()));
45 g.draw(expandedBounds);
49 public void setIsInSimulation(boolean isInSimulation) {
50 this.isInSimulation = isInSimulation;