public void ReadMBRs_ReadPolygon_ShouldReturnCorrectValues() { // Arrange. MBRInfo[] infos = null; MBRInfo[] expectedInfos = new[] { new MBRInfo(new Envelope(33.719047819505683, 33.78096814177016, 31.928805665809271, 32.025301664150398), 100, 0), new MBRInfo(new Envelope(33.819000337359398, 33.929011051318348, 31.97406740944362, 32.072449163771559), 252, 1), }; m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("polygon_ed50_geo")); // Act. m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path); infos = m_Reader.ReadMBRs().ToArray(); // Assert. Assert.IsNotNull(infos); Assert.AreEqual(2, infos.Length); int currIndex = 0; foreach (MBRInfo expectedInfo in expectedInfos) { HelperMethods.AssertMBRInfoEqual(expectedInfo, infos[currIndex++]); } }
public void ReadMBRs_ReadUnifiedWithNullAtEnd_ShouldReturnCorrectValues() { // Arrange. MBRInfo[] infos = null; MBRInfo[] expectedInfos = new[] { new MBRInfo(new Envelope(-1.151515151515152, -0.353535353535354, -0.929292929292929, -0.419191919191919), 100, 0), new MBRInfo(new Envelope(-0.457070707070707, 0.421717171717172, 0.070707070707071, 0.578282828282829), 236, 1), }; m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterialNullAtEnd")); // Act. m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path); infos = m_Reader.ReadMBRs().ToArray(); // Assert. Assert.IsNotNull(infos); Assert.AreEqual(expectedInfos.Length, infos.Length); int currIndex = 0; foreach (MBRInfo expectedInfo in expectedInfos) { HelperMethods.AssertMBRInfoEqual(expectedInfo, infos[currIndex++]); } }
public void ReadMBRs_ReadLine_ShouldReturnCorrectValues() { // Arrange. MBRInfo[] infos = null; MBRInfo[] expectedInfos = new[] { new MBRInfo(new Envelope(34.573027972716453, 34.628034609274806, 31.803273460424684, 31.895998933480186), 100, 0), new MBRInfo(new Envelope(34.396692412092257, 34.518021336158107, 31.778756216701534, 31.864880893370035), 236, 1), }; m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("line_wgs84_geo")); // Act. m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path); infos = m_Reader.ReadMBRs().ToArray(); // Assert. Assert.IsNotNull(infos); Assert.AreEqual(2, infos.Length); int currIndex = 0; foreach (MBRInfo expectedInfo in expectedInfos) { HelperMethods.AssertMBRInfoEqual(expectedInfo, infos[currIndex++]); } }
public void ReadMBRs_ReadPoint_ShouldReturnCorrectValues() { // Arrange. MBRInfo[] infos = null; MBRInfo[] expectedInfos = new[] { new MBRInfo(new Envelope(new Coordinate(34.282930701329349, 31.851167389309651)), 100, 0), new MBRInfo(new Envelope(new Coordinate(34.145260222088822, 31.864369159253059)), 128, 1), new MBRInfo(new Envelope(new Coordinate(34.181721116813314, 31.920632180204553)), 156, 2), }; m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("point_ed50_geo")); // Act. m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path); infos = m_Reader.ReadMBRs().ToArray(); // Assert. Assert.IsNotNull(infos); Assert.AreEqual(3, infos.Length); int currIndex = 0; foreach (MBRInfo expectedInfo in expectedInfos) { HelperMethods.AssertMBRInfoEqual(expectedInfo, infos[currIndex++]); } }