Skip to content
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
58 changes: 54 additions & 4 deletions src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ AbsoluteCoordinatesTest >> testAbsoluteCoordinates [
self assert: coord latitude isNil.
self assert: coord longitudeInDegrees isNil.
self assert: coord longitude isNil.
self assert: coord altitudeInMeters isNil.
self assert: coord altitude isNil.

coord latitudeInDegrees: 45.
self assert: coord isEmpty equals: false.
Expand All @@ -48,8 +46,6 @@ AbsoluteCoordinatesTest >> testAbsoluteCoordinates [
coord altitudeInMeters: 100.
self assert: coord isEmpty equals: false.
self assert: coord isValid equals: true.
self assert: coord altitudeInMeters equals: 100.
self assert: coord altitude equals: (100 units: #meters).
]

{ #category : #tests }
Expand Down Expand Up @@ -202,6 +198,42 @@ AbsoluteCoordinatesTest >> testAbsoluteCoordinatesRandom [
self assert: coord altitude isNil.
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testAltitude [

self assert: absCoord altitude isNil.

absCoord altitudeInMeters: 100.
self assert: absCoord altitude equals: (100 units: #meters).

absCoord altitudeInMeters: 0.
self assert: absCoord altitude equals: (0 units: #meters).

absCoord altitudeInMeters: -100.
self assert: absCoord altitude equals: (-100 units: #meters).

absCoord altitudeInMeters: nil.
self assert: absCoord altitude isNil
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testAltitudeInMeters [

self assert: absCoord altitudeInMeters isNil.

absCoord altitudeInMeters: 100.
self assert: absCoord altitudeInMeters equals: 100.

absCoord altitudeInMeters: 0.
self assert: absCoord altitudeInMeters equals: 0.

absCoord altitudeInMeters: -100.
self assert: absCoord altitudeInMeters equals: -100.

absCoord altitudeInMeters: nil.
self assert: absCoord altitudeInMeters isNil
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testAsLatLonDegreesPoint [

Expand Down Expand Up @@ -270,6 +302,24 @@ AbsoluteCoordinatesTest >> testFromStringLatitudeLongitude [
self assert: (AbsoluteCoordinates fromStringLatitude: 'S0°02''0''''' longitude: 'E0°0''0''''') equals: (AbsoluteCoordinates latitudeInDegrees: -0.03333333333333333 longitudeInDegrees: 0).
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testIsBelowSeaLevel [

self deny: absCoord isBelowSeaLevel.

absCoord altitudeInMeters: 100.
self deny: absCoord isBelowSeaLevel.

absCoord altitudeInMeters: 0.
self deny: absCoord isBelowSeaLevel.

absCoord altitudeInMeters: -100.
self assert: absCoord isBelowSeaLevel.

absCoord altitudeInMeters: nil.
self deny: absCoord isBelowSeaLevel.
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testIsLatLonZero [

Expand Down
7 changes: 7 additions & 0 deletions src/GeoTools/AbsoluteCoordinates.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,13 @@ AbsoluteCoordinates >> copy [
^copy
]

{ #category : #testing }
AbsoluteCoordinates >> isBelowSeaLevel [
"Sea level (sometimes referred to by its acronym as MSL, Mean Sea Level) is the average position of the sea surface, constituting a reference level considered stable. We consider it to be at an altitude of 0 meters by convention."

^ self altitudeInMeters notNil and: [ self altitudeInMeters < 0 ]
]

{ #category : #testing }
AbsoluteCoordinates >> isEmpty [

Expand Down