From 24a149aeac3fb9980492b69683e3d68cf5c3d76e Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 4 Apr 2019 16:43:29 +0300 Subject: [PATCH 1/1] Better default value for arrow length. gitlab #39 Change-Id: I7fdf6a6785e958be048dd6d3e49ff7156b72fd83 --- .../network/profile/ArrowLengthStyle.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java index 2e8c3458..0201f0b1 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java @@ -20,7 +20,6 @@ import org.simantics.scenegraph.profile.common.ProfileVariables; public class ArrowLengthStyle extends ThrottledStyleBase { private static final Double PENDING = Double.NaN; - private static final Double ONE = 1.0; @Override public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException { @@ -33,18 +32,13 @@ public class ArrowLengthStyle extends ThrottledStyleBase { // Prevent PendingVariableExceptions from coming through boolean wasSynchronous = graph.setSynchronous(true); try { - Double length = ONE; if (ds.arrowLengthProperty.isPresent()) { - length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem); - // System.out.println("read thickness: " + thickness + " : " + ds.arrowLengthProperty); - if (length == null) { - length = ONE; - } else { - length = length * ds.arrowLengthGain + ds.arrowLengthBias; - } + Double length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem); + return length != null ? length * ds.arrowLengthGain + ds.arrowLengthBias : null; + } + else { + return null; } - - return length; } finally { graph.setSynchronous(wasSynchronous); -- 2.45.2