本文整理汇总了C#中ICoordinateSequence.ToCoordinateArray方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSequence.ToCoordinateArray方法的具体用法?C# ICoordinateSequence.ToCoordinateArray怎么用?C# ICoordinateSequence.ToCoordinateArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICoordinateSequence
的用法示例。
在下文中一共展示了ICoordinateSequence.ToCoordinateArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCCW
/// <summary>
/// Computes whether a ring defined by a coordinate sequence is oriented counter-clockwise.
/// </summary>>
/// <remarks>
/// <list type="Bullet">
/// <item>The list of points is assumed to have the first and last points equal.</item>
/// <item>This will handle coordinate lists which contain repeated points.</item>
/// </list>
/// <para>This algorithm is only guaranteed to work with valid rings. If the ring is invalid (e.g. self-crosses or touches), the computed result may not be correct.</para>
/// </remarks>
/// <param name="ring">A coordinate sequence froming a ring</param>
/// <returns>true if the ring is oriented <see cref="Orientation.CounterClockwise"/></returns>
/// <exception cref="ArgumentException">If there are too few points to determine orientation (<4)</exception>
public static bool IsCCW(ICoordinateSequence ring)
{
return IsCCW(ring.ToCoordinateArray());
}
示例2: TransformCoordinates
/// <summary>
///
/// </summary>
/// <param name="coords"></param>
/// <param name="parent"></param>
/// <returns></returns>
protected override ICoordinateSequence TransformCoordinates(ICoordinateSequence coords, IGeometry parent)
{
Coordinate[] inputPts = coords.ToCoordinateArray();
Coordinate[] newPts = inputPts.Length == 0
? new Coordinate[0]
: DouglasPeuckerLineSimplifier.Simplify(inputPts, _container.DistanceTolerance);
return Factory.CoordinateSequenceFactory.Create(newPts);
}
示例3: Create
/// <summary>
/// Returns a CoordinateSequence based on the given coordinate sequence; whether or not the
/// array is copied is implementation-dependent.
/// </summary>
/// <param name="coordSeq"></param>
/// <returns></returns>
public ICoordinateSequence Create(ICoordinateSequence coordSeq)
{
if (type == PackedType.Double)
return new PackedDoubleCoordinateSequence(coordSeq.ToCoordinateArray(), dimension);
else return new PackedFloatCoordinateSequence(coordSeq.ToCoordinateArray(), dimension);
}
示例4: Add
private ICoordinateSequence Add(ICoordinateSequence seq1, ICoordinateSequence seq2)
{
if (seq1 == null)
{
return seq2;
}
if (seq2 == null)
{
return seq1;
}
Coordinate[] c1 = seq1.ToCoordinateArray();
Coordinate[] c2 = seq2.ToCoordinateArray();
Coordinate[] c3 = new Coordinate[c1.Length + c2.Length];
Array.Copy(c1, 0, c3, 0, c1.Length);
Array.Copy(c2, 0, c3, c1.Length, c2.Length);
return factory.CoordinateSequenceFactory.Create(c3);
}
示例5: TransformCoordinates
protected override ICoordinateSequence TransformCoordinates(ICoordinateSequence coords, IGeometry parent)
{
Coordinate[] inputPts = coords.ToCoordinateArray();
Coordinate[] newPts;
if (inputPts.Length == 0)
newPts = new Coordinate[0];
else newPts = VWLineSimplifier.Simplify(inputPts, _distanceTolerance);
return Factory.CoordinateSequenceFactory.Create(newPts);
}
示例6: TransformCoordinates
/// <summary>
///
/// </summary>
/// <param name="coords"></param>
/// <param name="parent"></param>
/// <returns></returns>
protected override ICoordinateSequence TransformCoordinates(ICoordinateSequence coords, IGeometry parent)
{
ICoordinate[] srcPts = coords.ToCoordinateArray();
ICoordinate[] newPts = SnapLine(srcPts, snapPts);
return factory.CoordinateSequenceFactory.Create(newPts);
}
示例7: reverse
///** Convience method for STRUCT construction. */
//private STRUCT toSTRUCT( Datum attributes[], String dataType )
// throws SQLException
//{
// if( dataType.startsWith("*.")){
// dataType = "DRA."+dataType.substring(2);//TODO here
// }
// StructDescriptor descriptor =
// StructDescriptor.createDescriptor( dataType, connection );
// return new STRUCT( descriptor, connection, attributes );
//}
///**
// * Convience method for ARRAY construction.
// * <p>
// * Compare and contrast with toORDINATE - which treats <code>Double.NaN</code>
// * as<code>NULL</code></p>
// */
//private ARRAY toARRAY( double doubles[], String dataType )
// throws SQLException
//{
// ArrayDescriptor descriptor =
// ArrayDescriptor.createDescriptor( dataType, connection );
// return new ARRAY( descriptor, connection, doubles );
//}
///**
// * Convience method for ARRAY construction.
// */
//private ARRAY toARRAY( int ints[], String dataType )
// throws SQLException
//{
// ArrayDescriptor descriptor =
// ArrayDescriptor.createDescriptor( dataType, connection );
// return new ARRAY( descriptor, connection, ints );
//}
///**
// * Convience method for NUMBER construction.
// * <p>
// * Double.NaN is represented as <code>NULL</code> to agree
// * with JTS use.</p>
// */
//private NUMBER toNUMBER( double number ) throws SQLException{
// if( Double.isNaN( number )){
// return null;
// }
// return new NUMBER( number );
//}
/**
* reverses the coordinate order
*
* @param factory
* @param sequence
*
* @return CoordinateSequence reversed sequence
*/
private ICoordinateSequence reverse(ICoordinateSequenceFactory factory, ICoordinateSequence sequence)
{
var list = new CoordinateList(sequence.ToCoordinateArray());
list.Reverse();
return factory.Create(list.ToCoordinateArray());
}
示例8: TransformCoordinates
protected override ICoordinateSequence TransformCoordinates(
ICoordinateSequence coords, IGeometry parent)
{
var inputPts = coords.ToCoordinateArray();
var newPts = Densifier
.DensifyPoints(inputPts, _distanceTolerance, parent.PrecisionModel);
// prevent creation of invalid linestrings
if (parent is ILineString && newPts.Length == 1)
{
newPts = new Coordinate[0];
}
return Factory.CoordinateSequenceFactory.Create(newPts);
}
示例9: PerformTest
private static void PerformTest(ICoordinateSequence sequence)
{
if (sequence == null)
throw new ArgumentNullException("sequence");
Coordinate[] coordinates = sequence.ToCoordinateArray();
NodedSegmentString segmentString = new NodedSegmentString(coordinates, null);
Stopwatch watch = new Stopwatch();
NodingValidator validator = new NodingValidator(new[] { segmentString });
validator.CheckValid();
watch.Start();
validator.CheckValid();
watch.Stop();
Console.WriteLine("NodingValidator.CheckValid => ElapsedMilliseconds: {0}", watch.ElapsedMilliseconds);
BasicSegmentString segmentStringBasic = new BasicSegmentString(coordinates, null);
FastNodingValidator fastValidator = new FastNodingValidator(new[] { segmentStringBasic });
watch.Reset(); watch.Start();
fastValidator.CheckValid();
watch.Stop();
Console.WriteLine("FastNodingValidator.CheckValid => ElapsedMilliseconds: {0}", watch.ElapsedMilliseconds);
}