@@ -19,6 +19,69 @@ GeoViewMercatorProjectionTest >> testEpsgCode [
1919 self assert: projection epsgCode equals: 3395
2020]
2121
22+ { #category : #tests }
23+ GeoViewMercatorProjectionTest >> testGeodesicCrossesValidDomainFromTo [
24+
25+ self deny: (projection
26+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
27+ to:
28+ (AbsoluteCoordinates latitudeInDegrees: 45 longitudeInDegrees: 100 )).
29+
30+ self deny: (projection
31+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
32+ to:
33+ (AbsoluteCoordinates latitudeInDegrees: 0 longitudeInDegrees: 0 )).
34+
35+ self deny: (projection
36+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
37+ to:
38+ (AbsoluteCoordinates latitudeInDegrees: 84 longitudeInDegrees: 180 )).
39+
40+ self deny: (projection
41+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
42+ to:
43+ (AbsoluteCoordinates latitudeInDegrees: - 80 longitudeInDegrees: 180 )).
44+
45+ self deny: (projection
46+ geodesicCrossesValidDomainFrom: (AbsoluteCoordinates latitudeInDegrees: 5.08 longitudeInDegrees: - 19.01 )
47+ to:
48+ (AbsoluteCoordinates latitudeInDegrees: 5.08 longitudeInDegrees: - 19.00 )).
49+
50+ " projection limits"
51+ self assert: (projection
52+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
53+ to:
54+ (AbsoluteCoordinates latitudeInDegrees: 90 longitudeInDegrees: 100 )).
55+
56+ self assert: (projection
57+ geodesicCrossesValidDomainFrom: AbsoluteCoordinates zero
58+ to:
59+ (AbsoluteCoordinates latitudeInDegrees: - 90 longitudeInDegrees: 100 )).
60+ ]
61+
62+ { #category : #tests }
63+ GeoViewMercatorProjectionTest >> testIsAbsoluteCoordinatesOutsideProjectionLimit [
64+
65+ self deny: (projection isAbsoluteCoordinatesOutsideProjectionLimit:
66+ AbsoluteCoordinates zero).
67+
68+ self deny: (projection isAbsoluteCoordinatesOutsideProjectionLimit:
69+ AbsoluteCoordinates frBrest).
70+
71+ " out"
72+ self assert:
73+ (projection isAbsoluteCoordinatesOutsideProjectionLimit:
74+ AbsoluteCoordinates new ).
75+
76+ self assert:
77+ (projection isAbsoluteCoordinatesOutsideProjectionLimit:
78+ (AbsoluteCoordinates latitudeInDegrees: - 90 longitudeInDegrees: 0 )).
79+
80+ self assert:
81+ (projection isAbsoluteCoordinatesOutsideProjectionLimit:
82+ (AbsoluteCoordinates latitudeInDegrees: 90 longitudeInDegrees: 0 ))
83+ ]
84+
2285{ #category : #tests }
2386GeoViewMercatorProjectionTest >> testKey [
2487
@@ -31,6 +94,44 @@ GeoViewMercatorProjectionTest >> testName [
3194 self assert: projection name equals: ' Mercator'
3295]
3396
97+ { #category : #tests }
98+ GeoViewMercatorProjectionTest >> testProjCartToLatLon [
99+
100+ " Brest"
101+ | cartesian absolute reference |
102+ reference := AbsoluteCoordinates frBrest.
103+ cartesian := CartesianCoordinates xInMeters: - 499082 yInMeters: 6203898 .
104+ absolute := projection projCartToLatLon: cartesian.
105+ self assert: (absolute latitudeInDegrees closeTo: (reference latitudeInDegrees) precision: 0.0001 ).
106+ self assert: (absolute longitudeInDegrees closeTo: (reference longitudeInDegrees) precision: 0.0001 ).
107+
108+ " Paris"
109+ reference := AbsoluteCoordinates frParis.
110+ cartesian := CartesianCoordinates xInMeters: 259745 yInMeters: 6284473 .
111+ absolute := projection projCartToLatLon: cartesian.
112+ self assert: (absolute latitudeInDegrees closeTo: (reference latitudeInDegrees) precision: 0.0001 ).
113+ self assert: (absolute longitudeInDegrees closeTo: (reference longitudeInDegrees) precision: 0.0001 ).
114+ ]
115+
116+ { #category : #tests }
117+ GeoViewMercatorProjectionTest >> testProjLatLonToCart [
118+
119+ " Brest"
120+ | coord cart |
121+ coord := AbsoluteCoordinates frBrest.
122+ cart := projection projLatLonToCart: coord.
123+ self assert: (cart xInMeters closeTo: - 499082 precision: 1 ).
124+ self assert: (cart yInMeters closeTo: 6203898 precision: 1 ).
125+ self assert: (cart zInMeters closeTo: 52 precision: 0.01 ).
126+
127+ " Paris"
128+ coord := AbsoluteCoordinates frParis.
129+ cart := projection projLatLonToCart: coord.
130+ self assert: (cart xInMeters closeTo: 259745 precision: 1 ).
131+ self assert: (cart yInMeters closeTo: 6284473 precision: 1 ).
132+ self assert: (cart zInMeters closeTo: 79 precision: 0.01 )
133+ ]
134+
34135{ #category : #' tests-accessing' }
35136GeoViewMercatorProjectionTest >> testReverseProj [
36137
@@ -53,3 +154,40 @@ GeoViewMercatorProjectionTest >> testReverseProj [
53154 closeTo: absoluteCoordinates longitudeInDegrees
54155 precision: precision) ]
55156]
157+
158+ { #category : #tests }
159+ GeoViewMercatorProjectionTest >> testSideOfAbsoluteCoordinates [
160+
161+ self
162+ assert:
163+ (projection sideOfAbsoluteCoordinates: AbsoluteCoordinates zero)
164+ equals: GeoViewMapProjectionSide leftOfZeroMeridian.
165+
166+ self
167+ assert:
168+ (projection sideOfAbsoluteCoordinates: (AbsoluteCoordinates latitudeInDegrees: 0 longitudeInDegrees: - 1 ))
169+ equals: GeoViewMapProjectionSide leftOfZeroMeridian.
170+
171+ self
172+ assert:
173+ (projection sideOfAbsoluteCoordinates: (AbsoluteCoordinates latitudeInDegrees: 0 longitudeInDegrees: 1 ))
174+ equals: GeoViewMapProjectionSide rightOfZeroMeridian.
175+
176+ " limits"
177+ self
178+ assert:
179+ (projection sideOfAbsoluteCoordinates: (AbsoluteCoordinates latitudeInDegrees: 90 longitudeInDegrees: 0 ))
180+ equals: GeoViewMapProjectionSide outsideLatitudeLimitTop.
181+
182+ self
183+ assert:
184+ (projection sideOfAbsoluteCoordinates: (AbsoluteCoordinates latitudeInDegrees: - 90 longitudeInDegrees: 0 ))
185+ equals: GeoViewMapProjectionSide outsideLatitudeLimitBottom.
186+
187+ " out"
188+ self
189+ assert:
190+ (projection sideOfAbsoluteCoordinates: AbsoluteCoordinates new )
191+ equals: GeoViewMapProjectionSide outOfProjection
192+ .
193+ ]
0 commit comments