65 myVehicleClasses2Keep(0),
66 myVehicleClasses2Remove(0),
67 myNeedGeoTransformedPruningBoundary(false) {
82 if (oc.
isSet(
"keep-edges.input-file")) {
85 if (oc.
isSet(
"remove-edges.input-file")) {
88 if (oc.
isSet(
"keep-edges.explicit")) {
89 const std::vector<std::string> edges = oc.
getStringVector(
"keep-edges.explicit");
92 if (oc.
isSet(
"remove-edges.explicit")) {
93 const std::vector<std::string> edges = oc.
getStringVector(
"remove-edges.explicit");
96 if (oc.
exists(
"keep-edges.by-vclass") && oc.
isSet(
"keep-edges.by-vclass")) {
99 if (oc.
exists(
"remove-edges.by-vclass") && oc.
isSet(
"remove-edges.by-vclass")) {
102 if (oc.
exists(
"keep-edges.by-type") && oc.
isSet(
"keep-edges.by-type")) {
103 const std::vector<std::string> types = oc.
getStringVector(
"keep-edges.by-type");
106 if (oc.
exists(
"remove-edges.by-type") && oc.
isSet(
"remove-edges.by-type")) {
107 const std::vector<std::string> types = oc.
getStringVector(
"remove-edges.by-type");
111 if (oc.
isSet(
"keep-edges.in-boundary") || oc.
isSet(
"keep-edges.in-geo-boundary")) {
113 "keep-edges.in-boundary" :
"keep-edges.in-geo-boundary");
115 std::vector<double> poly;
116 for (std::vector<std::string>::iterator i = polyS.begin(); i != polyS.end(); ++i) {
119 if (poly.size() < 4) {
120 throw ProcessError(
"Invalid boundary: need at least 2 coordinates");
121 }
else if (poly.size() % 2 != 0) {
122 throw ProcessError(
"Invalid boundary: malformed coordinate");
123 }
else if (poly.size() == 4) {
130 for (std::vector<double>::iterator j = poly.begin(); j != poly.end();) {
143 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
168 if (oc.
exists(
"dismiss-vclasses") && oc.
getBool(
"dismiss-vclasses")) {
234 WRITE_ERROR(
"Cannot prune edges using a geo-boundary because no projection has been loaded");
251 EdgeCont::const_iterator i =
myEdges.find(
id);
253 if (retrieveExtracted) {
294 if (downstream ==
true) {
318 hints.push_back(hintedge);
321 for (EdgeVector::iterator i = hints.begin(); i != hints.end(); i++) {
323 for (EdgeVector::iterator j = candidates.begin(); j != candidates.end(); j++) {
324 NBEdge* poss_searched = (*j);
326 ? poss_searched->
myTo : poss_searched->
myFrom;
329 if (find(cont.begin(), cont.end(), hintedge) != cont.end()) {
330 return poss_searched;
346 std::string tid =
id +
"[";
347 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
348 if ((*i).first.find(tid) == 0) {
349 maxLength =
MAX2(maxLength, (
int)(*i).first.length());
354 std::vector<std::string> names;
355 names.push_back(
id +
"[1]");
356 names.push_back(
id +
"[0]");
357 while (names.size() > 0) {
359 std::string cid = names.back();
365 if ((
int)cid.length() + 3 < maxLength) {
366 names.push_back(cid +
"[1]");
367 names.push_back(cid +
"[0]");
404 if (
myEdges.count(newID) != 0) {
405 throw ProcessError(
"Attempt to rename edge using existing id '" + newID +
"'");
423 const std::string& firstEdgeName,
424 const std::string& secondEdgeName,
425 int noLanesFirstEdge,
int noLanesSecondEdge,
427 const int changedLeft) {
438 return splitAt(dc, edge, pos, node, firstEdgeName, secondEdgeName,
439 noLanesFirstEdge, noLanesSecondEdge, speed, changedLeft);
446 const std::string& firstEdgeName,
447 const std::string& secondEdgeName,
448 int noLanesFirstEdge,
int noLanesSecondEdge,
450 const int changedLeft
453 assert(changedLeft > -((
int)noLanesFirstEdge));
454 assert(changedLeft < (
int)noLanesSecondEdge);
457 std::pair<PositionVector, PositionVector> geoms =
460 geoms.first.pop_back();
468 NBEdge* one =
new NBEdge(firstEdgeName, edge->
myFrom, node, edge, geoms.first, noLanesFirstEdge);
469 NBEdge* two =
new NBEdge(secondEdgeName, node, edge->
myTo, edge, geoms.second, noLanesSecondEdge);
472 if (firstEdgeName != origID) {
475 if (secondEdgeName != origID) {
488 for (std::set<NBTrafficLightDefinition*>::iterator i = fromTLS.begin(); i != fromTLS.end(); ++i) {
489 (*i)->replaceRemoved(edge, -1, one, -1);
492 for (std::set<NBTrafficLightDefinition*>::iterator i = toTLS.begin(); i != toTLS.end(); ++i) {
493 (*i)->replaceRemoved(edge, -1, two, -1);
504 for (
int i2 = 0; i2 < (int)two->
getNumLanes(); i2++) {
533 std::set<EdgeSet> addLater;
534 for (std::set<EdgeSet>::iterator it = roundabouts.begin(); it != roundabouts.end(); ++it) {
536 if (roundaboutSet.count(orig) > 0) {
537 roundaboutSet.erase(orig);
538 roundaboutSet.insert(part1);
539 roundaboutSet.insert(part2);
541 addLater.insert(roundaboutSet);
544 roundabouts.insert(addLater.begin(), addLater.end());
549 std::vector<std::string>
551 std::vector<std::string> ret;
552 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
553 ret.push_back((*i).first);
563 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
564 NBEdge* edge = (*i).second;
568 toRemove.push_back(edge);
571 for (EdgeVector::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
579 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
580 if ((*i).second->getGeometry().size() < 3) {
583 (*i).second->splitGeometry(*
this, nc);
590 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
591 (*i).second->reduceGeometry(minDist);
598 if (maxAngle > 0 || minRadius > 0) {
599 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
600 (*i).second->checkGeometry(maxAngle, minRadius, fix);
609 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
610 (*i).second->clearControllingTLInformation();
617 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
618 (*i).second->sortOutgoingConnectionsByAngle();
625 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
626 (*i).second->computeEdge2Edges(noLeftMovers);
633 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
634 (*i).second->computeLanes2Edges();
642 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
647 const std::string& oppositeID = edge->
getLanes().back().oppositeID;
648 if (oppositeID !=
"" && oppositeID !=
"-") {
649 NBEdge* oppEdge =
retrieve(oppositeID.substr(0, oppositeID.rfind(
"_")));
651 WRITE_WARNING(
"Removing unknown opposite lane '" + oppositeID +
"' for edge '" + edge->
getID() +
"'.");
656 if (fixOppositeLengths) {
670 WRITE_ERROR(
"Opposite lane '" + oppositeID +
"' does not connect the same nodes as edge '" + edge->
getID() +
"'!");
681 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
682 (*i).second->appendTurnaround(noTLSControlled,
true);
689 for (std::set<std::string>::const_iterator it = ids.begin(); it != ids.end(); it++) {
690 myEdges[*it]->appendTurnaround(noTLSControlled,
false);
697 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
698 (*i).second->computeEdgeShape();
705 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
706 (*i).second->computeLaneShapes();
727 NBEdge* tpledge = *(edges.begin());
728 NBNode* from = tpledge->getFromNode();
729 NBNode* to = tpledge->getToNode();
730 EdgeVector::const_iterator i;
731 for (i = edges.begin(); i != edges.end(); i++) {
733 assert((*i)->getFromNode() == from);
734 assert((*i)->getToNode() == to);
736 nolanes += (*i)->getNumLanes();
738 if (i != edges.begin()) {
743 speed += (*i)->getSpeed();
745 priority =
MAX2(priority, (*i)->getPriority());
747 speed /= edges.size();
749 NBEdge* newEdge =
new NBEdge(
id, from, to,
"", speed, nolanes, priority,
751 tpledge->getStreetName(), tpledge->myLaneSpreadFunction);
754 for (i = edges.begin(); i != edges.end(); ++i) {
755 const std::vector<NBEdge::Lane>& lanes = (*i)->
getLanes();
756 for (
int j = 0; j < (int)lanes.size(); ++j) {
770 for (i = edges.begin(); i != edges.end(); i++) {
772 for (EdgeVector::iterator j = ev.begin(); j != ev.end(); j++) {
778 for (i = edges.begin(); i != edges.end(); i++) {
780 currLane += (*i)->getNumLanes();
784 for (i = edges.begin(); i != edges.end(); i++) {
785 int noLanes = (*i)->getNumLanes();
786 for (
int j = 0; j < noLanes; j++, currLane++) {
792 for (i = edges.begin(); i != edges.end(); i++) {
801 const double distanceThreshold = 7;
802 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
811 if ((*j)->getToNode() == edge->
getFromNode() && !(*j)->getLanes().empty()) {
813 if (distance < distanceThreshold) {
830 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
844 const std::string oppositeID = edgeID[0] ==
'-' ? edgeID.substr(1) :
"-" + edgeID;
845 EdgeCont::const_iterator it =
myEdges.find(oppositeID);
851 EdgeCont::const_iterator it =
myEdges.find(edgeID);
858 bool keepClear,
double contPos,
double visibility,
double speed,
860 myConnections.push_back(
PostProcessConnection(from, fromLane, to, toLane, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, warnOnly));
870 if (from == 0 || to == 0 ||
872 (*i).keepClear, (*i).contPos, (*i).visibility, (*i).speed, (*i).customShape)) {
873 const std::string msg =
"Could not insert connection between '" + (*i).from +
"' and '" + (*i).to +
"' after build.";
874 if (warnOnly || (*i).warnOnly) {
883 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
884 NBEdge* edge = it->second;
887 std::vector<NBEdge::Connection> connections = edge->
getConnections();
888 for (std::vector<NBEdge::Connection>::iterator it_con = connections.begin(); it_con != connections.end(); ++it_con) {
892 "' to edge '" + c.
toEdge->
getID() +
"' via junction '" + to->
getID() +
"'.");
902 int len = (int)
id.length();
904 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
905 std::string curr = (*i).first;
908 if ((
int)curr.length() <= len) {
913 if (curr.substr(0, len) ==
id && curr[len] ==
'[') {
914 ret.push_back((*i).second);
918 std::string::size_type pos = curr.find(
id);
920 if (pos == std::string::npos) {
925 if (curr[pos - 1] !=
']' && curr[pos - 1] !=
'+') {
930 if (pos +
id.length() < curr.length()) {
931 if (curr[pos +
id.length()] !=
'[' && curr[pos +
id.length()] !=
'+') {
936 ret.push_back((*i).second);
945 std::set<NBEdge*> loadedRoundaboutEdges;
947 loadedRoundaboutEdges.insert(it->begin(), it->end());
951 std::set<NBEdge*> candidates;
952 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
956 candidates.insert(e);
961 std::set<NBEdge*> visited;
962 for (std::set<NBEdge*>::const_iterator i = candidates.begin(); i != candidates.end(); ++i) {
969 if (visited.count(e) > 0) {
973 loopEdges.push_back(e);
978 if (edges.size() < 2) {
987 EdgeVector::const_iterator me = find(edges.begin(), edges.end(), e);
996 EdgeVector::const_iterator loopClosed = find(loopEdges.begin(), loopEdges.end(), left);
997 const int loopSize = (int)(loopEdges.end() - loopClosed);
1002 }
else if (loopSize < (
int)loopEdges.size()) {
1004 EdgeVector(loopEdges.begin() + (loopEdges.size() - loopSize), loopEdges.end()).swap(loopEdges);
1007 int attachments = 0;
1008 for (EdgeVector::const_iterator j = loopEdges.begin(); j != loopEdges.end(); ++j) {
1009 if ((*j)->getToNode()->getEdges().size() > 2) {
1013 if (attachments < 3) {
1018 if (visited.count(left) > 0) {
1022 loopEdges.push_back(left);
1041 for (EdgeVector::const_iterator it = loopEdges.begin(); it != loopEdges.end(); ++it) {
1042 points.
append((*it)->getGeometry());
1044 double circumference = points.
length2D();
1045 return 4 *
M_PI * points.
area() / (circumference * circumference);
1049 const std::set<EdgeSet>
1059 if (roundabout.size() > 0) {
1072 for (std::set<EdgeSet>::const_iterator it = roundabouts.begin(); it != roundabouts.end(); ++it) {
1073 const EdgeSet roundaboutSet = *it;
1074 for (std::set<NBEdge*>::const_iterator j = roundaboutSet.begin(); j != roundaboutSet.end(); ++j) {
1076 NBNode* node = (*j)->getToNode();
1078 for (EdgeVector::const_iterator k = incoming.begin(); k != incoming.end(); ++k) {
1080 if (roundaboutSet.count(inEdge) > 0) {
1098 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
1138 int sidewalksCreated = 0;
1140 std::set<std::string> exclude(edges.begin(), edges.end());
1141 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1142 NBEdge* edge = it->second;
1144 exclude.count(edge->
getID()) == 0
1151 || (!fromPermissions && edge->
getSpeed() > minSpeed && edge->
getSpeed() <= maxSpeed)
1154 sidewalksCreated += 1;
1157 return sidewalksCreated;
1164 std::set<std::string> reserve;
1167 avoid.insert(avoid.end(), reserve.begin(), reserve.end());
1170 std::set<NBEdge*, Named::ComparatorIdLess> toChange;
1171 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1176 toChange.insert(it->second);
1179 if (reservedIDs && reserve.count(it->first) > 0) {
1180 toChange.insert(it->second);
1184 for (std::set<NBEdge*, Named::ComparatorIdLess>::iterator it = toChange.begin(); it != toChange.end(); ++it) {
1193 return (
int)toChange.size();
1199 for (EdgeCont::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1200 const NBEdge* e1 = it->second;
1206 for (EdgeCont::const_iterator it2 = it; it2 !=
myEdges.end(); it2++) {
1207 const NBEdge* e2 = it2->second;
1216 const double overlap = outline1.
getOverlapWith(outline2, zThreshold);
1217 if (overlap > threshold) {
1228 for (EdgeCont::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1229 const NBEdge* edge = it->second;
1230 for (
int i = 0; i < (int)edge->
getNumLanes(); i++) {
1232 if (grade > threshold) {
1237 const std::vector<NBEdge::Connection>& connections = edge->
getConnections();
1238 for (std::vector<NBEdge::Connection>::const_iterator it_con = connections.begin(); it_con != connections.end(); ++it_con) {
1241 if (grade > threshold) {
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
std::vector< Lane > myLanes
Lane information.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const std::string & getTypeID() const
get ID of type
A structure which describes a connection between edges or lanes.
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
void setRoundabout()
update the type of this node as a roundabout
NBEdge * retrievePossiblySplit(const std::string &id, bool downstream) const
Tries to retrieve an edge, even if it is splitted.
void checkOverlap(double threshold, double zThreshold) const
check whether edges overlap
A class representing a single street sign.
PositionVector shape
The lane's shape.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
void append(const PositionVector &v, double sameThreshold=2.0)
void addSign(NBSign sign)
add Sign
NBEdge * toEdge
The edge the connections yields in.
void reduceGeometries(const double minDist)
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
A container for traffic light definitions and built programs.
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
bool myRemoveEdgesAfterJoining
Whether edges shall be joined first, then removed.
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
void guessOpposites()
Sets opposite lane information for geometrically close edges.
PositionVector getCCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going counter-clock-wise around the given node ...
std::string getDescription(const NBEdge *parent) const
get string describing this connection
A container for districts.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
static GeoConvHelper & getLoaded()
the coordinate transformation that was loaded fron an input file
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false)
Removes the specified connection(s)
void removeDoubleEdges()
remove duble edges
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
double getSpeed() const
Returns the speed allowed on this edge.
void setLoadedLength(double val)
set loaded lenght
void generateStreetSigns()
assigns street signs to edges based on toNode types
void rename(NBEdge *edge, const std::string &newID)
Renames the edge. Throws exception if newID already exists.
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
void recheckPostProcessConnections()
Try to set any stored connections.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
static long long int _str2long(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter, which
static void nextCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
Lane & getLaneStruct(int lane)
static void loadEdgesFromFile(const std::string &file, std::set< std::string > &into)
Add edge ids defined in file (either ID or edge:ID per line) into the given set.
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
static const double UNSPECIFIED_WIDTH
unspecified lane width
A class that stores a 2D geometrical boundary.
std::vector< PostProcessConnection > myConnections
The list of connections to recheck.
void replaceOutgoing(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of outgoing by the second Connections are remap...
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
void checkGeometries(const double maxAngle, const double minRadius, bool fix)
NBEdge * getByID(const std::string &edgeID) const
Returns the edge with id if it exists.
PositionVector myPruningBoundary
Boundary within which an edge must be located in order to be kept.
PositionVector shape
shape of Connection
NBEdgeCont(NBTypeCont &tc)
Constructor.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
double getOverlapWith(const PositionVector &poly, double zThreshold) const
Returns the maximum overlaps between this and the given polygon (when not separated by at least zThre...
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
An (internal) definition of a single lane of an edge.
const std::string & getID() const
Returns the id.
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
double area() const
Returns the area (0 for non-closed)
SVCPermissions myVehicleClasses2Keep
Set of vehicle types which must be allowed on edges in order to keep them.
const Position & getPosition() const
std::vector< double > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
double myEdgesMinSpeed
The minimum speed an edge may have in order to be kept (default: -1)
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
std::set< NBEdge * > EdgeSet
container for unique edges
void patchRoundabouts(NBEdge *orig, NBEdge *part1, NBEdge *part2, std::set< EdgeSet > &roundabouts)
fix roundabout information after splitting an edge
std::string getNext()
Returns the next id.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
A point in 2D or 3D with translation and scaling methods.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void setOrigID(const std::string origID)
set origID for all lanes
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
std::set< std::string > myEdges2Keep
Set of ids of edges which shall explicitly be kept.
SumoXMLNodeType getType() const
Returns the type of this node.
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
int getNumLanes() const
Returns the number of lanes.
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
double length() const
Returns the length.
static double formFactor(const EdgeVector &loopEdges)
compute the form factor for a loop of edges
void splitGeometry(NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
EdgeCont myEdges
The instance of the dictionary (id->edge)
Boundary & grow(double by)
extends the boundary by the given amount
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
void clear()
Deletes all edges.
EdgeCont myExtractedEdges
The extracted nodes which are kept for reference.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
The connection was given by the user.
std::set< EdgeSet > myGuessedRoundabouts
Edges marked as belonging to a roundabout after guessing.
std::set< EdgeSet > myRoundabouts
Edges marked as belonging to a roundabout by the user (each EdgeVector is a roundabout) ...
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again ...
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
void joinSameNodeConnectingEdges(NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, EdgeVector edges)
Joins the given edges because they connect the same nodes.
double getMaxGrade() const
return the maximum grade of all segments as a fraction of zRange/length2D
SVCPermissions myVehicleClasses2Remove
Set of vehicle types which need not be supported (edges which allow ONLY these are removed) ...
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
std::set< std::string > myTypes2Keep
Set of edges types which shall be kept.
int guessSidewalks(double width, double minSpeed, double maxSpeed, bool fromPermissions)
add sidwalks to edges within the given limits or permissions and return the number of edges affected ...
NBNode * getToNode() const
Returns the destination node of the edge.
double getLength() const
Returns the computed length of the edge.
void setID(const std::string &newID)
resets the id
double length2D() const
Returns the length.
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY)
Adds a connection between the specified this edge's lane and an approached one.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
PositionVector viaShape
shape of via
std::string oppositeID
An opposite lane ID, if given.
void appendTurnarounds(bool noTLSControlled)
Appends turnarounds to all edges stored in the container.
void replaceIncoming(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of incoming by the second Connections are remap...
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
void addPostProcessConnection(const std::string &from, int fromLane, const std::string &to, int toLane, bool mayDefinitelyPass, bool keepClear, double contPos, double visibility, double speed, const PositionVector &customShape, bool warnOnly=false)
Adds a connection which could not be set during loading.
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
bool myNeedGeoTransformedPruningBoundary
whether a geo transform has been applied to the pruning boundary
const PositionVector & getGeometry() const
Returns the geometry of the edge.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
A storage for options typed value containers)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
const std::string SUMO_PARAM_ORIGID
A structure representing a connection between two lanes.
void computeEdgeShapes()
Computes the shapes of all edges stored in the container.
The connection was computed.
NBEdge * getOppositeByID(const std::string &edgeID) const
Returns the edge with negated id if it exists.
Represents a single node (junction) during network building.
void dismissVehicleClassInformation()
dimiss vehicle class information
bool isSimpleContinuation(bool checkLaneNumbers=true) const
check if node is a simple continuation
NBTypeCont & myTypeCont
The network builder; used to obtain type information.
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
std::pair< PositionVector, PositionVector > splitAt(double where) const
Returns the two lists made when this list vector is splitted at the given point.
std::string getLaneID(int lane) const
get Lane ID (Secure)
void checkGrade(double threshold) const
check whether edges are to steep
void removeFromSinksAndSources(NBEdge *const e)
Removes the given edge from the lists of sources and sinks in all stored districts.
std::set< std::string > myTypes2Remove
Set of edges types which shall be removed.
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Container for nodes during the netbuilding process.
static T maxValue(const std::vector< T > &v)
std::set< std::string > myIgnoredEdges
The ids of ignored edges.
EdgeVector getGeneratedFrom(const std::string &id) const
Returns the edges which have been built by splitting the edge of the given id.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
void addRoundabout(const EdgeSet &roundabout)
add user specified roundabout
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
int remapIDs(bool numericaIDs, bool reservedIDs)
remap node IDs accoring to options –numerical-ids and –reserved-ids
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNode * myFrom
The source and the destination node.
NBEdge * getTurnDestination(bool possibleDestination=false) const
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
bool ignoreFilterMatch(NBEdge *edge)
Returns true if this edge matches one of the removal criteria.
A storage for available types of edges.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int myEdgesSplit
the number of splits of edges during the building
std::set< std::string > myEdges2Remove
Set of ids of edges which shall explicitly be removed.
NBNode * getFromNode() const
Returns the origin node of the edge.