Ejemplo n.º 1
0
 protected override bool ValidStartingIntersection(SegmentIntersection intersectionData, out PolygonEdge currentEdge,
                                                   out bool startAgain)
 {
     startAgain = false;
     if (intersectionData.Relationship == SegmentRelationship.NoOverlap)
     {
         if (intersectionData.CollinearityType == CollinearityTypes.ABeforeBAfter && !intersectionData.VisitedA && !intersectionData.VisitedB)
         {
             currentEdge = intersectionData.EdgeB;
             return(true);
         }
         if (intersectionData.CollinearityType == CollinearityTypes.AAfterBBefore && !intersectionData.VisitedB && !intersectionData.VisitedA)
         {
             currentEdge = intersectionData.EdgeA;
             return(true);
         }
         if (intersectionData.CollinearityType == CollinearityTypes.None)
         {
             startAgain = !(intersectionData.VisitedB || intersectionData.VisitedA);
             if (!intersectionData.VisitedA)
             {
                 currentEdge = intersectionData.EdgeA;
                 return(true);
             }
             if (!intersectionData.VisitedB)
             {
                 currentEdge = intersectionData.EdgeB;
                 return(true);
             }
         }
     }
     if (intersectionData.VisitedB || intersectionData.VisitedA)
     {
         currentEdge = null;
         return(false);
     }
     if (intersectionData.Relationship == SegmentRelationship.AEnclosesB && !intersectionData.VisitedB && !intersectionData.VisitedA)
     {
         currentEdge = intersectionData.EdgeA;
         return(true);
     }
     if (intersectionData.Relationship == SegmentRelationship.BEnclosesA && !intersectionData.VisitedB && !intersectionData.VisitedA)
     {
         currentEdge = intersectionData.EdgeB;
         return(true);
     }
     if (intersectionData.Relationship == SegmentRelationship.CrossOver_AOutsideAfter && !intersectionData.VisitedB)
     {
         currentEdge = intersectionData.EdgeB;
         return(true);
     }
     if (intersectionData.Relationship == SegmentRelationship.CrossOver_BOutsideAfter && !intersectionData.VisitedA)
     {
         currentEdge = intersectionData.EdgeA;
         return(true);
     }
     currentEdge = null;
     return(false);
 }
Ejemplo n.º 2
0
 protected override bool PolygonCompleted(SegmentIntersection currentIntersection, SegmentIntersection startingIntersection, PolygonEdge currentEdge, PolygonEdge startingEdge)
 {
     if (startingIntersection != currentIntersection)
     {
         return(false);
     }
     if (startingIntersection.Relationship == SegmentRelationship.DoubleOverlap &&
         startingIntersection.CollinearityType == CollinearityTypes.None)
     {
         return(currentEdge == startingEdge);
     }
     return(true);
 }
Ejemplo n.º 3
0
 protected override bool SwitchAtThisIntersection(SegmentIntersection intersectionData, bool currentEdgeIsFromPolygonA)
 {
     if (intersectionData.Relationship == SegmentRelationship.DoubleOverlap)
     {
         return(true);
     }
     if (!currentEdgeIsFromPolygonA)
     {
         return
             (intersectionData.Relationship == SegmentRelationship.CrossOver_BOutsideAfter ||
              intersectionData.Relationship == SegmentRelationship.BEnclosesA);
     }
     return(intersectionData.Relationship == SegmentRelationship.CrossOver_AOutsideAfter ||
            intersectionData.Relationship == SegmentRelationship.AEnclosesB);
 }