/// <summary> /// Creates a {SegmentString} for a coordinate list which is a raw offset curve, /// and adds it to the list of buffer curves. /// The SegmentString is tagged with a Label giving the topology of the curve. /// The curve may be oriented in either direction. /// If the curve is oriented CW, the locations will be: /// Left: Location.Exterior. /// Right: Location.Interior. /// </summary> private void AddCurve(Coordinate[] coord, Location leftLoc, Location rightLoc) { // don't add null or trivial curves! if (coord == null || coord.Length < 2) return; // add the edge for a coordinate list which is a raw offset curve var e = new NodedSegmentString(coord, new Label(0, Location.Boundary, leftLoc, rightLoc)); _curveList.Add(e); }
/// <summary> /// This method is called by clients /// of the <see cref="ISegmentIntersector" /> class to process /// intersections for two segments of the <see cref="ISegmentString" />s being intersected.<br/> /// Note that some clients (such as <c>MonotoneChain</c>s) may optimize away /// this call for segment pairs which they have determined do not intersect /// (e.g. by an disjoint envelope test). /// </summary> /// <param name="e0"></param> /// <param name="segIndex0"></param> /// <param name="e1"></param> /// <param name="segIndex1"></param> public void ProcessIntersections(ISegmentString e0, int segIndex0, ISegmentString e1, int segIndex1) { // don't bother intersecting a segment with itself if (e0 == e1 && segIndex0 == segIndex1) { return; } Coordinate[] coordinates0 = e0.Coordinates; Coordinate p00 = coordinates0[segIndex0]; Coordinate p01 = coordinates0[segIndex0 + 1]; Coordinate[] coordinates1 = e1.Coordinates; Coordinate p10 = coordinates1[segIndex1]; Coordinate p11 = coordinates1[segIndex1 + 1]; _li.ComputeIntersection(p00, p01, p10, p11); if (!_li.HasIntersection) { return; } if (!_li.IsInteriorIntersection()) { return; } for (int intIndex = 0; intIndex < _li.IntersectionNum; intIndex++) { _interiorIntersections.Add(_li.GetIntersection(intIndex)); } NodedSegmentString nss0 = (NodedSegmentString)e0; nss0.AddIntersections(_li, segIndex0, 0); NodedSegmentString nss1 = (NodedSegmentString)e1; nss1.AddIntersections(_li, segIndex1, 1); }
private readonly NodedSegmentString _edge; // the parent edge /// <summary> /// Initializes a new instance of the <see cref="SegmentNodeList"/> class. /// </summary> /// <param name="edge">The edge.</param> public SegmentNodeList(NodedSegmentString edge) { _edge = edge; }
/// <summary> /// Returns a <see cref="IList{ISegmentString}"/> of fully noded <see cref="ISegmentString"/>s. /// The <see cref="ISegmentString"/>s have the same context as their parent. /// </summary> /// <returns></returns> public override IList <ISegmentString> GetNodedSubstrings() { return(NodedSegmentString.GetNodedSubstrings(_nodedSegStrings)); }
public LineTopology(ICoordinate[] pts, IGeometryFactory geomFact) { _segStr = new NodedSegmentString(pts, this); _geomFact = geomFact; }