Permalink
Browse files

Add idealNudgingDistance routing parameter.

This replaces the previous orthogonalNudgeDistance methods.  It is used
to control the ideal nudging distance used for spacing out connector
corners and segments that overlap each other.
  • Loading branch information...
1 parent 2aa2169 commit c64d67790ca0546e8d04ba3fe03dd73174cddc58 @mjwybrow committed Aug 2, 2012
Showing with 54 additions and 94 deletions.
  1. +1 −1 cola/libavoid/junction.cpp
  2. +3 −3 cola/libavoid/orthogonal.cpp
  3. +5 −17 cola/libavoid/router.cpp
  4. +16 −22 cola/libavoid/router.h
  5. +1 −1 cola/libavoid/tests/2junctions.cpp
  6. +1 −1 cola/libavoid/tests/buildOrthogonalChannelInfo1.cpp
  7. +0 −1 cola/libavoid/tests/checkpointNudging1.cpp
  8. +0 −1 cola/libavoid/tests/checkpointNudging2.cpp
  9. +1 −1 cola/libavoid/tests/checkpoints01.cpp
  10. +1 −1 cola/libavoid/tests/connectionpin03.cpp
  11. +0 −1 cola/libavoid/tests/finalSegmentNudging1.cpp
  12. +0 −1 cola/libavoid/tests/finalSegmentNudging2.cpp
  13. +0 −1 cola/libavoid/tests/finalSegmentNudging3.cpp
  14. +0 −1 cola/libavoid/tests/freeFloatingDirection01.cpp
  15. +1 −1 cola/libavoid/tests/hyperedge01.cpp
  16. +1 −1 cola/libavoid/tests/hyperedgeLoop1.cpp
  17. +1 −1 cola/libavoid/tests/improveHyperedge01.cpp
  18. +1 −1 cola/libavoid/tests/infinity.cpp
  19. +0 −1 cola/libavoid/tests/inlineShapes.cpp
  20. +1 −1 cola/libavoid/tests/inlineoverlap01.cpp
  21. +1 −1 cola/libavoid/tests/inlineoverlap02.cpp
  22. +1 −1 cola/libavoid/tests/inlineoverlap03.cpp
  23. +1 −1 cola/libavoid/tests/inlineoverlap04.cpp
  24. +1 −1 cola/libavoid/tests/inlineoverlap05.cpp
  25. +1 −1 cola/libavoid/tests/inlineoverlap06.cpp
  26. +1 −1 cola/libavoid/tests/inlineoverlap07.cpp
  27. +0 −1 cola/libavoid/tests/inlineoverlap08.cpp
  28. +1 −1 cola/libavoid/tests/junction01.cpp
  29. +1 −1 cola/libavoid/tests/junction02.cpp
  30. +1 −1 cola/libavoid/tests/junction03.cpp
  31. +0 −1 cola/libavoid/tests/lineSegWrapperCrash1.cpp
  32. +0 −1 cola/libavoid/tests/lineSegWrapperCrash2.cpp
  33. +0 −1 cola/libavoid/tests/lineSegWrapperCrash3.cpp
  34. +0 −1 cola/libavoid/tests/lineSegWrapperCrash4.cpp
  35. +0 −1 cola/libavoid/tests/lineSegWrapperCrash5.cpp
  36. +0 −1 cola/libavoid/tests/lineSegWrapperCrash6.cpp
  37. +0 −1 cola/libavoid/tests/lineSegWrapperCrash7.cpp
  38. +0 −1 cola/libavoid/tests/lineSegWrapperCrash8.cpp
  39. +1 −1 cola/libavoid/tests/node1.cpp
  40. +0 −1 cola/libavoid/tests/nudgeCrossing01.cpp
  41. +1 −1 cola/libavoid/tests/nudgeintobug.cpp
  42. +1 −1 cola/libavoid/tests/nudgeold.cpp
  43. +0 −1 cola/libavoid/tests/orderassertion.cpp
  44. +1 −1 cola/libavoid/tests/orthordering01.cpp
  45. +1 −1 cola/libavoid/tests/orthordering02.cpp
  46. +0 −1 cola/libavoid/tests/overlappingRects.cpp
  47. +0 −1 cola/libavoid/tests/performance01.cpp
  48. +1 −1 cola/libavoid/tests/restrictedNudging.cpp
  49. +1 −1 cola/libavoid/tests/slowrouting.cpp
  50. +1 −1 cola/libavoid/tests/tjunct.cpp
  51. +1 −1 cola/libavoid/tests/validPaths01.cpp
  52. +1 −1 cola/libavoid/tests/validPaths02.cpp
  53. +0 −1 cola/libavoid/tests/vertlineassertion.cpp
  54. +1 −1 cola/libtopology/orthogonal_topology.cpp
  55. +0 −1 cola/libtopology/tests/orthogonalOpt.cpp
