X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Ffunction%2FFunctions.java;h=60dd3e22131ee17b4ba9890052d5c5d0fca6fe2e;hb=refs%2Fchanges%2F50%2F2850%2F1;hp=cc9b336f69a796680b8fc8bd1c972900f9d35ece;hpb=04d29917ceb4e34d2d9fc32ac4c7c8bdd2f4a732;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java index cc9b336f..60dd3e22 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java @@ -109,24 +109,23 @@ public class Functions { return baseMappingModifier(graph, element, DistrictNetworkResource.getInstance(graph).HasMapping, mappingType, context); } - public static Map getVertexMappings(ReadGraph graph, Resource resource) throws DatabaseException { - Map second = getNetworkMappingsByType(graph, resource , DistrictNetworkResource.getInstance(graph).Mapping_VertexMapping); + public static Map getVertexMappings(ReadGraph graph, Resource indexRoot) throws DatabaseException { + Map second = getNetworkMappingsByType(graph, indexRoot, DistrictNetworkResource.getInstance(graph).Mapping_VertexMapping); return second; } - public static Map getEdgeMappings(ReadGraph graph, Resource resource) throws DatabaseException { - Map second = getNetworkMappingsByType(graph, resource , DistrictNetworkResource.getInstance(graph).Mapping_EdgeMapping); + public static Map getEdgeMappings(ReadGraph graph, Resource indexRoot) throws DatabaseException { + Map second = getNetworkMappingsByType(graph, indexRoot, DistrictNetworkResource.getInstance(graph).Mapping_EdgeMapping); return second; } public static Map getCRSs(ReadGraph graph, Resource resource) throws DatabaseException { - Map result = getNetworkMappingsByType(graph, resource, DistrictNetworkResource.getInstance(graph).SpatialRefSystem); + Map result = getNetworkMappingsByType(graph, graph.sync(new IndexRoot(resource)), DistrictNetworkResource.getInstance(graph).SpatialRefSystem); return result; } - public static Map getNetworkMappingsByType(ReadGraph graph, Resource element, Resource mappingType) throws DatabaseException { - Resource indexRoot = graph.sync(new IndexRoot(element)); + public static Map getNetworkMappingsByType(ReadGraph graph, Resource indexRoot, Resource mappingType) throws DatabaseException { List mappings = QueryIndexUtils.searchByType(graph, indexRoot, mappingType); Map result = new HashMap<>(mappings.size()); Layer0 L0 = Layer0.getInstance(graph); @@ -262,9 +261,9 @@ public class Functions { @Override public void run(ReadGraph graph) throws DatabaseException { - - vertexMappings = getVertexMappings(graph, configuration); - edgeMappings = getEdgeMappings(graph, configuration); + Resource indexRoot = graph.sync(new IndexRoot(configuration)); + vertexMappings = getVertexMappings(graph, indexRoot); + edgeMappings = getEdgeMappings(graph, indexRoot); composites = getComposites(graph, configuration); @@ -484,7 +483,13 @@ public class Functions { DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); return listInstanceNames(graph, context, DN.Edge_ThicknessProperty); } - + + @SCLValue(type = "ReadGraph -> Resource -> Variable -> b") + public static Object arrowLengthPropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { + DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); + return listInstanceNames(graph, context, DN.Edge_ArrowLengthProperty); + } + @SCLValue(type = "ReadGraph -> Resource -> Variable -> b") public static Object nodeScalePropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); @@ -498,6 +503,13 @@ public class Functions { return baseMappingModifier(graph, diagram, DN.Diagram_edgeThicknessProperty, DN.Edge_ThicknessProperty, context); } + @SCLValue(type = "ReadGraph -> Resource -> Variable -> b") + public static Object arrowLengthPropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { + Resource diagram = resolveElement(graph, context); + DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph); + return baseMappingModifier(graph, diagram, DN.Diagram_arrowLengthProperty, DN.Edge_ArrowLengthProperty, context); + } + @SCLValue(type = "ReadGraph -> Resource -> Variable -> b") public static Object nodeScalePropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { Resource diagram = resolveElement(graph, context);