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


C# IGeometry.ExtractCoordinates方法代码示例

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


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

示例1: Write

 /// <summary>
 /// Writes to the given stream the equilivent shape file record given a Geometry object.
 /// </summary>
 /// <param name="geometry">The geometry object to write.</param>
 /// <param name="file">The stream to write to.</param>
 ///// <param name="geometryFactory">The geometry factory to use.</param>
 public override void Write(IGeometry geometry, BinaryWriter file)//, IGeometryFactory geometryFactory)
 {
     file.Write(int.Parse(Enum.Format(typeof(ShapeType), this.ShapeType, "d")));
     ICoordinate[] coords = geometry.ExtractCoordinates();
     if (coords.Length > 0)
     {
         ICoordinate external = coords[0];// geometry.Coordinates[0];
         file.Write(external.X);
         file.Write(external.Y);
     }
 }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:17,代码来源:PointHandler.cs

示例2: GetLength

 /// <summary>
 /// Получить длину в байтах геометрического объекта (для записи в файл)
 /// </summary>
 /// <param name="geometry">Геометрический объект </param>
 /// <returns>
 /// Длина для 16битового формата </returns>
 public override int GetLength(IGeometry geometry)
 {			
     return (20 + geometry.ExtractCoordinates().Length /*.NumPoints*/ * 8); // 20 => shapetype(2) + bbox (4*4) + numpoints
 }					
开发者ID:gkrsu,项目名称:maparound.core,代码行数:10,代码来源:MultiPointHandler.cs

示例3: EuclideanDistance

        /// <summary>
        /// Calculates the Euclidean distance between two geometries.
        /// </summary>
        /// <param name="geometry1">First geometry</param>
        /// <param name="geometry2">Second geometry</param>
        /// /// <param name="threshold">The threshold value of the distance 
        /// at which a search is terminated</param>
        /// <returns>A distance between geometries (less than or equal to the threshold value)</returns>
        public static double EuclideanDistance(IGeometry geometry1, IGeometry geometry2, double threshold)
        {
            if (threshold < 0)
                throw new ArgumentOutOfRangeException("threshold");

            double result = 0;
            checkGeometry(geometry1);
            checkGeometry(geometry2);

            List<ICoordinate> points1 = new List<ICoordinate>(geometry1.ExtractCoordinates());
            List<ICoordinate> points2 = new List<ICoordinate>(geometry2.ExtractCoordinates());

            if (geometry1 is Polygon || geometry2 is Polygon)
            {
                if (geometry1.GetBoundingRectangle().Intersects(geometry2.GetBoundingRectangle()))
                    if (geometry1 is Polygon)
                    {
                        if (hasPointInside((Polygon)geometry1, points2))
                            return 0;
                    }
                    else
                    {
                        if (hasPointInside((Polygon)geometry2, points1))
                            return 0;
                    }
            }

            result = calculateDistanceBrutForce(geometry1, geometry2, points1, points2, threshold);

            return result;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:39,代码来源:DataStructures.cs


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