X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Fnodes%2FDistrictNetworkVertexNode.java;h=99eb3cc117b7fb91cbb8352016a62da7e9836249;hb=refs%2Fchanges%2F71%2F1971%2F3;hp=c566981e05261b5f735ae18c77538a18a97a2dc2;hpb=82fc4004ddaf355147e97fd951a18d3a3815e049;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java index c566981e..99eb3cc1 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java @@ -24,10 +24,10 @@ public class DistrictNetworkVertexNode extends G2DNode { private static final long serialVersionUID = -2641639101400236719L; private DistrictNetworkVertex vertex; - private static final double left = -0.5; - private static final double top = -0.5; - private static final double width = 1; - private static final double height = 1; + private static final double left = -0.25; + private static final double top = -0.25; + private static final double width = 0.5; + private static final double height = 0.5; private static final Rectangle2D NORMAL = new Rectangle2D.Double(left, top, width, height); private static final Rectangle2D HOVERED = new Rectangle2D.Double(left * 3, top * 3, width * 3, height * 3); @@ -40,6 +40,8 @@ public class DistrictNetworkVertexNode extends G2DNode { private Rectangle2D bounds; + private Double strokee; + @Override public void init() { setZIndex(2); @@ -65,7 +67,11 @@ public class DistrictNetworkVertexNode extends G2DNode { double scaleRecip = 1; if (scaleStroke) { double scale = GeometryUtils.getScale(g2d.getTransform()); - + double str; + if (strokee != null) + str = strokee; + else + str = 1.0; //System.out.println("scale: " + scale); scaleRecip = 1.0 / scale; } @@ -131,7 +137,7 @@ public class DistrictNetworkVertexNode extends G2DNode { private static Point2D calculatePoint2D(DistrictNetworkVertex vertex) { Point2D point= vertex.getPoint(); double x = ModelledCRS.longitudeToX(point.getX()); - double y = ModelledCRS.latitudeToY(point.getY()); + double y = ModelledCRS.latitudeToY(-point.getY()); // Inverse because Simantics Diagram is inverted // Apply the scaling Point2D res = new Point2D.Double(x, y); @@ -162,4 +168,8 @@ public class DistrictNetworkVertexNode extends G2DNode { return color; } + @PropertySetter(value = "stroke") + public void setStroke(Double stroke) { + this.strokee = stroke / 10; + } }