Beispiel #1
0
        IEnumerable <PointPair> Edges()
        {
            var set = new Set <PointPair>();

            foreach (var poly in Polylines)
            {
                for (var pp = poly.StartPoint; pp.Next != null; pp = pp.Next)
                {
                    set.Insert(FlipCollapser.OrderedPair(pp));
                }
            }
            return(set);
        }
        IEnumerable <PointPair> Edges()
        {
            var set = new Set <PointPair>();

            foreach (var pp in Vertices())
            {
                if (pp.Next != null)
                {
                    set.Insert(FlipCollapser.OrderedPair(pp));
                }
            }
            return(set);
        }
Beispiel #3
0
        bool InsertPointsOnPolypoint(PolylinePoint pp, Dictionary <PointPair, List <Point> > splittingPoints, Metroline metroline)
        {
            var          pointPair = FlipCollapser.OrderedPair(pp);
            var          reversed  = pp.Point != pointPair.First;
            List <Point> list;

            if (!splittingPoints.TryGetValue(pointPair, out list))
            {
                return(false);
            }

            var endPolyPoint = pp.Next;
            var poly         = pp.Polyline;

            if (reversed)
            {
                for (int i = list.Count - 1; i >= 0; i--)
                {
                    if (polylineAcceptsPoint != null && !polylineAcceptsPoint(metroline, list[i]))
                    {
                        continue;
                    }
                    var p = new PolylinePoint(list[i])
                    {
                        Prev = pp, Polyline = poly
                    };
                    pp.Next = p;
                    pp      = p;
                }
            }
            else
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (polylineAcceptsPoint != null && !polylineAcceptsPoint(metroline, list[i]))
                    {
                        continue;
                    }
                    var p = new PolylinePoint(list[i])
                    {
                        Prev = pp, Polyline = poly
                    };
                    pp.Next = p;
                    pp      = p;
                }
            }

            pp.Next           = endPolyPoint;
            endPolyPoint.Prev = pp;
            return(true);
        }