From: Reino Ruusu Date: Thu, 4 Apr 2019 13:43:29 +0000 (+0300) Subject: Better default value for arrow length. X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F2841%2F1;p=simantics%2Fdistrict.git Better default value for arrow length. gitlab #39 Change-Id: I7fdf6a6785e958be048dd6d3e49ff7156b72fd83 --- 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);