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


C# IO.ShapeFile.Extended.ShapeReader.ReadAllShapes方法代码示例

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


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

示例1: ReadAllShapes_ReadAllPolygonsFromUnifiedWithNullAtEnd_ShouldReturnCorrectValues

        public void ReadAllShapes_ReadAllPolygonsFromUnifiedWithNullAtEnd_ShouldReturnCorrectValues()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("UnifiedChecksMaterial.shp", ShpFiles.Read("UnifiedChecksMaterialNullAtEnd"));
            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.
            IGeometry[] shapes = m_Reader.ReadAllShapes(factory).ToArray();

            Assert.IsNotNull(shapes);
            Assert.AreEqual(shapes.Length, 2);

            for (int i = 0; i < shapes.Length; i++)
            {
                Assert.IsInstanceOf<IPolygon>(shapes[i]);
                HelperMethods.AssertPolygonsEqual(shapes[i] as IPolygon, expectedResult[i]);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:38,代码来源:ShapeReaderTests.cs

示例2: 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

示例3: ReadAllShapes_ReadPointZMWithMissingMValues_ShouldReturnCorrectValues

        public void ReadAllShapes_ReadPointZMWithMissingMValues_ShouldReturnCorrectValues()
        {
            // Arrange.
            IGeometryFactory factory = new GeometryFactory();
            m_TmpFile = new TempFileWriter("shape_PointZMWithMissingMValue.shp", ShpFiles.Read("shape_pointZM_MissingM values"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            double errorMargin = Math.Pow(10, -6);

            double[,] expectedValues = {{-11348202.6085706, 4503476.68482375},
									    {-601708.888562033, 3537065.37906758},
										{-7366588.02885523, -637831.461799072}};

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

            // Assert.
            Assert.IsNotNull(shapes);
            IGeometry[] shapesArr = shapes.ToArray();
            Assert.AreEqual(shapesArr.Length, 3);

            for (int i = 0; i < shapesArr.Length; i++)
            {
                Assert.IsInstanceOf<IPoint>(shapesArr[i]);
                IPoint currPoint = shapesArr[i] as IPoint;
                HelperMethods.AssertDoubleValuesEqual(currPoint.X, expectedValues[i, 0], errorMargin);
                HelperMethods.AssertDoubleValuesEqual(currPoint.Y, expectedValues[i, 1], errorMargin);
                HelperMethods.AssertDoubleValuesEqual(currPoint.Z, 0);
                HelperMethods.AssertDoubleValuesEqual(currPoint.M, Double.NaN);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:30,代码来源:ShapeReaderTests.cs

示例4: ReadAllShapes_ReadPointM_ShouldReturnCorrectValues

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

            double[,] expectedValues = {{-133.606621226874, 66.8997078870497},
									    {-68.0564751703992, 56.4888023369036},
										{-143.246348588121, 40.6796494644596},
										{-82.3232716650438, -21.014605647517}};

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

            // Assert.
            Assert.IsNotNull(shapes);
            IGeometry[] shapesArr = shapes.ToArray();
            Assert.AreEqual(shapesArr.Length, 4);

            for (int i = 0; i < shapesArr.Length; i++)
            {
                Assert.IsInstanceOf<IPoint>(shapesArr[i]);
                IPoint currPoint = shapesArr[i] as IPoint;
                HelperMethods.AssertDoubleValuesEqual(currPoint.X, expectedValues[i, 0]);
                HelperMethods.AssertDoubleValuesEqual(currPoint.Y, expectedValues[i, 1]);
                HelperMethods.AssertDoubleValuesEqual(currPoint.Z, Double.NaN);
                HelperMethods.AssertDoubleValuesEqual(currPoint.M, Double.NaN);
            }
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:30,代码来源:ShapeReaderTests.cs

示例5: ReadAllShapes_ReadEmptyShapeFile_ShouldReturnEmptyEnumerable

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

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

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

示例6: ReadAllShapes_SendNullFactory_ShouldThrowException

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

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

示例7: 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

示例8: 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

示例9: ReadAllShapes_SendNullFactory_ShouldThrowException

        public void ReadAllShapes_SendNullFactory_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));

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


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