本文整理汇总了C#中ICoordinateSequence.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSequence.GetX方法的具体用法?C# ICoordinateSequence.GetX怎么用?C# ICoordinateSequence.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICoordinateSequence
的用法示例。
在下文中一共展示了ICoordinateSequence.GetX方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToLineString
/// <summary>
/// Generates the WKT for a N-point <c>LineString</c> specified by a <see cref="ICoordinateSequence"/>.
/// </summary>
/// <param name="seq">The sequence to write.</param>
/// <returns>The WKT</returns>
public static String ToLineString(ICoordinateSequence seq)
{
var buf = new StringBuilder();
buf.Append("LINESTRING");
if (seq.Count == 0)
buf.Append(" EMPTY");
else
{
buf.Append("(");
for (var i = 0; i < seq.Count; i++)
{
if (i > 0)
buf.Append(", ");
buf.Append(String.Format(CultureInfo.InvariantCulture, "{0} {1}", seq.GetX(i), seq.GetY(i)));
}
buf.Append(")");
}
return buf.ToString();
}
示例2: ToLineString
/// <summary>
/// Generates the WKT for a N-point <c>LineString</c>.
/// </summary>
/// <param name="seq">The sequence to output.</param>
/// <returns></returns>
public static String ToLineString(ICoordinateSequence seq)
{
StringBuilder buf = new StringBuilder();
buf.Append("LINESTRING");
if (seq.Count == 0)
buf.Append(" EMPTY");
else
{
buf.Append("(");
for (int i = 0; i < seq.Count; i++)
{
if (i > 0)
buf.Append(",");
buf.Append(seq.GetX(i) + " " + seq.GetY(i));
}
buf.Append(")");
}
return buf.ToString();
}
示例3: WriteCoordinates
protected void WriteCoordinates(ICoordinateSequence sequence, BinaryWriter writer, Ordinates ordinates)
{
for (var i = 0; i < sequence.Count; i++)
{
writer.Write(sequence.GetX(i));
writer.Write(sequence.GetY(i));
}
if ((ordinates & Ordinates.Z) == Ordinates.Z)
{
WriteInterval(sequence, Ordinate.Z, writer);
for (var i = 0; i < sequence.Count; i++)
writer.Write(GetOrdinate(sequence, Ordinate.Z, i));
}
if ((ordinates & Ordinates.M) == Ordinates.M)
{
WriteInterval(sequence, Ordinate.M, writer);
for (var i = 0; i < sequence.Count; i++)
writer.Write(GetOrdinate(sequence, Ordinate.M, i));
}
}
示例4: Filter
public void Filter(ICoordinateSequence seq, int i)
{
seq.SetOrdinate(i, Ordinate.X, seq.GetX(i) + _xShift);
}
示例5: AppendCoordinate
///<summary>Appends the i'th coordinate from the sequence to the writer</summary>
/// <param name="seq">the <see cref="ICoordinateSequence"/> to process</param>
/// <param name="i">the index of the coordinate to write</param>
/// <param name="writer">writer the output writer to append to</param>
///<exception cref="IOException"></exception>
private void AppendCoordinate(ICoordinateSequence seq, int i, TextWriter writer)
{
writer.Write(WriteNumber(seq.GetX(i)) + " " + WriteNumber(seq.GetY(i)));
if (_outputDimension >= 3 && seq.Dimension >= 3)
{
double z = seq.GetOrdinate(i, Ordinate.Z);
if (!Double.IsNaN(z))
{
writer.Write(" ");
writer.Write(WriteNumber(z));
}
}
}
示例6: ExpandToInclude
public OctagonalEnvelope ExpandToInclude(ICoordinateSequence seq)
{
for (int i = 0; i < seq.Count; i++)
{
double x = seq.GetX(i);
double y = seq.GetY(i);
ExpandToInclude(x, y);
}
return this;
}
示例7: 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);
}
}
示例8: DotSpatialAffineCoordinateSequence
/// <summary>
/// Creates a sequence based on the given coordinate sequence.
/// </summary>
/// <param name="coordSeq">The coordinate sequence.</param>
public DotSpatialAffineCoordinateSequence(ICoordinateSequence coordSeq)
{
var dsCoordSeq = coordSeq as DotSpatialAffineCoordinateSequence;
var count = coordSeq.Count;
if (dsCoordSeq != null)
{
_xy = new double[2 * count];
Buffer.BlockCopy(dsCoordSeq._xy, 0, _xy, 0, 16 * count);
if (dsCoordSeq.Z != null)
{
_z = new double[dsCoordSeq.Count];
Buffer.BlockCopy(dsCoordSeq._z, 0, _z, 0, 8 * count);
}
if (dsCoordSeq.M != null)
{
_m = new double[dsCoordSeq.Count];
Buffer.BlockCopy(dsCoordSeq._m, 0, _m, 0, 8 * count);
}
_ordinates = dsCoordSeq._ordinates;
return;
}
_xy = new double[2 * coordSeq.Count];
if ((coordSeq.Ordinates & Ordinates.Z) != 0)
_z = new double[coordSeq.Count];
if ((coordSeq.Ordinates & Ordinates.M) != 0)
_m = new double[coordSeq.Count];
var j = 0;
for (var i = 0; i < coordSeq.Count; i++)
{
_xy[j++] = coordSeq.GetX(i);
_xy[j++] = coordSeq.GetY(i);
if (_z != null) _z[i] = coordSeq.GetOrdinate(i, Ordinate.Z);
if (_m != null) _m[i] = coordSeq.GetOrdinate(i, Ordinate.M);
}
}
示例9: IsEqual
/// <summary>
/// Tests for equality using all supported accessors,
/// to provides test coverage for them.
/// </summary>
/// <param name="seq"></param>
/// <param name="coords"></param>
/// <returns></returns>
bool IsEqual(ICoordinateSequence seq, Coordinate[] coords)
{
if (seq.Count != coords.Length)
return false;
Coordinate p = new Coordinate();
for (int i = 0; i < seq.Count; i++)
{
if (!coords[i].Equals(seq.GetCoordinate(i)))
return false;
// Ordinate named getters
if (coords[i].X != seq.GetX(i))
return false;
if (coords[i].Y != seq.GetY(i))
return false;
// Ordinate indexed getters
if (coords[i].X != seq.GetOrdinate(i, Ordinate.X))
return false;
if (coords[i].Y != seq.GetOrdinate(i, Ordinate.Y))
return false;
if (coords[i].Z != seq.GetOrdinate(i, Ordinate.Z))
return false;
// Coordinate getter
seq.GetCoordinate(i, p);
if (coords[i].X != p.X)
return false;
if (coords[i].Y != p.Y)
return false;
//TODO: Remove commented line below when NTS supports Z ordinates in CoordinateArraySequence.GetCoordinate and PackedCoordinateSequence.GetCoordinate
//if (coords[i].Z != p.Z) return false;
}
return true;
}
示例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);
}
}