From: Reino Ruusu Date: Thu, 24 Sep 2020 11:45:24 +0000 (+0300) Subject: Update SCL interface for element selection X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=9de17a229b42cfe7f133fe593ca28619ffd50250;p=simantics%2Fdistrict.git Update SCL interface for element selection gitlab #62 Change-Id: I511c65f318f8a28297267d539349bc86b6d0bae6 --- 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