import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
-import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
+import java.util.Optional;
import org.simantics.district.network.ModelledCRS;
import org.simantics.district.network.ui.DistrictNetworkEdge;
private Color color;
private Double stroke;
private transient Color dynamicColor = null;
+ private transient Color eventColor = null;
// Dimensions for shut-off valve symbol
private static final double left = -0.25;
}
g2d.setColor(dynamicColor != null ? dynamicColor : color);
+ g2d.setColor(eventColor != null ? eventColor : g2d.getColor());
g2d.setStroke(bs);
g2d.draw(path);
this.dynamicColor = color;
}
+ @PropertySetter(value = "eventColor")
+ public void setEventColor(Color color) {
+ this.eventColor = color;
+ }
+
@PropertySetter(value = "arrowLength")
public void setArrowLength(Double length) {
// find if there is a child deferred arrow node
this.hidden = value;
}
+ public void setStaticInformation(Optional<String> staticInformation) {
+ DistrictNetworkStaticInfoNode child = getOrCreateNode(DistrictNetworkStaticInfoNode.NODE_KEY, DistrictNetworkStaticInfoNode.class);
+ child.setEdgeNode(this);
+ if (staticInformation.isPresent()) {
+ child.setInfo(staticInformation.get());
+ } else {
+ child.setInfo(null);
+ }
+ }
+
+ public void setInSimulation(Optional<Boolean> isInSimulation) {
+ if (!isInSimulation.isPresent()) {
+ removeNode(NotInSimulationNode.NODE_NAME);
+ } else {
+ NotInSimulationNode child = getOrCreateNode(NotInSimulationNode.NODE_NAME, NotInSimulationNode.class);
+ child.setZIndex(1000);
+ child.setIsInSimulation(isInSimulation.get());
+ }
+ }
+
}