/// <summary> /// The length of this line, up to a specific position. /// </summary> /// <param name="g">The geometry for the line</param> /// <param name="asFarAs">Optional position on the line that the distance should /// be calculated to (null means return the length for the complete line). If this /// position doesn't actually coincide with the line, you'll get the length of the /// complete line.</param> /// <param name="tol">The tolerance for matching <c>asFarAs</c> with the line. Ignored /// if <c>asFarAs</c> is null.</param> /// <returns>The length of the specified line geometry</returns> public static ILength GetLength(IMultiSegmentGeometry g, IPosition asFarAs, ILength tol) { IPosition[] line = g.Data; double tsq = (tol == null ? 0.0 : (tol.Meters * tol.Meters)); double tx = (asFarAs == null ? 0.0 : asFarAs.X); double ty = (asFarAs == null ? 0.0 : asFarAs.Y); double x1 = line[0].X; double y1 = line[0].Y; double length = 0.0; // Total length so far bool finish = false; // True to break early for (int i = 1; i < line.Length && !finish; i++) { double x2 = line[i].X; double y2 = line[i].Y; if (asFarAs != null && IsCoincident(tx, ty, x1, y1, x2, y2, tsq)) { x2 = tx; y2 = ty; finish = true; } double dx = x2 - x1; double dy = y2 - y1; length += Math.Sqrt(dx * dx + dy * dy); x1 = x2; y1 = y2; } return(new Length(length)); }
internal uint IntersectMultiSegment(IMultiSegmentGeometry line) { return(m_IntersectedObject.LineGeometry.IntersectMultiSegment(this, line)); }
internal uint IntersectMultiSegment(IMultiSegmentGeometry line) { return m_IntersectedObject.LineGeometry.IntersectMultiSegment(this, line); }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry that) { return IntersectionHelper.Intersect(results, (ILineSegmentGeometry)this, that); }
abstract internal uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry line);
internal abstract uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry line);
internal static uint Intersect(IntersectionResult results, IMultiSegmentGeometry line, ICircularArcGeometry arc) { uint nx=0; IPointGeometry[] segs = line.Data; IPointGeometry f = arc.First; IPointGeometry s = arc.Second; ICircleGeometry circle = arc.Circle; for (int i=1; i<segs.Length; i++) nx += Intersect(results, segs[i-1], segs[i], f, s, circle); return nx; }
internal static uint Intersect(IntersectionResult result, ILineSegmentGeometry seg, IMultiSegmentGeometry line) { uint nx=0; IPointGeometry a = seg.Start; IPointGeometry b = seg.End; IPointGeometry[] data = line.Data; for (int i=1; i<data.Length; i++) nx += Intersect(result, a, b, data[i-1], data[i]); return nx; }
public static ILength GetDistance(IMultiSegmentGeometry g, IPosition p) { double dsq = BasicGeom.MinDistanceSquared(g.Data, p); return(new Length(Math.Sqrt(dsq))); }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry line) { return(Make().IntersectMultiSegment(results, line)); }
public static void Render(IMultiSegmentGeometry g, ISpatialDisplay display, IDrawStyle style) { style.Render(display, g.Data); }
/// <summary> /// The length of this line, up to a specific position. /// </summary> /// <param name="g">The geometry for the line</param> /// <param name="asFarAs">Optional position on the line that the distance should /// be calculated to (null means return the length for the complete line). If this /// position doesn't actually coincide with the line, you'll get the length of the /// complete line.</param> /// <param name="tol">The tolerance for matching <c>asFarAs</c> with the line. Ignored /// if <c>asFarAs</c> is null.</param> /// <returns>The length of the specified line geometry</returns> public static ILength GetLength(IMultiSegmentGeometry g, IPosition asFarAs, ILength tol) { IPosition[] line = g.Data; double tsq = (tol==null ? 0.0 : (tol.Meters * tol.Meters)); double tx = (asFarAs==null ? 0.0 : asFarAs.X); double ty = (asFarAs==null ? 0.0 : asFarAs.Y); double x1 = line[0].X; double y1 = line[0].Y; double length=0.0; // Total length so far bool finish=false; // True to break early for (int i=1; i<line.Length && !finish; i++) { double x2 = line[i].X; double y2 = line[i].Y; if (asFarAs!=null && IsCoincident(tx, ty, x1, y1, x2, y2, tsq)) { x2 = tx; y2 = ty; finish = true; } double dx = x2-x1; double dy = y2-y1; length += Math.Sqrt(dx*dx+dy*dy); x1 = x2; y1 = y2; } return new Length(length); }
public static IWindow GetExtent(IMultiSegmentGeometry g) { return new Window(g.Data); }
public static ILength GetDistance(IMultiSegmentGeometry g, IPosition p) { double dsq = BasicGeom.MinDistanceSquared(g.Data, p); return new Length(Math.Sqrt(dsq)); }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry that) { return(IntersectionHelper.Intersect(results, (ILineSegmentGeometry)this, that)); }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry that) { return(IntersectionHelper.Intersect(results, that, (ICircularArcGeometry)this)); }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry line) { return Make().IntersectMultiSegment(results, line); }
internal static uint Intersect(IntersectionResult result, IMultiSegmentGeometry line1, IMultiSegmentGeometry line2) { uint nx=0; IPointGeometry[] pa = line1.Data; IPointGeometry[] pb = line2.Data; for (int i=1; i<pa.Length; i++) { IPointGeometry a = pa[i-1]; IPointGeometry b = pa[i]; for(int j=1; j<pb.Length; j++) nx += Intersect(result, a, b, pb[j-1], pb[j]); } return nx; }
public static IWindow GetExtent(IMultiSegmentGeometry g) { return(new Window(g.Data)); }
internal static uint Intersect(IntersectionResult results, IMultiSegmentGeometry line, ICircleGeometry circle) { uint nx=0; IPointGeometry[] segs = line.Data; IPointGeometry c = circle.Center; double r = circle.Radius; for (int i=1; i<segs.Length; i++) nx += Intersect(results, segs[i-1], segs[i], c, r); return nx; }
internal override uint IntersectMultiSegment(IntersectionResult results, IMultiSegmentGeometry that) { return IntersectionHelper.Intersect(results, that, (ICircularArcGeometry)this); }