本文整理汇总了C#中Ordinates类的典型用法代码示例。如果您正苦于以下问题:C# Ordinates类的具体用法?C# Ordinates怎么用?C# Ordinates使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Ordinates类属于命名空间,在下文中一共展示了Ordinates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadPoint
/// <summary>
/// Function to read a <see cref="IPoint"/> from a ShapeFile stream using the specified <paramref name="reader"/>.
/// </summary>
/// <param name="reader">The reader to use</param>
/// <param name="ordinates">The ordinates to read</param>
/// <returns>The read point geometry</returns>
protected IGeometry ReadPoint(BinaryReader reader, Ordinates ordinates)
{
var buffer = new CoordinateBuffer(1, ShapeFileConstants.NoDataBorder, true);
ReadCoordinates(reader, 1, new[] { 0 }, ordinates, buffer);
IGeometry point = _factory.CreatePoint(buffer.ToSequence());
return point;
}
示例2: OrdinatesToDimension
/// <summary>
/// Translates the <paramref name="ordinates"/>-flag to a number of dimensions.
/// </summary>
/// <param name="ordinates">The ordinates flag</param>
/// <returns>The number of dimensions</returns>
public static int OrdinatesToDimension(Ordinates ordinates)
{
var ret = 2;
if ((ordinates & Ordinates.Z) != 0) ret++;
if ((ordinates & Ordinates.M) != 0) ret++;
return ret;
}
示例3: Write
/// <summary>
/// Writes a binary encoded PostGIS of the given <paramref name="geometry"/> to to an array of bytes.
/// </summary>
/// <param name="geometry">The geometry</param>
/// <param name="ordinates">The ordinates of each geometry's coordinate. <see cref="Ordinates.XY"/> area always written.</param>
/// <returns>An array of bytes.</returns>
private byte[] Write(IGeometry geometry, Ordinates ordinates)
{
var coordinateSpace = 8*OrdinatesUtility.OrdinatesToDimension(ordinates);
var bytes = GetBytes(geometry, coordinateSpace);
Write(geometry, ordinates, new MemoryStream(bytes));
return bytes;
}
示例4: ToOrdinateArray
/// <summary>
/// Converts an <see cref="Ordinates"/> encoded flag to an array of <see cref="Ordinate"/> indices.
/// </summary>
/// <param name="ordinates">The ordinate flags</param>
/// <param name="maxEval">The maximum oridinate flag that is to be checked</param>
/// <returns>The ordinate indices</returns>
public static Ordinate[] ToOrdinateArray(Ordinates ordinates, int maxEval = 4)
{
if (maxEval > 32) maxEval = 32;
var intOrdinates = (int) ordinates;
var ordinateList = new List<Ordinate>(maxEval);
for (var i = 0; i < maxEval; i++)
{
if ((intOrdinates & (1<<i)) != 0) ordinateList.Add((Ordinate)i);
}
return ordinateList.ToArray();
}
示例5: ReadLineString
/// <summary>
/// Function to read a <see cref="ILineString"/> or <see cref="IMultiLineString"/> from a ShapeFile stream using the specified <paramref name="reader"/>.
/// </summary>
/// <param name="reader">The reader to use</param>
/// <param name="ordinates">The ordinates to read</param>
/// <returns>The read lineal geometry</returns>
protected IGeometry ReadLineString(BinaryReader reader, Ordinates ordinates)
{
/*var bbox = */ ReadBoundingBox(reader); // Jump boundingbox
var numParts = ReadNumParts(reader);
var numPoints = ReadNumPoints(reader);
var indexParts = ReadIndexParts(reader, numParts, numPoints);
var buffer = new CoordinateBuffer(numPoints, ShapeFileConstants.NoDataBorder, true);
ReadCoordinates(reader, numPoints, indexParts, ordinates, buffer);
if (numParts == 1)
return _factory.CreateLineString(buffer.ToSequence());
return CreateMultiLineString(buffer.ToSequences());
}
示例6: GeometryType
/// <summary>
/// Inititalizes this instance based on an <see cref="OgcGeometryType"/> and an SRID indicator
/// </summary>
/// <param name="ogcGeometryType">The OGC geometry type</param>
/// <param name="ordinates">The ordinates flag.</param>
/// <param name="hasSrid">Indicator if a SRID is supplied.</param>
public GeometryType(OgcGeometryType ogcGeometryType, Ordinates ordinates, bool hasSrid)
{
_geometrytype = (uint) ogcGeometryType;
if ((ordinates & Ordinates.Z) != 0)
{
HasWkbZ = true;
HasEwkbM = true;
}
if ((ordinates & Ordinates.M) != 0)
{
HasWkbZ = true;
HasEwkbM = true;
}
HasEwkbSrid = hasSrid;
}
示例7: DotSpatialAffineCoordinateSequence
/// <summary>
/// Constructs a sequence of a given size, populated with new Coordinates.
/// </summary>
/// <param name="size">The size of the sequence to create.</param>
/// <param name="ordinates">The kind of ordinates.</param>
public DotSpatialAffineCoordinateSequence(int size, Ordinates ordinates)
{
_xy = new double[2 * size];
_ordinates = ordinates;
if ((ordinates & Ordinates.Z) != 0)
{
_z = new double[size];
for (var i = 0; i < size; i++)
_z[i] = Coordinate.NullOrdinate;
}
if ((ordinates & Ordinates.M) != 0)
{
_m = new double[size];
for (var i = 0; i < size; i++)
_m[i] = Coordinate.NullOrdinate;
}
}
示例8: DotSpatialAffineCoordinateSequence
/// <summary>
/// Creates an instance of this class
/// </summary>
/// <param name="coordinates">The</param>
public DotSpatialAffineCoordinateSequence(IList<Coordinate> coordinates)
{
if (coordinates == null)
{
_xy = new double[0];
return;
}
_xy = new double[2 * coordinates.Count];
_z = new double[coordinates.Count];
var j = 0;
for (var i = 0; i < coordinates.Count; i++)
{
XY[j++] = coordinates[i].X;
XY[j++] = coordinates[i].Y;
Z[i] = coordinates[i].Z;
}
_ordinates = Ordinates.XYZ;
}
示例9: PostGis2GeometryHeader
public PostGis2GeometryHeader(IGeometry geometry, Ordinates handleOrdinates, bool isGeodetic)
{
Srid = geometry.SRID;
HasM = (handleOrdinates & Ordinates.Z) == Ordinates.Z; // geometry.HasM();
HasZ = (handleOrdinates & Ordinates.M) == Ordinates.M; // geometry.HasZ();
if (geometry.OgcGeometryType != OgcGeometryType.Point)
{
HasBoundingBox = true;
_envelope = geometry.EnvelopeInternal;
if (HasM)
_mInterval = geometry.GetMRange();
if (HasZ | isGeodetic)
_zInterval = geometry.GetZRange();
}
ComputeSize(geometry);
_factory = geometry.Factory;
}
示例10: 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));
}
}
示例11: GetOrdinate
/**
* TODO: I'd like to see this method added to the base Coordinate class
* Returns the ordinate value specified in this Coordinate instance. The
* index of the desired ordinates are specified in the CoordinateSequence
* class; hence CoodinateSequence.X returns the x ordinate,
* CoodinateSequence.Y the y ordinate, CoodinateSequence.Z the z ordinate,
* and CoodinateSequence.M the M ordinate. Note that the dimension may not
* imply the desired ordinate in the case where one is using a 2 dimensional
* geometry with a measure value. Therefore, these constants are highly
* recommended.
*
* @param ordinateIndex
* the desired ordinate index.
* @return the value of stored in the ordinate index. Incorrect or unused
* indexes shall return Double.NaN
*/
public double GetOrdinate(Ordinates ordinateIndex)
{
switch (ordinateIndex)
{
case Ordinates.X:
return this.X;
case Ordinates.Y:
return this.Y;
case Ordinates.Z:
return this.Z;
case Ordinates.M:
return M;
}
return Double.NaN;
}
示例12: SetOrdinate
/**
* TODO: I'd like to see this method added to the base Coordinate class Sets
* the value for a given ordinate. This should be specified using the
* CoordinateSequence ordinate index constants.
*
* @param ordinateIndex
* the desired ordinate index.
* @param value
* the new ordinate value
* @throws IllegalArgumentException
* if the ordinateIndex value is incorrect
* @see #GetOrdinate(int)
*/
public void SetOrdinate(Ordinates ordinateIndex, double value)
{
switch (ordinateIndex)
{
case Ordinates.X:
this.X = value;
break;
case Ordinates.Y:
this.Y = value;
break;
case Ordinates.Z:
this.Z = value;
break;
case Ordinates.M:
M = value;
break;
default:
throw new ArgumentException("ordinateIndex");
}
}
示例13: GetOrdinate
/// <summary>
/// Returns the ordinate of a coordinate in this sequence.
/// Ordinate indices 0 and 1 are assumed to be X and Y.
/// Ordinates indices greater than 1 have user-defined semantics
/// (for instance, they may contain other dimensions or measure values).
/// </summary>
/// <param name="index">The coordinate index in the sequence.</param>
/// <param name="ordinate">The ordinate index in the coordinate (in range [0, dimension-1]).</param>
/// <returns></returns>
public double GetOrdinate(int index, Ordinates ordinate)
{
switch (ordinate)
{
case Ordinates.X:
return coordinates[index].X;
case Ordinates.Y:
return coordinates[index].Y;
case Ordinates.Z:
return coordinates[index].Z;
default:
return Double.NaN;
}
}
示例14: SetOrdinate
/// <summary>
/// Sets the value for a given ordinate of a coordinate in this sequence.
/// </summary>
/// <param name="index">The coordinate index in the sequence.</param>
/// <param name="ordinate">The ordinate index in the coordinate (in range [0, dimension-1]).</param>
/// <param name="value">The new ordinate value.</param>
public void SetOrdinate(int index, Ordinates ordinate, double value)
{
switch (ordinate)
{
case Ordinates.X:
coordinates[index].X = value;
break;
case Ordinates.Y:
coordinates[index].Y = value;
break;
case Ordinates.Z:
coordinates[index].Z = value;
break;
default:
throw new ArgumentException("invalid ordinate index: " + ordinate);
}
}
示例15: CreateLineal
private static IGeometry CreateLineal(Ordinates ordinates, bool empty)
{
switch (Rnd.Next(2))
{
case 0:
return CreateLineString(ordinates, empty);
default:
return CreateMultiLineString(ordinates, empty);
}
}