50 ClusteredRouting(true),
53 UseLeesAlgorithm(true),
54 InvisibilityGrph(true),
56 SelectiveReroute(true),
57 PartialFeedback(false),
58 RubberBandRouting(false),
61 m_largest_assigned_id(0),
62 m_consolidate_actions(true),
63 m_currently_calling_destructors(false),
66 m_allows_polyline_routing(false),
67 m_allows_orthogonal_routing(false),
68 m_static_orthogonal_graph_invalidated(true),
69 m_in_crossing_rerouting_stage(false),
70 m_settings_changes(false),
71 m_debug_handler(nullptr)
112 ConnRefList::iterator conn =
connRefs.begin();
115 db_printf(
"Deleting connector %u in ~Router()\n", (*conn)->id());
121 ObstacleList::iterator obstacle =
m_obstacles.begin();
126 db_printf(
"Deleting %s %u in ~Router()\n",
127 (shape) ?
"shape" :
"junction", obstaclePtr->
id());
161 bool countBorder =
true;
164 ObstacleList::const_iterator finish =
m_obstacles.end();
165 for (ObstacleList::const_iterator i =
m_obstacles.begin(); i != finish; ++i)
177 const ConnEnd& connEnd,
bool connPinMoveUpdate)
181 ActionInfoList::iterator found =
186 modInfo.
conns.push_back(std::make_pair(type, connEnd));
192 found->addConnEndUpdate(type, connEnd, connPinMoveUpdate);
206 ActionInfoList::iterator found =
224 ActionInfoList::iterator found =
240 for (ActionInfoList::iterator curr =
actionList.begin();
243 if (curr->objPtr ==
object)
267 ActionInfoList::iterator found =
290 ActionInfoList::iterator found = find(
actionList.begin(),
322 ActionInfoList::iterator found =
329 newPoly = found->newPoly;
344 for (ObstacleList::iterator obstacleIt =
m_obstacles.begin();
361 const bool first_move)
369 ActionInfoList::iterator found = find(
actionList.begin(),
376 found->shape()->setNewPoly(newPoly);
389 found->newPoly = newPoly;
467 bool seenShapeMovesOrDeletes =
false;
472 std::list<unsigned int> deletedObstacles;
474 ActionInfoList::iterator curr;
475 ActionInfoList::iterator finish =
actionList.end();
476 for (curr =
actionList.begin(); curr != finish; ++curr)
485 seenShapeMovesOrDeletes =
true;
494 unsigned int pid = obstacle->
id();
528 deletedObstacles.push_back(obstacle->
id());
539 for (curr =
actionList.begin(); curr != finish; ++curr)
549 for (std::list<unsigned int>::iterator it = deletedObstacles.begin();
550 it != deletedObstacles.end(); ++it)
563 for (curr =
actionList.begin(); curr != finish; ++curr)
580 unsigned int pid = obstacle->
id();
604 if (!isMove || notPartialTime)
623 for (curr =
actionList.begin(); curr != finish; ++curr)
630 for (ConnUpdateList::iterator conn = actInf.
conns.begin();
631 conn != actInf.
conns.end(); ++conn)
671 ActionInfoList::iterator found =
694 ActionInfoList::iterator found = find(
actionList.begin(),
720 ActionInfoList::iterator found =
727 newPosition = found->newPosition;
734 newPosition.
x += xDiff;
735 newPosition.
y += yDiff;
749 ActionInfoList::iterator found = find(
actionList.begin(),
755 found->junction()->setPosition(newPosition);
767 found->newPosition = newPosition;
784 unsigned int pid = cluster->
id();
795 unsigned int pid = cluster->
id();
811 unsigned int assignedId = (suggestedId == 0) ?
newObjectId() : suggestedId;
830 for (ObstacleList::const_iterator i =
m_obstacles.begin();
833 if ((*i)->id() == id)
840 for (ConnRefList::const_iterator i =
connRefs.begin();
843 if ((*i)->id() == id)
850 for (ClusterRefList::const_iterator i =
clusterRefs.begin();
853 if ((*i)->id() == id)
868 const unsigned int type)
870 ConnRefList::const_iterator fin =
connRefs.end();
871 for (ConnRefList::const_iterator i =
connRefs.begin(); i != fin; ++i)
873 std::pair<Obstacle *, Obstacle *> anchors = (*i)->endpointAnchors();
876 (anchors.second && (anchors.second->id() == shapeId)))
878 conns.push_back((*i)->id());
881 (anchors.first && (anchors.first->id() == shapeId)))
883 conns.push_back((*i)->id());
892 const unsigned int type)
894 ConnRefList::const_iterator fin =
connRefs.end();
895 for (ConnRefList::const_iterator i =
connRefs.begin(); i != fin; ++i)
897 std::pair<Obstacle *, Obstacle *> anchors = (*i)->endpointAnchors();
900 (anchors.second && (anchors.second->id() == shapeId)))
905 shapes.push_back(anchors.first->id());
909 (anchors.first && (anchors.first->id() == shapeId)))
914 shapes.push_back(anchors.second->id());
927 ConnRefList::const_iterator fin =
connRefs.end();
934 for (ConnRefList::const_iterator i =
connRefs.begin(); i != fin; ++i)
936 (*i)->freeActivePins();
949 size_t totalConns =
connRefs.size();
950 size_t numOfReroutedConns = 0;
951 for (ConnRefList::const_iterator i =
connRefs.begin(); i != fin; ++i)
955 numOfReroutedConns, totalConns);
956 ++numOfReroutedConns;
959 if (hyperedgeConns.find(connector) != hyperedgeConns.end())
976 reroutedConns.push_back(connector);
992 if (withMinorImprovements || withMajorImprovements)
1007 changedHyperedgeObjs =
1013 fin = reroutedConns.end();
1014 for (ConnRefList::const_iterator i = reroutedConns.begin(); i != fin; ++i)
1019 ConnRefList::iterator findIt = std::find(
1020 deletedConns.begin(), deletedConns.end(), conn);
1021 if (findIt != deletedConns.end())
1047 return (u.second->id() < v.second->id());
1065 for (
size_t i = 1; i < route.
size(); ++i)
1067 const Point& a = route.
ps[i - 1];
1070 double segmentLength = (isPolyLine) ?
1072 length += segmentLength;
1074 return length - (route.
size() + 1);
1086class CrossingConnectorsInfo
1095 CrossingConnectorsMapList::iterator it =
1096 groupForCrossingConns(conn1, conn2);
1100 pairsSet[conn1].insert(conn2);
1101 pairsSet[conn2].insert(conn1);
1117 for (CrossingConnectorsMapList::iterator it = pairsSetList.begin();
1118 it != pairsSetList.end(); ++it)
1126 std::set<ConnectionPinIds> exclusivePins;
1133 while ( (crossingCausingConnector =
1134 removeConnectorWithMostCrossings(pairsSet)).second != nullptr )
1137 crossingSet.insert(crossingCausingConnector);
1141 std::pair<ConnEnd, ConnEnd> ends =
1142 crossingCausingConnector.second->endpointConnEnds();
1147 exclusivePins.insert(pin->
ids());
1150 pin = ends.second.m_active_pin;
1153 exclusivePins.insert(pin->
ids());
1161 for (CrossingConnectorsMap::const_iterator it2 =
1162 pairsSet.begin(); it2 != pairsSet.end(); ++it2)
1170 if (exclusivePins.count(pin->
ids()) > 0)
1176 crossingSet.insert(std::make_pair(0, conn));
1181 pin = ends.second.m_active_pin;
1184 if (exclusivePins.count(pin->
ids()) > 0)
1190 crossingSet.insert(std::make_pair(0, conn));
1195 if (!crossingSet.empty())
1197 crossingSetsList.push_back(crossingSet);
1200 return crossingSetsList;
1206 CrossingConnectorsMapList::iterator it1 = groupForConn(conn1);
1207 CrossingConnectorsMapList::iterator it2 = groupForConn(conn2);
1210 if ((it1 == it2) && (it1 != pairsSetList.end()))
1215 return ((pairsSet.count(conn1) > 0) &&
1216 (pairsSet[conn1].count(conn2) > 0));
1230 ConnRef *candidateConnector =
nullptr;
1231 size_t candidateCrossingCount = 0;
1232 double candidateEstimatedCost = 0;
1235 for (CrossingConnectorsMap::const_iterator it = pairsSet.begin();
1236 it != pairsSet.end(); ++it)
1239 size_t crossings = it->second.size();
1250 if ((crossings > candidateCrossingCount) ||
1251 ((crossings == candidateCrossingCount) &&
1252 (
cost > candidateEstimatedCost)))
1255 candidateConnector = it->first;
1256 candidateCrossingCount = crossings;
1257 candidateEstimatedCost =
cost;
1261 if (candidateConnector ==
nullptr)
1264 return std::make_pair(0, (
ConnRef *)
nullptr);
1269 std::set<ConnRef *>& connSet = pairsSet[candidateConnector];
1271 for (std::set<ConnRef *>::const_iterator it = connSet.begin();
1272 it != connSet.end(); ++it)
1275 pairsSet[*it].erase(candidateConnector);
1281 return std::make_pair(
static_cast<double>(candidateCrossingCount), candidateConnector);
1286 CrossingConnectorsMapList::iterator groupForConn(
ConnRef *conn)
1289 for (CrossingConnectorsMapList::iterator it = pairsSetList.begin();
1290 it != pairsSetList.end(); ++it)
1293 if (it->count(conn) > 0)
1300 return pairsSetList.end();
1309 CrossingConnectorsMapList::iterator groupForCrossingConns(
1312 CrossingConnectorsMapList::iterator it1 = groupForConn(conn1);
1313 CrossingConnectorsMapList::iterator it2 = groupForConn(conn2);
1316 CrossingConnectorsMapList::iterator groupIt = pairsSetList.end();
1318 if ((it1 == pairsSetList.end()) && (it2 == pairsSetList.end()))
1322 groupIt = pairsSetList.insert(pairsSetList.end(), newSet);
1324 else if ((it1 != pairsSetList.end()) && (it2 == pairsSetList.end()))
1329 else if ((it1 == pairsSetList.end()) && (it2 != pairsSetList.end()))
1334 else if (it1 != it2)
1337 COLA_ASSERT(it1 != pairsSetList.end());
1338 COLA_ASSERT(it2 != pairsSetList.end());
1339 it1->insert(it2->begin(), it2->end());
1340 pairsSetList.erase(it2);
1346 COLA_ASSERT(it1 == it2);
1357 size_t stepNumber,
size_t totalSteps)
1360 unsigned int elapsedMsec = (
unsigned int)
1362 (CLOCKS_PER_SEC / (double) 1000));
1366 stepNumber / (
double)totalSteps);
1367 if (shouldContinue ==
false)
1376 unsigned int phaseNumber,
unsigned int totalPhases,
1379 COLA_UNUSED(elapsedTime);
1380 COLA_UNUSED(phaseNumber);
1381 COLA_UNUSED(totalPhases);
1382 COLA_UNUSED(proportion);
1385 printf(
"Progress: %8u, phase %u of %u... %.2f%%\n", elapsedTime,
1386 phaseNumber, totalPhases, proportion * 100);
1394class CmpOrderedConnCostRef
1397 CmpOrderedConnCostRef()
1402 return (u.first < v.first);
1412 if ((crossing_penalty == 0) && (shared_path_penalty == 0))
1419 CrossingConnectorsInfo crossingConnInfo;
1421 size_t numOfConns =
connRefs.size();
1422 size_t numOfConnsChecked = 0;
1426 ConnRefList::iterator fin =
connRefs.end();
1427 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
1430 ++numOfConnsChecked;
1432 numOfConnsChecked, numOfConns);
1440 if (iRoute.
size() == 0)
1446 ConnRefList::iterator j = i;
1447 for (++j; j != fin; ++j)
1449 if (crossingConnInfo.connsKnownToCross(*i, *j))
1458 for (
size_t jInd = 1; jInd < jRoute.
size(); ++jInd)
1460 const bool finalSegment = ((jInd + 1) == jRoute.
size());
1461 cross.countForSegment(jInd, finalSegment);
1463 if ((shared_path_penalty > 0) &&
1471 crossingConnInfo.addCrossing(*i, *j);
1474 else if ((crossing_penalty > 0) && (cross.crossingCount > 0))
1477 crossingConnInfo.addCrossing(*i, *j);
1490 crossingConnInfo.crossingSetsListToRemoveCrossingsFromGroups();
1497 unsigned int numOfConnsToReroute = 1;
1498 unsigned int numOfConnsRerouted = 1;
1499 for (ConnCostRefSetList::iterator setIt = crossingConnsGroups.begin();
1500 setIt != crossingConnsGroups.end(); ++setIt)
1505 orderedConnList.sort(CmpOrderedConnCostRef());
1508 for (
int pass = 0; pass < 2; ++pass)
1510 for (ConnCostRefList::iterator connIt = orderedConnList.begin();
1511 connIt != orderedConnList.end(); ++connIt)
1513 ConnRef *conn = connIt->second;
1516 ++numOfConnsToReroute;
1532 numOfConnsRerouted, numOfConnsToReroute);
1538 ++numOfConnsRerouted;
1562 std::pair<VertID, VertID> ids(tmp->
ids());
1564 VertID eID2 = ids.second;
1565 std::pair<Point, Point> points(tmp->
points());
1566 Point e1 = points.first;
1567 Point e2 = points.second;
1568 bool blocked =
false;
1570 bool countBorder =
false;
1571 bool ep_in_poly1 = (eID1.
isConnPt()) ?
1572 inPoly(poly, e1, countBorder) :
false;
1573 bool ep_in_poly2 = (eID2.
isConnPt()) ?
1574 inPoly(poly, e2, countBorder) :
false;
1575 if (ep_in_poly1 || ep_in_poly2)
1582 bool seenIntersectionAtEndpoint =
false;
1583 for (
size_t pt_i = 0; pt_i < poly.
size(); ++pt_i)
1585 size_t pt_n = (pt_i == (poly.
size() - 1)) ? 0 : pt_i + 1;
1586 const Point& pi = poly.
ps[pt_i];
1587 const Point& pn = poly.
ps[pt_n];
1589 seenIntersectionAtEndpoint))
1597 db_printf(
"\tRemoving newly blocked edge (by shape %3d)"
1629 else if (tmp->
blocker() == pid)
1665 bool knownNew =
true;
1679 bool countBorder =
false;
1682 ObstacleList::const_iterator finish =
m_obstacles.end();
1683 for (ObstacleList::const_iterator i =
m_obstacles.begin(); i != finish; ++i)
1685 if (
inPoly((*i)->routingPolygon(), pt->
point, countBorder))
1692 ClusterRefList::const_iterator clFinish =
clusterRefs.end();
1693 for (ClusterRefList::const_iterator i =
clusterRefs.begin();
1705 const int p_cluster)
1723 (*k).second.erase(p_cluster);
1731 bool countBorder =
false;
1736 if (
inPoly(poly, k->point, countBorder))
1748 (*k).second.erase(p_shape);
1753#ifdef SELECTIVE_DEBUG
1758 return acos((pow(b, 2) + pow(
c, 2) - pow(a, 2)) / (2 * b *
c));
1781 for (ConnRefList::const_iterator it =
connRefs.begin(); it !=
end; ++it)
1814 const Point& p1 = i->point;
1815 const Point& p2 = i->shNext->point;
1835 min = std::min(p1.
x, p2.
x);
1836 max = std::max(p1.
x, p2.
x);
1838 else if (p1.
x == p2.
x)
1847 min = std::min(p1.
y, p2.
y);
1848 max = std::max(p1.
y, p2.
y);
1860 double theta = 0 - atan2(n_p2.
y, n_p2.
x);
1868 double cosv = cos(theta);
1869 double sinv = sin(theta);
1871 r_p2.
x = cosv * n_p2.
x - sinv * n_p2.
y;
1872 r_p2.
y = cosv * n_p2.
y + sinv * n_p2.
x;
1873 start.
x = cosv * n_start.
x - sinv * n_start.
y;
1874 start.
y = cosv * n_start.
y + sinv * n_start.
x;
1875 end.
x = cosv * n_end.
x - sinv * n_end.
y;
1876 end.
y = cosv * n_end.
y + sinv * n_end.
x;
1882 if (fabs(r_p2.
y) > 0.0001)
1894 min = std::min(r_p1.
x, r_p2.
x);
1895 max = std::max(r_p1.
x, r_p2.
x);
1906 if ((b == 0) && (d == 0))
1909 if (((a < min) && (
c < min)) ||
1910 ((a > max) && (
c > max)))
1922 x = ((b*
c) + (a*d)) / (b + d);
1928 x = std::max(min, x);
1929 x = std::min(max, x);
1952 if (estdist < conndist)
1954#ifdef SELECTIVE_DEBUG
1957 db_printf(
"[%3d] - Possible better path found (%.1f < %.1f)\n",
1958 conn->_id, estdist, conndist);
2061 const double penValue)
2086 fprintf(fp,
"\nVisibility Graph info:\n");
2087 fprintf(fp,
"----------------------\n");
2089 unsigned int currshape = 0;
2091 int st_vertices = 0;
2092 int st_endpoints = 0;
2093 int st_valid_shape_visedges = 0;
2094 int st_valid_endpt_visedges = 0;
2095 int st_orthogonal_visedges = 0;
2096 int st_invalid_visedges = 0;
2104 currshape = pID.
objID;
2120 std::pair<VertID, VertID> idpair = t->ids();
2122 if (idpair.first.isConnPt() || idpair.second.isConnPt())
2124 st_valid_endpt_visedges++;
2128 st_valid_shape_visedges++;
2134 st_invalid_visedges++;
2139 st_orthogonal_visedges++;
2141 fprintf(fp,
"Number of shapes: %d\n", st_shapes);
2142 fprintf(fp,
"Number of vertices: %d (%d real, %d endpoints)\n",
2143 st_vertices + st_endpoints, st_vertices, st_endpoints);
2144 fprintf(fp,
"Number of orthog_vis_edges: %d\n", st_orthogonal_visedges);
2145 fprintf(fp,
"Number of vis_edges: %d (%d valid [%d normal, %d endpt], "
2146 "%d invalid)\n", st_valid_shape_visedges + st_invalid_visedges +
2147 st_valid_endpt_visedges, st_valid_shape_visedges +
2148 st_valid_endpt_visedges, st_valid_shape_visedges,
2149 st_valid_endpt_visedges, st_invalid_visedges);
2150 fprintf(fp,
"----------------------\n");
2152 fprintf(fp,
"----------------------\n");
2165 val = std::min(val,
LIMIT);
2166 val = std::max(val, -
LIMIT);
2176 ConnRefList::iterator fin =
connRefs.end();
2177 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
2180 ConnRefList::iterator j = i;
2181 for (++j; j != fin; ++j)
2186 cross.checkForBranchingSegments =
true;
2187 for (
size_t jInd = 1; jInd < jRoute.
size(); ++jInd)
2189 const bool finalSegment = ((jInd + 1) == jRoute.
size());
2190 cross.countForSegment(jInd, finalSegment);
2209 ConnRefList::iterator fin =
connRefs.end();
2210 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
2213 ConnRefList::iterator j = i;
2214 for (++j; j != fin; ++j)
2219 cross.checkForBranchingSegments =
true;
2220 for (
size_t jInd = 1; jInd < jRoute.
size(); ++jInd)
2222 const bool finalSegment = ((jInd + 1) == jRoute.
size());
2223 cross.countForSegment(jInd, finalSegment);
2243 ConnRefList::iterator fin =
connRefs.end();
2244 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
2247 ConnRefList::iterator j = i;
2248 for (++j; j != fin; ++j)
2253 cross.checkForBranchingSegments =
true;
2254 for (
size_t jInd = 1; jInd < jRoute.
size(); ++jInd)
2256 const bool finalSegment = ((jInd + 1) == jRoute.
size());
2257 cross.countForSegment(jInd, finalSegment);
2280 ConnRefList::iterator fin =
connRefs.end();
2281 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
2284 ConnRefList::iterator j = i;
2285 for (++j; j != fin; ++j)
2289 ConnRef *iConn = (optimisedForConnectorType) ? *i :
nullptr;
2290 ConnRef *jConn = (optimisedForConnectorType) ? *j :
nullptr;
2292 cross.checkForBranchingSegments =
true;
2293 for (
size_t jInd = 1; jInd < jRoute.
size(); ++jInd)
2295 const bool finalSegment = ((jInd + 1) == jRoute.
size());
2299 cross.countForSegment(jInd, finalSegment);
2301 count += cross.crossingCount;
2313 ConnRefList::iterator fin =
connRefs.end();
2314 for (ConnRefList::iterator i =
connRefs.begin(); i != fin; ++i)
2321 for (
size_t iInd = 1; iInd < iRoute.
size(); ++iInd)
2324 if ( (iRoute.
at(iInd - 1).
x != iRoute.
at(iInd).
x) &&
2325 (iRoute.
at(iInd - 1).
y != iRoute.
at(iInd).
y) )
2360 std::string filename;
2361 if (!instanceName.empty())
2363 filename = instanceName;
2367 filename =
"libavoid-debug";
2370 FILE *fp = fopen(filename.c_str(),
"w");
2377 double minX =
LIMIT;
2378 double minY =
LIMIT;
2379 double maxX = -
LIMIT;
2380 double maxY = -
LIMIT;
2392 minX = std::min(minX, p.
x);
2396 maxX = std::max(maxX, p.
x);
2400 minY = std::min(minY, p.
y);
2404 maxY = std::max(maxY, p.
y);
2413 fprintf(fp,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
2414 fprintf(fp,
"<svg xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%%\" height=\"100%%\" viewBox=\"%g %g %g %g\">\n", minX, minY, maxX - minX, maxY - minY);
2417 fprintf(fp,
"<!-- Source code to generate this instance:\n");
2418 fprintf(fp,
"#include \"libavoid/libavoid.h\"\n");
2421 fprintf(fp,
"#include \"libcola/cola.h\"\n");
2422 fprintf(fp,
"#include \"libtopology/orthogonal_topology.h\"\n");
2423 fprintf(fp,
"using namespace cola;\n");
2425 fprintf(fp,
"using namespace Avoid;\n");
2426 fprintf(fp,
"int main(void) {\n");
2427 fprintf(fp,
" Router *router = new Router(");
2430 fprintf(fp,
"PolyLineRouting");
2438 fprintf(fp,
"OrthogonalRouting");
2440 fprintf(fp,
");\n");
2443 fprintf(fp,
" router->setRoutingParameter((RoutingParameter)%lu, %g);\n",
2448 fprintf(fp,
" router->setRoutingOption((RoutingOption)%lu, %s);\n",
2451 fprintf(fp,
" Polygon polygon;\n");
2452 fprintf(fp,
" ConnRef *connRef = nullptr;\n");
2453 fprintf(fp,
" ConnEnd srcPt;\n");
2454 fprintf(fp,
" ConnEnd dstPt;\n");
2455 fprintf(fp,
" ConnEnd heConnPt;\n");
2456 fprintf(fp,
" PolyLine newRoute;\n");
2457 fprintf(fp,
" ShapeConnectionPin *connPin = nullptr;\n");
2459 ClusterRefList::reverse_iterator revClusterRefIt =
clusterRefs.rbegin();
2463 fprintf(fp,
" polygon = Polygon(%lu);\n",
2465 for (
size_t i = 0; i <cRef->
polygon().
size(); ++i)
2467 fprintf(fp,
" polygon.ps[%lu] = Point(%g, %g);\n",
2471 fprintf(fp,
" new ClusterRef(router, polygon, %u);\n", cRef->
id());
2474 ObstacleList::reverse_iterator revObstacleIt =
m_obstacles.rbegin();
2477 Obstacle *obstacle = *revObstacleIt;
2481 ConnRefList::reverse_iterator revConnRefIt =
connRefs.rbegin();
2482 while (revConnRefIt !=
connRefs.rend())
2484 ConnRef *connRef = *revConnRefIt;
2491 fprintf(fp,
" router->processTransaction();\n");
2492 fprintf(fp,
" router->outputInstanceToSVG();\n");
2495 fprintf(fp,
" delete router;\n");
2496 fprintf(fp,
" return 0;\n");
2497 fprintf(fp,
"};\n");
2498 fprintf(fp,
"-->\n");
2500 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2501 "inkscape:label=\"Clusters\">\n");
2506 fprintf(fp,
"<path id=\"cluster-%u\" style=\"stroke-width: 1px; "
2507 "stroke: black; fill: green; opacity: 0.1;\" d=\"",
2509 for (
size_t i = 0; i < cRef->
polygon().
size(); ++i)
2511 fprintf(fp,
"%c %g %g ", ((i == 0) ?
'M' :
'L'),
2514 fprintf(fp,
"Z\" />\n");
2516 fprintf(fp,
"<path id=\"cluster-%u-rect\" style=\"stroke-width: 1px; "
2517 "stroke: black; fill: green; opacity: 0.1;\" d=\"",
2521 fprintf(fp,
"%c %g %g ", ((i == 0) ?
'M' :
'L'),
2525 fprintf(fp,
"Z\" />\n");
2528 fprintf(fp,
"</g>\n");
2530 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2531 "style=\"display: none;\" "
2532 "inkscape:label=\"ShapePolygons\">\n");
2533 ObstacleList::iterator obstacleIt =
m_obstacles.begin();
2537 bool isShape = (
nullptr !=
dynamic_cast<ShapeRef *
> (obstacle));
2546 fprintf(fp,
"<path id=\"poly-%u\" style=\"stroke-width: 1px; "
2547 "stroke: black; fill: %s; fill-opacity: 0.3;\" d=\"",
2548 obstacle->
id(), (isShape) ?
"grey" :
"red");
2549 for (
size_t i = 0; i < obstacle->
polygon().
size(); ++i)
2551 fprintf(fp,
"%c %g %g ", ((i == 0) ?
'M' :
'L'),
2554 fprintf(fp,
"Z\" />\n");
2557 fprintf(fp,
"</g>\n");
2559 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2560 "style=\"display: none;\" "
2561 "inkscape:label=\"ObstaclePolygons\">\n");
2566 bool isShape = (
nullptr !=
dynamic_cast<ShapeRef *
> (obstacle));
2576 fprintf(fp,
"<path id=\"poly-%u\" style=\"stroke-width: 1px; "
2577 "stroke: black; fill: %s; fill-opacity: 0.3;\" d=\"",
2578 obstacle->
id(), (isShape) ?
"grey" :
"red");
2579 for (
size_t i = 0; i < polygon.
size(); ++i)
2581 fprintf(fp,
"%c %g %g ", ((i == 0) ?
'M' :
'L'),
2582 polygon.
at(i).
x, polygon.
at(i).
y);
2584 fprintf(fp,
"Z\" />\n");
2587 fprintf(fp,
"</g>\n");
2589 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2590 "style=\"display: none;\" "
2591 "inkscape:label=\"IdealJunctions\">\n");
2592 for (ObstacleList::iterator obstacleIt =
m_obstacles.begin();
2598 fprintf(fp,
"<circle id=\"idealJunction-%u\" cx=\"%g\" cy=\"%g\" "
2599 "r=\"8\" style=\"stroke: none; fill: %s; "
2600 "fill-opacity: 0.5;\" />\n", junction->
id(),
2606 fprintf(fp,
"</g>\n");
2608 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2609 "inkscape:label=\"ObstacleRects\">\n");
2614 bool isShape = (
nullptr !=
dynamic_cast<ShapeRef *
> (obstacle));
2625 fprintf(fp,
"<rect id=\"rect-%u\" x=\"%g\" y=\"%g\" width=\"%g\" "
2626 "height=\"%g\" style=\"stroke-width: 1px; stroke: black; "
2627 "fill: grey; stroke-opacity: 0.1; fill-opacity: 0.1;\" />\n",
2632 fprintf(fp,
"</g>\n");
2634 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2635 "inkscape:label=\"VisGraph\""
2638 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2639 "style=\"display: none;\" "
2640 "inkscape:label=\"VisGraph-shape\""
2645 std::pair<VertID, VertID> ids = t->
ids();
2646 bool isConn = ids.first.isConnPt() || ids.second.isConnPt();
2651 std::pair<Point, Point> ptpair = t->points();
2652 Point p1 = ptpair.first;
2653 Point p2 = ptpair.second;
2660 fprintf(fp,
"<path d=\"M %g %g L %g %g\" "
2661 "style=\"fill: none; stroke: %s; stroke-width: 1px;\" />\n",
2662 p1.
x, p1.
y, p2.
x, p2.
y,
2663 (ids.first.isConnPt() || ids.second.isConnPt()) ?
"blue" :
2666 fprintf(fp,
"</g>\n");
2667 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2668 "style=\"display: none;\" "
2669 "inkscape:label=\"VisGraph-conn\""
2674 std::pair<VertID, VertID> ids = t->
ids();
2675 bool isConn = ids.first.isConnPt() || ids.second.isConnPt();
2680 std::pair<Point, Point> ptpair = t->points();
2681 Point p1 = ptpair.first;
2682 Point p2 = ptpair.second;
2689 fprintf(fp,
"<path d=\"M %g %g L %g %g\" "
2690 "style=\"fill: none; stroke: %s; stroke-width: 1px;\" />\n",
2691 p1.
x, p1.
y, p2.
x, p2.
y,
2692 (ids.first.isConnPt() || ids.second.isConnPt()) ?
"blue" :
2695 fprintf(fp,
"</g>\n");
2696 fprintf(fp,
"</g>\n");
2698 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2699 "style=\"display: none;\" "
2700 "inkscape:label=\"OrthogVisGraph\">\n");
2704 std::pair<Point, Point> ptpair = t->
points();
2705 Point p1 = ptpair.first;
2706 Point p2 = ptpair.second;
2713 std::pair<VertID, VertID> ids = t->ids();
2715 fprintf(fp,
"<path d=\"M %g %g L %g %g\" "
2716 "style=\"fill: none; stroke: %s; stroke-width: 1px;\" />\n",
2717 p1.
x, p1.
y, p2.
x, p2.
y,
2718 (ids.first.isConnPt() || ids.second.isConnPt()) ?
"green" :
2721 fprintf(fp,
"</g>\n");
2723 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2724 "style=\"display: none;\" "
2725 "inkscape:label=\"RawConnectors\""
2727 ConnRefList::iterator connRefIt =
connRefs.begin();
2728 while (connRefIt !=
connRefs.end())
2730 ConnRef *connRef = *connRefIt;
2735 fprintf(fp,
"<path id=\"raw-%u\" d=\"M %g %g ", connRef->
id(),
2736 route.
ps[0].x, route.
ps[0].y);
2737 for (
size_t i = 1; i < route.
size(); ++i)
2739 fprintf(fp,
"L %g %g ", route.
ps[i].x, route.
ps[i].y);
2742 if (connRef->
src() && connRef->
dst())
2744 fprintf(fp,
"debug=\"src: %d dst: %d\" ",
2748 fprintf(fp,
"style=\"fill: none; stroke: black; "
2749 "stroke-width: 1px;\" />\n");
2754 fprintf(fp,
"</g>\n");
2756 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2757 "style=\"display: none;\" "
2758 "inkscape:label=\"CurvedDisplayConnectors\""
2761 while (connRefIt !=
connRefs.end())
2763 ConnRef *connRef = *connRefIt;
2768 fprintf(fp,
"<path id=\"curved-%u\" d=\"M %g %g ", connRef->
id(),
2769 route.
ps[0].x, route.
ps[0].y);
2770 for (
size_t i = 1; i < route.
size(); ++i)
2772 if (route.
ts[i] ==
'C')
2774 fprintf(fp,
"%c %g %g %g %g %g %g", route.
ts[i],
2775 route.
ps[i].x, route.
ps[i].y,
2776 route.
ps[i+1].x, route.
ps[i+1].y,
2777 route.
ps[i+2].x, route.
ps[i+2].y);
2782 fprintf(fp,
"%c %g %g ", route.
ts[i],
2783 route.
ps[i].x, route.
ps[i].y);
2787 if (connRef->
src() && connRef->
dst())
2789 fprintf(fp,
"debug=\"src: %d dst: %d\" ",
2793 fprintf(fp,
"style=\"fill: none; stroke: black; "
2794 "stroke-width: 1px;\" />\n");
2799 fprintf(fp,
"</g>\n");
2802 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2803 "inkscape:label=\"DisplayConnectors\""
2806 while (connRefIt !=
connRefs.end())
2808 ConnRef *connRef = *connRefIt;
2813 fprintf(fp,
"<path id=\"disp-%u\" d=\"M %g %g ", connRef->
id(),
2814 route.
ps[0].x, route.
ps[0].y);
2815 for (
size_t i = 1; i < route.
size(); ++i)
2817 fprintf(fp,
"L %g %g ", route.
ps[i].x, route.
ps[i].y);
2820 if (connRef->
src() && connRef->
dst())
2822 fprintf(fp,
"debug=\"src: %d dst: %d\" ",
2826 fprintf(fp,
"style=\"fill: none; stroke: black; "
2827 "stroke-width: 1px;\" />\n");
2832 fprintf(fp,
"</g>\n");
2834 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2835 "inkscape:label=\"ConnectorCheckpoints\""
2838 while (connRefIt !=
connRefs.end())
2840 ConnRef *connRef = *connRefIt;
2844 fprintf(fp,
"<circle id=\"checkpoint-%u-%d\" cx=\"%g\" cy=\"%g\" "
2845 "r=\"8\" style=\"stroke: none; fill: red; "
2846 "fill-opacity: 0.25;\" />\n", connRef->
id(), (
int) i,
2853 fprintf(fp,
"</g>\n");
2856 fprintf(fp,
"</svg>\n");
2863 std::string filename;
2864 if (!instanceName.empty())
2866 filename = instanceName;
2870 filename =
"libavoid-diagram";
2873 FILE *fp = fopen(filename.c_str(),
"w");
2880 double minX =
LIMIT;
2881 double minY =
LIMIT;
2882 double maxX = -
LIMIT;
2883 double maxY = -
LIMIT;
2895 minX = std::min(minX, p.
x);
2899 maxX = std::max(maxX, p.
x);
2903 minY = std::min(minY, p.
y);
2907 maxY = std::max(maxY, p.
y);
2916 fprintf(fp,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
2917 fprintf(fp,
"<svg xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%%\" height=\"100%%\" viewBox=\"%g %g %g %g\">\n", minX, minY, maxX - minX, maxY - minY);
2919 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2920 "inkscape:label=\"ShapesRect\">\n");
2921 ObstacleList::iterator obstacleIt =
m_obstacles.begin();
2925 bool isShape = (
nullptr !=
dynamic_cast<ShapeRef *
> (obstacle));
2936 fprintf(fp,
"<rect id=\"rect-%u\" x=\"%g\" y=\"%g\" width=\"%g\" "
2937 "height=\"%g\" style=\"stroke-width: 1px; stroke: black; "
2938 "fill: grey; stroke-opacity: 0.5; fill-opacity: 0.4;\" />\n",
2943 fprintf(fp,
"</g>\n");
2945 fprintf(fp,
"<g inkscape:groupmode=\"layer\" "
2946 "inkscape:label=\"DisplayConnectors\""
2948 ConnRefList::iterator connRefIt =
connRefs.begin();
2949 while (connRefIt !=
connRefs.end())
2951 ConnRef *connRef = *connRefIt;
2956 fprintf(fp,
"<path id=\"disp-%u\" d=\"M %g %g ", connRef->
id(),
2957 route.
ps[0].x, route.
ps[0].y);
2958 for (
size_t i = 1; i < route.
size(); ++i)
2960 fprintf(fp,
"L %g %g ", route.
ps[i].x, route.
ps[i].y);
2963 fprintf(fp,
"style=\"fill: none; stroke: black; "
2964 "stroke-width: 1px;\" />\n");
2983 fprintf(fp,
"</g>\n");
2988 for (LineReps::iterator it = lineReps->begin(); it != lineReps->end();
2991 fprintf(fp,
"<path d=\"M %g %g ",
2992 it->begin.x, it->begin.y);
2993 fprintf(fp,
"L %g %g\" ", it->end.x, it->end.y);
2994 fprintf(fp,
"style=\"fill: none; stroke: red; "
2995 "stroke-width: 1px; stroke-opacity: 0.7;\" />\n");
2999 fprintf(fp,
"</svg>\n");
3013 std::string filename;
3014 if (!instanceName.empty())
3016 filename = instanceName;
3020 filename =
"libavoid-diagram";
3023 FILE *fp = fopen(filename.c_str(),
"w");
3030 ObstacleList::iterator obstacleIt =
m_obstacles.begin();
3034 bool isShape = (
nullptr !=
dynamic_cast<ShapeRef *
> (obstacle));
3045 fprintf(fp,
"rect\n");
3046 fprintf(fp,
"id=%u\n", obstacle->
id());
3047 fprintf(fp,
"x=%g\n", bBox.
min.
x);
3048 fprintf(fp,
"y=%g\n", bBox.
min.
y);
3049 fprintf(fp,
"width=%g\n", bBox.
max.
x - bBox.
min.
x);
3050 fprintf(fp,
"height=%g\n", bBox.
max.
y - bBox.
min.
y);
3056 ConnRefList::iterator connRefIt =
connRefs.begin();
3057 while (connRefIt !=
connRefs.end())
3059 ConnRef *connRef = *connRefIt;
3064 fprintf(fp,
"path\n");
3065 fprintf(fp,
"id=%u\n", connRef->
id());
3066 for (
size_t i = 0; i < route.
size(); ++i)
3068 fprintf(fp,
"p%zu: %g %g ", i, route.
ps[i].x, route.
ps[i].y);
3099 m_mapping.push_back(std::make_pair(conn,
false));
3105 std::list<std::pair<ConnRef *, bool> >::iterator it;
3108 if (it->first == conn)
3110 it->first =
nullptr;
3118 std::list<std::pair<ConnRef *, bool> >::iterator it;
3121 if ((it->first !=
nullptr) && (it->second ==
true))
3124 it->first->m_needs_reroute_flag =
true;
Obstacle * obstacle(void) const
ShapeRef * shape(void) const
ConnRef * conn(void) const
JunctionRef * junction(void) const
A bounding box, represented by the top-left and bottom-right corners.
Point min
The top-left point.
Point max
The bottom-right point.
The ClusterRef class represents a cluster object.
unsigned int id(void) const
Returns the ID of this cluster.
ReferencingPolygon & polygon(void)
Returns a reference to the polygon boundary of this cluster.
Polygon & rectangularPolygon(void)
Returns a reference to the rectangular boundary of this cluster.
The ConnEnd class represents different possible endpoints for connectors.
The ConnRef class represents a connector object.
void outputCode(FILE *fp) const
unsigned int id(void) const
Returns the ID of this connector.
void freeActivePins(void)
const PolyLine & route(void) const
Returns a reference to the current raw "debug" route for the connector.
VertInf * dst(void) const
ConnType routingType(void) const
Returns the type of routing performed for this connector.
bool m_needs_reroute_flag
bool hasFixedRoute(void) const
Returns whether the connector route is marked as fixed.
std::vector< Checkpoint > m_checkpoints
void makePathInvalid(void)
void performCallback(void)
VertInf * src(void) const
PolyLine & displayRoute(void)
Returns a reference to the current display version of the route for the connector.
std::pair< ConnEnd, ConnEnd > endpointConnEnds(void) const
Returns ConnEnds specifying what this connector is attached to.
void updateEndPoint(const unsigned int type, const ConnEnd &connEnd)
ConnRerouteFlagDelegate()
~ConnRerouteFlagDelegate()
std::list< std::pair< ConnRef *, bool > > m_mapping
bool * addConn(ConnRef *conn)
void removeConn(ConnRef *conn)
std::pair< Point, Point > points(void) const
static EdgeInf * checkEdgeVisibility(VertInf *i, VertInf *j, bool knownNew=false)
std::pair< VertID, VertID > ids(void) const
static EdgeInf * existingEdge(VertInf *i, VertInf *j)
void execute(bool canMakeMajorChanges)
void setRouter(Router *router)
HyperedgeNewAndDeletedObjectLists newAndDeletedObjectLists(void) const
The HyperedgeRerouter class is a convenience object that can be used to register hyperedges to be rer...
ConnRefSet calcHyperedgeConnectors(void)
HyperedgeNewAndDeletedObjectLists newAndDeletedObjectLists(size_t index) const
Returns a HyperedgeNewAndDeletedObjectLists detailing the lists of junctions and connectors created a...
void setRouter(Router *router)
void performRerouting(void)
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to.
Point recommendedPosition(void) const
Returns a recommended position for the junction based on improving hyperedge routes.
void moveAttachedConns(const Point &newPosition)
Point position(void) const
Returns the position of this junction.
void setPosition(const Point &position)
unsigned int id(void) const
Returns the ID of this obstacle.
Box routingBox(void) const
void removeFromGraph(void)
void updatePinPolyLineVisibility(void)
void computeVisibilitySweep(void)
virtual void outputCode(FILE *fp) const =0
void computeVisibilityNaive(void)
VertInf * firstVert(void)
void setNewPoly(const Polygon &poly)
bool isActive(void) const
Polygon routingPolygon(void) const
const Polygon & polygon(void) const
Returns a reference to the polygon boundary of this obstacle.
The Point class defines a point in the plane.
A common interface used by the Polygon classes.
Box offsetBoundingBox(double offset) const
Returns the bounding rectangle that contains this polygon with optionally some buffer space around it...
A dynamic Polygon, to which points can be easily added and removed.
size_t size(void) const
Returns the number of points in this polygon.
Polygon curvedPolyline(const double curve_amount, const bool closed=false) const
Returns a curved approximation of this multi-segment PolyLine, with the corners replaced by smooth Be...
std::vector< char > ts
If used, denotes whether the corresponding point in ps is a move-to operation or a Bezier curve-to.
bool empty(void) const
Returns true if this polygon is empty.
void translate(const double xDist, const double yDist)
Translates the polygon position by a relative amount.
std::vector< Point > ps
A vector of the points that make up the Polygon.
const Point & at(size_t index) const
Returns a specific point in the polygon.
A Polygon which just references its points from other Polygons.
const Point & at(size_t index) const
Returns a specific point in the polygon.
size_t size(void) const
Returns the number of points in this polygon.
unsigned int assignId(const unsigned int suggestedId)
void moveJunction(JunctionRef *junction, const Point &newPosition)
Move an existing junction within the router scene.
void rerouteAndCallbackConnectors(void)
void setRoutingOption(const RoutingOption option, const bool value)
Turn specific routing options on or off.
void newBlockingShape(const Polygon &poly, int pid)
TopologyAddonInterface * m_topology_addon
void checkAllMissingEdges(void)
void deleteShape(ShapeRef *shape)
Delete a shape from the router scene.
virtual unsigned int newObjectId(void) const
Returns the object ID used for automatically generated objects, such as during hyperedge routing.
HyperedgeNewAndDeletedObjectLists newAndDeletedObjectListsFromHyperedgeImprovement(void) const
Returns a HyperedgeNewAndDeletedObjectLists detailing the lists of junctions and connectors created a...
bool m_static_orthogonal_graph_invalidated
bool routingOption(const RoutingOption option) const
Returns the current state for a specific routing option.
HyperedgeImprover m_hyperedge_improver
void setTopologyAddon(TopologyAddonInterface *topologyAddon)
Set an addon for doing orthogonal topology improvement.
void addJunction(JunctionRef *junction)
virtual bool shouldContinueTransactionWithProgress(unsigned int elapsedTime, unsigned int phaseNumber, unsigned int totalPhases, double proportion)
A method called at regular intervals during transaction processing to report progress and ask if the ...
void generateContains(VertInf *pt)
void deleteConnector(ConnRef *connector)
Remove a connector from the router scene.
void modifyConnector(ConnRef *conn)
void adjustContainsWithAdd(const Polygon &poly, const int p_shape)
void improveCrossings(void)
DebugHandler * debugHandler(void) const
HyperedgeRerouter * hyperedgeRerouter(void)
Returns a pointer to the hyperedge rerouter for the router.
virtual ~Router()
Destructor for router instance.
void outputInstanceToSVG(std::string filename=std::string())
Generates an SVG file containing debug output and code that can be used to regenerate the instance.
unsigned int m_largest_assigned_id
DebugHandler * m_debug_handler
ConnType validConnType(const ConnType select=ConnType_None) const
void setRoutingParameter(const RoutingParameter parameter, const double value=chooseSensibleParamValue)
Sets values for routing parameters, including routing penalties.
void deleteJunction(JunctionRef *junction)
Remove a junction from the router scene.
void setStaticGraphInvalidated(const bool invalidated)
ClusterRefList clusterRefs
bool m_consolidate_actions
void setDebugHandler(DebugHandler *handler)
void setTransactionUse(const bool transactions)
Allows setting of the behaviour of the router in regard to transactions.
void moveShape(ShapeRef *shape, const Polygon &newPoly, const bool first_move=false)
Move or resize an existing shape within the router scene.
void addShape(ShapeRef *shape)
bool m_allows_orthogonal_routing
bool m_in_crossing_rerouting_stage
ContainsMap enclosingClusters
void registerSettingsChange(void)
ConnRerouteFlagDelegate m_conn_reroute_flags
bool existsOrthogonalTouchingPaths(void)
bool objectIdIsUnused(const unsigned int id) const
Returns whether or not the given ID is already used.
void attachedShapes(IntList &shapes, const unsigned int shapeId, const unsigned int type)
bool existsOrthogonalSegmentOverlap(const bool atEnds=false)
ActionInfoList actionList
void addCluster(ClusterRef *cluster)
void improveOrthogonalTopology(void)
void regenerateStaticBuiltGraph(void)
void checkAllBlockedEdges(int pid)
void markPolylineConnectorsNeedingReroutingForDeletedObstacle(Obstacle *obstacle)
ShapeRef * shapeContainingPoint(const Point &point)
clock_t m_transaction_start_time
Router(const unsigned int flags)
Constructor for router instance.
double routingParameter(const RoutingParameter parameter) const
Returns the current value for a particular routing parameter of a given type.
void outputDiagram(std::string instanceName=std::string())
int existsCrossings(const bool optimisedForConnectorType=false)
void destroyOrthogonalVisGraph(void)
void attachedConns(IntList &conns, const unsigned int shapeId, const unsigned int type)
bool m_routing_options[lastRoutingOptionMarker]
void performContinuationCheck(unsigned int phaseNumber, size_t stepNumber, size_t totalSteps)
double m_routing_parameters[lastRoutingParameterMarker]
bool processTransaction(void)
Finishes the current transaction and processes all the queued object changes efficiently.
void outputDiagramSVG(std::string instanceName=std::string(), LineReps *lineReps=nullptr)
void processActions(void)
bool m_allows_polyline_routing
void modifyConnectionPin(ShapeConnectionPin *pin)
void adjustClustersWithAdd(const PolygonInterface &poly, const int p_cluster)
bool isInCrossingPenaltyReroutingStage(void) const
void setRoutingPenalty(const RoutingParameter penType, const double penVal=chooseSensibleParamValue)
Sets or removes penalty values that are applied during connector routing.
void adjustContainsWithDel(const int p_shape)
bool existsOrthogonalFixedSegmentOverlap(const bool atEnds=false)
bool m_currently_calling_destructors
void outputDiagramText(std::string instanceName=std::string())
HyperedgeRerouter m_hyperedge_rerouter
bool existsInvalidOrthogonalPaths(void)
bool transactionUse(void) const
Reports whether the router groups actions into transactions.
void deleteCluster(ClusterRef *cluster)
void adjustClustersWithDel(const int p_cluster)
void removeObjectFromQueuedActions(const void *object)
void markAllObstaclesAsMoved(void)
The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to.
ConnectionPinIds ids(void) const
bool isExclusive(void) const
Returns whether the connection pin is exclusive, i.e., only one connector can attach to it.
The ShapeRef class represents a shape object.
const Polygon & polygon(void) const
Returns a reference to the polygon boundary of this shape.
void moveAttachedConns(const Polygon &newPoly)
virtual bool outputDeletionCode(FILE *fp) const
virtual void improveOrthogonalTopology(Router *router)
virtual TopologyAddonInterface * clone(void) const
virtual bool outputCode(FILE *fp) const
bool isConnPt(void) const
bool isConnectionPin(void) const
VertInf * shapesBegin(void)
VertInf * removeVertex(VertInf *vert)
VertInf * connsBegin(void)
ConnDirFlags visDirections
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
Contains the interface for the ShapeConnectionPin class.
Contains the interface for the ConnRef class.
Contains the interface for the ConnEnd class.
Contains the interface for the JunctionRef class.
libavoid: Object-avoiding orthogonal and polyline connector routing library.
std::list< CrossingConnectorsMap > CrossingConnectorsMapList
void db_printf(const char *fmt,...)
double manhattanDist(const Point &a, const Point &b)
static double cost(ConnRef *lineRef, const double dist, VertInf *inf2, VertInf *inf3, ANode *inf1Node)
bool inPoly(const Polygon &poly, const Point &q, bool countBorder)
static const unsigned int runningTo
std::list< ConnCostRefSet > ConnCostRefSetList
ConnType
Describes the type of routing that is performed for each connector.
@ ConnType_Orthogonal
The connector path will be a shortest-path orthogonal poly-line (only vertical and horizontal line se...
@ ConnType_PolyLine
The connector path will be a shortest-path poly-line that routes around obstacles.
std::pair< double, ConnRef * > ConnCostRef
@ TransactionPhaseRouteSearch
Initial routes are searched for in the visibility graph.
@ TransactionPhaseCrossingDetection
With crossing penalties enabled, crossing detection is performed to find all crossings.
@ TransactionPhaseCompleted
Not a real phase, but represents the router is finished (or has aborted) the transaction and you may ...
@ TransactionPhaseRerouteSearch
Crossing connectors are rerouted to search for better routes.
std::list< unsigned int > IntList
const unsigned int CROSSING_SHARES_PATH_AT_END
std::list< LineRep > LineReps
static const double LIMIT
const unsigned int CROSSING_SHARES_PATH
std::set< ConnRef * > ConnRefSet
bool segmentShapeIntersect(const Point &e1, const Point &e2, const Point &s1, const Point &s2, bool &seenIntersectionAtEndpoint)
std::list< ConnCostRef > ConnCostRefList
static const unsigned int runningFrom
static void reduceRange(double &val)
double euclideanDist(const Point &a, const Point &b)
RoutingParameter
Types of routing parameters and penalties that can be used to tailor the style and improve the qualit...
@ lastRoutingParameterMarker
@ crossingPenalty
This penalty is applied whenever a connector path crosses another connector path.
@ clusterCrossingPenalty
This penalty is applied whenever a connector path crosses a cluster boundary.
@ portDirectionPenalty
This penalty is applied to port selection choice when the other end of the connector being routed doe...
@ fixedSharedPathPenalty
This penalty is applied whenever a connector path shares some segments with an immovable portion of a...
@ anglePenalty
This penalty is applied in its full amount to tight acute bends in the connector path.
@ segmentPenalty
This penalty is applied for each segment in the connector path beyond the first.
@ idealNudgingDistance
This parameter defines the spacing distance that will be used for nudging apart overlapping corners a...
@ OrthogonalRouting
This option specifies that the router should maintain the structures necessary to allow orthogonal co...
@ PolyLineRouting
This option specifies that the router should maintain the structures necessary to allow poly-line con...
static double cheapEstimatedCost(ConnRef *lineRef)
void generateStaticOrthogonalVisGraph(Router *router)
std::list< ConnRef * > ConnRefList
A list of ConnRef objects.
static const VertID dummyOrthogID(0, 0)
static double AngleAFromThreeSides(const double a, const double b, const double c)
const unsigned int CROSSING_SHARES_FIXED_SEGMENT
std::map< ConnRef *, std::set< ConnRef * > > CrossingConnectorsMap
const unsigned int CROSSING_TOUCHES
RoutingOption
Types of routing options that can be enabled.
@ performUnifyingNudgingPreprocessingStep
This option can be used to control whether the router performs a preprocessing step before orthogonal...
@ lastRoutingOptionMarker
@ improveHyperedgeRoutesMovingJunctions
This option causes hyperedge routes to be locally improved fixing obviously bad paths.
@ improveHyperedgeRoutesMovingAddingAndDeletingJunctions
This option causes hyperedge routes to be locally improved fixing obviously bad paths.
@ nudgeOrthogonalTouchingColinearSegments
This option can be used to control whether collinear line segments that touch just at their ends will...
@ nudgeSharedPathsWithCommonEndPoint
This option determines whether intermediate segments of connectors that are attached to common endpoi...
@ penaliseOrthogonalSharedPathsAtConnEnds
This option penalises and attempts to reroute orthogonal shared connector paths terminating at a comm...
@ nudgeOrthogonalSegmentsConnectedToShapes
This option causes the final segments of connectors, which are attached to shapes,...
void improveOrthogonalRoutes(Router *router)
std::set< ConnCostRef, CmpConnCostRef > ConnCostRefSet
bool inPolyGen(const PolygonInterface &argpoly, const Point &q)
Contains the interface for the Router class.
Contains the interface for the ShapeRef class.
The HyperedgeNewAndDeletedObjectLists class stores lists of objects created and deleted during hypere...
ConnRefList deletedConnectorList
A list of deleted connectors.
Contains the interface for the ClusterRef class.