Browse Source

Object graph - fixed a small bug in multiple edge spacing.

pull/15/head
mkonicek 15 years ago
parent
commit
0681775b63
  1. 5
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/Point2D.cs
  2. 12
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs

5
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/Point2D.cs

@ -20,5 +20,10 @@ namespace Debugger.AddIn.Visualizers.Graph.SplineRouting
public double X { get; set; } public double X { get; set; }
public double Y { get; set; } public double Y { get; set; }
public override string ToString()
{
return string.Format("[Point2D X={0}, Y={1}]", X, Y);
}
} }
} }

12
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs

@ -104,8 +104,7 @@ namespace Debugger.AddIn.Visualizers.Graph.SplineRouting
{ {
if (edgeStart == null || edgeEnd == null) { if (edgeStart == null || edgeEnd == null) {
// should not happen // should not happen
throw new System.Exception("edgeStart is null"); throw new System.Exception("The line between box centers does not intersect the boxes!");
//return;
} }
var startPoint = new RouteVertex(edgeStart.Value.X, edgeStart.Value.Y); var startPoint = new RouteVertex(edgeStart.Value.X, edgeStart.Value.Y);
startPoint.IsEdgeEndpoint = true; startPoint.IsEdgeEndpoint = true;
@ -209,12 +208,17 @@ namespace Debugger.AddIn.Visualizers.Graph.SplineRouting
static double GetMultiEdgeSpan(double space, int multiEdgeCount, double multiEdgeGap) static double GetMultiEdgeSpan(double space, int multiEdgeCount, double multiEdgeGap)
{ {
if ((multiEdgeCount + 1) * multiEdgeGap < space) if (multiEdgeCount <= 1) {
// 1 edge, no spacing needed
return 0;
}
if ((multiEdgeCount + 1) * multiEdgeGap < space) {
// the edges fit, maintain the gap // the edges fit, maintain the gap
return (multiEdgeCount - 1) * multiEdgeGap; return (multiEdgeCount - 1) * multiEdgeGap;
else } else {
// there are too many edges, we have to make smaller gaps to fit edges into given space // there are too many edges, we have to make smaller gaps to fit edges into given space
return space - multiEdgeGap; return space - multiEdgeGap;
}
} }
} }
} }

Loading…
Cancel
Save