Skip to content

Commit 4520fe6

Browse files
committed
Continue
1 parent 6ac458d commit 4520fe6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

core/src/test/java/org/mapfish/print/map/ScaleTest.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,28 @@ public void geodetic() {
5050
1.0);
5151
}
5252

53+
/**
54+
* This test verifies that the geodetic scale calculation correctly uses position.x for the
55+
* horizontal coordinate. In projections like CH2056 (Swiss Oblique Mercator) or UTM, shifting a
56+
* point in X direction while keeping Y constant affects the geodetic distance, unlike EPSG:3857
57+
* where distortion is primarily latitude-dependent.
58+
*/
5359
@Test
5460
public void geodeticCH2056XPositionDependence() {
55-
// This test verifies that the geodetic scale calculation correctly uses position.x
56-
// for the horizontal coordinate. In projections like CH2056 (Swiss Oblique Mercator)
57-
// or UTM, shifting a point in X direction while keeping Y constant affects the
58-
// geodetic distance, unlike EPSG:3857 where distortion is primarily latitude-dependent.
5961
final Scale scale = new Scale(25000.0, CH2056, PDF_DPI);
6062

6163
// Calculate geodetic scale at two positions with same Y but different X
6264
// Using coordinates in CH2056 CRS (EPSG:2056)
63-
final Coordinate position1 = new Coordinate(2600000.0, 1200000.0);
64-
final Coordinate position2 = new Coordinate(2650000.0, 1299970.0);
65+
final Coordinate positionRef = new Coordinate(2600000.0, 1200000.0);
66+
final Coordinate positionDown = new Coordinate(2600000.0, 1299970.0);
67+
final Coordinate positionLeft = new Coordinate(2484274.0, 1200000.0);
6568

66-
final double geodeticScale1 = scale.getGeodeticDenominator(CH2056, PDF_DPI, position1);
67-
final double geodeticScale2 = scale.getGeodeticDenominator(CH2056, PDF_DPI, position2);
69+
final double geodeticScaleRef = scale.getGeodeticDenominator(CH2056, PDF_DPI, positionRef);
70+
final double geodeticScaleDown = scale.getGeodeticDenominator(CH2056, PDF_DPI, positionDown);
71+
final double geodeticScaleLeft = scale.getGeodeticDenominator(CH2056, PDF_DPI, positionLeft);
6872

69-
assertEquals(geodeticScale1, 24997.0, 1.0);
70-
assertEquals(geodeticScale2, 24993.0, 1.0);
73+
assertEquals(geodeticScaleRef, 24997.0, 1.0);
74+
assertEquals(geodeticScaleDown, 24993.0, 1.0);
75+
assertEquals(geodeticScaleLeft, 25001.0, 1.0);
7176
}
7277
}

0 commit comments

Comments
 (0)