本文整理汇总了C#中ILineString类的典型用法代码示例。如果您正苦于以下问题:C# ILineString类的具体用法?C# ILineString怎么用?C# ILineString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILineString类属于命名空间,在下文中一共展示了ILineString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例7: GeometryToSqlGeometry
private static void GeometryToSqlGeometry(ILineString geom, SqlGeometryBuilder bldr)
{
bldr.BeginGeometry(OpenGisGeometryType.LineString);
AddFigure(geom, bldr);
bldr.EndGeometry();
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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 };
}
示例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);
}
示例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();
}
}
示例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);
}
}