Skip to content

Commit ca28aaf

Browse files
committed
BoundingBox: add constructors + tests
1 parent 21526ff commit ca28aaf

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/GeoTools-Tests/GeoToolsBoundingBoxTest.class.st

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ GeoToolsBoundingBoxTest >> testMinLongitudeInDegrees [
210210
self assert: boundingBox minLongitudeInDegrees equals: -1.
211211
]
212212

213+
{ #category : #tests }
214+
GeoToolsBoundingBoxTest >> testOriginCorner [
215+
216+
| box |
217+
box := GeoToolsBoundingBox origin: AbsoluteCoordinates zero corner: AbsoluteCoordinates frParis.
218+
self assert: box centerAbsoluteCoordinates isValid.
219+
]
220+
213221
{ #category : #tests }
214222
GeoToolsBoundingBoxTest >> testRightLongitudeInDegrees [
215223

@@ -244,6 +252,14 @@ GeoToolsBoundingBoxTest >> testTopLeftAbsoluteCoordinates [
244252
self assert: boundingBox topLeftAbsoluteCoordinates isZero.
245253
]
246254

255+
{ #category : #tests }
256+
GeoToolsBoundingBoxTest >> testTopLeftBottomRight [
257+
258+
| box |
259+
box := GeoToolsBoundingBox topLeft: AbsoluteCoordinates zero bottomRight: AbsoluteCoordinates frParis.
260+
self assert: box centerAbsoluteCoordinates isValid.
261+
]
262+
247263
{ #category : #tests }
248264
GeoToolsBoundingBoxTest >> testTopRightAbsoluteCoordinates [
249265

src/GeoTools/TGeoToolsBoundingBox.trait.st

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ Trait {
99
#category : #'GeoTools-Coordinates'
1010
}
1111

12+
{ #category : #constructor }
13+
TGeoToolsBoundingBox classSide >> origin: aFromAbsolutePosition corner: aToAbsolutePostion [
14+
15+
^ self topLeft: aFromAbsolutePosition bottomRight: aToAbsolutePostion
16+
]
17+
18+
{ #category : #constructor }
19+
TGeoToolsBoundingBox classSide >> topLeft: aFromAbsolutePosition bottomRight: aToAbsolutePostion [
20+
21+
| box |
22+
box := self new.
23+
box topLeftAbsoluteCoordinates: aFromAbsolutePosition.
24+
box bottomRightAbsoluteCoordinates: aToAbsolutePostion.
25+
^ box
26+
]
27+
1228
{ #category : #accessing }
1329
TGeoToolsBoundingBox >> bottomLatitudeInDegrees [
1430

0 commit comments

Comments
 (0)