本文整理汇总了C#中ICoordinateSequence.SetOrdinate方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSequence.SetOrdinate方法的具体用法?C# ICoordinateSequence.SetOrdinate怎么用?C# ICoordinateSequence.SetOrdinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICoordinateSequence
的用法示例。
在下文中一共展示了ICoordinateSequence.SetOrdinate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyToSequence
private static ICoordinateSequence CopyToSequence(Coordinate[] coords, ICoordinateSequence sequence)
{
for (int i = 0; i < coords.Length; i++)
{
sequence.SetOrdinate(i, Ordinate.X, coords[i].X);
sequence.SetOrdinate(i, Ordinate.Y, coords[i].Y);
}
return sequence;
}
示例2: Swap
/// <summary>
/// Swaps two coordinates in a sequence.
/// </summary>
/// <param name="seq"></param>
/// <param name="i"></param>
/// <param name="j"></param>
public static void Swap(ICoordinateSequence seq, int i, int j)
{
if (i == j)
return;
for (int dim = 0; dim < seq.Dimension; dim++)
{
double tmp = seq.GetOrdinate(i, (Ordinates)dim);
seq.SetOrdinate(i, (Ordinates)dim, seq.GetOrdinate(j, (Ordinates)dim));
seq.SetOrdinate(j, (Ordinates)dim, tmp);
}
}
示例3: CopyCoord
///<summary>
/// Copies a coordinate of a <see cref="ICoordinateSequence"/> to another <see cref="ICoordinateSequence"/>.
/// The sequences may have different dimensions;
/// in this case only the common dimensions are copied.
///</summary>
/// <param name="src">The sequence to copy coordinate from</param>
/// <param name="srcPos">The index of the coordinate to copy</param>
/// <param name="dest">The sequence to which the coordinate should be copied to</param>
/// <param name="destPos">The index of the coordinate in <see paramref="dest"/></param>
public static void CopyCoord(ICoordinateSequence src, int srcPos, ICoordinateSequence dest, int destPos)
{
int minDim = Math.Min(src.Dimension, dest.Dimension);
for (int dim = 0; dim < minDim; dim++)
{
Ordinate ordinate = (Ordinate)dim;
double value = src.GetOrdinate(srcPos, ordinate);
dest.SetOrdinate(destPos, ordinate, value);
}
}
示例4: EnsureClosedSequence
/// <summary>
/// Function to return a coordinate sequence that is ensured to be closed.
/// </summary>
/// <param name="sequence">The base sequence</param>
/// <param name="factory">The factory to use in case we need to create a new sequence</param>
/// <returns>A closed coordinate sequence</returns>
private static ICoordinateSequence EnsureClosedSequence(ICoordinateSequence sequence,
ICoordinateSequenceFactory factory)
{
//This sequence won't serve a valid linear ring
if (sequence.Count < 3)
return null;
//The sequence is closed
var start = sequence.GetCoordinate(0);
var lastIndex = sequence.Count - 1;
var end = sequence.GetCoordinate(lastIndex);
if (start.Equals2D(end))
return sequence;
// The sequence is not closed
// 1. Test for a little offset, in that case simply correct x- and y- ordinate values
const double eps = 1E-7;
if (start.Distance(end) < eps)
{
sequence.SetOrdinate(lastIndex, Ordinate.X, start.X);
sequence.SetOrdinate(lastIndex, Ordinate.Y, start.Y);
return sequence;
}
// 2. Close the sequence by adding a new point, this is heavier
var newSequence = factory.Create(sequence.Count + 1, sequence.Ordinates);
var ordinates = OrdinatesUtility.ToOrdinateArray(sequence.Ordinates);
for (var i = 0; i < sequence.Count; i++)
{
foreach (var ordinate in ordinates)
newSequence.SetOrdinate(i, ordinate, sequence.GetOrdinate(i, ordinate));
}
foreach (var ordinate in ordinates)
newSequence.SetOrdinate(sequence.Count, ordinate, sequence.GetOrdinate(0, ordinate));
return newSequence;
}
示例5: Filter
public void Filter(ICoordinateSequence seq, int i)
{
seq.SetOrdinate(i, Ordinate.X, seq.GetX(i) + _xShift);
}
示例6: Transform
public ICoordinateSequence Transform(ICoordinateSequence coordinateSequence)
{
var clone = new Coordinate();
for (var i = 0; i < coordinateSequence.Count; i++)
{
clone.CoordinateValue = coordinateSequence.GetCoordinate(i);
clone = Transform(clone);
coordinateSequence.SetOrdinate(i, Ordinate.X, clone.X);
coordinateSequence.SetOrdinate(i, Ordinate.Y, clone.Y);
if (DimTarget > 2)
coordinateSequence.SetOrdinate(i, Ordinate.Z, clone.Z);
}
return coordinateSequence;
}
示例7: Filter
/// <summary>
///
/// </summary>
/// <param name="seq">The coordinate sequence</param>
public void Filter(ICoordinateSequence seq, int i)
{
var xp = seq.GetOrdinate(i, Ordinate.X) + _trans.X;
var yp = seq.GetOrdinate(i, Ordinate.Y) + _trans.Y;
seq.SetOrdinate(i, Ordinate.X, xp);
seq.SetOrdinate(i, Ordinate.Y, yp);
}
示例8: Filter
///<summary>
/// Rounds the Coordinates in the sequence to match the PrecisionModel
///</summary>
public void Filter(ICoordinateSequence seq, int i)
{
seq.SetOrdinate(i, Ordinate.X, _precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.X)));
seq.SetOrdinate(i, Ordinate.Y, _precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.Y)));
}
示例9: Filter
public void Filter(ICoordinateSequence seq, int i)
{
double x = seq.GetX(i);
double y = seq.GetY(i);
if (_ctx.IsGeo() && _normalizeGeomCoords)
{
double xNorm = DistanceUtils.NormLonDEG(x);
if (x != xNorm)
{
changed = true;
seq.SetOrdinate(i, Ordinate.X, xNorm);
}
double yNorm = DistanceUtils.NormLatDEG(y);
if (y != yNorm)
{
changed = true;
seq.SetOrdinate(i, Ordinate.Y, yNorm);
}
}
else
{
_ctx.VerifyX(x);
_ctx.VerifyY(y);
}
}
示例10: Filter
public void Filter(ICoordinateSequence seq, int i)
{
double x = seq.GetX(i);
double xNorm = _ctx.NormX(x);
if (x != xNorm)
{
changed = true;
seq.SetOrdinate(i, Ordinate.X, xNorm);
}
double y = seq.GetY(i);
double yNorm = _ctx.NormY(y);
if (y != yNorm)
{
changed = true;
seq.SetOrdinate(i, Ordinate.Y, yNorm);
}
}