void buildConnectorRouteCheckpointCache(Router *router) { for (ConnRefList::const_iterator curr = router->connRefs.begin(); curr != router->connRefs.end(); ++curr) { ConnRef *conn = *curr; if (conn->routingType() != ConnType_Orthogonal) { continue; } PolyLine& displayRoute = conn->displayRoute(); std::vector<Point> checkpoints = conn->routingCheckpoints(); // Initialise checkpoint vector and set to false. There will be // one entry for each *segment* in the path, and the value indicates // whether the segment is affected by a checkpoint. displayRoute.segmentHasCheckpoint = std::vector<bool>(displayRoute.size() - 1, false); size_t nCheckpoints = displayRoute.segmentHasCheckpoint.size(); for (size_t cpi = 0; cpi < checkpoints.size(); ++cpi) { for (size_t ind = 0; ind < displayRoute.size(); ++ind) { if (displayRoute.ps[ind].equals(checkpoints[cpi])) { // The checkpoint is at a bendpoint, so mark the edge // before and after and being affected by checkpoints. if (ind > 0) { displayRoute.segmentHasCheckpoint[ind - 1] = true; } if (ind < nCheckpoints) { displayRoute.segmentHasCheckpoint[ind] = true; } } else if ((ind > 0) && pointOnLine(displayRoute.ps[ind - 1], displayRoute.ps[ind], checkpoints[cpi]) ) { // If the checkpoint is on a segment, only that segment is // affected. displayRoute.segmentHasCheckpoint[ind - 1] = true; } } } } }
void buildConnectorRouteCheckpointCache(Router *router) { for (ConnRefList::const_iterator curr = router->connRefs.begin(); curr != router->connRefs.end(); ++curr) { ConnRef *conn = *curr; if (conn->routingType() != ConnType_Orthogonal) { continue; } PolyLine& displayRoute = conn->displayRoute(); std::vector<Checkpoint> checkpoints = conn->routingCheckpoints(); // Initialise checkpoint vector and set to false. There will be // one entry for each *segment* in the path, and the value indicates // whether the segment is affected by a checkpoint. displayRoute.checkpointsOnRoute = std::vector<std::pair<size_t, Point> >(); for (size_t ind = 0; ind < displayRoute.size(); ++ind) { if (ind > 0) { for (size_t cpi = 0; cpi < checkpoints.size(); ++cpi) { if (pointOnLine(displayRoute.ps[ind - 1], displayRoute.ps[ind], checkpoints[cpi].point) ) { // The checkpoint is on a segment. displayRoute.checkpointsOnRoute.push_back( std::make_pair((ind * 2) - 1, checkpoints[cpi].point)); } } } for (size_t cpi = 0; cpi < checkpoints.size(); ++cpi) { if (displayRoute.ps[ind].equals(checkpoints[cpi].point)) { // The checkpoint is at a bendpoint. displayRoute.checkpointsOnRoute.push_back( std::make_pair(ind * 2, checkpoints[cpi].point)); } } } } }