-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
763 additions
and
761 deletions.
There are no files selected for viewing
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,57 +1,57 @@ | ||
Extension { #name : #OGCCurve } | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCCurve >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
| allXPixel allYPixel surface amplitudeX amplitudeY initialOffsetX initialOffsetY coordInit coordNext pointInit morph path | | ||
" 1. define working surface " | ||
allXPixel := points collect: [ :each | each xPixelWithZoom: zoom ]. | ||
allYPixel := points collect: [ :each | each yPixelWithZoom: zoom ]. | ||
amplitudeX := allXPixel max - allXPixel min. | ||
amplitudeY := allYPixel max - allYPixel min. | ||
surface := AthensCairoSurface extent: amplitudeX@amplitudeY. | ||
" 2. define first point coordinates: reference " | ||
initialOffsetX := (self startPoint xPixelWithZoom: zoom) - allXPixel min. | ||
initialOffsetY := (self startPoint yPixelWithZoom: zoom) - allYPixel min. | ||
coordInit := initialOffsetX @ initialOffsetY . | ||
|
||
surface drawDuring: [ :can | | ||
" 3. init surface " | ||
surface clear: Color transparent . | ||
" to do : consider style dictionary " | ||
|
||
" 4. draw linestring " | ||
path := can createPath: [ :p | | ||
|
||
pointInit := points first. | ||
p relative. | ||
p moveTo: coordInit. | ||
|
||
points allButFirst do: [ :point_i | | ||
coordNext := | ||
(Point x: (point_i xPixelWithZoom: zoom) y: (point_i yPixelWithZoom: zoom) ) | ||
- (Point x: (pointInit xPixelWithZoom: zoom) y: (pointInit yPixelWithZoom: zoom) ). | ||
|
||
p lineTo: coordNext. | ||
|
||
coordInit := coordInit + coordNext. | ||
pointInit := point_i. | ||
] | ||
]. | ||
can setShape: path. | ||
]. | ||
|
||
surface drawDuring: [ :can | | ||
can setPaint: self styleFillColor. | ||
can draw | ||
]. | ||
surface drawDuring: [ :can | | ||
(can setStrokePaint: self styleStrokeColor ) width: self styleStrokeWidth. | ||
can draw | ||
]. | ||
" 5. change result position " | ||
morph := surface asMorph. | ||
morph position: | ||
((initialOffsetX sign: (-1) ) + (self startPoint xPixelWithOffset: offsetX withZoom: zoom)) | ||
@ ((initialOffsetY sign: (-1) ) + (self startPoint yPixelWithOffset: offsetY withZoom: zoom)). | ||
^ morph | ||
] | ||
Extension { #name : 'OGCCurve' } | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCCurve >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
| allXPixel allYPixel surface amplitudeX amplitudeY initialOffsetX initialOffsetY coordInit coordNext pointInit morph path | | ||
" 1. define working surface " | ||
allXPixel := points collect: [ :each | each xPixelWithZoom: zoom ]. | ||
allYPixel := points collect: [ :each | each yPixelWithZoom: zoom ]. | ||
amplitudeX := allXPixel max - allXPixel min. | ||
amplitudeY := allYPixel max - allYPixel min. | ||
surface := AthensCairoSurface extent: amplitudeX@amplitudeY. | ||
" 2. define first point coordinates: reference " | ||
initialOffsetX := (self startPoint xPixelWithZoom: zoom) - allXPixel min. | ||
initialOffsetY := (self startPoint yPixelWithZoom: zoom) - allYPixel min. | ||
coordInit := initialOffsetX @ initialOffsetY . | ||
|
||
surface drawDuring: [ :can | | ||
" 3. init surface " | ||
surface clear: Color transparent . | ||
" to do : consider style dictionary " | ||
|
||
" 4. draw linestring " | ||
path := can createPath: [ :p | | ||
|
||
pointInit := points first. | ||
p relative. | ||
p moveTo: coordInit. | ||
|
||
points allButFirst do: [ :point_i | | ||
coordNext := | ||
(Point x: (point_i xPixelWithZoom: zoom) y: (point_i yPixelWithZoom: zoom) ) | ||
- (Point x: (pointInit xPixelWithZoom: zoom) y: (pointInit yPixelWithZoom: zoom) ). | ||
|
||
p lineTo: coordNext. | ||
|
||
coordInit := coordInit + coordNext. | ||
pointInit := point_i. | ||
] | ||
]. | ||
can setShape: path. | ||
]. | ||
|
||
surface drawDuring: [ :can | | ||
can setPaint: self styleFillColor. | ||
can draw | ||
]. | ||
surface drawDuring: [ :can | | ||
(can setStrokePaint: self styleStrokeColor ) width: self styleStrokeWidth. | ||
can draw | ||
]. | ||
" 5. change result position " | ||
morph := surface asMorph. | ||
morph position: | ||
((initialOffsetX sign: (-1) ) + (self startPoint xPixelWithOffset: offsetX withZoom: zoom)) | ||
@ ((initialOffsetY sign: (-1) ) + (self startPoint yPixelWithOffset: offsetY withZoom: zoom)). | ||
^ morph | ||
] |
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,22 +1,22 @@ | ||
Extension { #name : #OGCFeature } | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCFeature >> displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue [ | ||
| morph | | ||
morph := self geometry displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue. | ||
morph on: #click send: #handleClick to: self. | ||
^ morph | ||
] | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCFeature >> handleClick [ | ||
" at click on my morph: open window with properties " | ||
| textToDisplay | | ||
textToDisplay := String new. | ||
self properties keysAndValuesDo: [ :aKey :aValue | | ||
textToDisplay := textToDisplay , aKey asString , ' : ' , aValue asString , ' | ||
' ]. | ||
OGCInformationWindowPresenter isClosed ifTrue: [ OGCInformationWindowPresenter open ]. | ||
OGCInformationWindowPresenter textPresenter text: textToDisplay . | ||
OGCInformationWindowPresenter inspectButton action: [ self inspect ]. | ||
] | ||
Extension { #name : 'OGCFeature' } | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCFeature >> displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue [ | ||
| morph | | ||
morph := self geometry displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue. | ||
morph on: #click send: #handleClick to: self. | ||
^ morph | ||
] | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCFeature >> handleClick [ | ||
" at click on my morph: open window with properties " | ||
| textToDisplay | | ||
textToDisplay := String new. | ||
self properties keysAndValuesDo: [ :aKey :aValue | | ||
textToDisplay := textToDisplay , aKey asString , ' : ' , aValue asString , ' | ||
' ]. | ||
OGCInformationWindowPresenter isClosed ifTrue: [ OGCInformationWindowPresenter open ]. | ||
OGCInformationWindowPresenter textPresenter text: textToDisplay . | ||
OGCInformationWindowPresenter inspectButton action: [ self inspect ]. | ||
] |
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,15 +1,15 @@ | ||
Extension { #name : #OGCFeatureCollection } | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCFeatureCollection >> displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue [ | ||
| morph initialOffsetX initialOffsetY | | ||
initialOffsetX := (self rectangularTileEnvelopeWithZoom: aZoom) origin x. | ||
initialOffsetY := (self rectangularTileEnvelopeWithZoom: aZoom) origin y. | ||
morph := ImageMorph new. | ||
self features do: [ :each | | ||
| morphFeature | | ||
morphFeature := each displayWithZoom: aZoom offsetX: (aXValue + initialOffsetX) offsetY: (aYValue + initialOffsetY). | ||
morph addMorph: morphFeature. | ||
]. | ||
^ morph | ||
] | ||
Extension { #name : 'OGCFeatureCollection' } | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCFeatureCollection >> displayWithZoom: aZoom offsetX: aXValue offsetY: aYValue [ | ||
| morph initialOffsetX initialOffsetY | | ||
initialOffsetX := (self rectangularTileEnvelopeWithZoom: aZoom) origin x. | ||
initialOffsetY := (self rectangularTileEnvelopeWithZoom: aZoom) origin y. | ||
morph := ImageMorph new. | ||
self features do: [ :each | | ||
| morphFeature | | ||
morphFeature := each displayWithZoom: aZoom offsetX: (aXValue + initialOffsetX) offsetY: (aYValue + initialOffsetY). | ||
morph addMorph: morphFeature. | ||
]. | ||
^ morph | ||
] |
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,6 +1,6 @@ | ||
Extension { #name : #OGCGeometry } | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCGeometry >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
self subclassResponsibility | ||
] | ||
Extension { #name : 'OGCGeometry' } | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCGeometry >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
self subclassResponsibility | ||
] |
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,13 +1,13 @@ | ||
Extension { #name : #OGCGeometryCollection } | ||
|
||
{ #category : #'*OGC-Viewer' } | ||
OGCGeometryCollection >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
| morph | | ||
morph := ImageMorph new. | ||
geometries do: [ :each | | ||
| morphGeometry | | ||
morphGeometry := each displayWithZoom: zoom offsetX: (offsetX) offsetY: (offsetY). | ||
morph addMorph: morphGeometry. | ||
]. | ||
^ morph | ||
] | ||
Extension { #name : 'OGCGeometryCollection' } | ||
|
||
{ #category : '*OGC-Viewer' } | ||
OGCGeometryCollection >> displayWithZoom: zoom offsetX: offsetX offsetY: offsetY [ | ||
| morph | | ||
morph := ImageMorph new. | ||
geometries do: [ :each | | ||
| morphGeometry | | ||
morphGeometry := each displayWithZoom: zoom offsetX: (offsetX) offsetY: (offsetY). | ||
morph addMorph: morphGeometry. | ||
]. | ||
^ morph | ||
] |
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,68 +1,69 @@ | ||
Class { | ||
#name : #OGCInformationWindowPresenter, | ||
#superclass : #SpWindowPresenter, | ||
#classInstVars : [ | ||
'presenter' | ||
], | ||
#category : #'OGC-Viewer' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> getNewPresenter [ | ||
^ self new | ||
presenter: self getNewSubPresenter ; | ||
title: 'Information' | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> getNewSubPresenter [ | ||
| newPresenter | | ||
|
||
newPresenter := SpPresenter new. | ||
newPresenter layout: (SpBoxLayout newTopToBottom | ||
add: 'Properties' expand: false; | ||
add: (newPresenter newText beNotEditable) expand: true; | ||
addLast: (SpBoxLayout newLeftToRight | ||
addLast: (newPresenter newButton label: 'Inspect') expand: false; | ||
yourself) | ||
expand: false; | ||
yourself). | ||
|
||
^ newPresenter | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> inspectButton [ | ||
^ self presenter presenter layout children third children first | ||
] | ||
|
||
{ #category : #testing } | ||
OGCInformationWindowPresenter class >> isClosed [ | ||
^ self isOpened not | ||
] | ||
|
||
{ #category : #testing } | ||
OGCInformationWindowPresenter class >> isOpened [ | ||
^ self presenter isOpen | ||
] | ||
|
||
{ #category : #testing } | ||
OGCInformationWindowPresenter class >> open [ | ||
presenter := self getNewPresenter . | ||
self presenter open. | ||
] | ||
|
||
{ #category : #accessing } | ||
OGCInformationWindowPresenter class >> presenter [ | ||
^ presenter ifNil: [ ^ presenter := self getNewPresenter ] | ||
] | ||
|
||
{ #category : #accessing } | ||
OGCInformationWindowPresenter class >> textPresenter [ | ||
^ self presenter presenter layout children second | ||
] | ||
|
||
{ #category : #accessing } | ||
OGCInformationWindowPresenter class >> title [ | ||
^ 'Informations' | ||
] | ||
Class { | ||
#name : 'OGCInformationWindowPresenter', | ||
#superclass : 'SpWindowPresenter', | ||
#classInstVars : [ | ||
'presenter' | ||
], | ||
#category : 'OGC-Viewer', | ||
#package : 'OGC-Viewer' | ||
} | ||
|
||
{ #category : 'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> getNewPresenter [ | ||
^ self new | ||
presenter: self getNewSubPresenter ; | ||
title: 'Information' | ||
] | ||
|
||
{ #category : 'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> getNewSubPresenter [ | ||
| newPresenter | | ||
|
||
newPresenter := SpPresenter new. | ||
newPresenter layout: (SpBoxLayout newTopToBottom | ||
add: 'Properties' expand: false; | ||
add: (newPresenter newText beNotEditable) expand: true; | ||
addLast: (SpBoxLayout newLeftToRight | ||
addLast: (newPresenter newButton label: 'Inspect') expand: false; | ||
yourself) | ||
expand: false; | ||
yourself). | ||
|
||
^ newPresenter | ||
] | ||
|
||
{ #category : 'as yet unclassified' } | ||
OGCInformationWindowPresenter class >> inspectButton [ | ||
^ self presenter presenter layout children third children first | ||
] | ||
|
||
{ #category : 'testing' } | ||
OGCInformationWindowPresenter class >> isClosed [ | ||
^ self isOpened not | ||
] | ||
|
||
{ #category : 'testing' } | ||
OGCInformationWindowPresenter class >> isOpened [ | ||
^ self presenter isOpen | ||
] | ||
|
||
{ #category : 'testing' } | ||
OGCInformationWindowPresenter class >> open [ | ||
presenter := self getNewPresenter . | ||
self presenter open. | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OGCInformationWindowPresenter class >> presenter [ | ||
^ presenter ifNil: [ ^ presenter := self getNewPresenter ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OGCInformationWindowPresenter class >> textPresenter [ | ||
^ self presenter presenter layout children second | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OGCInformationWindowPresenter class >> title [ | ||
^ 'Informations' | ||
] |
Oops, something went wrong.