Beispiel #1
0
        IEnumerable <DebugCurve> IdealBundles()
        {
            List <DebugCurve> dc = new List <DebugCurve>();

            foreach (var edge in mgd.VirtualEdges())
            {
                var node = edge.Item1;
                var adj  = edge.Item2;

                double width = mgd.GetWidth(node, adj, bundlingSettings.EdgeSeparation);
                dc.Add(new DebugCurve(0.1, "black", Intersections.Create4gon(node.Position, adj.Position, width, width)));
            }

            return(dc);
        }
        internal MetroGraphData(EdgeGeometry[] regularEdges,
            RectangleNode<Polyline> looseTree, RectangleNode<Polyline> tightTree,
            BundlingSettings bundlingSettings, Cdt cdt,
            Dictionary<EdgeGeometry, Set<Polyline>> edgeLooseEnterable, Dictionary<EdgeGeometry, Set<Polyline>> edgeTightEnterable, Func<Port, Polyline> loosePolylineOfPort) {
            //Debug.Assert(cdt != null);
            this.regularEdges = regularEdges;
            if (cdt != null)
                Cdt = cdt;
            else
                Cdt = BundleRouter.CreateConstrainedDelaunayTriangulation(looseTree);

            EdgeLooseEnterable = edgeLooseEnterable;
            EdgeTightEnterable = edgeTightEnterable;
            LoosePolylineOfPort = loosePolylineOfPort;

            looseIntersections = new Intersections(this, bundlingSettings, looseTree, station => station.EnterableLoosePolylines);
            tightIntersections = new Intersections(this, bundlingSettings, tightTree, station => station.EnterableTightPolylines);
            cdtIntersections = new CdtIntersections(this, bundlingSettings);

            Initialize(false);
        }
 bool LineIsLegal(Point a, Point b)
 {
     return(tightObstaclesInTheBoundingBox.All(t => !Intersections.LineSegmentIntersectPolyline(a, b, t)));
 }