当前位置: 首页>>代码示例>>C#>>正文


C# Extended.ShapeReader类代码示例

本文整理汇总了C#中IO.ShapeFile.Extended.ShapeReader的典型用法代码示例。如果您正苦于以下问题:C# IO.ShapeFile.Extended.ShapeReader类的具体用法?C# IO.ShapeFile.Extended.ShapeReader怎么用?C# IO.ShapeFile.Extended.ShapeReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IO.ShapeFile.Extended.ShapeReader类属于命名空间,在下文中一共展示了IO.ShapeFile.Extended.ShapeReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Ctor_SendValidParameters_ShouldReturnNotNull

        public void Ctor_SendValidParameters_ShouldReturnNotNull()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("line_ed50_geo"));

            // Act.
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Assert.
            Assert.IsNotNull(m_Reader);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:11,代码来源:ShapeReaderTests.cs

示例2: Ctor_SendValidParameters_ShouldReturnNotNull

        public void Ctor_SendValidParameters_ShouldReturnNotNull()
        {
            // Arrange
            m_TmpFile = new TempFileCloudUploader("shape.shp", ShpFiles.Read("line_ed50_geo"));

            // Act.
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(new ShapefileStreamProviderRegistry(GetProvider(m_TmpFile.Path), null, true, false));

            // Assert.
            Assert.IsNotNull(m_Reader);
        }
开发者ID:APLANA-Alexey-Stolyarov,项目名称:NetTopologySuite,代码行数:11,代码来源:ShapeReaderTests.cs

示例3: FileHeader_ReadPoint_ShouldReturnCorrectValues

        public void FileHeader_ReadPoint_ShouldReturnCorrectValues()
        {
            // Arrange.
            Envelope expectedMBR = new Envelope(34.14526022208882, 34.28293070132935, 31.85116738930965, 31.92063218020455);

            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("point_ed50_geo"));

            // Act.
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Assert.
            Assert.IsNotNull(m_Reader);
            Assert.IsNotNull(m_Reader.ShapefileHeader);
            Assert.AreEqual(m_Reader.ShapefileHeader.ShapeType, ShapeGeometryType.Point);
            HelperMethods.AssertEnvelopesEqual(m_Reader.ShapefileHeader.Bounds, expectedMBR);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:16,代码来源:ShapeReaderTests.cs

