void RemoveShortcuttedPolypoint(PolylinePoint pp, Dictionary <PointPair, Set <Metroline> > segsToPolylines)
        {
            var a = pp.Point;
            var b = pp.Next.Point;
            var c = pp.Next.Next.Point;

            Set <Metroline> abPolylines, bcPolylines, abcPolylines;

            FindPolylines(pp, segsToPolylines, out abPolylines, out bcPolylines, out abcPolylines);

            double ab = (a - b).Length;
            double bc = (b - c).Length;
            double ac = (a - c).Length;

            //fixing ink
            if (abPolylines.Count == abcPolylines.Count)
            {
                ink -= ab;
            }
            if (bcPolylines.Count == abcPolylines.Count)
            {
                ink -= bc;
            }
            if (!segsToPolylines.ContainsKey(new PointPair(a, c)) || segsToPolylines[new PointPair(a, c)].Count == 0)
            {
                ink += ac;
            }

            //fixing edge lengths
            foreach (var metroline in abcPolylines)
            {
                polylineLength[metroline] -= ab + bc - ac;
            }

            //fixing polylines
            foreach (var metroline in abcPolylines)
            {
                RemovePolypoint(metroline.Polyline.PolylinePoints.First(p => p.Point == b));
                CollectionUtilities.RemoveFromMap(segsToPolylines, new PointPair(a, b), metroline);
                CollectionUtilities.RemoveFromMap(segsToPolylines, new PointPair(b, c), metroline);
                CollectionUtilities.AddToMap(segsToPolylines, new PointPair(a, c), metroline);
            }
        }
コード例 #2
0
ファイル: FlipSwitcher.cs プロジェクト: suprcodr/EFDesigner
 void UnregisterPolylinePointInPathsThrough(PolylinePoint pp)
 {
     CollectionUtilities.RemoveFromMap(pathsThroughPoints, pp.Point, pp);
 }