/// <summary> /// Create a EdgeStub for the edge before the intersection eiCurr. /// The previous intersection is provided /// in case it is the endpoint for the stub edge. /// Otherwise, the previous point from the parent edge will be the endpoint. /// eiCurr will always be an EdgeIntersection, but eiPrev may be null. /// </summary> /// <param name="edge"></param> /// <param name="l"></param> /// <param name="eiCurr"></param> /// <param name="eiPrev"></param> public void CreateEdgeEndForPrev(Edge edge, IList <EdgeEnd> l, EdgeIntersection eiCurr, EdgeIntersection eiPrev) { int iPrev = eiCurr.SegmentIndex; if (eiCurr.Distance == 0.0) { // if at the start of the edge there is no previous edge if (iPrev == 0) { return; } iPrev--; } var pPrev = edge.GetCoordinate(iPrev); // if prev intersection is past the previous vertex, use it instead if (eiPrev != null && eiPrev.SegmentIndex >= iPrev) { pPrev = eiPrev.Coordinate; } var label = new Label(edge.Label); // since edgeStub is oriented opposite to it's parent edge, have to flip sides for edge label label.Flip(); var e = new EdgeEnd(edge, eiCurr.Coordinate, pPrev, label); l.Add(e); }
/// <summary> /// /// </summary> /// <param name="ee"></param> public virtual void InsertEdgeEnds(IList ee) { for (IEnumerator i = ee.GetEnumerator(); i.MoveNext();) { EdgeEnd e = (EdgeEnd)i.Current; _nodes.Add(e); } }
/// <summary> /// /// </summary> /// <param name="ee"></param> private void InsertEdgeEnds(IList ee) { for (IEnumerator i = ee.GetEnumerator(); i.MoveNext();) { EdgeEnd e = (EdgeEnd)i.Current; nodes.Add(e); } }
} // public void CopyNodesAndLabels( GeometryGraph geomGraph, int argIndex ) /// <summary> /// /// </summary> /// <param name="ee"></param> public void InsertEdgeEnds(ArrayList ee) { foreach (object obj in ee) { EdgeEnd e = (EdgeEnd)obj; _nodes.Add(e); } // foreach ( object obj in ee ) } // public void InsertEdgeEnds( ArrayList ee)
} // public IntersectionMatrix ComputeIM() #endregion #region Private Methods /// <summary> /// /// </summary> /// <param name="ee"></param> private void InsertEdgeEnds(ArrayList ee) { foreach (object obj in ee) { EdgeEnd e = (EdgeEnd)obj; _nodes.Add(e); } } // private void InsertEdgeEnds( ArrayList ee )
/// <summary> /// /// </summary> /// <param name="outstream"></param> public override void Write(StreamWriter outstream) { outstream.WriteLine("EdgeEndBundle--> Label: " + Label); for (IEnumerator it = GetEnumerator(); it.MoveNext();) { EdgeEnd ee = (EdgeEnd)it.Current; ee.Write(outstream); outstream.WriteLine(); } }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(EdgeStart != null ? EdgeStart.ToStepValue() : "$"); parameters.Add(EdgeEnd != null ? EdgeEnd.ToStepValue() : "$"); parameters.Add(ParentEdge != null ? ParentEdge.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
/// <summary> /// /// </summary> /// <param name="boundaryNodeRule"></param> /// <param name="e"></param> public EdgeEndBundle(IBoundaryNodeRule boundaryNodeRule, EdgeEnd e) : base(e.Edge, e.Coordinate, e.DirectedCoordinate, new Label(e.Label)) { /* if (boundaryNodeRule != null) this.boundaryNodeRule = boundaryNodeRule; else boundaryNodeRule = BoundaryNodeRules.OgcSfsBoundaryRule; */ Insert(e); }
/// <summary> /// /// </summary> /// <param name="boundaryNodeRule"></param> /// <param name="e"></param> public EdgeEndBundle(IBoundaryNodeRule boundaryNodeRule, EdgeEnd e) : base(e.Edge, e.Coordinate, e.DirectedCoordinate, new Label(e.Label)) { /* * if (boundaryNodeRule != null) * this.boundaryNodeRule = boundaryNodeRule; * else * boundaryNodeRule = BoundaryNodeRules.OgcSfsBoundaryRule; */ Insert(e); }
} // void UpdateIM(IntersectionMatrix im) /// <summary> /// Returns a string representation of this object. /// </summary> /// <returns></returns> public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("EdgeEndBundle--> Label: " + _label); foreach (object obj in _edgeEnds) { EdgeEnd ee = (EdgeEnd)obj; sb.Append(ee.ToString()); } return(sb.ToString()); } // public override string ToString()
/* /// <summary> /// /// </summary> public EdgeEndBundleStar() { } */ /// <summary> /// Insert a EdgeEnd in order in the list. /// If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is /// added to the bundle. Otherwise, a new EdgeEndBundle is created /// to contain the EdgeEnd. /// </summary> /// <param name="e"></param> public override void Insert(EdgeEnd e) { EdgeEnd ee; //EdgeEndBundle eb; //= (EdgeEndBundle) edgeMap[e]; //if (eb == null) if (!edgeMap.TryGetValue(e, out ee)) { //eb = new EdgeEndBundle(e); //InsertEdgeEnd(e, eb); InsertEdgeEnd(e, new EdgeEndBundle(e)); } else ((EdgeEndBundle)ee).Insert(e); }
/// <summary> /// Insert a EdgeEnd in order in the list. /// If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is /// added to the bundle. Otherwise, a new EdgeEndBundle is created /// to contain the EdgeEnd. /// </summary> /// <param name="e"></param> public override void Insert(EdgeEnd e) { EdgeEndBundle eb = (EdgeEndBundle)EdgeMap[e]; if (eb == null) { eb = new EdgeEndBundle(e); InsertEdgeEnd(e, eb); } else { eb.Insert(e); } }
/* * /// <summary> * /// * /// </summary> * public EdgeEndBundleStar() { } */ /// <summary> /// Insert a EdgeEnd in order in the list. /// If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is /// added to the bundle. Otherwise, a new EdgeEndBundle is created /// to contain the EdgeEnd. /// </summary> /// <param name="e"></param> public override void Insert(EdgeEnd e) { EdgeEnd ee; //EdgeEndBundle eb; //= (EdgeEndBundle) edgeMap[e]; //if (eb == null) if (!edgeMap.TryGetValue(e, out ee)) { //eb = new EdgeEndBundle(e); //InsertEdgeEnd(e, eb); InsertEdgeEnd(e, new EdgeEndBundle(e)); } else { ((EdgeEndBundle)ee).Insert(e); } }
} // private void ComputeLabelSides( int geomIndex ) /// <summary> /// To compute the summary label for a side, the algorithm is: /// FOR all edges /// IF any edge's location is INTERIOR for the side, side location = INTERIOR /// ELSE IF there is at least one EXTERIOR attribute, side location = EXTERIOR /// ELSE side location = NULL /// Note that it is possible for two sides to have apparently contradictory information /// i.e. one edge side may indicate that it is in the interior of a geometry, while /// another edge side may indicate the exterior of the same geometry. This is /// not an incompatibility - GeometryCollections may contain two Polygons that touch /// along an edge. This is the reason for Interior-primacy rule above - it /// results in the summary label having the Geometry interior on both sides. /// </summary> /// <param name="geomIndex"></param> /// <param name="side"></param> private void ComputeLabelSide(int geomIndex, int side) { foreach (object obj in _edgeEnds) { EdgeEnd e = (EdgeEnd)obj; if (e.Label.IsArea()) { int loc = e.Label.GetLocation(geomIndex, side); if (loc == Location.Interior) { _label.SetLocation(geomIndex, side, Location.Interior); return; } else if (loc == Location.Exterior) { _label.SetLocation(geomIndex, side, Location.Exterior); } } //if ( e.Label.IsArea() ) } //foreach ( object obj in _edgeEnds ) } // private void ComputeLabelSide( int geomIndex, int side )
/// <summary> /// To compute the summary label for a side, the algorithm is: /// FOR all edges /// IF any edge's location is Interior for the side, side location = Interior /// ELSE IF there is at least one Exterior attribute, side location = Exterior /// ELSE side location = Null /// Note that it is possible for two sides to have apparently contradictory information /// i.e. one edge side may indicate that it is in the interior of a point, while /// another edge side may indicate the exterior of the same point. This is /// not an incompatibility - GeometryCollections may contain two Polygons that touch /// along an edge. This is the reason for Interior-primacy rule above - it /// results in the summary label having the Geometry interior on both sides. /// </summary> /// <param name="geomIndex"></param> /// <param name="side"></param> private void ComputeLabelSide(int geomIndex, Positions side) { for (IEnumerator it = GetEnumerator(); it.MoveNext();) { EdgeEnd e = (EdgeEnd)it.Current; if (e.Label.IsArea()) { Locations loc = e.Label.GetLocation(geomIndex, side); if (loc == Locations.Interior) { label.SetLocation(geomIndex, side, Locations.Interior); return; } else if (loc == Locations.Exterior) { label.SetLocation(geomIndex, side, Locations.Exterior); } } } }
/// <summary> /// Computes the label for a side. /// </summary> /// <remarks> /// To compute the summary label for a side, the algorithm is: /// <code> /// FOR all edges /// IF any edge's location is INTERIOR for the side, side location = INTERIOR /// ELSE IF there is at least one EXTERIOR attribute, side location = EXTERIOR /// ELSE side location = NULL /// </code> /// <para> /// Note that it is possible for two sides to have apparently contradictory information /// i.e. one edge side may indicate that it is in the interior of a geometry, while /// another edge side may indicate the exterior of the same geometry. This is /// not an incompatibility - GeometryCollections may contain two Polygons that touch /// along an edge. This is the reason for Interior-primacy rule above - it /// results in the summary label having the Geometry interior on both sides. /// </para> /// </remarks> private void ComputeLabelSide(int geomIndex, int side) { for (IEnumerator it = Iterator(); it.MoveNext();) { EdgeEnd e = (EdgeEnd)it.Current; if (e.Label.IsArea()) { int loc = e.Label.GetLocation(geomIndex, side); if (loc == LocationType.Interior) { m_objLabel.SetLocation(geomIndex, side, LocationType.Interior); return; } else if (loc == LocationType.Exterior) { m_objLabel.SetLocation(geomIndex, side, LocationType.Exterior); } } } }
/// <summary> /// To compute the summary label for a side, the algorithm is: /// FOR all edges /// IF any edge's location is Interior for the side, side location = Interior /// ELSE IF there is at least one Exterior attribute, side location = Exterior /// ELSE side location = Null /// Notice that it is possible for two sides to have apparently contradictory information /// i.e. one edge side may indicate that it is in the interior of a point, while /// another edge side may indicate the exterior of the same point. This is /// not an incompatibility - GeometryCollections may contain two Polygons that touch /// along an edge. This is the reason for Interior-primacy rule above - it /// results in the summary label having the Geometry interior on both sides. /// </summary> /// <param name="geomIndex"></param> /// <param name="side"></param> private void ComputeLabelSide(int geomIndex, PositionType side) { for (IEnumerator it = GetEnumerator(); it.MoveNext();) { EdgeEnd e = (EdgeEnd)it.Current; if (!e.Label.IsArea()) { continue; } LocationType loc = e.Label.GetLocation(geomIndex, side); if (loc == LocationType.Interior) { Label.SetLocation(geomIndex, side, LocationType.Interior); return; } if (loc == LocationType.Exterior) { Label.SetLocation(geomIndex, side, LocationType.Exterior); } } }
/// <summary> /// Create a StubEdge for the edge after the intersection eiCurr. /// The next intersection is provided /// in case it is the endpoint for the stub edge. /// Otherwise, the next point from the parent edge will be the endpoint. /// eiCurr will always be an EdgeIntersection, but eiNext may be null. /// </summary> /// <param name="edge"></param> /// <param name="l"></param> /// <param name="eiCurr"></param> /// <param name="eiNext"></param> public virtual void CreateEdgeEndForNext(Edge edge, IList l, EdgeIntersection eiCurr, EdgeIntersection eiNext) { int iNext = eiCurr.SegmentIndex + 1; // if there is no next edge there is nothing to do if (iNext >= edge.NumPoints && eiNext == null) { return; } Coordinate pNext = edge.GetCoordinate(iNext); // if the next intersection is in the same segment as the current, use it as the endpoint if (eiNext != null && eiNext.SegmentIndex == eiCurr.SegmentIndex) { pNext = eiNext.Coordinate; } EdgeEnd e = new EdgeEnd(edge, eiCurr.Coordinate, pNext, new Label(edge.Label)); l.Add(e); }
public void adjustVert(NodeKey nk, int edge, int vert, int amount) { changeNumber++; Node n = myRoot.getOrCreateNode(nk); int[] ie = Node.edgeIndices(edge); EdgeEnd end = vert == ie[0] ? EdgeEnd.START : EdgeEnd.END; int edgeValue; if (end == EdgeEnd.START) { edgeValue = (int)n.edgeStart(edge); n.setEdgeStart(edge, edgeValue + amount); } else { edgeValue = (int)n.edgeStop(edge); n.setEdgeStop(edge, edgeValue + amount); } setDirty(); }
/// <summary> /// /// </summary> /// <param name="de"></param> /// <param name="i"></param> /// <returns></returns> private static PositionType GetRightmostSideOfSegment(EdgeEnd de, int i) { Edge e = de.Edge; IList <Coordinate> coord = e.Coordinates; if (i < 0 || i + 1 >= coord.Count) { return(PositionType.Parallel); } if (coord[i].Y == coord[i + 1].Y) { return(PositionType.Parallel); } PositionType pos = PositionType.Left; if (coord[i].Y < coord[i + 1].Y) { pos = PositionType.Right; } return(pos); }
/// <summary> /// /// </summary> /// <param name="e"></param> public EdgeEndBundle(EdgeEnd e) : base(e.Edge, e.Coordinate, e.DirectedCoordinate, new Label(e.Label)) { Insert(e); }
/// <summary> /// Insert an EdgeEnd into the map, and clear the edgeList cache, /// since the list of edges has now changed. /// </summary> /// <param name="e"></param> /// <param name="obj"></param> protected void InsertEdgeEnd(EdgeEnd e, EdgeEnd obj) { edgeMap[e] = obj; edgeList = null; // edge list has changed - clear the cache }
/* /// <summary> /// /// </summary> public DirectedEdgeStar() { } */ /// <summary> /// Insert a directed edge in the list. /// </summary> /// <param name="ee"></param> public override void Insert(EdgeEnd ee) { DirectedEdge de = (DirectedEdge) ee; InsertEdgeEnd(de, de); }
/// <summary> /// /// </summary> /// <param name="eSearch"></param> /// <returns></returns> public int FindIndex(EdgeEnd eSearch) { GetEnumerator(); // force edgelist to be computed for (int i = 0; i < edgeList.Count; i++ ) { EdgeEnd e = edgeList[i]; if (e == eSearch) return i; } return -1; }
/* /// <summary> /// /// </summary> protected EdgeEndStar() { } */ /// <summary> /// Insert a EdgeEnd into this EdgeEndStar. /// </summary> /// <param name="e"></param> abstract public void Insert(EdgeEnd e);
/* /// <summary> /// /// </summary> protected EdgeEndStar() { } */ /// <summary> /// Insert a EdgeEnd into this EdgeEndStar. /// </summary> /// <param name="e"></param> public abstract void Insert(EdgeEnd e);
/// <summary> /// /// </summary> /// <param name="ee"></param> /// <returns></returns> public EdgeEnd GetNextCW(EdgeEnd ee) { IList<EdgeEnd> temp = Edges; temp = null; // Hack for calling property int i = edgeList.IndexOf(ee); int iNextCW = i - 1; if (i == 0) iNextCW = edgeList.Count - 1; return edgeList[iNextCW]; }
public EdgeEndBundle(EdgeEnd e) : this(null, e) { }
public void Insert(EdgeEnd e) { edgeEnds.Add(e); }
/// <summary> /// Create a StubEdge for the edge after the intersection eiCurr. /// The next intersection is provided /// in case it is the endpoint for the stub edge. /// Otherwise, the next point from the parent edge will be the endpoint. /// eiCurr will always be an EdgeIntersection, but eiNext may be null. /// </summary> /// <param name="edge"></param> /// <param name="l"></param> /// <param name="eiCurr"></param> /// <param name="eiNext"></param> public void CreateEdgeEndForNext(Edge edge, IList<EdgeEnd> l, EdgeIntersection eiCurr, EdgeIntersection eiNext) { int iNext = eiCurr.SegmentIndex + 1; // if there is no next edge there is nothing to do if (iNext >= edge.NumPoints && eiNext == null) return; Coordinate pNext = edge.GetCoordinate(iNext); // if the next intersection is in the same segment as the current, use it as the endpoint if (eiNext != null && eiNext.SegmentIndex == eiCurr.SegmentIndex) pNext = eiNext.Coordinate; EdgeEnd e = new EdgeEnd(edge, eiCurr.Coordinate, pNext, new Label(edge.Label)); l.Add(e); }
/// <summary> /// /// </summary> /// <param name="e"></param> public void Insert(EdgeEnd e) { // Assert: start point is the same // Assert: direction is the same _edgeEnds.Add(e); }
/// <summary> /// /// </summary> /// <param name="e"></param> public void Add(EdgeEnd e) { _nodes.Add(e); edgeEndList.Add(e); }
/// <summary> /// Add the edge to the list of edges at this node. /// </summary> /// <param name="e"></param> public void Add(EdgeEnd e) { // Assert: start pt of e is equal to node point _edges.Insert(e); e.Node = this; }
/// <summary> /// Create a EdgeStub for the edge before the intersection eiCurr. /// The previous intersection is provided /// in case it is the endpoint for the stub edge. /// Otherwise, the previous point from the parent edge will be the endpoint. /// eiCurr will always be an EdgeIntersection, but eiPrev may be null. /// </summary> /// <param name="edge"></param> /// <param name="l"></param> /// <param name="eiCurr"></param> /// <param name="eiPrev"></param> public void CreateEdgeEndForPrev(Edge edge, IList<EdgeEnd> l, EdgeIntersection eiCurr, EdgeIntersection eiPrev) { int iPrev = eiCurr.SegmentIndex; if (eiCurr.Distance == 0.0) { // if at the start of the edge there is no previous edge if (iPrev == 0) return; iPrev--; } Coordinate pPrev = edge.GetCoordinate(iPrev); // if prev intersection is past the previous vertex, use it instead if (eiPrev != null && eiPrev.SegmentIndex >= iPrev) pPrev = eiPrev.Coordinate; Label label = new Label(edge.Label); // since edgeStub is oriented opposite to it's parent edge, have to flip sides for edge label label.Flip(); EdgeEnd e = new EdgeEnd(edge, eiCurr.Coordinate, pPrev, label); l.Add(e); }
/// <summary> /// /// </summary> /// <param name="e"></param> public void Insert(EdgeEnd e) { // Assert: start point is the same // Assert: direction is the same _edgeEnds.Add(e); }
public EdgeEndBundle(EdgeEnd e) : this(null, e) { }
/// <summary> /// Adds a node for the start point of this EdgeEnd /// (if one does not already exist in this map). /// Adds the EdgeEnd to the (possibly new) node. /// </summary> /// <param name="e"></param> public void Add(EdgeEnd e) { Coordinate p = e.Coordinate; Node n = AddNode(p); n.Add(e); }
public EdgeFamily(List <IdentifierPartTemplate> ranges, EdgeEnd source, EdgeEnd target) : base(ranges) { Source = source; Target = target; }