X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fprofile%2FDiagramSettingsRequest.java;h=eac9ce0814982b3d4bbd309f8532f8469fb8b4bc;hb=refs%2Fchanges%2F67%2F3267%2F1;hp=a17464d8aefe655ea4e83b9eea54832a513cc9f6;hpb=00803fe68b14b5dce310a5a88b9c2a55bd1c85e6;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java index a17464d8..eac9ce08 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettingsRequest.java @@ -26,71 +26,34 @@ public class DiagramSettingsRequest extends ResourceRead { DiagramResource DIA = DiagramResource.getInstance(graph); DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); - Function1 elementColoringFunction = null; - float elementColoringGradientHue = 0; - float elementColoringGradientSaturation = 1; - Function1 edgeThicknessProperty = null; - Function1 nodeScaleProperty = null; - double edgeThicknessGain = 1; - double edgeThicknessBias = 0; - double nodeScaleGain = 1; - double nodeScaleBias = 0; + Function1 arrowLengthProperty = null; + double arrowLengthGain = 1; + double arrowLengthBias = 0; Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration); if (diagram != null) { Variable dv = Variables.getPossibleVariable(graph, diagram); - if (dv != null) { - Object obj = dv.getPossiblePropertyValue(graph, DN.Diagram_elementColoringFunction); - if (obj instanceof Function1) { - elementColoringFunction = (Function1) obj; - } - } - elementColoringGradientHue = - limit(0, 360, safeFloatProperty(graph, diagram, DN.Diagram_elementColoringGradientHue, 0.0f)) - / 360.0f; - elementColoringGradientSaturation = - limit(0, 100, safeFloatProperty(graph, diagram, DN.Diagram_elementColoringGradientSaturation, 0.0f)) - / 100.0f; - Resource etp = graph.getPossibleObject(diagram, DN.Diagram_edgeThicknessProperty); - //System.out.println("etp: " + NameUtils.getURIOrSafeNameInternal(graph, etp)); - if (etp != null) { - Variable etpv = Variables.getPossibleVariable(graph, etp); - if (etpv != null) { - //System.out.println("etpv: " + etpv.getURI(graph)); - edgeThicknessProperty = etpv.getPropertyValue(graph, DN.Edge_ThicknessProperty_value); + Resource alp = graph.getPossibleObject(diagram, DN.Diagram_arrowLengthProperty); + //System.out.println("alp: " + NameUtils.getURIOrSafeNameInternal(graph, alp)); + if (alp != null) { + Variable alpv = Variables.getPossibleVariable(graph, alp); + if (alpv != null) { + //System.out.println("alpv: " + alpv.getURI(graph)); + arrowLengthProperty = alpv.getPropertyValue(graph, DN.Edge_ArrowLengthProperty_value); } - edgeThicknessGain = - safeDoubleProperty(graph, etp, DN.Edge_ThicknessProperty_gain, 1) - * safeDoubleProperty(graph, diagram, DN.Diagram_edgeThicknessGain, 1); - edgeThicknessBias = - safeDoubleProperty(graph, etp, DN.Edge_ThicknessProperty_bias, 0) - + safeDoubleProperty(graph, diagram, DN.Diagram_edgeThicknessBias, 0); + arrowLengthGain = + safeDoubleProperty(graph, alp, DN.Edge_ArrowLengthProperty_gain, 1) + * safeDoubleProperty(graph, diagram, DN.Diagram_arrowLengthGain, 1); + arrowLengthBias = + safeDoubleProperty(graph, alp, DN.Edge_ArrowLengthProperty_bias, 0) + + safeDoubleProperty(graph, diagram, DN.Diagram_arrowLengthBias, 0); } - Resource nsp = graph.getPossibleObject(diagram, DN.Diagram_nodeScaleProperty); - if (nsp != null) { - Variable nspv = Variables.getPossibleVariable(graph, nsp); - if (nspv != null) { - //System.out.println("nspv: " + nspv.getURI(graph)); - nodeScaleProperty = nspv.getPropertyValue(graph, DN.Vertex_ScaleProperty_value); - } - nodeScaleGain = - safeDoubleProperty(graph, nsp, DN.Vertex_ScaleProperty_gain, 1) - * safeDoubleProperty(graph, diagram, DN.Diagram_nodeScaleGain, 1); - nodeScaleBias = - safeDoubleProperty(graph, nsp, DN.Vertex_ScaleProperty_bias, 0) - + safeDoubleProperty(graph, diagram, DN.Diagram_nodeScaleBias, 0); - } } - DiagramSettings ds = new DiagramSettings( - nodeScaleProperty, nodeScaleGain, nodeScaleBias, - edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias, - elementColoringFunction, - elementColoringGradientHue, - elementColoringGradientSaturation); + DiagramSettings ds = new DiagramSettings( arrowLengthProperty, arrowLengthGain, arrowLengthBias); //System.out.println("new diagram settings: " + ds); return ds; }