public void TestExtentExpansion() { /* * Empty extent * + */ GeoExtent extent = new GeoExtent(4740877.11612745, 4740877.11612745, 329020.170629896, 329020.170629896); Assert.IsTrue(extent.IsEmpty); Assert.AreEqual(0.0, extent.Width, 0.001); Assert.AreEqual(0.0, extent.Height, 0.001); /* * Extent expanded with 20km on each side * +-----+ * | + | * +-----+ */ extent.Expand(20000); Assert.IsFalse(extent.IsEmpty); Assert.AreEqual(40000.0, extent.Width, 0.001); Assert.AreEqual(40000.0, extent.Height, 0.001); }
public void BatchTransformWithParameters() { GeoExtent extent = new GeoExtent(4590706, 4556298, 8561889, 8519105); extent.Expand(20000); Transformations tr = new Transformations(); double[] parameters = tr.CalculateAffineTransformationParameters(extent, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); int count = 100000; GeoPoint[] input = new GeoPoint[count]; GeoPoint[] expected = new GeoPoint[count]; for (int i = 0; i < count; i++) { input[i] = new GeoPoint(4573488, 8539465); expected[i] = new GeoPoint(4700322.190, 361795.526); } // check results for (int i = 0; i < count; i++) { GeoPoint result = tr.TransformBGSCoordinates(input[i], parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected[i], result, Common.DELTA_BGS_EXTENT); } }
public void CalculateParametersForExtent() { GeoExtent extent = new GeoExtent(4590706, 4556298, 8561889, 8519105); extent.Expand(20000); Transformations tr = new Transformations(); double[] parameters = tr.CalculateAffineTransformationParameters(extent, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); // K9 GeoPoint input = new GeoPoint(4573488, 8539465); GeoPoint expected = new GeoPoint(4700322.190, 361795.526); GeoPoint result = tr.TransformBGSCoordinates(input, parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected, result, Common.DELTA_BGS_EXTENT); input = new GeoPoint(4557529, 8530750); expected = new GeoPoint(4684583.019, 352691.179); result = tr.TransformBGSCoordinates(input, parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected, result, Common.DELTA_BGS_EXTENT); input = new GeoPoint(4589108, 8551915); expected = new GeoPoint(4715630.512, 374624.861); result = tr.TransformBGSCoordinates(input, parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected, result, Common.DELTA_BGS_EXTENT); input = new GeoPoint(4573488, 8517394); expected = new GeoPoint(4700865.033, 339732.391); result = tr.TransformBGSCoordinates(input, parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected, result, Common.DELTA_BGS_EXTENT); input = new GeoPoint(4574394, 8583155); expected = new GeoPoint(4700154.937, 405492.239); result = tr.TransformBGSCoordinates(input, parameters, enumProjection.BGS_1970_K9, enumProjection.BGS_2005_KK); Common.CheckResults(expected, result, Common.DELTA_BGS_EXTENT); }