public void MultiTileMapTest() { IImageTileSerializer serializer = new MockClasses.MockTileSerializer(); MockClasses.MockColorMap map = new MockClasses.MockColorMap(); map.ExpectedLongitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); map.ExpectedLatitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); // Expected value at pixel (0,0) map.ExpectedLongitudes[0] = -179.296875; map.ExpectedLatitudes[0] = 84.9901001802348; // Expected value at pixel (100,100) map.ExpectedLongitudes[100 + 100 * 256] = -38.671875; map.ExpectedLatitudes[100 + 100 * 256] = 36.031331776331868; MercatorTileCreator mercator = new MercatorTileCreator(map, serializer); // Toast map MockClasses.MockColorMap toastMap = new MockClasses.MockColorMap(); toastMap.ExpectedLongitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); toastMap.ExpectedLatitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); // Expected value at pixel (0,0) toastMap.ExpectedLongitudes[0] = -5.44921875; toastMap.ExpectedLatitudes[0] = -89.309545852399211; // Expected value at pixel (100,100) toastMap.ExpectedLongitudes[100 + 100 * 256] = -45.0; toastMap.ExpectedLatitudes[100 + 100 * 256] = 59.83399091605358; ToastTileCreator toast = new ToastTileCreator(toastMap, serializer); MultiTileCreator multiCreator = new MultiTileCreator(new Collection <ITileCreator>() { mercator, toast }, ProjectionTypes.Mercator); multiCreator.Create(0, 0, 0); multiCreator.CreateParent(0, 0, 0); // Validate Mercator file Assert.AreEqual(ProjectionTypes.Mercator, multiCreator.ProjectionType); }
public void InvalidateMercatorSerializerTestForNull() { // Get Values from XML File string expectedError = utilityObj.XmlUtil.GetTextValue(Constants.MercDemSerializerTestNode, Constants.ExpectedErrorNode); ImageTileSerializer imageTileSerializer = new ImageTileSerializer(Path.Combine(Environment.CurrentDirectory, imageTemplate), ImageFormat.Png); MercatorTileCreator merc = null; try { merc = new MercatorTileCreator(null, imageTileSerializer); Assert.Fail(); } catch (ArgumentNullException ex) { string message = ex.Message; Assert.IsNull(merc); Assert.AreEqual(expectedError, message.Replace("\r", string.Empty).Replace("\n", string.Empty)); } }
public void MercatorMapTest() { MockClasses.MockColorMap map = new MockClasses.MockColorMap(); map.ExpectedLongitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); map.ExpectedLatitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); // Expected value at pixel (0,0) map.ExpectedLongitudes[0] = -179.296875; map.ExpectedLatitudes[0] = 84.9901001802348; // Expected value at pixel (100,100) map.ExpectedLongitudes[100 + 100 * 256] = -38.671875; map.ExpectedLatitudes[100 + 100 * 256] = 36.031331776331868; IImageTileSerializer serializer = new MockClasses.MockTileSerializer(); MercatorTileCreator tc = new MercatorTileCreator(map, serializer); Assert.AreEqual(tc.ProjectionType, ProjectionTypes.Mercator); tc.Create(0, 0, 0); }
public void MultiTileMapTest() { IImageTileSerializer serializer = new MockClasses.MockTileSerializer(); MockClasses.MockColorMap map = new MockClasses.MockColorMap(); map.ExpectedLongitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); map.ExpectedLatitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); // Expected value at pixel (0,0) map.ExpectedLongitudes[0] = -179.296875; map.ExpectedLatitudes[0] = 84.9901001802348; // Expected value at pixel (100,100) map.ExpectedLongitudes[100 + 100 * 256] = -38.671875; map.ExpectedLatitudes[100 + 100 * 256] = 36.031331776331868; MercatorTileCreator mercator = new MercatorTileCreator(map, serializer); // Toast map MockClasses.MockColorMap toastMap = new MockClasses.MockColorMap(); toastMap.ExpectedLongitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); toastMap.ExpectedLatitudes = Enumerable.Range(0, Constants.TileSize * Constants.TileSize).Select(i => double.NaN).ToArray(); // Expected value at pixel (0,0) toastMap.ExpectedLongitudes[0] = -5.44921875; toastMap.ExpectedLatitudes[0] = -89.309545852399211; // Expected value at pixel (100,100) toastMap.ExpectedLongitudes[100 + 100 * 256] = -45.0; toastMap.ExpectedLatitudes[100 + 100 * 256] = 59.83399091605358; ToastTileCreator toast = new ToastTileCreator(toastMap, serializer); MultiTileCreator multiCreator = new MultiTileCreator(new Collection<ITileCreator>() { mercator, toast }, ProjectionTypes.Mercator); multiCreator.Create(0, 0, 0); multiCreator.CreateParent(0, 0, 0); // Validate Mercator file Assert.AreEqual(ProjectionTypes.Mercator, multiCreator.ProjectionType); }