]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.selection/src/org/simantics/district/selection/ElementSelector.java
Fix district finder search result comparison
[simantics/district.git] / org.simantics.district.selection / src / org / simantics / district / selection / ElementSelector.java
index 9015b7117605674dd56bcaa9385e3116ccaedf43..6de06ff690ea23a03304e119e412309301e581c1 100644 (file)
@@ -56,6 +56,8 @@ public class ElementSelector {
        Selector selector;
        Condition condition;
        
+       private float[] color;
+       
        static Logger LOG = LoggerFactory.getLogger(ElementSelector.class);
        
        static ElementSelectionResource ES;
@@ -81,6 +83,9 @@ public class ElementSelector {
                try {
                        this.name = graph.getRelatedValue(resource, L0.HasLabel);
                        this.expression = getExpression(graph, resource);
+                       
+                       float[] color = graph.getPossibleRelatedValue(resource, ES.Selection_HasHighlightColor);
+                       this.color = color;
                } catch (DatabaseException e) {
                        LOG.error("Error reading element selector", e);
                        throw e;
@@ -149,6 +154,13 @@ public class ElementSelector {
        public Condition getCondition() {
                return condition;
        }
+       
+       /**
+        * Get the selection highlight color as a four element BGRA array.
+        */
+       public float[] getColor() {
+               return color;
+       }
 
        /**
         * 
@@ -636,7 +648,7 @@ public class ElementSelector {
                        // Select sorting direction
                        Comparator<Pair<Resource, Double>> comparator = smallest ?
                                        (p1, p2) -> Double.compare(p1.second, p2.second) :
-                                       (p1, p2) -> Double.compare(p1.second, p2.second);
+                                       (p1, p2) -> Double.compare(p2.second, p1.second);
                        
                        // Get association list to property values
                        List<Pair<Resource, Double>> result2 = elements.stream()