本文整理汇总了C#中ILineString类的典型用法代码示例。如果您正苦于以下问题:C# ILineString类的具体用法?C# ILineString怎么用?C# ILineString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILineString类属于命名空间,在下文中一共展示了ILineString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Intersects
public bool Intersects(Coordinate pt, ILineString ring)
{
var seq = ring.CoordinateSequence;
var seqProj = Project(seq, _facingPlane);
Coordinate ptProj = Project(pt, _facingPlane);
return Location.Exterior != RayCrossingCounter.LocatePointInRing(ptProj, seqProj);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:PlanarPolygon3D.cs
示例2: TransformToImageI
public static Point[] TransformToImageI(ILineString line, Map map, bool simplifyGeometry, ref int pointCount)
{
var length = line.Coordinates.Length;
var points = new Point[length];
points[0] = WorldtoMap(line.Coordinates[0], map);
Point pt = points[0];
Point pt2 = pt;
pointCount = 1;
int i = 1;
for (; i < length - 1; i++)
{
pt = WorldtoMap(line.Coordinates[i], map);
if (!simplifyGeometry || Math.Abs(pt2.X - pt.X) > 0 || Math.Abs(pt2.Y - pt.Y) > 0)
{
points[pointCount] = pt;
pointCount++;
pt2 = pt;
}
}
if (length > 1)
points[pointCount++] = WorldtoMap(line.Coordinates[i], map);
return points;
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:Transform.cs
示例3: BuildGrid
private IGeometry BuildGrid()
{
var lines = new ILineString[_numLines * 2];
int index = 0;
for (int i = 0; i < _numLines; i++)
{
Coordinate p0 = new Coordinate(GetRandOrdinate(), 0);
Coordinate p1 = new Coordinate(GetRandOrdinate(), GridWidth);
ILineString line = _geomFactory.CreateLineString(new [] { p0, p1 });
lines[index++] = line;
}
for (int i = 0; i < _numLines; i++)
{
Coordinate p0 = new Coordinate(0, GetRandOrdinate());
Coordinate p1 = new Coordinate(GridWidth, GetRandOrdinate());
ILineString line = _geomFactory.CreateLineString(new [] { p0, p1 });
lines[index++] = line;
}
IMultiLineString ml = _geomFactory.CreateMultiLineString(lines);
_grid = ml.Buffer(_lineWidth);
var wktWriter = new WKTWriter(2) {Formatted = true, MaxCoordinatesPerLine = 6};
if (Verbose)
Console.WriteLine(wktWriter.Write(_grid));
return _grid;
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:29,代码来源:PerturbedGridPolygonBuilder.cs
示例4: Buffer
/// <summary>
/// </summary>
/// <param name="line">the line to buffer</param>
/// <param name="startWidth">the buffer width at the start of the line</param>
/// <param name="endWidth">the buffer width at the end of the line</param>
/// <returns>The variable-width buffer polygon</returns>
public static IGeometry Buffer(ILineString line, double startWidth,
double endWidth)
{
var width = Interpolate(line, startWidth, endWidth);
var vb = new VariableWidthBuffer(line, width);
return vb.GetResult();
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:VariableWidthBuffer.cs
示例5: SqlGeometryToGeometryMultiLineString
private static IMultiLineString SqlGeometryToGeometryMultiLineString(SqlGeometry geometry, GeometryFactory factory)
{
ILineString[] lineStrings = new ILineString[geometry.STNumGeometries().Value];
for (int i = 1; i <= lineStrings.Length; i++)
lineStrings[i - 1] = SqlGeometryToGeometryLineString(geometry.STGeometryN(i), factory);
return factory.CreateMultiLineString(lineStrings);
}
开发者ID:interworks,项目名称:FastShapefile,代码行数:8,代码来源:ConvertToGeometry.cs
示例6: LineStringSelfIntersectionsOp
/// <summary>
///
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
public static IGeometry LineStringSelfIntersectionsOp(ILineString line)
{
IGeometry lineEndPts = GetEndPoints(line);
IGeometry nodedLine = line.Union(lineEndPts);
IGeometry nodedEndPts = GetEndPoints(nodedLine);
IGeometry selfIntersections = nodedEndPts.Difference(lineEndPts);
return selfIntersections;
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:LineStringSelfIntersections.cs
示例7: GeometryToSqlGeometry
private static void GeometryToSqlGeometry(ILineString geom, SqlGeometryBuilder bldr)
{
bldr.BeginGeometry(OpenGisGeometryType.LineString);
AddFigure(geom, bldr);
bldr.EndGeometry();
}
开发者ID:interworks,项目名称:FastShapefile,代码行数:8,代码来源:ConvertToSqlGeometry.cs
示例8: DrawLineString
/// <summary>
/// Renders a LineString to the map.
/// </summary>
/// <param name="g">Graphics reference</param>
/// <param name="line">LineString to render</param>
/// <param name="pen">Pen style used for rendering</param>
/// <param name="map">Map reference</param>
public static void DrawLineString(System.Drawing.Graphics g, ILineString line, System.Drawing.Pen pen, SharpMap.Map map)
{
if (line.Coordinates.Length > 1)
{
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
gp.AddLines(Transform.TransformToImage(line, map));
g.DrawPath(pen, gp);
}
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:16,代码来源:VectorRenderer.cs
示例9: AddFigure
private static void AddFigure(ILineString line, SqlGeometryBuilder bldr)
{
IList<Coordinate> coords = line.Coordinates;
bldr.BeginFigure(coords[0].X, coords[0].Y);
for (int i = 0; i < coords.Count; i++)
bldr.AddLine(coords[i].X, coords[i].Y);
bldr.EndFigure();
}
开发者ID:interworks,项目名称:FastShapefile,代码行数:9,代码来源:ConvertToSqlGeometry.cs
示例10: Add
private void Add(ILineString lineString)
{
ICoordinateSequence seq = lineString.CoordinateSequence;
for (int i = 1; i < seq.Count; i++)
{
Coordinate prev = seq.GetCoordinate(i - 1);
Coordinate curr = seq.GetCoordinate(i);
graph.AddEdge(prev, curr);
}
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:10,代码来源:EdgeGraphBuilder.cs
示例11: UpdateGridValues
/// <summary>
/// Fills gridvalues function with profiledata based on profileline over the grid
/// </summary>
/// <param name="function"></param>
/// <param name="grid"></param>
/// <param name="polyline"></param>
public static void UpdateGridValues(Function function, IRegularGridCoverage grid, ILineString polyline)
{
function.Clear();
double offset = 0;
double step = polyline.Length / 100;
foreach (ICoordinate coordinate in GetGridProfileCoordinates(polyline, step))
{
function[offset] = grid.Evaluate(coordinate);
offset += step;
}
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:RegularGridCoverageHelper.cs
示例12: WriteGeom
private Coordinate[][] WriteGeom(JsonWriter writer, ILineString ls)
{
if (ls == null)
throw new ArgumentNullException("ls");
writer.WritePropertyName("arcs");
writer.WriteStartArray();
writer.WriteValue(0);
writer.WriteEndArray();
return new[] { ls.Coordinates };
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:11,代码来源:TopoFeatureConverter.cs
示例13: angleBisectors
public static IGeometry angleBisectors(IGeometry g)
{
var pts = trianglePts(g);
var cc = Triangle.InCentre(pts[0], pts[1], pts[2]);
var geomFact = FunctionsUtil.getFactoryOrDefault(g);
var line = new ILineString[3];
line[0] = geomFact.CreateLineString(new Coordinate[] { pts[0], cc });
line[1] = geomFact.CreateLineString(new Coordinate[] { pts[1], cc });
line[2] = geomFact.CreateLineString(new Coordinate[] { pts[2], cc });
return geomFact.CreateMultiLineString(line);
}
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:11,代码来源:TestCaseGeometryFunctions.cs
示例14: GetGridProfileCoordinates
/// <summary>
/// return the coordinates along the gridProfile at stepSize intervals.
/// </summary>
/// <param name="gridProfile"></param>
/// <param name="stepSize"></param>
/// <returns></returns>
public static IEnumerable<ICoordinate> GetGridProfileCoordinates(ILineString gridProfile, double stepSize)
{
var lengthIndexedLine = new LengthIndexedLine(gridProfile);
if (0 == stepSize)
throw new ArgumentException("Stepsize too small", "stepSize");
int count = (int)((gridProfile.Length / stepSize) + 1);
for (int i=0; i<count; i++)
{
yield return (ICoordinate)lengthIndexedLine.ExtractPoint(i * stepSize).Clone();
}
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:RegularGridCoverageHelper.cs
示例15: ComputeDistance
public static void ComputeDistance(ILineString line, Coordinate pt, PointPairDistance ptDist)
{
var coords = line.Coordinates;
var tempSegment = new LineSegment();
for (var i = 0; i < coords.Length - 1; i++)
{
tempSegment.SetCoordinates(coords[i], coords[i + 1]);
// this is somewhat inefficient - could do better
var closestPt = tempSegment.ClosestPoint(pt);
ptDist.SetMinimum(closestPt, pt);
}
}
开发者ID:leoliusg,项目名称:NetTopologySuite,代码行数:12,代码来源:DistanceToPoint.cs
示例16: AngleBisectors
public static IGeometry AngleBisectors(IGeometry g)
{
Coordinate[] pts = TrianglePts(g);
Triangle t = new Triangle(pts[0], pts[1], pts[2]);
Coordinate cc = t.InCentre();
IGeometryFactory geomFact = FunctionsUtil.GetFactoryOrDefault(g);
ILineString[] line = new ILineString[3];
line[0] = geomFact.CreateLineString(new[] { pts[0], cc });
line[1] = geomFact.CreateLineString(new[] { pts[1], cc });
line[2] = geomFact.CreateLineString(new[] { pts[2], cc });
return geomFact.CreateMultiLineString(line);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:12,代码来源:TestCaseGeometryFunctions.cs
示例17: ExtractChain
private static ILineString ExtractChain(ILineString line, int index, int maxChainSize)
{
int size = maxChainSize + 1;
if (index + size > line.NumPoints)
size = line.NumPoints - index;
Coordinate[] pts = new Coordinate[size];
for (int i = 0; i < size; i++)
{
pts[i] = line.GetCoordinateN(index + i);
}
return line.Factory.CreateLineString(pts);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:12,代码来源:LineHandlingFunctions.cs
示例18: LineStringSnapAllTrackers
public static void LineStringSnapAllTrackers(ref double minDistance, ref ISnapResult snapResult, ILineString lineString, ICoordinate worldPos)
{
for (int i = 0; i < lineString.Coordinates.Length; i++)
{
ICoordinate c1 = lineString.Coordinates[i];
double distance = GeometryHelper.Distance(c1.X, c1.Y, worldPos.X, worldPos.Y);
if (distance >= minDistance)
continue;
minDistance = distance;
snapResult = new SnapResult(lineString.Coordinates[i], null, lineString, i, i);
}
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:SnappingHelper.cs
示例19: Read
/// <summary>
/// Reads a stream and converts the shapefile record to an equilivent geometry object.
/// </summary>
/// <param name="file">The stream to read.</param>
/// <param name="geometryFactory">The geometry factory to use when making the object.</param>
/// <returns>The Geometry object that represents the shape file record.</returns>
public override IGeometry Read(BigEndianBinaryReader file, IGeometryFactory geometryFactory)
{
int shapeTypeNum = file.ReadInt32();
type = (ShapeGeometryType) Enum.Parse(typeof(ShapeGeometryType), shapeTypeNum.ToString());
if (type == ShapeGeometryType.NullShape)
return geometryFactory.CreateMultiLineString(null);
if (!(type == ShapeGeometryType.LineString || type == ShapeGeometryType.LineStringM ||
type == ShapeGeometryType.LineStringZ || type == ShapeGeometryType.LineStringZM))
throw new ShapefileException("Attempting to load a non-arc as arc.");
// Read and for now ignore bounds.
int bblength = GetBoundingBoxLength();
bbox = new double[bblength];
for (; bbindex < 4; bbindex++)
{
double d = file.ReadDouble();
bbox[bbindex] = d;
}
int numParts = file.ReadInt32();
int numPoints = file.ReadInt32();
int[] partOffsets = new int[numParts];
for (int i = 0; i < numParts; i++)
partOffsets[i] = file.ReadInt32();
ILineString[] lines = new ILineString[numParts];
for (int part = 0; part < numParts; part++)
{
int start, finish, length;
start = partOffsets[part];
if (part == numParts - 1)
finish = numPoints;
else finish = partOffsets[part + 1];
length = finish - start;
CoordinateList points = new CoordinateList();
points.Capacity = length;
for (int i = 0; i < length; i++)
{
double x = file.ReadDouble();
double y = file.ReadDouble();
ICoordinate external = new Coordinate(x, y);
geometryFactory.PrecisionModel.MakePrecise(external);
points.Add(external);
}
ILineString line = geometryFactory.CreateLineString(points.ToArray());
lines[part] = line;
}
geom = geometryFactory.CreateMultiLineString(lines);
GrabZMValues(file);
return geom;
}
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:58,代码来源:MultiLineHandler.cs
示例20: DrawLineString
/// <summary>
/// Renders a LineString to the map.
/// </summary>
/// <param name="g">IGraphics reference</param>
/// <param name="line">LineString to render</param>
/// <param name="pen">Pen style used for rendering</param>
/// <param name="map">Map reference</param>
/// <param name="offset">Offset by which line will be moved to right</param>
public void DrawLineString(IGraphics g, ILineString line, Pen pen, Map map, float offset)
{
var points = line.TransformToImage(map);
if (points.Length > 1)
{
var gp = new GraphicsPath();
if (offset != 0d)
points = RendererHelper.OffsetRight(points, offset);
gp.AddLines(/*LimitValues(*/points/*, ExtremeValueLimit)*/);
g.DrawPath(pen, gp);
}
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:21,代码来源:VectorRenderer.cs
注:本文中的ILineString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论