From c555dea3cbfd7c0f8e7f4fc02784fe30caf2def4 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Wed, 30 Jan 2019 16:20:28 +0200 Subject: [PATCH] Management of mapped component properties in queries gitlab #28 TODO: * UI for listing stored queries * UI for defining/editing queries * UI for executing queries Change-Id: Ie1c3892d77313c452560f7015b387825a9d34e9e --- .../org/simantics/district/selection/ElementSelector.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.simantics.district.selection/src/org/simantics/district/selection/ElementSelector.java b/org.simantics.district.selection/src/org/simantics/district/selection/ElementSelector.java index 9de46638..a45839c9 100644 --- a/org.simantics.district.selection/src/org/simantics/district/selection/ElementSelector.java +++ b/org.simantics.district.selection/src/org/simantics/district/selection/ElementSelector.java @@ -21,6 +21,7 @@ import org.simantics.db.layer0.variable.RVI; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.district.network.ontology.DistrictNetworkResource; import org.simantics.district.region.ontology.DiagramRegionsResource; import org.simantics.district.selection.ElementSelector.AggregateCondition.Type; import org.simantics.layer0.Layer0; @@ -49,6 +50,7 @@ public class ElementSelector { static StructuralResource2 STR; static ModelingResources MOD; static DiagramResource DIA; + static DistrictNetworkResource DN; ElementSelector(ReadGraph graph, Resource resource) throws DatabaseException { super(); @@ -58,6 +60,7 @@ public class ElementSelector { STR = StructuralResource2.getInstance(graph); MOD = ModelingResources.getInstance(graph); DIA = DiagramResource.getInstance(graph); + DN = DistrictNetworkResource.getInstance(graph); this.resource = resource; this.count = -1; @@ -353,6 +356,11 @@ public class ElementSelector { if (value != null) return value.doubleValue(); } + + // No property found - try possible mapped element property as well + Resource mappedElement = graph.getPossibleObject(element, DN.MappedComponent); + if (mappedElement != null) + return getPropertyValue(graph, mappedElement, propertyName); } catch (DatabaseException e) { } -- 2.45.2