本文整理汇总了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);
}
}
示例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
}
示例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;
}