From 9de17a229b42cfe7f133fe593ca28619ffd50250 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 24 Sep 2020 14:45:24 +0300 Subject: [PATCH] Update SCL interface for element selection gitlab #62 Change-Id: I511c65f318f8a28297267d539349bc86b6d0bae6 --- .../scl/Simantics/District/Selection.scl | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/org.simantics.district.selection/scl/Simantics/District/Selection.scl b/org.simantics.district.selection/scl/Simantics/District/Selection.scl index 4f1d2705..861af953 100644 --- a/org.simantics.district.selection/scl/Simantics/District/Selection.scl +++ b/org.simantics.district.selection/scl/Simantics/District/Selection.scl @@ -27,13 +27,27 @@ importJava "org.simantics.district.selection.ElementSelector" where @JavaName getResource getSelectorResource :: ElementSelector -> Resource - """ - Get the elements selected by an element selector object. - - `selectedElements = selectElementsFrom elementSelector model` - """ @JavaName selectElementsFrom - selectElementsFrom :: ElementSelector -> Resource -> [Resource] + selectElementsFrom' :: ElementSelector -> Resource -> SelectionResult + +""" +Get the elements selected by an element selector object. + +`selectedElements = selectElementsFrom elementSelector model` +""" +selectElementsFrom :: ElementSelector -> Resource -> [Resource] +selectElementsFrom s r = selectedElements $ selectElementsFrom' s r + +importJava "org.simantics.district.selection.ElementSelector$SelectionResult" where + data SelectionResult + + "Get the list of selected elements" + @JavaName elements + selectedElements :: SelectionResult -> [Resource] + "Number of selected elements with equal selection criteria (for n lowest/n highest selections)" + tailCount :: SelectionResult -> Integer + "Actual number of elements with selection criteria equal to the last selected element (for n lowest/n highest selections)" + tailSize :: SelectionResult -> Integer data Generator = Model | Diagram Resource | Explicit [Resource] data Selector = All | NLowest String Integer | NHighest String Integer -- 2.47.1