/// <summary> /// use the mapFrame with this dialog /// </summary> /// <param name="mapFrame"></param> public MapFrameProjectionDialog(IMapFrame mapFrame) { InitializeComponent(); _mapFrame = mapFrame; _projection = new ProjectionInfo(); _projection.CopyProperties(_mapFrame.Projection); UpdateProjectionStrings(); }
public void Reproject_ForLinearRingWithTargetCoordinateSystemWithoutTransform_ReturnDesifiedLinearRing() { // Setup var p1 = new Coordinate(0.0, 0.0); var p2 = new Coordinate(1.1, 1.1); var p3 = new Coordinate(2.2, 0.0); Coordinate[] triangleCoordinates = { p1, p2, p3, p1 }; var ring = new LinearRing(triangleCoordinates); ProjectionInfo sourceProjection = KnownCoordinateSystems.Projected.NationalGrids.Rijksdriehoekstelsel; var targetProjection = new ProjectionInfo(); targetProjection.CopyProperties(sourceProjection); targetProjection.Transform = null; // Call ILinearRing reprojectedRing = ring.Reproject(sourceProjection, sourceProjection); // Assert const int numberOfEdges = 3; const int expectedNumberOfExtraPoints = 35; Assert.AreEqual(numberOfEdges * expectedNumberOfExtraPoints + numberOfEdges + 1, reprojectedRing.Coordinates.Length); const double allowedError = 1e-6; // Allow small drift in reprojecting to same coordinate system. const int expectedP1Index = 0; const int expectedP2Index = expectedNumberOfExtraPoints + 1; const int expectedP3Index = 2 * (expectedNumberOfExtraPoints + 1); const int expectedP1RepeatIndex = 3 * (expectedNumberOfExtraPoints + 1); AssertCoordinatesAreEqual(p1, reprojectedRing.Coordinates[expectedP1Index], allowedError); AssertCoordinatesAreEqual(GetExpectedExtraDesificationCoordinates(p1, p2, expectedNumberOfExtraPoints).ToArray(), TakeElementsFromTo(reprojectedRing.Coordinates, expectedP1Index + 1, expectedP2Index - 1).ToArray(), allowedError); AssertCoordinatesAreEqual(p2, reprojectedRing.Coordinates[expectedP2Index], allowedError); AssertCoordinatesAreEqual(GetExpectedExtraDesificationCoordinates(p2, p3, expectedNumberOfExtraPoints).ToArray(), TakeElementsFromTo(reprojectedRing.Coordinates, expectedP2Index + 1, expectedP3Index - 1).ToArray(), allowedError); AssertCoordinatesAreEqual(p3, reprojectedRing.Coordinates[expectedP3Index], allowedError); AssertCoordinatesAreEqual(GetExpectedExtraDesificationCoordinates(p3, p1, expectedNumberOfExtraPoints).ToArray(), TakeElementsFromTo(reprojectedRing.Coordinates, expectedP3Index + 1, expectedP1RepeatIndex - 1).ToArray(), allowedError); AssertCoordinatesAreEqual(p1, reprojectedRing.Coordinates[expectedP1RepeatIndex], allowedError); }
public void Reproject_ForExtentWithTargetProjectionWithoutTransform_ReturnEqualExtent() { // Setup var extent = new Extent(1.1, 2.2, 3.3, 4.4); ProjectionInfo source = KnownCoordinateSystems.Projected.NationalGrids.Rijksdriehoekstelsel; var targetProjection = new ProjectionInfo(); targetProjection.CopyProperties(KnownCoordinateSystems.Projected.World.WebMercator); targetProjection.Transform = null; // Call Extent result = extent.Reproject(source, targetProjection); // Assert AssertExtentAreEqual(extent, result, 1e-6); }