本文整理汇总了C#中Ordinates类的典型用法代码示例。如果您正苦于以下问题:C# Ordinates类的具体用法?C# Ordinates怎么用?C# Ordinates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ordinates类属于命名空间,在下文中一共展示了Ordinates类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:ShapeReader.cs
示例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;
}
开发者ID:leoliusg,项目名称:GeoAPI,代码行数:13,代码来源:OridinatesUtility.cs
示例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;
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:14,代码来源:PostGisWriter.cs
示例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();
}
开发者ID:leoliusg,项目名称:GeoAPI,代码行数:17,代码来源:OridinatesUtility.cs
示例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());
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:21,代码来源:ShapeReader.cs
示例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;
}
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:24,代码来源:GeometryType.cs
示例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;
}
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:23,代码来源:DotSpatialAffineCoordinateSequence.cs
示例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;
}
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:24,代码来源:DotSpatialAffineCoordinateSequence.cs
示例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;
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:20,代码来源:PostGis2GeometryHeader.cs
示例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));
}
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:22,代码来源:ShapeWriter.cs
示例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;
}
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:32,代码来源:MCoordinate.cs
示例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");
}
}
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:34,代码来源:MCoordinate.cs
示例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;
}
}
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:23,代码来源:CoordinateArraySequence.cs
示例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);
}
}
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:23,代码来源:CoordinateArraySequence.cs
示例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);
}
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:10,代码来源:ShapefileWriteTest.cs
示例16: Create
public ICoordinateSequence Create(int size, Ordinates ordinates)
{
throw new NotImplementedException();
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:4,代码来源:extendedcoordinatesequencefactory.cs
示例17: CreateRectangleRing
private static ILinearRing CreateRectangleRing(Ordinates ordinates, double x, double y, double width, double height, bool reverse = false)
{
var dx = Factory.PrecisionModel.MakePrecise(width / 2);
var dy = Factory.PrecisionModel.MakePrecise(height / 2);
var seq = CsFactory.Create(5, ordinates);
seq.SetOrdinate(0, Ordinate.X, Factory.PrecisionModel.MakePrecise(x - dx));
seq.SetOrdinate(0, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y - dy));
seq.SetOrdinate(1, Ordinate.X, Factory.PrecisionModel.MakePrecise(x - dx));
seq.SetOrdinate(1, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y + dy));
seq.SetOrdinate(2, Ordinate.X, Factory.PrecisionModel.MakePrecise(x + dx));
seq.SetOrdinate(2, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y + dy));
seq.SetOrdinate(3, Ordinate.X, Factory.PrecisionModel.MakePrecise(x + dx));
seq.SetOrdinate(3, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y - dy));
seq.SetOrdinate(4, Ordinate.X, Factory.PrecisionModel.MakePrecise(x - dx));
seq.SetOrdinate(4, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y - dy));
if ((ordinates & (Ordinates.Z | Ordinates.M)) != Ordinates.None)
{
var k = 0;
for (; k < 4; k++)
{
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.Z, RandomOrdinate(Ordinate.Z, Factory.PrecisionModel));
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.M, RandomOrdinate(Ordinate.M, Factory.PrecisionModel));
}
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.Z, seq.GetOrdinate(0, Ordinate.Z));
if ((ordinates & Ordinates.M) == Ordinates.M)
seq.SetOrdinate(k, Ordinate.M, seq.GetOrdinate(0, Ordinate.M));
}
return Factory.CreateLinearRing(reverse ? seq.Reversed() : seq);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:36,代码来源:ShapefileWriteTest.cs
示例18: CreatePolygon
private static IGeometry CreatePolygon(Ordinates ordinates, bool empty, int nextKind = -1)
{
if (empty)
{
Factory.CreatePolygon((ICoordinateSequence)null);
}
if (nextKind == -1) nextKind = Rnd.Next(0, 5);
var x = RandomOrdinate(Ordinate.X, Factory.PrecisionModel);
var y = RandomOrdinate(Ordinate.Y, Factory.PrecisionModel);
switch (nextKind)
{
case 0: // circle
var ring = CreateCircleRing(ordinates, x, y, 3 * Rnd.NextDouble());
return Factory.CreatePolygon(ring, null);
case 1: // rectangle
ring = CreateRectangleRing(ordinates, x, y, 6 * Rnd.NextDouble(), 3 * Rnd.NextDouble());
return Factory.CreatePolygon(ring, null);
case 2: // cirle with hole
var radius = 3 * Rnd.NextDouble();
var shell = CreateCircleRing(ordinates, x, y, radius);
var hole = CreateCircleRing(ordinates, x, y, 0.66 * radius, true);
return Factory.CreatePolygon(shell, new[] { hole });
case 3: // rectanglee with hole
var width = 6 * Rnd.NextDouble();
var height = 3 * Rnd.NextDouble();
shell = CreateRectangleRing(ordinates, x, y, width, height);
hole = CreateRectangleRing(ordinates, x, y, 0.66 * width, 0.66 * height, true);
return Factory.CreatePolygon(shell, new[] { hole });
case 4: // rectanglee with hole
width = 6 * Rnd.NextDouble();
height = 3 * Rnd.NextDouble();
shell = CreateRectangleRing(ordinates, x, y, width, height);
hole = CreateCircleRing(ordinates, x, y, 0.33 * Math.Min(width, height), true);
return Factory.CreatePolygon(shell, new[] { hole });
default:
throw new NotSupportedException();
}
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:40,代码来源:ShapefileWriteTest.cs
示例19: CreateCircleRing
private static ILinearRing CreateCircleRing(Ordinates ordinates, double x, double y, double radius, bool reverse = false)
{
var seq = CsFactory.Create(4 * 12 + 1, ordinates);
var angle = Math.PI * 2;
const double quandrantStep = Math.PI / 2d / 12d;
var k = 0;
for (var i = 0; i < 4; i++)
{
for (var j = 0; j < 12; j++)
{
var dx = radius * Math.Cos(angle);
var dy = radius * Math.Sin(angle);
seq.SetOrdinate(k, Ordinate.X, Factory.PrecisionModel.MakePrecise(x + dx));
seq.SetOrdinate(k, Ordinate.Y, Factory.PrecisionModel.MakePrecise(y + dy));
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.Z, RandomOrdinate(Ordinate.Z, Factory.PrecisionModel));
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.M, RandomOrdinate(Ordinate.M, Factory.PrecisionModel));
k++;
angle -= quandrantStep;
}
}
seq.SetOrdinate(k, Ordinate.X, seq.GetOrdinate(0, Ordinate.X));
seq.SetOrdinate(k, Ordinate.Y, seq.GetOrdinate(0, Ordinate.Y));
if ((ordinates & Ordinates.Z) == Ordinates.Z)
seq.SetOrdinate(k, Ordinate.Z, seq.GetOrdinate(0, Ordinate.Z));
if ((ordinates & Ordinates.M) == Ordinates.M)
seq.SetOrdinate(k, Ordinate.M, seq.GetOrdinate(0, Ordinate.M));
return Factory.CreateLinearRing(reverse ? seq.Reversed() : seq);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:31,代码来源:ShapefileWriteTest.cs
示例20: CreateShapes
public static IGeometryCollection CreateShapes(OgcGeometryType type, Ordinates ordinates, int number = 50)
{
var empty = new bool[number];
empty[Rnd.Next(2, number / 2)] = true;
empty[Rnd.Next(number / 2, number)] = true;
var result = new IGeometry[number];
for (var i = 0; i < number; i++)
{
switch (type)
{
case OgcGeometryType.Point:
result[i] = CreatePoint(ordinates, empty[i]);
break;
case OgcGeometryType.MultiPoint:
result[i] = CreateMultiPoint(ordinates, empty[i]);
break;
case OgcGeometryType.LineString:
case OgcGeometryType.MultiLineString:
result[i] = CreateLineal(ordinates, empty[i]);
break;
case OgcGeometryType.Polygon:
case OgcGeometryType.MultiPolygon:
result[i] = CreatePolygonal(ordinates, empty[i]);
break;
}
/*
// Ensure no empty elements
if (result[i] == null || (result[i].IsEmpty && result[i].OgcGeometryType == OgcGeometryType.GeometryCollection))
i--;
*/
// Ensure not null and not geometry collection
if (result[i] == null || result[i].OgcGeometryType == OgcGeometryType.GeometryCollection)
i--;
}
return Factory.CreateGeometryCollection(result);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:40,代码来源:ShapefileWriteTest.cs
注:本文中的Ordinates类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论