예제 #1
0
        double FindMaxPaddingForTightPolyline(Polyline polyline)
        {
            var dist    = double.MaxValue;
            var polygon = new Polygon(polyline);

            foreach (var poly in RootOfLooseHierarchy.GetAllLeaves().Where(p => p != polyline))
            {
                dist = Math.Min(dist, Polygon.Distance(polygon, new Polygon(poly)));
            }

            //            TraverseHierarchy(RootOfLooseHierarchy, delegate(RectangleNode<Polyline> node) {
            //                                                        if (node.UserData != null)
            //                                                            if (node.UserData != polyline)
            //                                                                dist = Math.Min(dist,
            //                                                                                Polygon.Distance(polygon,
            //                                                                                                 new Polygon(
            //                                                                                                     node.UserData)));
            //                                                    });
            dist = Math.Min(dist, RouterBetweenTwoNodes.DistanceFromPointToPolyline(router.SourcePoint, polyline));
            dist = Math.Min(dist, RouterBetweenTwoNodes.DistanceFromPointToPolyline(router.TargetPoint, polyline));
            return(dist);
        }
예제 #2
0
 private void RouteEdge(GeometryEdge geometryEdge)
 {
     var router = new RouterBetweenTwoNodes(Graph.GeometryGraph, Graph.Attr.NodeSeparation * tightOffsetForRouting,
                                            Graph.Attr.NodeSeparation * looseOffsetForRouting,
                                            Graph.Attr.NodeSeparation * offsetForRelaxingInRouting);
     try
     {
         router.RouteEdge(geometryEdge, true);
     }
     catch (Exception)
     {
     }
 }
예제 #3
0
 internal ObstacleCalculator(RouterBetweenTwoNodes router)
 {
     this.router = router;
 }
 internal ObstacleCalculator(RouterBetweenTwoNodes router) {
     this.router = router;
 }