From 0f871d5a2e1a0a531195ef80f007af89de62c914 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Fri, 6 Sep 2019 15:07:32 +0300 Subject: [PATCH] Provide Path2D for calculating path of DistrictNetworkEdgeElement gitlab #61 Change-Id: I2d1195c3e1107e22ab26ef5d61c55da05cdae71b --- .../network/ui/adapters/DistrictNetworkEdgeElement.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.47.1