Skip to content

Commit 42f33ff

Browse files
authored
Merge pull request #137 from ThalesGroup/devSelectionFilter
Add selectionFilterBlock on InteractionsStrategy and use it for selec…
2 parents b04d701 + 6a0db9e commit 42f33ff

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/GeoView-Tests/GeoViewElementTest.class.st

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,17 @@ GeoViewElementTest >> testInteractionsStrategyDefaultValues [
315315

316316
self assert: geoView interactionsStrategy allowMapMoving.
317317
self assert: geoView interactionsStrategy allowMapScaling.
318-
self assert: geoView interactionsStrategy isMultipleSelection
318+
self assert: geoView interactionsStrategy isMultipleSelection.
319+
self assert: geoView interactionsStrategy selectionFilterBlock equals: nil
320+
]
321+
322+
{ #category : #tests }
323+
GeoViewElementTest >> testInteractionsStrategySelectionFilter [
324+
325+
self assert: geoView interactionsStrategy selectionFilterBlock equals: nil.
326+
geoView interactionsStrategy selectionFilterBlock: [ :e | ].
327+
self assert: geoView interactionsStrategy selectionFilterBlock notNil.
328+
319329
]
320330

321331
{ #category : #tests }

src/GeoView/GeoViewInteractionsStrategy.class.st

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Class {
1212
'mouseDownPosition',
1313
'pickingRadius',
1414
'lastMouseMoveEventTimestamp',
15-
'isMultipleSelection'
15+
'isMultipleSelection',
16+
'selectionFilterBlock'
1617
],
1718
#category : #'GeoView-Events'
1819
}
@@ -203,6 +204,9 @@ GeoViewInteractionsStrategy >> primaryClickEvent: anEvent [
203204
point := anEvent position.
204205

205206
pickingResult := element pickAt: point radius: self pickingRadius.
207+
self selectionFilterBlock ifNotNil:[
208+
pickingResult := pickingResult applyFilter: self selectionFilterBlock
209+
].
206210

207211
"send picking event"
208212
event := GeoViewPickingEvent new.
@@ -251,6 +255,18 @@ GeoViewInteractionsStrategy >> pulsePeriodInMs [
251255
^ 15 milliSecond
252256
]
253257

258+
{ #category : #accessing }
259+
GeoViewInteractionsStrategy >> selectionFilterBlock [
260+
261+
^ selectionFilterBlock
262+
]
263+
264+
{ #category : #accessing }
265+
GeoViewInteractionsStrategy >> selectionFilterBlock: aSelectFilterBlock [
266+
267+
selectionFilterBlock := aSelectFilterBlock
268+
]
269+
254270
{ #category : #'events - processing' }
255271
GeoViewInteractionsStrategy >> sendMouseCoordinatesChanged: anEvent [
256272

0 commit comments

Comments
 (0)