示例4: ReadShapeAtOffset_ReadPolygon_shouldReturnCorrectValue

        public void ReadShapeAtOffset_ReadPolygon_shouldReturnCorrectValue()
        {
            // Arrange.
            IGeometryFactory factory = new GeometryFactory();
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("polygon_ed50_geo"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            long[] shapeOffsets = { 100, 252 };

            Coordinate[,] expectedLines = new Coordinate[,]
			{
				{
					new Coordinate(33.719047819505683, 31.989469320254013), 
					new Coordinate(33.730049025918099, 32.025301664150398),
					new Coordinate(33.771538712027194, 32.008956957757299),
					new Coordinate(33.78096814177016, 31.993555297099103),
					new Coordinate(33.744507207486457, 31.928805665809271),
					new Coordinate(33.719047819505683, 31.989469320254013)
				},
				{
					new Coordinate(33.821829475819285, 32.051075573685317), 
					new Coordinate(33.860176141775888, 32.072449163771559),
					new Coordinate(33.927125440097875, 32.054847113210094),
					new Coordinate(33.929011051318348, 31.97878189417845),
					new Coordinate(33.819000337359398, 31.97406740944362),
					new Coordinate(33.821829475819285, 32.051075573685317)
				}
			};

            // Act.
            for (int i = 0; i < shapeOffsets.Length; i++)
            {
                IGeometry geo = m_Reader.ReadShapeAtOffset(shapeOffsets[i], factory);

                // Assert.
                Assert.IsNotNull(geo);
                Assert.IsTrue(geo.IsValid);
                Assert.IsInstanceOf<IPolygon>(geo);
                IPolygon givenPoly = geo as IPolygon;

                Assert.IsNotNull(givenPoly.ExteriorRing);
                Assert.AreSame(givenPoly.ExteriorRing, givenPoly.Shell);
                Assert.AreEqual(givenPoly.Shell.Coordinates.Length, expectedLines.GetLength(1));

                ILineString givenLine = givenPoly.Shell;

                for (int j = 0; j < givenLine.Coordinates.Length; j++)
                {
                    Coordinate currPoint = givenLine.Coordinates[j];

                    HelperMethods.AssertDoubleValuesEqual(currPoint.X, expectedLines[i, j].X);
                    HelperMethods.AssertDoubleValuesEqual(currPoint.Y, expectedLines[i, j].Y);
                }
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:55,代码来源:ShapeReaderTests.cs

示例5: ReadAllShapes_TryReadAfterDisposed_ShouldThrowException

        public void ReadAllShapes_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileCloudUploader("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(new ShapefileStreamProviderRegistry(GetProvider(m_TmpFile.Path), null, true, false));
            IGeometryFactory factory = new GeometryFactory();

            // Act.
            m_Reader.Dispose();
            m_Reader.ReadAllShapes(factory);
        }
开发者ID:APLANA-Alexey-Stolyarov,项目名称:NetTopologySuite,代码行数:11,代码来源:ShapeReaderTests.cs

示例6: FileHeader_ReadPolygon_ShouldReturnCorrectValues

        public void FileHeader_ReadPolygon_ShouldReturnCorrectValues()
        {
            // Arrange.
            Envelope expectedMBR = new Envelope(33.47383821246188, 33.75452922072821, 32.0295864794076, 32.1886342399706);

            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("polygon_wgs84_geo"));

            // Act.
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Assert.
            Assert.IsNotNull(m_Reader);
            Assert.IsNotNull(m_Reader.ShapefileHeader);
            Assert.AreEqual(m_Reader.ShapefileHeader.ShapeType, ShapeGeometryType.Polygon);
            HelperMethods.AssertEnvelopesEqual(m_Reader.ShapefileHeader.Bounds, expectedMBR);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:16,代码来源:ShapeReaderTests.cs

示例7: ReadAllShapes_ReadEmptyShapeFile_ShouldReturnEmptyEnumerable

        public void ReadAllShapes_ReadEmptyShapeFile_ShouldReturnEmptyEnumerable()
        {
            // Arrange.
            m_TmpFile = new TempFileCloudUploader("shape.shp", ShpFiles.Read("EmptyShapeFile"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(new ShapefileStreamProviderRegistry(GetProvider(m_TmpFile.Path), null, true, false));
            IGeometryFactory factory = new GeometryFactory();

            // Act.
            IEnumerable<IGeometry> geos = m_Reader.ReadAllShapes(factory);

            // Assert.
            Assert.IsNotNull(geos);
            Assert.IsFalse(geos.Any());
        }
开发者ID:APLANA-Alexey-Stolyarov,项目名称:NetTopologySuite,代码行数:14,代码来源:ShapeReaderTests.cs

示例8: FileHeader_ReadLine_ShouldReturnCorrectValues

        public void FileHeader_ReadLine_ShouldReturnCorrectValues()
        {
            // Arrange.
            Envelope expectedMBR = new Envelope(639384.5630270261, 662946.9241196744, 3505730.839052265, 3515879.236960234);

            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("line_ed50_utm36"));

            // Act.
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Assert.
            Assert.IsNotNull(m_Reader);
            Assert.IsNotNull(m_Reader.ShapefileHeader);
            Assert.AreEqual(m_Reader.ShapefileHeader.ShapeType, ShapeGeometryType.LineString);
            HelperMethods.AssertEnvelopesEqual(m_Reader.ShapefileHeader.Bounds, expectedMBR);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:16,代码来源:ShapeReaderTests.cs

示例9: ReadAllShapes_TryReadAfterDisposed_ShouldThrowException

        public void ReadAllShapes_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            // Act.
            m_Reader.Dispose();
            m_Reader.ReadAllShapes(factory);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:11,代码来源:ShapeReaderTests.cs

示例10: ReadShapeAtOffset_TryReadAfterDisposed_shouldThrowException

        public void ReadShapeAtOffset_TryReadAfterDisposed_shouldThrowException()
        {
            // Arrange.
            IGeometryFactory factory = new GeometryFactory();
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("line_wgs84_geo"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            m_Reader.Dispose();
            m_Reader.ReadShapeAtOffset(108, factory);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:10,代码来源:ShapeReaderTests.cs

示例11: ReadShapeAtIndex_ReadFirstUnifiedCheckMaterialShape_ShouldReturnRectangle

        public void ReadShapeAtIndex_ReadFirstUnifiedCheckMaterialShape_ShouldReturnRectangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(-0.815656565656566, -0.439393939393939),
						new Coordinate(-0.353535353535354, -0.795454545454545),
						new Coordinate(-0.888888888888889,-0.929292929292929),
						new Coordinate(-1.151515151515152, -0.419191919191919),
						new Coordinate(-0.815656565656566,-0.439393939393939),
					}));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(0, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf<IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:23,代码来源:ShapeReaderTests.cs

示例12: ReadMBRs_ReadUnifiedWithNullAtEnd_ShouldReturnCorrectValues

        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++]);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:32,代码来源:ShapeReaderTests.cs

示例13: ReadMBRs_ReadPoint_ShouldReturnCorrectValues

        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++]);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:35,代码来源:ShapeReaderTests.cs

示例14: ReadShapeAtIndex_ReadUnifiedCheckMaterialWithNulLInMiddle_ShouldReturnBothShapesCorrectly

        public void ReadShapeAtIndex_ReadUnifiedCheckMaterialWithNulLInMiddle_ShouldReturnBothShapesCorrectly()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterialNullInMiddle"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            IPolygon[] expectedResult = new Polygon[]
			{
				new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(-0.815656565656566, -0.439393939393939),
						new Coordinate(-0.353535353535354, -0.795454545454545),
						new Coordinate(-0.888888888888889,-0.929292929292929),
						new Coordinate(-1.151515151515152, -0.419191919191919),
						new Coordinate(-0.815656565656566,-0.439393939393939),
					})),
				new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(0.068181818181818,0.578282828282829),
						new Coordinate(0.421717171717172,0.070707070707071),
						new Coordinate(-0.457070707070707,0.080808080808081),
						new Coordinate(0.068181818181818,0.578282828282829),
					}))
			};

            // Act.
            for (int i = 0; i < expectedResult.Length; i++)
            {
                IGeometry result = m_Reader.ReadShapeAtIndex(i, factory);

                Assert.IsNotNull(result);
                Assert.IsInstanceOf<IPolygon>(result);

                HelperMethods.AssertPolygonsEqual(expectedResult[i], result as IPolygon);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:37,代码来源:ShapeReaderTests.cs

示例15: ReadShapeAtIndex_ReadSecondUnifiedCheckMaterialShape_ShouldReturnTriangle

        public void ReadShapeAtIndex_ReadSecondUnifiedCheckMaterialShape_ShouldReturnTriangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(0.068181818181818,0.578282828282829),
						new Coordinate(0.421717171717172,0.070707070707071),
						new Coordinate(-0.457070707070707,0.080808080808081),
						new Coordinate(0.068181818181818,0.578282828282829),
					}));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(1, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf<IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:22,代码来源:ShapeReaderTests.cs


注:本文中的IO.ShapeFile.Extended.ShapeReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。