From: jsimomaa Date: Fri, 6 Sep 2019 12:07:32 +0000 (+0300) Subject: Provide Path2D for calculating path of DistrictNetworkEdgeElement X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=0f871d5a2e1a0a531195ef80f007af89de62c914;hp=94be073aed6fca8266b2d9ed147c4843f3d23da5;p=simantics%2Fdistrict.git Provide Path2D for calculating path of DistrictNetworkEdgeElement gitlab #61 Change-Id: I2d1195c3e1107e22ab26ef5d61c55da05cdae71b --- diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElement.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElement.java index ef2e21fe..8fb105d8 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElement.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/adapters/DistrictNetworkEdgeElement.java @@ -102,13 +102,17 @@ public class DistrictNetworkEdgeElement { public static final DNEdgeInternalSize INSTANCE = new DNEdgeInternalSize(); + private ThreadLocal path = new ThreadLocal() { + protected Path2D initialValue() { return new Path2D.Double(); } + }; + @Override public Rectangle2D getBounds(IElement e, Rectangle2D size) { DistrictNetworkEdge edge = e.getHint(KEY_DN_EDGE); if (size == null) size = new Rectangle2D.Double(); if (edge != null) - size.setFrame(DistrictNetworkEdgeNode.calculatePath(edge, null, false).getBounds2D()); + size.setFrame(DistrictNetworkEdgeNode.calculatePath(edge, path.get(), false).getBounds2D()); else LOGGER.debug("Element {} does not have edge!", e);