Exemplo n.º 1
0
 public bool Equals(NeighborsSegment segment)
 {
     if (
         this.FrontPoint.Equals(segment.FrontPoint) &&
         this.MediumPoint.Equals(segment.MediumPoint) &&
         this.BackPoint.Equals(segment.BackPoint) &&
         this.TypeNeighbor.Equals(segment.TypeNeighbor)
         )
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public NeighborsSegment JoinAdjoiningSegmentParcel(NeighborsSegment segment)
        {
            NeighborsSegment newSegment = new NeighborsSegment((PolygonSegment)this, TypeNeighbor.Undefined);

            //newSegment.TypeNeighbor = TypeNeighbor.Undefined;

            if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Front
                )
            {
                newSegment.BackPoint = segment.BackPoint;
            }
            else if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Back &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Nothing
                )
            {
                newSegment.FrontPoint = segment.FrontPoint;
            }
            else if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Nothing
                )
            {
                newSegment.FrontPoint = segment.FrontPoint;
            }
            else
            {
                return(null);
            }

            return(newSegment);
        }
Exemplo n.º 3
0
        public NeighborsSegment JoinAdjoiningSegmentNeighbor(NeighborsSegment segment)
        {
            NeighborsSegment newSegment = this;
            TypeNeighbor     type       = TypeNeighbor.Undefined;

            if (
                (this.TypeNeighbor == TypeNeighbor.Starting && segment.TypeNeighbor == TypeNeighbor.Ending) ||
                (this.TypeNeighbor == TypeNeighbor.Ending && segment.TypeNeighbor == TypeNeighbor.Starting)
                )
            {
                type = TypeNeighbor.Intermediate;
            }
            else if (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside)
            {
                type = TypeNeighbor.OnlyOnePoint_Outside;
            }
            else if (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside)
            {
                type = TypeNeighbor.OnlyOnePoint_Inside;
            }
            else if (
                (this.TypeNeighbor == TypeNeighbor.Starting && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside) ||
                (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside && segment.TypeNeighbor == TypeNeighbor.Starting) ||
                (this.TypeNeighbor == TypeNeighbor.Starting && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside) ||
                (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside && segment.TypeNeighbor == TypeNeighbor.Starting)
                )
            {
                type = TypeNeighbor.Starting;
            }
            else if (
                (this.TypeNeighbor == TypeNeighbor.Ending && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside) ||
                (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Outside && segment.TypeNeighbor == TypeNeighbor.Ending) ||
                (this.TypeNeighbor == TypeNeighbor.Ending && segment.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside) ||
                (this.TypeNeighbor == TypeNeighbor.OnlyOnePoint_Inside && segment.TypeNeighbor == TypeNeighbor.Ending)
                )
            {
                type = TypeNeighbor.Ending;
            }


            if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Front
                )
            {
                newSegment.BackPoint = segment.BackPoint;
            }
            else if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Back &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Nothing
                )
            {
                newSegment.FrontPoint = segment.FrontPoint;
            }
            else
            {
                return(null);
            }

            newSegment.TypeNeighbor = type;

            return(newSegment);
        }