X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fprofile%2FArrowLengthStyle.java;h=d180d77bd75a98328e7437ab48b57633b5e03a9f;hb=ded33522a93462a69f30ecb258df42b8d7127b22;hp=2e8c3458164770959409e9aa7fce6f87b2276532;hpb=7d92384ac5455e67e69c02bff9a53e1f0cc256b2;p=simantics%2Fdistrict.git 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..d180d77b 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 @@ -1,14 +1,11 @@ package org.simantics.district.network.profile; -import java.util.HashSet; -import java.util.List; import java.util.Set; import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.TransientCacheListener; -import org.simantics.db.common.request.ResourceRead; import org.simantics.db.exception.DatabaseException; import org.simantics.layer0.Layer0; import org.simantics.scenegraph.INode; @@ -20,7 +17,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 +29,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); @@ -71,17 +62,4 @@ public class ArrowLengthStyle extends ThrottledStyleBase { for (INode nn : n.getNodes()) ProfileVariables.claimNodeProperty(nn, "arrowLength", null, evaluationContext); } - - private static final class MidBranchEdgeSetRequest extends ResourceRead> { - private MidBranchEdgeSetRequest(Resource resource) { - super(resource); - } - - @Override - public Set perform(ReadGraph graph) throws DatabaseException { - List edges = Simantics.applySCL("Simantics/District/Algorithm", "midBranchEdges", graph, resource); - return new HashSet<>(edges); - } - } - }