@@ -63,7 +63,7 @@ Rectangle JunctionRef::makeRectangle(Router *router, const Point& position)
{
COLA_ASSERT(router);
- double nudgeDist = router->orthogonalNudgeDistance();
+ double nudgeDist = router->routingParameter(idealNudgingDistance);
Point low = position;
low.x -= nudgeDist;
@@ -370,7 +370,7 @@ class NudgingShiftSegment : public ShiftSegment
}
double nudgeDistance(void) const
{
- return connRef->router()->orthogonalNudgeDistance();
+ return connRef->router()->routingParameter(idealNudgingDistance);
}
bool immovable(void) const
{
@@ -2145,7 +2145,7 @@ static void buildOrthogonalNudgingSegments(Router *router,
const size_t n = router->m_obstacles.size();
shapeLimits = std::vector<RectBounds>(n);
- double nudgeDistance = router->orthogonalNudgeDistance();
+ double nudgeDistance = router->routingParameter(idealNudgingDistance);
ObstacleList::iterator obstacleIt = router->m_obstacles.begin();
for (unsigned i = 0; i < n; i++)
@@ -2821,7 +2821,7 @@ static void nudgeOrthogonalRoutes(Router *router, size_t dimension,
{
bool nudgeFinalSegments = router->routingOption(
nudgeOrthogonalSegmentsConnectedToShapes);
- double baseSepDist = router->orthogonalNudgeDistance();
+ double baseSepDist = router->routingParameter(idealNudgingDistance);
COLA_ASSERT(baseSepDist >= 0);
// If we can fit things with the desired separation distance, then
// we try 10 times, reducing each time by a 10th of the original amount.
View
@@ -61,7 +61,6 @@ Router::Router(const unsigned int flags)
m_largest_assigned_id(0),
m_consolidate_actions(true),
m_currently_calling_destructors(false),
- m_orthogonal_nudge_distance(4.0),
m_slow_routing_callback(NULL),
m_topology_addon(new TopologyAddonInterface()),
// Mode options:
@@ -89,6 +88,7 @@ Router::Router(const unsigned int flags)
m_routing_parameters[segmentPenalty] = 10;
m_routing_parameters[clusterCrossingPenalty] = 4000;
m_routing_parameters[portDirectionPenalty] = 100;
+ m_routing_parameters[idealNudgingDistance] = 4.0;
m_routing_options[nudgeOrthogonalSegmentsConnectedToShapes] = false;
m_routing_options[improveHyperedgeRoutesMovingJunctions] = true;
@@ -710,19 +710,6 @@ void Router::deleteCluster(ClusterRef *cluster)
}
-void Router::setOrthogonalNudgeDistance(const double dist)
-{
- COLA_ASSERT(dist >= 0);
- m_orthogonal_nudge_distance = dist;
-}
-
-
-double Router::orthogonalNudgeDistance(void) const
-{
- return m_orthogonal_nudge_distance;
-}
-
-
unsigned int Router::newObjectId(void) const
{
return m_largest_assigned_id + 1;
@@ -1662,7 +1649,7 @@ void Router::setRoutingParameter(const RoutingParameter parameter,
COLA_ASSERT(parameter < lastRoutingParameterMarker);
if (value < 0)
{
- // Set some sensible parameter value for the parameter being 'active'..
+ // Set some sensible parameter value for the parameter being 'active'.
switch (parameter)
{
case segmentPenalty:
@@ -1680,6 +1667,9 @@ void Router::setRoutingParameter(const RoutingParameter parameter,
case clusterCrossingPenalty:
m_routing_parameters[parameter] = 4000;
break;
+ case idealNudgingDistance:
+ m_routing_parameters[parameter] = 4.0;
+ break;
default:
m_routing_parameters[parameter] = 50;
break;
@@ -2063,8 +2053,6 @@ void Router::outputInstanceToSVG(std::string instanceName)
fprintf(fp, " router->setRoutingOption((RoutingOption)%lu, %s);\n",
(unsigned long)p, (m_routing_options[p]) ? "true" : "false");
}
- fprintf(fp, " router->setOrthogonalNudgeDistance(%g);\n\n",
- orthogonalNudgeDistance());
ClusterRefList::reverse_iterator revClusterRefIt = clusterRefs.rbegin();
while (revClusterRefIt != clusterRefs.rend())
{
View
@@ -131,8 +131,19 @@ enum RoutingParameter
//! as a method of checking progress or cancelling overly slow
//! operations.
portDirectionPenalty,
-
- // Used for determining the size of the routing parameter array..
+ //! @brief This parameter defines the spacing distance that will be added
+ //! to the sides of each shape when determining obstacle sizes for
+ //! routing. This controls how closely connectors pass shapes, and
+ //! can be used to prevent connectors overlapping with shape
+ //! boundaries. By default, this distance is set to a value of 0.
+ //! @note Currently used.
+ shapeBufferDistance,
+ //! @brief This parameter defines the spacing distance that will be used
+ //! for nudging apart overlapping corners and line segments of
+ //! connectors. By default, this distance is set to a value of 4.
+ idealNudgingDistance,
+
+ // Used for determining the size of the routing parameter array.
// This should always we the last value in the enum.
lastRoutingParameterMarker
};
@@ -453,25 +464,6 @@ class Router {
void moveJunction(JunctionRef *junction, const double xDiff,
const double yDiff);
- //! @brief Sets a spacing distance for overlapping orthogonal
- //! connectors to be nudged apart.
- //!
- //! By default, this distance is set to a value of 4.
- //!
- //! This method does not re-trigger post-processing of connectors.
- //! The new distance will be used the next time rerouting is performed.
- //!
- //! @param[in] dist The distance to be used for orthogonal nudging.
- //!
- void setOrthogonalNudgeDistance(const double dist);
-
- //! @brief Returns the spacing distance that overlapping orthogonal
- //! connectors are nudged apart.
- //!
- //! @return The current spacing distance used for orthogonal nudging.
- //!
- double orthogonalNudgeDistance(void) const;
-
//! @brief Sets values for routing parameters, including routing
//! penalties.
//!
@@ -492,6 +484,9 @@ class Router {
//! when calling this method, then a sensible penalty value will
//! be automatically chosen.
//!
+ //! This method does not re-trigger processing of connectors. The new
+ //! parameter value will be used the next time rerouting is performed.
+ //!
//! @param[in] parameter The type of penalty, a RoutingParameter.
//! @param[in] value The value to be set for that parameter.
//!
@@ -665,7 +660,6 @@ class Router {
unsigned int m_largest_assigned_id;
bool m_consolidate_actions;
bool m_currently_calling_destructors;
- double m_orthogonal_nudge_distance;
double m_routing_parameters[lastRoutingParameterMarker];
bool m_routing_options[lastRoutingOptionMarker];
@@ -21,7 +21,7 @@ int test()
router1->setRoutingPenalty(Avoid::crossingPenalty);
router1->setRoutingPenalty(Avoid::fixedSharedPathPenalty);
router1->setRoutingOption(Avoid::penaliseOrthogonalSharedPathsAtConnEnds, true);
- router1->setOrthogonalNudgeDistance(25);
+ router1->setRoutingParameter(idealNudgingDistance, 25);
poly = Avoid::Polygon(4);
poly.setPoint(0, Avoid::Point(51410, 50640));
poly.setPoint(1, Avoid::Point(51410, 50960));
@@ -21,7 +21,7 @@ void test()
router1->setRoutingPenalty(Avoid::crossingPenalty);
router1->setRoutingPenalty(Avoid::fixedSharedPathPenalty, 9000);
router1->setRoutingOption(Avoid::penaliseOrthogonalSharedPathsAtConnEnds, true);
- router1->setOrthogonalNudgeDistance(25);
+ router1->setRoutingParameter(idealNudgingDistance, 25);
poly = Avoid::Polygon(4);
poly.setPoint(0, Avoid::Point(50760, 50691));
poly.setPoint(1, Avoid::Point(50760, 50775));
@@ -14,7 +14,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
- router->setOrthogonalNudgeDistance(4);
#ifdef ALL
@@ -14,7 +14,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
- router->setOrthogonalNudgeDistance(4);
Polygon poly1(4);
@@ -7,7 +7,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 105);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Rectangle rect478845150(Point(50695, 51070), Point(50705, 51080));
JunctionRef *junctionRef478845150 = new JunctionRef(router,
Point(50700, 51075), 478845150);
@@ -8,7 +8,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 200);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly219926511(4);
poly219926511.ps[0] = Point(50760, 51240);
@@ -14,7 +14,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
- router->setOrthogonalNudgeDistance(4);
/*
Polygon poly1(4);
@@ -14,7 +14,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
- router->setOrthogonalNudgeDistance(4);
/*
Polygon poly1(4);
@@ -13,7 +13,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
- router->setOrthogonalNudgeDistance(4);
#ifdef ALL
Polygon poly1(4);
@@ -8,7 +8,6 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 0);
- router->setOrthogonalNudgeDistance(4);
Polygon poly2(4);
poly2.ps[0] = Point(348, 1286.05);
@@ -8,7 +8,7 @@ int main(void) {
//router->setRoutingPenalty((PenaltyType)2, 200);
router->setRoutingPenalty((PenaltyType)3, 4000);
//router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
JunctionRef *shapeRef171026375 = new JunctionRef(router, Point(51075, 51225), 171026375);
@@ -22,7 +22,7 @@ void test()
router1->setRoutingPenalty(Avoid::segmentPenalty);
router1->setRoutingPenalty(Avoid::crossingPenalty);
router1->setRoutingPenalty(Avoid::fixedSharedPathPenalty, 9000);
- router1->setOrthogonalNudgeDistance(25);
+ router1->setRoutingParameter(idealNudgingDistance, 25);
poly = Avoid::Polygon(4);
poly.setPoint(0, Avoid::Point(50760, 50620));
@@ -24,7 +24,7 @@ int test()
router->setRoutingPenalty(Avoid::segmentPenalty);
router->setRoutingPenalty(Avoid::crossingPenalty);
router->setRoutingPenalty(Avoid::fixedSharedPathPenalty);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
router->setRoutingOption(Avoid::improveHyperedgeRoutesMovingJunctions, true);
poly = Avoid::Polygon(4);
poly.setPoint(0, Avoid::Point(51160, 50670));
@@ -3,7 +3,7 @@ using namespace Avoid;
int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingPenalty(segmentPenalty, 50);
- router->setOrthogonalNudgeDistance(10);
+ router->setRoutingParameter(idealNudgingDistance, 10);
Rectangle rect47(Point(51145, 50195), Point(51145+360, 50195+685));
new ShapeRef(router, rect47);
Rectangle rect46(Point(51920, 49770), Point(51920+360, 49770+310));
@@ -7,7 +7,6 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 0);
- router->setOrthogonalNudgeDistance(4);
Polygon poly1(4);
poly1.ps[0] = Point(52, 188);
@@ -4,7 +4,7 @@ int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingPenalty(segmentPenalty);
router->setRoutingPenalty(fixedSharedPathPenalty);
- router->setOrthogonalNudgeDistance(20);
+ router->setRoutingParameter(idealNudgingDistance, 20);
Rectangle rect335855988(Point(51140, 50190), Point(51510, 50885));
new ShapeRef(router, rect335855988, 335855988);
Rectangle rect548374163(Point(51915, 50415), Point(52285, 50885));
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly548374163(4);
poly548374163.ps[0] = Point(52285, 50415);
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly421433292(4);
poly421433292.ps[0] = Point(51335, 50215);
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly170253204(4);
poly170253204.ps[0] = Point(50450, 50190);
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly231469760(4);
poly231469760.ps[0] = Point(6385, 9390);
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 210);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly170253204(4);
poly170253204.ps[0] = Point(50450, 50190);
@@ -9,7 +9,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
router->setRoutingPenalty((PenaltyType)5, 100);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly186982048(4);
poly186982048.ps[0] = Point(52660, 50490);
@@ -13,7 +13,6 @@ int main(void) {
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
- router->setOrthogonalNudgeDistance(4);
Polygon poly1(4);
poly1.ps[0] = Point(99, -20);
@@ -7,7 +7,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 105);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Rectangle rect478845150(Point(50695, 51070), Point(50705, 51080));
ShapeRef *shapeRef478845150 = new ShapeRef(router, rect478845150, 478845150);
ShapeConnectionPin *pin = new Avoid::ShapeConnectionPin(shapeRef478845150,
@@ -7,7 +7,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 105);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
JunctionRef *junction478845150 = new JunctionRef(router, Point(50700, 51075));
@@ -7,7 +7,7 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 105);
- router->setOrthogonalNudgeDistance(25);
+ router->setRoutingParameter(idealNudgingDistance, 25);
Rectangle rect478845150(Point(50695, 51070), Point(50705, 51080));
JunctionRef *junctionRef478845150 = new JunctionRef(router,
Point(50700, 51075), 478845150);
@@ -7,7 +7,6 @@ int main(void) {
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 0);
- router->setOrthogonalNudgeDistance(4);
Polygon poly29(4);
poly29.ps[0] = Point(1038.92, 415.557);
Oops, something went wrong.

0 comments on commit c64d677

Please sign in to comment.