Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better separation between Core and Molecule #22

Merged
merged 19 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions BaselineOfGeoView/BaselineOfGeoView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,35 @@ BaselineOfGeoView >> coreDependencies: spec [
{ #category : #packages }
BaselineOfGeoView >> corePackages: spec [

"Core and graphical backend packages"
spec
package: 'GeoView' with:[ spec requires: #('OpenSmock' 'GeoTools') ];
package: 'GeoView-GeoObjects' with:[ spec requires: #('GeoView') ];
package: 'GeoView-Bloc' with:[ spec requires: #('GeoView') ];
package: 'GeoView-Bloc-Alexandrie' with:[ spec requires: #('GeoView-Bloc') ].

"Molecule integration packages"
spec
package: 'GeoView-Molecule' with:[ spec requires: #('GeoView' 'GeoView-GeoObjects') ];
package: 'GeoView-Bloc-Alexandrie-Molecule' with:[ spec requires: #('GeoView-Bloc-Alexandrie') ].

"examples packages"
spec
package: 'GeoView-Examples' with:[ spec requires: #('GeoView' 'GeoView-GeoObjects') ];
package: 'GeoView-Examples-Bloc' with:[ spec requires: #('GeoView-Examples') ].
package: 'GeoView-Examples-Bloc' with:[ spec requires: #('GeoView-Bloc' 'GeoView-GeoObjects') ].

"examples with Molecule packages"
spec
package: 'GeoView-Examples-Bloc-Molecule' with:[ spec requires: #('GeoView-Molecule' 'GeoView-Bloc-Alexandrie-Molecule') ].

"Tests packages"
spec
package: 'GeoView-Tests' with: [ spec requires: #('GeoView' 'GeoView-GeoObjects') ].
package: 'GeoView-Tests' with: [ spec requires: #('GeoView' 'GeoView-GeoObjects') ];
package: 'GeoView-Bloc-Tests' with: [ spec requires: #('GeoView-Bloc') ].

"Tests with Molecule packages"
spec
package: 'GeoView-Molecule-Tests' with: [ spec requires: #('GeoView-Molecule') ].

]

{ #category : #baselines }
Expand Down
38 changes: 38 additions & 0 deletions GeoView-Bloc-Alexandrie-Molecule/GeoViewManagerBlocAeImpl.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Class {
#name : #GeoViewManagerBlocAeImpl,
#superclass : #GeoViewManagerImpl,
#category : #'GeoView-Bloc-Alexandrie-Molecule'
}

{ #category : #'layer creation' }
GeoViewManagerBlocAeImpl >> createGeoObjectsLayer: aName [

| layer |
layer := GeoViewGeoObjectsLayer new.
layer name: aName.
layer displayModel indexAccessor: self getObjectIndexAccessor.

^ layer
]

{ #category : #initialization }
GeoViewManagerBlocAeImpl >> createView [

| element |
element := BlGeoViewAeElement new.
self installEventHandlers: element.

self view: element.
]

{ #category : #initialization }
GeoViewManagerBlocAeImpl >> installEventHandlers: aBlElement [

aBlElement addEventHandlerOn: GeoViewLayerProcessDataChanged do: [ :e | self layerHasBeenUpdated: e layerName ]
]

{ #category : #'services - drawing' }
GeoViewManagerBlocAeImpl >> requestViewUpdate [

self view requestRepaint
]
1 change: 1 addition & 0 deletions GeoView-Bloc-Alexandrie-Molecule/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'GeoView-Bloc-Alexandrie-Molecule' }
202 changes: 0 additions & 202 deletions GeoView-Bloc-Alexandrie/BlElementAeGeoView.class.st

This file was deleted.

64 changes: 64 additions & 0 deletions GeoView-Bloc-Alexandrie/BlGeoViewAeElement.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"
I am a BlElement which display a GeoViewWidget using Alexandrie backend drawing.
"
Class {
#name : #BlGeoViewAeElement,
#superclass : #BlAbstractGeoViewElement,
#instVars : [
'inputContext'
],
#category : #'GeoView-Bloc-Alexandrie-Core'
}

{ #category : #drawing }
BlGeoViewAeElement >> aeDrawOn: aeCanvas [
"drawing native bloc elements"

| sort |
super aeDrawOn: aeCanvas.

sort := self isMarkedForSortDatas.
self layers do: [ :l |
sort ifTrue: [ l sortDatas ].
l aeDrawOn: aeCanvas ].

isMarkedForSortDatas := false
]

{ #category : #'API -- picking' }
BlGeoViewAeElement >> pickAt: aGlobalPoint radius: aRadiusInPixels [
"prepare the picking result"

| pickingResult distanceBlock radius |
pickingResult := (super pickAt: aGlobalPoint radius: aRadiusInPixels) ifNil:[ ^ nil ].

"labordep: prepare to be setup with others blocks"
distanceBlock := [ :gShape :point | gShape distanceTo: point ].
radius := aRadiusInPixels ifNil:[ 0 ].

"Collect all picked elements"
self getLayers do:[ :l |
l graphicModel datas keysAndValuesDo:[ :key :gShape | | distanceInPixels pickingElement |

"Way to detect if the gShape is picked"
distanceInPixels := distanceBlock value: gShape value: pickingResult localPoint.
distanceInPixels <= radius ifTrue:[

"Store the element into the result"
pickingElement := GeoViewPickingElement new.
pickingElement layerName: l name.
pickingElement layerLevel: nil. self flag:'labordep: put the level of the layer'.
pickingElement distanceInPixels: distanceInPixels.
pickingElement objectKey: key.
pickingElement dShape: (l displayModel getData: key).
pickingElement gShape: gShape.

pickingResult addPickingElement: pickingElement.

].
].
].

pickingResult applyOrder: [ :a :b | a distanceInPixels < b distanceInPixels ].
^ pickingResult
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Extension { #name : #GeoViewUserToDisplayToGraphicLayer }
Extension { #name : #GeoViewGeoObjectsLayer }

{ #category : #'*GeoView-Bloc-Alexandrie' }
GeoViewUserToDisplayToGraphicLayer >> aeDrawOn: aeCanvas [
GeoViewGeoObjectsLayer >> aeDrawOn: aeCanvas [

self isVisible ifFalse: [ ^ self ].
sortedDatas ifNil: [ ^ self ].
Expand Down
Loading
Loading