-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factorization of DCompositeShape process datas management in OpenSmock.
Optimization: On projection change, update only user draw mode shapes (or composites with user draw mode children). Move tests into OpenSmock.
- Loading branch information
Showing
6 changed files
with
49 additions
and
169 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
src/GeoView-Tests/DCompositeShapeGeoViewProcessDataTest.class.st
This file was deleted.
Oops, something went wrong.
131 changes: 18 additions & 113 deletions
131
src/GeoView/DCompositeShapeGeoViewProcessData.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,134 +1,39 @@ | ||
Class { | ||
#name : #DCompositeShapeGeoViewProcessData, | ||
#superclass : #DShapeGeoViewProcessData, | ||
#traits : 'TSmockDCompositeShapeProcessData', | ||
#classTraits : 'TSmockDCompositeShapeProcessData classTrait', | ||
#category : #'GeoView-ProcessDatas' | ||
} | ||
|
||
{ #category : #processing } | ||
DCompositeShapeGeoViewProcessData >> createAndAddGChildFrom: aDShape inGComposite: aGComposite2D [ | ||
|
||
| processData gShape2D | | ||
|
||
"Not add no keyed dShape" | ||
aDShape key ifNil:[ ^ self ]. | ||
self processor ifNil:[ ^ self ]. | ||
|
||
processData := (self processor getProcessDataFor: aDShape) ifNil:[ ^ self ]. | ||
self processor isRecyclingActive ifTrue:[ | ||
gShape2D := self processor destockRecycledDataFor: aDShape class. | ||
]. | ||
|
||
gShape2D := processData processCreatedData: aDShape key incoming: aDShape with: gShape2D context: nil. | ||
gShape2D ifNotNil:[ | ||
aGComposite2D addChild: gShape2D. | ||
]. | ||
|
||
] | ||
|
||
{ #category : #processing } | ||
DCompositeShapeGeoViewProcessData >> processCreatedData: aKey incoming: aDComposite with: aGComposite2D context: aContext [ | ||
DCompositeShapeGeoViewProcessData >> processCreatedData: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext [ | ||
|
||
| gComposite2D | | ||
gComposite2D := aGComposite2D | ||
ifNil: [ SmockGCompositeShape2D id: aKey ] | ||
ifNotNil:[ :e | e removeChildren ]. | ||
|
||
super processCreatedData: aKey incoming: aDComposite with: gComposite2D context: aContext. | ||
gComposite2D := aGCompositeShape2D ifNil: [ SmockGCompositeShape2D id: aKey ]. | ||
|
||
"Sort the list before create GShape to manage zOrder" | ||
aDComposite sortChildrenBy: [ :a :b | a zIndex < b zIndex ]. | ||
super processCreatedData: aKey incoming: aDCompositeShape with: gComposite2D context: aContext. | ||
self processCreatedDComposite: aKey incoming: aDCompositeShape with: gComposite2D context: aContext. | ||
self processUpdatedData: aKey incoming: aDCompositeShape with: gComposite2D context: aContext. | ||
|
||
aDComposite dShapeList do:[ :dShape | | ||
self createAndAddGChildFrom: dShape inGComposite: gComposite2D. | ||
]. | ||
|
||
^ self processUpdatedData: aKey incoming: aDComposite with: gComposite2D context: aContext | ||
^ gComposite2D | ||
] | ||
|
||
{ #category : #processing } | ||
DCompositeShapeGeoViewProcessData >> processUpdatedData: aKey incoming: aDComposite with: aGComposite2D context: aContext [ | ||
DCompositeShapeGeoViewProcessData >> processRecycledData: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext [ | ||
"clean the GShape" | ||
|
||
super processUpdatedData: aKey incoming: aDComposite with: aGComposite2D context: aContext. | ||
|
||
self flag:'laborde: same principle between others view, factorize + tests'. | ||
|
||
"new children was added" | ||
aDComposite numberOfChildren > aGComposite2D numberOfChildren ifTrue:[ | ||
|
||
"Sort the list before create GShape to manage zOrder" | ||
aDComposite sortChildrenBy: [ :a :b | a zIndex < b zIndex ]. | ||
|
||
aDComposite dShapeList do:[ :dShape | | gChild | | ||
"cannot manage no keyed dShape" | ||
dShape key ifNotNil:[ | ||
gChild := aGComposite2D getChild: dShape key. | ||
gChild ifNil:[ self createAndAddGChildFrom: dShape inGComposite: aGComposite2D ]. | ||
]. | ||
]. | ||
]. | ||
|
||
aDComposite hasDirtyChildren ifTrue:[ | ||
|
||
"Sort the list before updated GShape to manage zOrder" | ||
aDComposite sortChildrenBy: [ :a :b | a zIndex < b zIndex ]. | ||
super processRecycledData: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext. | ||
self processRecycledDComposite: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext. | ||
|
||
"check for updated children" | ||
aDComposite toUpdateDShapeList do:[ :dShape | | processData gChild | | ||
"cannot manage no keyed dShape" | ||
dShape key ifNotNil:[ | ||
gChild := aGComposite2D getChild: dShape key. | ||
gChild ifNotNil:[ | ||
processData := self processor getProcessDataFor: dShape. | ||
processData processUpdatedData: dShape key incoming: dShape with: gChild context: aContext. | ||
]. | ||
]. | ||
]. | ||
|
||
"check for remove children" | ||
aDComposite toDeleteDShapeList do:[ :dShape | | gChild | | ||
"cannot manage no keyed dShape" | ||
dShape key ifNotNil:[ | ||
gChild := aGComposite2D getChild: dShape key. | ||
gChild ifNil:[ | ||
"add the new dShape" | ||
self removeGChild: gChild createdFrom: dShape offGComposite: aGComposite2D. | ||
]. | ||
]. | ||
]. | ||
|
||
aDComposite clearChangedDShapeLists. | ||
aDComposite updateModelWithChildren. | ||
]. | ||
|
||
self flag:'labordep : déplacer ce code dans un pipeline de mise à jour graphique au changement de projection et pas sur maj des objets'. | ||
aDComposite hasDrawModeUserChildren ifTrue:[ | ||
aDComposite dShapeList do:[ :dShape | | processData blChild | | ||
"cannot manage no keyed dShape" | ||
dShape key ifNotNil:[ | ||
blChild := aGComposite2D getChild: dShape key. | ||
blChild ifNotNil:[ | ||
processData := self processor getProcessDataFor: dShape. | ||
processData processUpdatedData: dShape key incoming: dShape with: blChild context: nil. | ||
]. | ||
]. | ||
]. | ||
]. | ||
|
||
^ aGComposite2D | ||
^ aGCompositeShape2D | ||
] | ||
|
||
{ #category : #processing } | ||
DCompositeShapeGeoViewProcessData >> removeGChild: aGShape2D createdFrom: aDShape offGComposite: aGComposite2D [ | ||
|
||
| processData gChild | | ||
DCompositeShapeGeoViewProcessData >> processUpdatedData: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext [ | ||
|
||
"Not remove no keyed dShape" | ||
aDShape key ifNil:[ ^ self ]. | ||
|
||
processData := self processor getProcessDataFor: aDShape. | ||
gChild := processData processDeletedData: aDShape key incoming: aDShape with: aGShape2D context: nil. | ||
gChild ifNotNil:[ | ||
aGComposite2D removeChild: aDShape key. | ||
self processor isRecyclingActive ifTrue:[self processor stockRecycledData: gChild for: aDShape class]. | ||
]. | ||
super processUpdatedData: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext. | ||
self processUpdatedDComposite: aKey incoming: aDCompositeShape with: aGCompositeShape2D context: aContext. | ||
|
||
^ aGCompositeShape2D | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters