Skip to content

Commit 34628b2

Browse files
authored
Merge pull request #80 from jhaverkost/bugfix/64-wrong-parameter-order-when-calling-base-constructor
Fix incorrect parameter order in coordinate system constructors (#64)
2 parents 9333270 + bdc3b0e commit 34628b2

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

src/ProjNet/CoordinateSystems/GeographicCoordinateSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class GeographicCoordinateSystem : HorizontalCoordinateSystem
5050
/// <param name="remarks">Provider-supplied remarks</param>
5151
internal GeographicCoordinateSystem(AngularUnit angularUnit, HorizontalDatum horizontalDatum, PrimeMeridian primeMeridian, List<AxisInfo> axisInfo, string name, string authority, long authorityCode, string alias, string abbreviation, string remarks)
5252
:
53-
base(horizontalDatum, axisInfo, name, authority, authorityCode, alias, abbreviation, remarks)
53+
base(horizontalDatum, axisInfo, name, authority, authorityCode, alias, remarks, abbreviation)
5454
{
5555
AngularUnit = angularUnit;
5656
PrimeMeridian = primeMeridian;

src/ProjNet/CoordinateSystems/ProjectedCoordinateSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal ProjectedCoordinateSystem(HorizontalDatum datum, GeographicCoordinateSy
4646
LinearUnit linearUnit, IProjection projection, List<AxisInfo> axisInfo,
4747
string name, string authority, long code, string alias,
4848
string remarks, string abbreviation)
49-
: base(datum, axisInfo, name, authority, code, alias, abbreviation, remarks)
49+
: base(datum, axisInfo, name, authority, code, alias, remarks, abbreviation)
5050
{
5151
GeographicCoordinateSystem = geographicCoordinateSystem;
5252
LinearUnit = linearUnit;

test/ProjNet.Tests/GitHub/Issues.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,51 @@ public void TestConvertWgs84ToEPSG26910_DS()
136136
Assert.That(ptI[1], Is.EqualTo(6246615.391161).Within(0.01), "Northing");
137137
*/
138138
}
139+
140+
[Test(Description =
141+
"Issue #64, Wrong parameter order when calling base constructor (in systems extending HorizontalCoordinateSystem)")]
142+
public void TestHorizontalCoordinateSystemImplementationsAbbreviationAndRemarks()
143+
{
144+
string abbreviation = "TestAbbreviation";
145+
string remarks = "This is a test remark.";
146+
147+
// construct a GeographicCoordinateSystem to test
148+
var gcsAxes = new List<AxisInfo>(2);
149+
gcsAxes.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
150+
gcsAxes.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
151+
152+
var geographicCoordinateSystem =
153+
new GeographicCoordinateSystem(AngularUnit.Degrees, HorizontalDatum.WGS84, PrimeMeridian.Greenwich, gcsAxes,
154+
"WGS 84", "EPSG", 4326, string.Empty, abbreviation, remarks);
155+
156+
Assert.That(geographicCoordinateSystem.Abbreviation, Is.EqualTo(abbreviation));
157+
Assert.That(geographicCoordinateSystem.Remarks, Is.EqualTo(remarks));
158+
159+
// construct a ProjectedCoordinateSystem to test
160+
var pInfo = new List<ProjectionParameter>
161+
{
162+
new ProjectionParameter("latitude_of_origin", 0.0),
163+
new ProjectionParameter("central_meridian", 0.0),
164+
new ProjectionParameter("false_easting", 0.0),
165+
new ProjectionParameter("false_northing", 0.0)
166+
};
167+
168+
var proj = new Projection("Popular Visualisation Pseudo-Mercator", pInfo, "Popular Visualisation Pseudo-Mercator", "EPSG", 3856,
169+
"Pseudo-Mercator", string.Empty, string.Empty);
170+
171+
var pcsAxes = new List<AxisInfo>
172+
{
173+
new AxisInfo("East", AxisOrientationEnum.East),
174+
new AxisInfo("North", AxisOrientationEnum.North)
175+
};
176+
177+
var projectedCoordinateSystem =
178+
new ProjectedCoordinateSystem(HorizontalDatum.WGS84, GeographicCoordinateSystem.WGS84, LinearUnit.Metre, proj, pcsAxes,
179+
"WGS 84 / Pseudo-Mercator", "EPSG", 3857, "WGS 84 / Popular Visualisation Pseudo-Mercator",
180+
remarks, abbreviation);
181+
182+
Assert.That(projectedCoordinateSystem.Abbreviation, Is.EqualTo(abbreviation));
183+
Assert.That(projectedCoordinateSystem.Remarks, Is.EqualTo(remarks));
184+
}
139185
}
140186
}

0 commit comments

Comments
 (0)