]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Better default value for arrow length. 41/2841/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Thu, 4 Apr 2019 13:43:29 +0000 (16:43 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Thu, 4 Apr 2019 13:43:29 +0000 (16:43 +0300)
gitlab #39

Change-Id: I7fdf6a6785e958be048dd6d3e49ff7156b72fd83

org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java

index 2e8c3458164770959409e9aa7fce6f87b2276532..0201f0b16b98bae9a2cae6e5bd0e750bcf16afb8 100644 (file)
@@ -20,7 +20,6 @@ import org.simantics.scenegraph.profile.common.ProfileVariables;
 public class ArrowLengthStyle extends ThrottledStyleBase<Double> {
 
        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<Double> {
                // 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);