import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
+import java.util.List;
+import java.util.Optional;
import org.simantics.district.network.ui.adapters.DistrictNetworkVertex;
import org.simantics.maps.MapScalingTransform;
private Color color;
private transient Color dynamicColor;
+ private transient Color eventColor;
private Rectangle2D bounds;
private transient Point2D point;
}
Color oldColor = g2d.getColor();
- Color newColor = dynamicColor != null ? dynamicColor : color;
+ Color newColor = eventColor != null ? eventColor : dynamicColor != null ? dynamicColor : color;
boolean changeColor = !oldColor.equals(newColor);
double scaleRecip = viewScaleRecip * nodeSize;
this.dynamicColor = color;
}
+ @PropertySetter(value = "eventColor")
+ public void setEventColor(Color colorr) {
+ this.eventColor = colorr;
+ }
+
@PropertySetter(value = "hidden")
public void setHidden(Boolean value) {
this.hidden = value;
}
+
+ public void setStaticInformation(Optional<String> staticInformation) {
+ DistrictNetworkStaticInfoNode child = getOrCreateNode(DistrictNetworkStaticInfoNode.NODE_KEY, DistrictNetworkStaticInfoNode.class);
+ Point2D calculatePoint2D = DistrictNetworkNodeUtils.calculatePoint2D(vertex.getPoint(), null);
+ child.setLocation(calculatePoint2D, new Point2D.Double(1.0, 0.0));
+ 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());
+ }
+ }
+
+ public void setConnectionLinePoints(List<Point2D> points) {
+ if (points == null) {
+ removeNode(ConnectionLineNode.NODE_NAME);
+ } else {
+ ConnectionLineNode child = getOrCreateNode(ConnectionLineNode.NODE_NAME, ConnectionLineNode.class);
+ child.setZIndex(0);
+ child.setStrokeWidth(2.f);
+ child.setPoints(points);
+ }
+ }
+
}