Skip to content

Commit

Permalink
Fix bug from build + load only spheric
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurineDargaud committed Aug 6, 2021
1 parent e4465b6 commit c83c807
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 84 deletions.
2 changes: 1 addition & 1 deletion BaselineOfOGC/BaselineOfOGC.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BaselineOfOGC >> baseline: spec [
group: 'Geometric' with: #('OGC-Geometry' 'OGC-Geometry-Tests');
group: 'Spheric' with: #('OGC-Spheric' 'OGC-Spheric-Tests');
group: 'Visualisation' with: #('OGC-Viewer' 'OGC-Viewer-Tests');
group: 'default' with: #('Core' 'Tests' 'Geometric' 'Spheric' 'Visualisation').
group: 'default' with: #('Core' 'Tests' 'Spheric' 'Visualisation').
]

]
Expand Down
18 changes: 0 additions & 18 deletions OGC-Core-Tests/OGCLineStringTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,3 @@ Class {
],
#category : #'OGC-Core-Tests'
}

{ #category : #tests }
OGCLineStringTest >> testLength [
| point1 point2 point3 point4 lineS points |
point1 := OGCPoint xy: #(0 0).
point2 := OGCPoint xy: #(3 0).
point3 := OGCPoint xy: #(3 5).
point4 := OGCPoint xy: #(10 5).
points := OrderedCollection with: point1.
points add: point2.
points add: point3.
points add: point4.
lineS := OGCLineString withPoints: points.
(point1 spatialReferenceSystem name = 'Geometric')
ifTrue: [ self assert: lineS length equals: 15 ]


]
16 changes: 0 additions & 16 deletions OGC-Core-Tests/OGCTriangleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,3 @@ Class {
#superclass : #TestCase,
#category : #'OGC-Core-Tests'
}

{ #category : #tests }
OGCTriangleTest >> testArea [
| point1 point2 point3 lineS triangle points |
point1 := OGCPoint xy: #(0 0).
point2 := OGCPoint xy: #(1 0).
point3 := OGCPoint xy: #(0 1).
points := OrderedCollection with: point1.
points add: point2.
points add: point3.
lineS := OGCLineString withPoints: points.
triangle := OGCTriangle withExteriorRing: lineS.
(point1 spatialReferenceSystem name = 'Geometric')
ifTrue: [ self assert: (triangle area round: 4) equals: 0.5 ]

]
2 changes: 1 addition & 1 deletion OGC-Core/OGCFeature.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ OGCFeature >> id: aStringIdOrInteger [

{ #category : #accessing }
OGCFeature >> properties [
^ properties
^ properties ifNil: [ ^ properties := Dictionary new ]
]

{ #category : #accessing }
Expand Down
10 changes: 5 additions & 5 deletions OGC-Core/OGCGeometry.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ OGCGeometry >> applyStyle: aStyleDictionary [
aStyleDictionary keysDo: [ :aKey | self style at: aKey put: (aStyleDictionary at: aKey) ]
]

{ #category : #converting }
OGCGeometry >> asFeature [
^ OGCFeature new geometry: self
]

{ #category : #converting }
OGCGeometry >> asFeaturesCollection [
| aFeature |
Expand Down Expand Up @@ -159,11 +164,6 @@ OGCGeometry >> geometryType [
^ self class geometryType
]

{ #category : #initialization }
OGCGeometry >> initialize [
spatialReferenceSystem := OGCSphericSystem
]

{ #category : #'methods analysis' }
OGCGeometry >> intersection: anotherGeometry [
"Returns a geometric object that represents the
Expand Down
20 changes: 20 additions & 0 deletions OGC-Core/OGCPoint.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ OGCPoint >> isMeasured [
^ m isNotNil
]

{ #category : #accessing }
OGCPoint >> latitude [
^ self y
]

{ #category : #accessing }
OGCPoint >> latitude: aNumberOrString [
self y: aNumberOrString asNumber
]

{ #category : #testing }
OGCPoint >> locateBetween: mStart and: mEnd [
"Returns a derived geometry collection value
Expand All @@ -105,6 +115,16 @@ Geometry” for more details."
ifFalse: [ OGCEmptySet new ]
]

{ #category : #accessing }
OGCPoint >> longitude [
^ self x
]

{ #category : #accessing }
OGCPoint >> longitude: aNumberOrString [
self x: aNumberOrString asNumber
]

{ #category : #accessing }
OGCPoint >> m [
^ m
Expand Down
19 changes: 19 additions & 0 deletions OGC-Geometry-Tests/OGCLineStringTest.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Extension { #name : #OGCLineStringTest }

{ #category : #'*OGC-Geometry-Tests' }
OGCLineStringTest >> testLength [
| point1 point2 point3 point4 lineS points |
point1 := OGCPoint xy: #(0 0).
point2 := OGCPoint xy: #(3 0).
point3 := OGCPoint xy: #(3 5).
point4 := OGCPoint xy: #(10 5).
points := OrderedCollection with: point1.
points add: point2.
points add: point3.
points add: point4.
lineS := OGCLineString withPoints: points.
(point1 spatialReferenceSystem name = 'Geometric')
ifTrue: [ self assert: lineS length equals: 15 ]


]
24 changes: 0 additions & 24 deletions OGC-Geometry-Tests/OGCLineTest.extension.st

This file was deleted.

9 changes: 0 additions & 9 deletions OGC-Geometry-Tests/OGCPointTest.extension.st

This file was deleted.

2 changes: 1 addition & 1 deletion OGC-Geometry-Tests/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'OGC-Geometry-Tests' }
Package { #name : #'OGC-Geometry-Tests' }
38 changes: 29 additions & 9 deletions OGC-Viewer-Tests/OGCViewerTest.class.st
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
Class {
#name : #OGCViewerTest,
#superclass : #TestCase,
#instVars : [
'model'
],
#category : #'OGC-Viewer-Tests'
}

{ #category : #running }
OGCViewerTest >> setUp [
| point1 point2 point3 linearRing lineString polygon features |
point1 := OGCPoint xy: #(0 0).
point2 := OGCPoint xy: #(1 1).
point3 := OGCPoint xy: #(0 1).
linearRing := OGCLinearRing new points: { point1 . point2 . point3 . point1 }.
lineString := OGCLineString new points: { point1 . point2 }.
polygon := OGCPolygon new exteriorRing: linearRing.
features := { lineString . linearRing . polygon }.
model := OGCFeatureCollection new features: (features collect: [ :aFeature | aFeature asFeature ]).
model features: (model features do:
[:aFeature |
|code|
code := ((Random new nextBetween: 0 and: 1) * 10) round: 0.
aFeature properties at: 'code' put: code])




]

{ #category : #tests }
OGCViewerTest >> testApplyStyle [
| model |
model := GeoJSONExamples regionsFranceMetropole .
model applyStyle: (OGCGeometry createStyleDictionary: #(blue 0.3 green 4)).
self assert: (model features first geometry style at: 'fill') equals: 'blue'.
self assert: (model features second geometry style at: 'fill-opacity') equals: '0.3'.
self assert: (model features third geometry style at: 'stroke') equals: 'green'.
self assert: (model features fourth geometry style at: 'stroke-width') equals: '4'.
self assert: (model features third geometry style at: 'stroke-width') equals: '4'.
]

{ #category : #tests }
OGCViewerTest >> testApplyStyleifFeature [
| model blockCondition styleDictionary |
model := GeoJSONExamples regionsFranceMetropole .
| blockCondition styleDictionary |
blockCondition := [ :aFeature | (aFeature properties at: 'code') asNumber even ].
styleDictionary := OGCGeometry createStyleDictionary: #(purple 0.8 orange 3).
model
Expand All @@ -29,8 +51,7 @@ OGCViewerTest >> testApplyStyleifFeature [

{ #category : #tests }
OGCViewerTest >> testBestZoom [
| model bestZoom rectangleEnvelopeAtBestZoom rectangleEnvelopeBigger |
model := GeoJSONExamples pointLineAndPolygon2 .
| bestZoom rectangleEnvelopeAtBestZoom rectangleEnvelopeBigger |
bestZoom := model bestZoomWithZoomLimit: 19 widthTileLimit: 3 heightTileLimit: 2.
rectangleEnvelopeAtBestZoom := model rectangularTileEnvelopeWithZoom: bestZoom.
rectangleEnvelopeBigger := model rectangularTileEnvelopeWithZoom: (bestZoom + 1).
Expand All @@ -53,8 +74,7 @@ OGCViewerTest >> testCoordinatesPoint [

{ #category : #tests }
OGCViewerTest >> testWithMapTiles [
| model morph |
model := GeoJSONReader fromURL: 'https://raw.githubusercontent.com/mapbox/mapping/master/worldcities/worldcities.geojson'.
| morph |
morph := (OGCViewerMorph withMapTiles: 4@3) displayObject: model.
self assert: morph fullBounds width equals: 256*4.
self assert: morph fullBounds height equals: 256*3.
Expand Down

0 comments on commit c83c807

Please sign in to comment.