/// <summary>
 /// Compute the change in depth as an edge is crossed from R to L.
 /// </summary>
 /// <param name="label"></param>
 private static int DepthDelta(Label label)
 {
     Locations lLoc = label.GetLocation(0, Positions.Left);
     Locations rLoc = label.GetLocation(0, Positions.Right);
     if (lLoc == Locations.Interior && rLoc == Locations.Exterior)
         return 1;
     else if (lLoc == Locations.Exterior && rLoc == Locations.Interior)
         return -1;
     return 0;
 }
Example #2
0
 /// <summary>
 /// Converts a Label to a Line label (that is, one with no side Locations).
 /// </summary>
 /// <param name="label">Label to convert.</param>
 /// <returns>Label as Line label.</returns>
 public static Label ToLineLabel(Label label)
 {
     Label lineLabel = new Label(Locations.Null);
     for (int i = 0; i < 2; i++) 
         lineLabel.SetLocation(i, label.GetLocation(i));            
     return lineLabel;
 }
Example #3
0
        private int _depthDelta;   // the change in area depth from the R to Curve side of this edge

        /// <summary> 
        /// Updates an IM from the label for an edge.
        /// Handles edges from both L and A geometries.
        /// </summary>
        /// <param name="im"></param>
        /// <param name="label"></param>
        public static void UpdateIM(Label label, IntersectionMatrix im)
        {
            im.SetAtLeastIfValid(label.GetLocation(0, Positions.On), label.GetLocation(1, Positions.On), Dimensions.Curve);
            if (label.IsArea())
            {
                im.SetAtLeastIfValid(label.GetLocation(0, Positions.Left), label.GetLocation(1, Positions.Left), Dimensions.Surface);
                im.SetAtLeastIfValid(label.GetLocation(0, Positions.Right), label.GetLocation(1, Positions.Right), Dimensions.Surface);
            }
        }
Example #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="label"></param>
 /// <param name="opCode"></param>
 /// <returns></returns>
 public static bool IsResultOfOp(Label label, SpatialFunctions opCode)
 {
     Locations loc0 = label.GetLocation(0);
     Locations loc1 = label.GetLocation(1);
     return IsResultOfOp(loc0, loc1, opCode);
 }
 /// <summary> 
 /// Update incomplete dirEdge labels from the labelling for the node.
 /// </summary>
 /// <param name="nodeLabel"></param>
 public virtual void UpdateLabelling(Label nodeLabel)
 {
     for (IEnumerator it = GetEnumerator(); it.MoveNext(); ) 
     {
         DirectedEdge de = (DirectedEdge)it.Current;
         Label label = de.Label;
         label.SetAllLocationsIfNull(0, nodeLabel.GetLocation(0));
         label.SetAllLocationsIfNull(1, nodeLabel.GetLocation(1));
     }
 }
Example #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lbl"></param>
 public virtual void Add(Label lbl)
 {
     for (int i = 0; i < 2; i++)
     {
         for (int j = 1; j < 3; j++)
         {
             Locations loc = lbl.GetLocation(i, (Positions)j);
             if (loc == Locations.Exterior || loc == Locations.Interior)
             {
                 // initialize depth if it is null, otherwise add this location value
                 if (IsNull(i, (Positions)j))
                      depth[i,j]  = DepthAtLocation(loc);
                 else depth[i,j] += DepthAtLocation(loc);
             }
         }
     }
 }
Example #7
0
 /// <summary> 
 /// Merge the RHS label from a DirectedEdge into the label for this EdgeRing.
 /// The DirectedEdge label may be null.  This is acceptable - it results
 /// from a node which is NOT an intersection node between the Geometries
 /// (e.g. the end node of a LinearRing).  In this case the DirectedEdge label
 /// does not contribute any information to the overall labelling, and is simply skipped.
 /// </summary>
 /// <param name="deLabel"></param>
 /// <param name="geomIndex"></param>
 protected virtual void MergeLabel(Label deLabel, int geomIndex)
 {
     Locations loc = deLabel.GetLocation(geomIndex, Positions.Right);
     // no information to be had from this label
     if (loc == Locations.Null) 
         return;
     // if there is no current RHS value, set it
     if (_label.GetLocation(geomIndex) == Locations.Null)
     {
         _label.SetLocation(geomIndex, loc);
         return;
     }
 }
Example #8
0
 /// <summary> 
 /// The location for a given eltIndex for a node will be one
 /// of { Null, Interior, Boundary }.
 /// A node may be on both the boundary and the interior of a point;
 /// in this case, the rule is that the node is considered to be in the boundary.
 /// The merged location is the maximum of the two input values.
 /// </summary>
 /// <param name="label2"></param>
 /// <param name="eltIndex"></param>
 public virtual Locations ComputeMergedLocation(Label label2, int eltIndex)
 {
     Locations loc = Locations.Null;
     loc = Label.GetLocation(eltIndex);
     if (!label2.IsNull(eltIndex)) 
     {
         Locations nLoc = label2.GetLocation(eltIndex);
         if (loc != Locations.Boundary) 
             loc = nLoc;
     }
     return loc;
 }