]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java
Better default value for arrow length.
[simantics/district.git] / 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);