50 m_type(router->validConnType()),
51 m_reroute_flag_ptr(nullptr),
52 m_needs_reroute_flag(true),
54 m_needs_repaint(false),
56 m_hate_crossings(false),
57 m_has_fixed_route(false),
61 m_start_vert(nullptr),
62 m_callback_func(nullptr),
64 m_src_connend(nullptr),
65 m_dst_connend(nullptr)
78 const unsigned int id)
80 m_type(router->validConnType()),
81 m_reroute_flag_ptr(nullptr),
82 m_needs_reroute_flag(true),
84 m_needs_repaint(false),
86 m_hate_crossings(false),
87 m_has_fixed_route(false),
91 m_callback_func(nullptr),
93 m_src_connend(nullptr),
94 m_dst_connend(nullptr)
113 err_printf(
"ERROR: ConnRef::~ConnRef() shouldn't be called directly.\n");
114 err_printf(
" It is owned by the router. Call Router::deleteConnector() instead.\n");
233 COLA_ASSERT((type == (
unsigned int)
VertID::src) ||
354 if (vertex ==
nullptr)
356 err_printf(
"Warning: In ConnRef::getConnEndForEndpointVertex():\n"
357 " ConnEnd for connector %d is uninitialised. It may have been\n"
358 " set but Router::processTrancaction has not yet been called.\n",
405 bool knownNew =
true;
406 bool genContains =
true;
431 fprintf(fp,
" // connRef%u\n",
id());
432 fprintf(fp,
" connRef = new ConnRef(router, %u);\n",
id());
436 fprintf(fp,
" connRef->setSourceEndpoint(srcPt);\n");
440 fprintf(fp,
" srcPt = ConnEnd(Point(%" PREC
"g, %" PREC
"g), %u);\n",
441 src()->point.x,
src()->point.y,
src()->visDirections);
442 fprintf(fp,
" connRef->setSourceEndpoint(srcPt);\n");
447 fprintf(fp,
" connRef->setDestEndpoint(dstPt);\n");
451 fprintf(fp,
" dstPt = ConnEnd(Point(%" PREC
"g, %" PREC
"g), %u);\n",
452 dst()->point.x,
dst()->point.y,
dst()->visDirections);
453 fprintf(fp,
" connRef->setDestEndpoint(dstPt);\n");
455 fprintf(fp,
" connRef->setRoutingType((ConnType)%u);\n",
routingType());
460 fprintf(fp,
" newRoute._id = %u;\n",
id());
461 fprintf(fp,
" newRoute.ps.resize(%d);\n", (
int)currRoute.
size());
462 for (
size_t i = 0; i < currRoute.
size(); ++i)
464 fprintf(fp,
" newRoute.ps[%d] = Point(%" PREC
"g, %" PREC
"g);\n",
465 (
int) i, currRoute.
ps[i].x, currRoute.
ps[i].y);
466 fprintf(fp,
" newRoute.ps[%d].id = %u;\n",
467 (
int) i, currRoute.
ps[i].id);
468 fprintf(fp,
" newRoute.ps[%d].vn = %u;\n",
469 (
int) i, currRoute.
ps[i].vn);
471 fprintf(fp,
" connRef->setFixedRoute(newRoute);\n");
476 fprintf(fp,
" std::vector<Checkpoint> checkpoints%u(%d);\n",
id(),
480 fprintf(fp,
" checkpoints%u[%d] = Checkpoint(Point("
481 "%" PREC
"g, %" PREC
"g), (ConnDirFlags) %d, "
482 "(ConnDirFlags) %d);\n",
id(), (
int) cInd,
487 fprintf(fp,
" connRef->setRoutingCheckpoints(checkpoints%u);\n",
496 std::pair<Obstacle *, Obstacle *> anchors;
497 anchors.first =
nullptr;
498 anchors.second =
nullptr;
513 std::pair<ConnEnd, ConnEnd> endpoints;
520 Point *pointSuggestion)
606 db_printf(
"Error:\tTrying to update libavoid route with itself.\n");
695 const size_t segmentN)
725 return std::make_pair(newJunction, newConn);
814 bool bendOkay =
true;
816 if ((aInf ==
nullptr) || (cInf ==
nullptr))
822 COLA_ASSERT(bInf !=
nullptr);
825 COLA_ASSERT(dInf !=
nullptr);
826 COLA_ASSERT(eInf !=
nullptr);
834 if ((a == b) || (b ==
c))
862 COLA_ASSERT(
vecDir(d, b, e) > 0);
863 int abe =
vecDir(a, b, e);
864 int abd =
vecDir(a, b, d);
868 db_printf(
"&& (abe == %d) && (abd == %d) &&\n(bce == %d) && (bcd == %d)",
875 if ((abc > 0) && (abd >= 0) && (bce >= 0))
882 if ((abc < 0) && (abe <= 0) && (bcd <= 0))
919 return std::make_pair(dummySrc, dummyDst);
959 if (isDummyAtEnd.first)
966 existingRoute.
ps.insert(existingRoute.
ps.begin(), 1, firstPoint);
970 std::vector<Point> path;
971 std::vector<VertInf *> vertices;
981 COLA_ASSERT(vertices.size() >= 2);
982 COLA_ASSERT(vertices[0] ==
src());
983 COLA_ASSERT(vertices[vertices.size() - 1] ==
dst());
986 for (
size_t i = 1; i < vertices.size(); ++i)
1001 VertInf *vertex = vertices[i];
1016 std::vector<Point> clippedPath;
1017 std::vector<Point>::iterator pathBegin = path.begin();
1018 std::vector<Point>::iterator pathEnd = path.end();
1019 if (path.size() > 2 && isDummyAtEnd.first)
1024 if (path.size() > 2 && isDummyAtEnd.second)
1029 clippedPath.insert(clippedPath.end(), pathBegin, pathEnd);
1036 output_route.
ps = clippedPath;
1040 for (
size_t i = 0; i < output_route.
ps.size(); ++i)
1042 db_printf(
"[%d,%d] %g, %g ", output_route.
ps[i].id,
1043 output_route.
ps[i].vn, output_route.
ps[i].x,
1044 output_route.
ps[i].y);
1060 std::vector<VertInf *>& vertices)
1063 checkpoints.insert(checkpoints.begin(),
src());
1064 checkpoints.push_back(
dst());
1068 path.push_back(
src()->point);
1069 vertices.push_back(
src());
1071 size_t lastSuccessfulIndex = 0;
1072 for (
size_t i = 1; i < checkpoints.size(); ++i)
1078 if (lastSuccessfulIndex > 0)
1086 if ((i + 1) < checkpoints.size())
1100 if (lastSuccessfulIndex > 0)
1104 if ((i + 1) < checkpoints.size())
1110 int pathlen =
end->pathLeadsBackTo(
start);
1113 size_t prev_path_size = path.size();
1114 path.resize(prev_path_size + (pathlen - 1));
1115 vertices.resize(prev_path_size + (pathlen - 1));
1117 for (
size_t index = path.size() - 1;
index >= prev_path_size;
1131 vertices[
index] = vertInf;
1134 lastSuccessfulIndex = i;
1136 else if (i + 1 == checkpoints.size())
1139 db_printf(
"Warning: Path not found...\n");
1142 path.push_back(
dst()->point);
1143 vertices.push_back(
dst());
1145 COLA_ASSERT(path.size() >= 2);
1149 err_printf(
"Warning: skipping checkpoint for connector "
1150 "%d at (%g, %g).\n", (
int)
id(),
1151 checkpoints[i]->point.x, checkpoints[i]->point.y);
1157 unsigned int topbit = ((
unsigned int) 1) << 31;
1158 path[path.size() - 1].id =
m_id | topbit;
1164 std::vector<VertInf *>& vertices)
1167 size_t existingPathStart = 0;
1179 for (
size_t i = 0; i < currRoute.
ps.size(); ++i)
1185 if (currRoute.
size() > 2)
1189 existingPathStart = currRoute.
size() - 2;
1190 COLA_ASSERT(existingPathStart != 0);
1191 const Point& pnt = currRoute.
at(existingPathStart);
1201 unsigned int pathlen = 0;
1202 while (pathlen == 0)
1209 if (existingPathStart == 0)
1216 existingPathStart--;
1217 const Point& pnt = currRoute.
at(existingPathStart);
1228 bool unwind =
false;
1249 if (existingPathStart == 0)
1253 existingPathStart--;
1254 const Point& pnt = currRoute.
at(existingPathStart);
1270 db_printf(
"Warning: Path not found...\n");
1282 path.resize(pathlen);
1283 vertices.resize(pathlen);
1285 unsigned int j = pathlen - 1;
1290 path[j].
id = i->id.objID;
1291 path[j].vn = i->id.vn;
1316 std::vector<Point> points;
1328 for (
size_t dim = 0; dim < 2; ++dim)
1343 if (
sorted[dim] ==
false)
1354 if (
sorted[dim] ==
false)
1376 for ( ; i <
nodes[dim].size(); ++i)
1378 if (
nodes[dim][i].second == pointPair.second)
1384 nodes[dim].push_back(pointPair);
1385 return nodes[dim].size() - 1;
1402 COLA_ASSERT(
inner != outer);
1409 links[dim].push_back(std::make_pair(outerIndex, innerIndex));
1419 size_t n =
nodes[dim].size();
1422 std::vector<std::vector<bool> > adjacencyMatrix(n);
1423 for (
size_t i = 0; i < n; ++i)
1425 adjacencyMatrix[i].assign(n,
false);
1427 std::vector<int> incomingDegree(n);
1428 std::queue<size_t> queue;
1431 for (NodeIndexPairLinkList::iterator it =
links[dim].begin();
1432 it !=
links[dim].end(); ++it)
1434 adjacencyMatrix[it->first][it->second] =
true;
1439 for (
size_t i = 0; i < n; ++i)
1443 for (
size_t j = 0; j < n; ++j)
1445 if (adjacencyMatrix[j][i])
1450 incomingDegree[i] =
degree;
1458 while (queue.empty() ==
false)
1460 size_t k = queue.front();
1468 for (
size_t i = 0; i < n; ++i)
1470 if (adjacencyMatrix[k][i])
1472 adjacencyMatrix[k][i] =
false;
1473 incomingDegree[i]--;
1475 if (incomingDegree[i] == 0)
1508 if ((p0.
vn < 4) && (p1.
vn < 4))
1515 int vn_mid = std::min(p0.
vn, p1.
vn);
1516 if ((std::max(p0.
vn, p1.
vn) == 3) && (vn_mid == 0))
1522 COLA_ASSERT((p0.
x == p1.
x) || (p0.
y == p1.
y));
1527 if ((p0.
vn == 2) || (p0.
vn == 3))
1535 if ((p0.
vn == 0) || (p0.
vn == 3))
1546 if ((p1.
vn == 2) || (p1.
vn == 3))
1554 if ((p1.
vn == 0) || (p1.
vn == 3))
1563 db_printf(
"midVertexNumber(): p0.vn and p1.vn both = "
1564 "kUnassignedVertexNumber\n");
1575 for (std::vector<Avoid::Point>::iterator i = conn.
ps.begin();
1576 i != conn.
ps.end(); ++i)
1578 if (i == conn.
ps.begin())
1585 for (std::vector<Avoid::Point>::iterator j = poly.
ps.begin();
1586 j != poly.
ps.end(); )
1588 if (polyIsConn && (j == poly.
ps.begin()))
1595 Point& c0 = *(i - 1);
1598 Point& p0 = (j == poly.
ps.begin()) ? poly.
ps.back() : *(j - 1);
1602 if (((i - 1) == conn.
ps.begin()) &&
1608 j = poly.
ps.insert(j, c0);
1609 if (j != poly.
ps.begin())
1621 j = poly.
ps.insert(j, c1);
1622 if (j != poly.
ps.begin())
1630 if (polyIsConn && ((j - 1) == poly.
ps.begin()) &&
1636 i = conn.
ps.insert(i, p0);
1645 i = conn.
ps.insert(i, p1);
1663 else if (p1.
y == p2.
y)
1677 size_t pLast = poly.
size() - 1;
1678 size_t cLast = conn.
size() - 1;
1681 ((pos == poly.
ps[0][dim]) && (pos == poly.
ps[1][dim])) ||
1683 ((pos == poly.
ps[pLast][dim]) && (pos == poly.
ps[pLast - 1][dim]))
1686 ((pos == conn.
ps[0][dim]) && (pos == conn.
ps[1][dim])) ||
1688 ((pos == conn.
ps[cLast][dim]) && (pos == conn.
ps[cLast - 1][dim]))
1699 polyIsConn(polyIsConn),
1701 checkForBranchingSegments(false),
1702 polyConnRef(polyConnRef),
1703 connConnRef(connConnRef),
1704 crossingPoints(nullptr),
1705 pointOrders(nullptr),
1706 sharedPaths(nullptr)
1726 for (
unsigned int ind = 1; ind <
size; ++ind)
1728 if ( (*(c_path[ind - 1]) == *(p_path[ind - 1])) &&
1729 (*(c_path[ind]) == *(p_path[ind])) )
1736 length +=
manhattanDist(*(c_path[ind - 1]), *(c_path[ind]));
1766 !polyIsOrthogonal || !connIsOrthogonal)
1768 double epsilon = std::numeric_limits<double>::epsilon();
1777 double tolerance = (!
polyIsConn) ? epsilon : 0.0;
1782 COLA_ASSERT(cIndex >= 1);
1794 size_t max_path_size = std::min(poly_size,
conn.
size());
1799 for (
size_t j = ((
polyIsConn) ? 1 : 0); j < poly_size; ++j)
1808 bool converging =
false;
1810 const bool a1_eq_b1 = (a1 == b1);
1811 const bool a2_eq_b1 = (a2 == b1);
1812 const bool a2_eq_b2 = (a2 == b2);
1813 const bool a1_eq_b2 = (a1 == b2);
1815 if ( (a1_eq_b1 && a2_eq_b2) ||
1816 (a2_eq_b1 && a1_eq_b2) )
1829 else if (a2_eq_b1 || a2_eq_b2 || a1_eq_b2)
1840 if (a1_eq_b1 || converging)
1863 COLA_ASSERT(converging || !a2_eq_b2);
1865 bool shared_path =
false;
1879 p_dir_back = a2_eq_b2 ? true :
false;
1880 p_dir = p_dir_back ? -1 : 1;
1881 trace_c = (int) cIndex;
1897 else if (cIndex >= 2)
1905 if ((a0 == b2) || (a0 == b0))
1909 p_dir_back = (a0 == b0) ?
true :
false;
1910 p_dir = p_dir_back ? -1 : 1;
1911 trace_c = (int) cIndex;
1912 trace_p = (int) (p_dir_back ? j : j - 2);
1922 COLA_ASSERT(p_dir != 0);
1927 ((trace_p >= 0) && (trace_p < (
int) poly_size))) )
1931 size_t index_p = (size_t)
1932 ((trace_p + (2 * poly_size)) % poly_size);
1933 size_t index_c = (size_t) trace_c;
1947 bool front_same = (*(c_path[0]) == *(p_path[0]));
1948 bool back_same = (*(c_path[
size - 1]) == *(p_path[
size - 1]));
1951 bool terminatesAtJunction =
false;
1957 std::pair<ConnEnd, ConnEnd> connEnds =
1961 std::pair<ConnEnd, ConnEnd> polyEnds =
1967 connJunction = (front_same) ? connEnds.second.junction() :
1968 connEnds.first.junction();
1969 bool use_first = back_same;
1973 use_first = !use_first;
1977 polyJunction = (use_first) ? polyEnds.second.junction() :
1978 polyEnds.first.junction();
1980 terminatesAtJunction = (connJunction &&
1981 (connJunction == polyJunction));
1987 size_t start = (front_same) ? 0 : 1;
1988 size_t limit =
size - ((back_same) ? 0 : 1);
1993 sPath[i -
start] = *(c_path[i]);
1999 if (polyIsOrthogonal && connIsOrthogonal)
2001 size_t startPt = (front_same) ? 0 : 1;
2002 size_t endPt =
size - ((back_same) ? 1 : 2);
2003 for (
size_t dim = 0; dim < 2; ++dim)
2005 if ((*c_path[startPt])[dim] == (*c_path[endPt])[dim])
2007 double pos = (*c_path[startPt])[dim];
2012 if ( ((pos ==
poly.
ps[0][dim]) ||
2013 (pos ==
poly.
ps[poly_size - 1][dim])) &&
2014 ((pos ==
conn.
ps[0][dim]) ||
2015 (pos ==
conn.
ps[cIndex][dim])) &&
2016 (terminatesAtJunction ==
false))
2023 if (!front_same && !back_same)
2038 for (
size_t dim = 0; dim < 2; ++dim)
2041 size_t altDim = (dim + 1) % 2;
2043 if ((*c_path[1])[altDim] == (*c_path[
end - 1])[altDim])
2045 double posBeg = (*c_path[1])[dim];
2046 double posEnd = (*c_path[
end - 1])[dim];
2048 if ( (posBeg == (*c_path[0])[dim]) &&
2049 (posBeg == (*p_path[0])[dim]) &&
2050 (posEnd == (*c_path[
end])[dim]) &&
2051 (posEnd == (*p_path[
end])[dim]) )
2077 if (!front_same && !back_same)
2079 for (
size_t dim = 0; dim < 2; ++dim)
2081 size_t altDim = (dim + 1) % 2;
2082 if ((*c_path[1])[altDim] == (*c_path[1])[altDim])
2084 size_t n = c_path.size();
2085 double yPosB = (*c_path[1])[dim];
2086 if ( (yPosB == (*c_path[0])[dim]) &&
2087 (yPosB == (*p_path[0])[dim]) )
2093 double yPosE = (*c_path[n - 2])[dim];
2094 if ( (yPosE == (*c_path[n - 1])[dim]) &&
2095 (yPosE == (*p_path[n - 1])[dim]) )
2108 int startCornerSide = 1;
2109 int endCornerSide = 1;
2111 bool reversed =
false;
2117 *c_path[2], *p_path[0]);
2124 *c_path[
size - 2], *c_path[
size - 1],
2129 endCornerSide = startCornerSide;
2133 startCornerSide = endCornerSide;
2136 if (endCornerSide != startCornerSide)
2147 if (front_same || back_same)
2157 double straightModifier = 200;
2160 if (back_same && (
size > 2))
2162 if (
vecDir(*p_path[0], *p_path[1], *p_path[2]) == 0)
2167 if (
vecDir(*c_path[0], *c_path[1], *c_path[2]) == 0)
2172 else if (front_same && (
size > 2))
2175 *p_path[
size - 1]) == 0)
2181 *c_path[
size - 1]) == 0)
2187 else if (polyIsOrthogonal && connIsOrthogonal)
2189 int cStartDir =
vecDir(*c_path[0], *c_path[1], *c_path[2]);
2190 int pStartDir =
vecDir(*p_path[0], *p_path[1], *p_path[2]);
2191 if ((cStartDir != 0) && (cStartDir == -pStartDir))
2197 startCornerSide = -cStartDir;
2202 *c_path[
size - 2], *c_path[
size - 1]);
2204 *p_path[
size - 2], *p_path[
size - 1]);
2205 if ((cEndDir != 0) && (cEndDir == -pEndDir))
2211 startCornerSide = -cEndDir;
2217 int prevTurnDir = 0;
2221 COLA_ASSERT(c_path.size() > 0 || back_same);
2222 size_t adj_size = (c_path.size() - ((back_same) ? 0 : 1));
2223 for (
size_t i = (front_same) ? 0 : 1; i < adj_size; ++i)
2227 int currTurnDir = ((i > 0) && (i < (adj_size - 1))) ?
2228 vecDir(*c_path[i - 1], an,
2229 *c_path[i + 1]) : 0;
2231 if ( (currTurnDir == (-1 * prevTurnDir)) &&
2232 (currTurnDir != 0) && (prevTurnDir != 0) )
2238 reversed = !reversed;
2240 bool orderSwapped = (*pointOrders)[an].addOrderedPoints(
2241 &bn, &an, reversed);
2245 reversed = !reversed;
2247 prevTurnDir = currTurnDir;
2254 size_t startPt = (front_same) ? 0 : 1;
2257 COLA_ASSERT(
size > (startPt + 1));
2259 if (startCornerSide > 0)
2261 reversed = !reversed;
2266 COLA_ASSERT(
size > 0 || back_same);
2267 size_t adj_size = (
size - ((back_same) ? 0 : 1));
2268 for (
size_t i = startPt; i < adj_size; ++i)
2272 COLA_ASSERT(an == bn);
2279 int thisDir =
segDir(ap, an);
2284 reversed = !reversed;
2287 else if (thisDir != prevDir)
2289 reversed = !reversed;
2292 int orientation = (ap.
x == an.
x) ? 0 : 1;
2295 (*pointOrders)[an].addOrderedPoints(
2300 COLA_ASSERT(ap == bp);
2302 (*pointOrders)[ap].addOrderedPoints(
2313 if ((
id.vn == 1) || (
id.vn == 2))
2320 if ((
id.vn == 0) || (
id.vn == 1))
2333 else if (
id.vn == 5)
2338 else if (
id.vn == 6)
2343 else if (
id.vn == 7)
2353 else if (cIndex >= 2)
2359 COLA_ASSERT(cIndex >= 2);
2381 if (polyIsOrthogonal && connIsOrthogonal)
2387 bool reversedX = ((a0.
x < a1.
x) || (a2.
x < a1.
x));
2388 bool reversedY = ((a0.
y < a1.
y) || (a2.
y < a1.
y));
2392 (*pointOrders)[b1].addOrderedPoints(0,
2396 (*pointOrders)[b1].addOrderedPoints(1,
2405 int turnDirA =
vecDir(a0, a1, a2);
2406 int turnDirB =
vecDir(b0, b1, b2);
2407 bool reversed = (side1 != -turnDirA);
2420 else if (turnDirB == 0)
2436 if ( polyIsOrthogonal && connIsOrthogonal)
2449 a1, a2, b1, b2, &(cPt.
x), &(cPt.
y));
2454 ((a1 == cPt) || (a2 == cPt) || (b1 == cPt) || (b2 == cPt)))
2459 COLA_ASSERT(a1 != cPt);
2460 COLA_ASSERT(a2 != cPt);
2461 COLA_ASSERT(b1 != cPt);
2462 COLA_ASSERT(b2 != cPt);
static SPStyleProp const props[]
Lookup dictionary for attributes/properties.
void search(ConnRef *lineRef, VertInf *src, VertInf *tar, VertInf *start)
A checkpoint is a point that the route for a particular connector must visit.
ConnDirFlags departureDirections
ConnDirFlags arrivalDirections
The ConnEnd class represents different possible endpoints for connectors.
std::vector< Point > possiblePinPoints(void) const
const Point position(void) const
Returns the position of this connector endpoint.
void usePinVertex(VertInf *pinVert)
bool isPinConnection(void) const
ConnDirFlags directions(void) const
Returns the directions in which this connector endpoint should be given visibility.
void outputCode(FILE *fp, const char *srcDst) const
void disconnect(const bool shapeDeleted=false)
void connect(ConnRef *conn)
void assignPinVisibilityTo(VertInf *dummyConnectionVert, VertInf *targetVert)
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.
std::vector< Point > possibleDstPinPoints(void) const
VertInf * dst(void) const
ConnType routingType(void) const
Returns the type of routing performed for this connector.
ConnRef(Router *router, const unsigned int id=0)
Constructs a connector with no endpoints specified.
void removeFromGraph(void)
std::pair< JunctionRef *, ConnRef * > splitAtSegment(const size_t segmentN)
Splits a connector in the centre of the segmentNth segment and creates a junction point there as well...
std::vector< Checkpoint > routingCheckpoints(void) const
Returns the current set of routing checkpoints for this connector.
void setFixedRoute(const PolyLine &route)
Sets a fixed user-specified route for this connector.
std::vector< VertInf * > m_checkpoint_vertices
bool m_needs_reroute_flag
bool doesHateCrossings(void) const
void setSourceEndpoint(const ConnEnd &srcPoint)
Sets just a new source endpoint for this connector.
void setEndpoint(const unsigned int type, const ConnEnd &connEnd)
bool hasFixedRoute(void) const
Returns whether the connector route is marked as fixed.
std::vector< Checkpoint > m_checkpoints
void makePathInvalid(void)
bool needsRepaint(void) const
Returns an indication of whether this connector has a new route and thus needs to be repainted.
ConnRefList::iterator m_connrefs_pos
void performCallback(void)
void setHateCrossings(bool value)
std::pair< Obstacle *, Obstacle * > endpointAnchors(void) const
void setDestEndpoint(const ConnEnd &dstPoint)
Sets just a new destination endpoint for this connector.
void common_updateEndPoint(const unsigned int type, ConnEnd connEnd)
void setRoutingCheckpoints(const std::vector< Checkpoint > &checkpoints)
Allows the user to specify a set of checkpoints that this connector will route via.
void clearFixedRoute(void)
Returns the connector to being automatically routed if it was marked as fixed.
void setCallback(void(*cb)(void *), void *ptr)
Sets a callback function that will called to indicate that the connector needs rerouting.
bool isInitialised(void) const
PolyLine & routeRef(void)
void setFixedExistingRoute(void)
Sets a fixed existing route for this connector.
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.
~ConnRef()
Connector reference destuctor.
Router * router(void) const
Returns a pointer to the router scene this connector is in.
void setRoutingType(ConnType type)
Sets the type of routing to be performed for this connector.
void(* m_callback_func)(void *)
void generateCheckpointsPath(std::vector< Point > &path, std::vector< VertInf * > &vertices)
void setEndpoints(const ConnEnd &srcPoint, const ConnEnd &dstPoint)
Sets both a new source and destination endpoint for this connector.
bool * m_reroute_flag_ptr
void generateStandardPath(std::vector< Point > &path, std::vector< VertInf * > &vertices)
bool getConnEndForEndpointVertex(VertInf *vertex, ConnEnd &connEnd) const
void set_route(const PolyLine &route)
void updateEndPoint(const unsigned int type, const ConnEnd &connEnd)
std::pair< bool, bool > assignConnectionPinVisibility(const bool connect)
bool * addConn(ConnRef *conn)
void removeConn(ConnRef *conn)
unsigned int crossingFlags
PointSet * crossingPoints
ConnectorCrossings(Avoid::Polygon &poly, bool polyIsConn, Avoid::Polygon &conn, ConnRef *polyConnRef=nullptr, ConnRef *connConnRef=nullptr)
bool checkForBranchingSegments
void countForSegment(size_t cIndex, const bool finalSegment)
SharedPathList * sharedPaths
double secondSharedPathAtEndLength
unsigned int crossingCount
double firstSharedPathAtEndLength
virtual void updateConnectorRoute(ConnRef *conn, int index1, int index2)
void setDist(double dist)
static EdgeInf * existingEdge(VertInf *i, VertInf *j)
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to.
void preferOrthogonalDimension(const size_t dim)
The Point class defines a point in the plane.
unsigned short vn
The vertex number associated with this point.
unsigned int id
The ID associated with this point.
A dynamic Polygon, to which points can be easily added and removed.
Polygon simplify(void) const
Returns a simplified Polyline, where all collinear line segments have been collapsed down into single...
size_t size(void) const
Returns the number of points in this polygon.
bool empty(void) const
Returns true if this polygon is empty.
std::vector< Point > ps
A vector of the points that make up the Polygon.
void clear(void)
Resets this to the empty polygon.
const Point & at(size_t index) const
Returns a specific point in the polygon.
void sort(const size_t dim)
void addPoints(const size_t dim, const PtConnPtrPair &arg1, const PtConnPtrPair &arg2)
size_t insertPoint(const size_t dim, const PtConnPtrPair &point)
int positionFor(const size_t dim, const ConnRef *conn)
PointRepVector sortedConnVector[2]
NodeIndexPairLinkList links[2]
PointRepVector sortedPoints(const size_t dim)
void addOrderedPoints(const size_t dim, const PtConnPtrPair &innerArg, const PtConnPtrPair &outerArg, bool swapped)
The Router class represents a libavoid router instance.
unsigned int assignId(const unsigned int suggestedId)
void addJunction(JunctionRef *junction)
void modifyConnector(ConnRef *conn)
DebugHandler * debugHandler(void) const
ConnType validConnType(const ConnType select=ConnType_None) const
void setStaticGraphInvalidated(const bool invalidated)
void registerSettingsChange(void)
ConnRerouteFlagDelegate m_conn_reroute_flags
bool processTransaction(void)
Finishes the current transaction and processes all the queued object changes efficiently.
bool m_allows_polyline_routing
bool m_currently_calling_destructors
void removeObjectFromQueuedActions(const void *object)
static const unsigned short tar
static const VertIDProps PROP_DummyPinHelper
static const VertIDProps PROP_ConnCheckpoint
static const unsigned short src
void db_print(void) const
bool isConnPt(void) const
bool isConnCheckpoint(void) const
bool isConnectionPin(void) const
static const VertIDProps PROP_ConnPoint
VertInf * getVertexByID(const VertID &id)
VertInf * removeVertex(VertInf *vert)
void setVisibleDirections(const ConnDirFlags directions)
ConnDirFlags visDirections
void removeFromGraph(const bool isConnVert=true)
unsigned int pathLeadsBackTo(const VertInf *start) const
void Reset(const VertID &vid, const Point &vpoint)
double inner(valarray< double > const &x, valarray< double > const &y)
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.
const unsigned int CROSSING_NONE
void db_printf(const char *fmt,...)
double manhattanDist(const Point &a, const Point &b)
int segmentIntersectPoint(const Point &a1, const Point &a2, const Point &b1, const Point &b2, double *x, double *y)
bool validateBendPoint(VertInf *aInf, VertInf *bInf, VertInf *cInf)
static const int DO_INTERSECT
Point midpoint(Point a, Point b)
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.
static double pathLength(Avoid::Point **c_path, Avoid::Point **p_path, size_t size)
static const unsigned short kUnassignedVertexNumber
Constant value representing an unassigned vertex number.
std::pair< Point *, ConnRef * > PtConnPtrPair
const unsigned int CROSSING_SHARES_PATH_AT_END
static int midVertexNumber(const Point &p0, const Point &p1, const Point &c)
void vertexVisibility(VertInf *point, VertInf *partner, bool knownNew, const bool gen_contains)
const unsigned int CROSSING_SHARES_PATH
static int segDir(const Point &p1, const Point &p2)
double euclideanDist(const Point &a, const Point &b)
unsigned short VertIDProps
static int vecDir(const Point &a, const Point &b, const Point &c, const double maybeZero=0.0)
const unsigned int CROSSING_SHARES_FIXED_SEGMENT
std::vector< Avoid::Point > PointList
void err_printf(const char *fmt,...)
const unsigned int CROSSING_TOUCHES
@ ConnDirAll
This option, provided for convenience, specifies the point should be given visibility to all four sid...
std::vector< PtConnPtrPair > PointRepVector
bool pointOnLine(const Point &a, const Point &b, const Point &c, const double tolerance)
int cornerSide(const Point &c1, const Point &c2, const Point &c3, const Point &p)
void splitBranchingSegments(Avoid::Polygon &poly, bool polyIsConn, Avoid::Polygon &conn, const double tolerance)
static bool posInlineWithConnEndSegs(const double pos, const size_t dim, const Avoid::Polygon &poly, const Avoid::Polygon &conn)
double dist(const Point &a, const Point &b)
Contains the interface for the Router class.