Point FigureOutHookLocationForClusterOtherPort(Polyline poly, ClusterBoundaryPort otherEdgeEndPort, EdgeGeometry edgeGeom) { var shapes = shortestPathRouter.MakeTransparentShapesOfEdgeGeometry(edgeGeom); //SplineRouter.ShowVisGraph(this.VisibilityGraph, this.LooseHierarchy.GetAllLeaves(), // shapes.Select(sh => sh.BoundaryCurve), new[] { new LineSegment(edgeGeom.SourcePort.Location, edgeGeom.TargetPort.Location) }); var s = new MultipleSourceMultipleTargetsShortestPathOnVisibilityGraph(otherEdgeEndPort.LoosePolyline.Select(p => VisibilityGraph.FindVertex(p)), poly.Select(p => VisibilityGraph.FindVertex(p)), VisibilityGraph); var path = s.GetPath(); foreach (var sh in shapes) { sh.IsTransparent = false; } return(path.Last().Point); }
double GetIdealDistanceBetweenClusterPortAndPort(ClusterBoundaryPort clsp, Port port) { var poly = clsp.LoosePolyline; var otherClsp = port as ClusterBoundaryPort; if (otherClsp != null) { var polygon0 = new Polygon(poly); var polygon1 = new Polygon(otherClsp.LoosePolyline); return(Polygon.Distance(polygon0, polygon1)); } var point = port.Location; var closestPar = poly.ClosestParameter(point); return((point - poly[closestPar]).Length); }
Point FigureOutHookLocationForClusterOtherPort(Polyline poly, ClusterBoundaryPort otherEdgeEndPort, EdgeGeometry edgeGeom) { var shapes = shortestPathRouter.MakeTransparentShapesOfEdgeGeometry(edgeGeom); //SplineRouter.ShowVisGraph(this.VisibilityGraph, this.LooseHierarchy.GetAllLeaves(), // shapes.Select(sh => sh.BoundaryCurve), new[] { new LineSegment(edgeGeom.SourcePort.Location, edgeGeom.TargetPort.Location) }); var s = new MultipleSourceMultipleTargetsShortestPathOnVisibilityGraph(otherEdgeEndPort.LoosePolyline.Select(p => VisibilityGraph.FindVertex(p)), poly.Select(p => VisibilityGraph.FindVertex(p)), VisibilityGraph); var path = s.GetPath(); foreach (var sh in shapes) sh.IsTransparent = false; return path.Last().Point; }
double GetIdealDistanceBetweenClusterPortAndPort(ClusterBoundaryPort clsp, Port port) { var poly = clsp.LoosePolyline; var otherClsp = port as ClusterBoundaryPort; if (otherClsp != null) { var polygon0 = new Polygon(poly); var polygon1 = new Polygon(otherClsp.LoosePolyline); return Polygon.Distance(polygon0, polygon1); } var point = port.Location; var closestPar = poly.ClosestParameter(point); return (point - poly[closestPar]).Length; }