Esempio n. 1
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. 2
0
        public static Dictionary <LandPolygon, TypeContour> GetContours(LandPolygon polygon)
        {
            List <PolygonSegment>   allSegments = polygon.GetPolygonSegments();
            List <NeighborsSegment> segments    = new List <NeighborsSegment>();

            foreach (PolygonSegment segment in allSegments)
            {
                segments.Add(new NeighborsSegment(segment, TypeNeighbor.Undefined));
            }

            segments = ServiceNeighborsSegments.JoinAdjoiningSegments(segments, true);

            Dictionary <LandPolygon, TypeContour> contours = new Dictionary <LandPolygon, TypeContour>();

            NeighborsSegment curSegment;

            AcGe.Point2d backPoint = segments[0].MediumPoint;

            LandPolygon contour = new LandPolygon(polygon.Info);

            while (segments.Count > 0)
            {
                List <NeighborsSegment> findSegments = ServiceNeighborsSegments.FindNeighborSegments(segments, backPoint);

                if (findSegments.Count > 0)
                {
                    curSegment = findSegments[0];

                    contour.Points.Add(curSegment.MediumPoint);

                    backPoint = curSegment.FrontPoint;
                    segments.Remove(segments.Find(f => f.Equals(curSegment)));
                }
                else
                {
                    backPoint = segments[0].MediumPoint;

                    contours.Add(contour, TypeContour.Internal);
                    contour = new LandPolygon(polygon.Info);
                }
            }

            contours.Add(contour, TypeContour.Internal);

            return(contours);
        }