Esempio n. 1
0
        private bool IsAllPointsParcelCommonNeighbor(LandPolygon polygonNeighbor)
        {
            int common = 0;

            AcGe.Point2dCollection commonPoints = new AcGe.Point2dCollection();

            foreach (AcGe.Point2d point in this.Points)
            {
                foreach (AcGe.Point2d pointNeighbor in polygonNeighbor.Points)
                {
                    if (point.Equals(pointNeighbor))
                    {
                        if (!commonPoints.Contains(point))
                        {
                            common++;
                            commonPoints.Add(point);
                        }
                    }
                }
            }

            if (common == this.Points.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool IsCoincidesDirectionBorder(LandPolygon polygon)
        {
            if (this.IsCommonPoints(polygon))
            {
                List <NeighborsSegment> polygonSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.Undefined);


                //List<PolygonSegment> polygonSegments = this.GetCommonPolygonSegments(polygon);

                if (polygonSegments.Count > 0)
                {
                    List <PolygonSegment> thisSegments =
                        this.GetPolygonSegmentsByMediumPoint(polygonSegments.ToArray()[0].MediumPoint);

                    if (polygonSegments.ToArray()[0]
                        .FrontPoint.Equals(thisSegments.ToArray()[0].FrontPoint))
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 public bool IsCommonPoints(LandPolygon polygon)
 {
     AcGe.Point2d pnt;
     for (int i = 0; i < this.Points.Count; i++)
     {
         pnt = new AcGe.Point2d();
         pnt = this.Points.ToArray()[i];
         if (polygon.Points.Contains(pnt))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
        public List <NeighborsSegment> GetCommonNeighborSegmentsByType(LandPolygon polygonNeighbor, TypeNeighbor typeNeighbor)
        {
            List <NeighborsSegment> neighborSegments = this.GetCommonNeighborSegments(polygonNeighbor);

            if (!this.IsAllPointsParcelCommonNeighbor(polygonNeighbor))
            {
                neighborSegments = ServiceNeighborsSegments.JoinAdjoiningSegments(neighborSegments, false);
            }

            return(neighborSegments.FindAll
                   (
                       delegate(NeighborsSegment segment)
            {
                return segment.TypeNeighbor == typeNeighbor;
            }
                   ));
        }
Esempio n. 5
0
        public List <PolygonSegment> GetCommonPolygonSegments(LandPolygon polygon)
        {
            List <PolygonSegment> allSegmets            = polygon.GetPolygonSegments();
            List <PolygonSegment> commonPolygonSegments = null;

            foreach (AcGe.Point2d point in this.Points)
            {
                commonPolygonSegments.AddRange
                (
                    allSegmets.FindAll
                    (
                        delegate(PolygonSegment segment)
                {
                    return(segment.MediumPoint.Equals(point));
                }
                    )
                );
            }

            return(commonPolygonSegments);
        }
Esempio n. 6
0
        public List <LandPolygon> GetNeighborLines(LandPolygon polygon)
        {
            if (this.IsCommonPoints(polygon))
            {
                List <LandPolygon> neighborLines = new List <LandPolygon>();
                LandPolygon        neighborLine  = new LandPolygon(polygon.Info);

                List <NeighborsSegment> startingNeighborSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.Starting);

                List <NeighborsSegment> endingNeighborSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.Ending);

                List <NeighborsSegment> onlyOnePointOutsideNeighborSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.OnlyOnePoint_Outside);

                List <NeighborsSegment> onlyOnePointInsideNeighborSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.OnlyOnePoint_Inside);

                List <NeighborsSegment> intermediateNeighborSegments =
                    this.GetCommonNeighborSegmentsByType(polygon, TypeNeighbor.Intermediate);

                if (this.Points.Count - intermediateNeighborSegments.Count == 0)
                {
                    neighborLines.Add(polygon);
                }
                else
                {
                    AcGe.Point2d backPoint = AcGe.Point2d.Origin;

                    foreach (NeighborsSegment startingNeighborSegment in startingNeighborSegments)
                    {
                        neighborLines.Add
                        (
                            ServiceNeighborsSegments
                            .ExtractNeighborByStartingSegment
                                (this, polygon, startingNeighborSegment)
                        );
                    }

                    AcGe.Point2d[] pointsOnlyOnePointOutside;

                    foreach (NeighborsSegment onlyOnePointOutsideNeighborSegment in onlyOnePointOutsideNeighborSegments)
                    {
                        pointsOnlyOnePointOutside = new AcGe.Point2d[]
                        {
                            onlyOnePointOutsideNeighborSegment.FrontPoint,
                            onlyOnePointOutsideNeighborSegment.MediumPoint,
                            onlyOnePointOutsideNeighborSegment.BackPoint
                        };
                        neighborLines.Add
                        (
                            new LandPolygon
                            (
                                polygon.Info,
                                new AcGe.Point2dCollection(pointsOnlyOnePointOutside)
                            )
                        );
                    }
                }

                return(neighborLines);
            }

            return(null);
        }
Esempio n. 7
0
        public List <NeighborsSegment> GetCommonNeighborSegments(LandPolygon polygon)
        {
            List <NeighborsSegment> commonNeighborSegments = new List <NeighborsSegment>();

            List <PolygonSegment>        parcelSegmets = this.GetPolygonSegments();
            List <PolygonSegment>        foundSegments = null;
            ResultComparePolygonSegments resultCompare = null;

            foreach (PolygonSegment parcelSegment in parcelSegmets)
            {
                foundSegments = polygon.GetPolygonSegmentsByMediumPoint(parcelSegment.MediumPoint);

                foreach (PolygonSegment neighborSegmet in foundSegments)
                {
                    resultCompare = parcelSegment.CompareSegments(neighborSegmet);

                    if (
                        resultCompare.FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                        resultCompare.MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                        resultCompare.BackPoint == CoincidencePoints.Coincides_With_Nothing
                        )
                    {
                        commonNeighborSegments.Add
                        (
                            new NeighborsSegment(neighborSegmet, parcelSegment.GetTypeNeighbor_OnlyOnePoint(neighborSegmet))
                        );
                    }
                    else if (
                        resultCompare.FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                        resultCompare.MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                        resultCompare.BackPoint == CoincidencePoints.Coincides_With_Front
                        )
                    {
                        commonNeighborSegments.Add
                        (
                            new NeighborsSegment(neighborSegmet, TypeNeighbor.Ending)
                        );
                    }
                    else if (
                        resultCompare.FrontPoint == CoincidencePoints.Coincides_With_Back &&
                        resultCompare.MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                        resultCompare.BackPoint == CoincidencePoints.Coincides_With_Front
                        )
                    {
                        commonNeighborSegments.Add
                        (
                            new NeighborsSegment(neighborSegmet, TypeNeighbor.Intermediate)
                        );
                    }
                    else if (
                        resultCompare.FrontPoint == CoincidencePoints.Coincides_With_Back &&
                        resultCompare.MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                        resultCompare.BackPoint == CoincidencePoints.Coincides_With_Nothing
                        )
                    {
                        commonNeighborSegments.Add
                        (
                            new NeighborsSegment(neighborSegmet, TypeNeighbor.Starting)
                        );
                    }
                    else if (
                        resultCompare.MediumPoint == CoincidencePoints.Coincides_With_Medium
                        )
                    {
                        commonNeighborSegments.Add
                        (
                            new NeighborsSegment(neighborSegmet, TypeNeighbor.Undefined)
                        );
                    }
                }
            }

            return(commonNeighborSegments);
        }