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


C# Coordinate.GetLength方法代码示例

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


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

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


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