111 const
double GNENet::Z_INITIALIZED = 1;
121 myNetBuilder(netBuilder),
124 myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()),
125 myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()),
126 myNeedRecompute(true),
127 myAdditionalsSaved(true),
128 myShapesSaved(true) {
133 initJunctionsAndEdges();
136 if (myZBoundary.ymin() != Z_INITIALIZED) {
137 myZBoundary.add(0, 0);
145 it.second->decRef(
"GNENet::~GNENet");
148 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
154 it.second->decRef(
"GNENet::~GNENet");
157 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
165 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
173 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
181 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
189 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
235 const std::string& imgFile,
const PositionVector& shape,
bool geo,
bool fill,
bool ) {
240 GNEPoly* poly =
new GNEPoly(
this,
id, type, shape, geo, fill, color, layer, angle, imgFile,
false,
false);
252 const std::string& lane,
double posOverLane,
double posLat,
double layer,
double angle,
253 const std::string& imgFile,
double width,
double height,
bool ) {
259 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, pos, geo, layer, angle, imgFile, width, height,
false);
266 throw ProcessError(
"Error adding GNEPOI into shapeContainer");
271 GNEPOILane* poiLane =
new GNEPOILane(
this,
id, type, color, layer, angle, imgFile, retrievedLane, posOverLane, posLat, width, height,
false);
278 throw ProcessError(
"Error adding GNEPOILane into shapeContainer");
325 const std::string& suggestedName,
327 bool allowDuplicateGeom) {
330 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
331 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
332 if (!allowDuplicateGeom) {
339 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
350 edge =
new GNEEdge(*nbe,
this, wasSplit);
353 double defaultSpeed = 50 / 3.6;
354 std::string defaultType =
"";
355 int defaultNrLanes = 1;
356 int defaultPriority = 1;
360 defaultType, defaultSpeed,
361 defaultNrLanes, defaultPriority,
364 edge =
new GNEEdge(*nbe,
this, wasSplit);
390 std::vector<GNECrossing*> crossingsToRemove;
392 for (
auto i : junctionNeighbours) {
394 for (
auto j : i->getGNECrossings()) {
397 crossingsToRemove.push_back(j);
403 for (
auto i : crossingsToRemove) {
409 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
418 std::set<GUIGlID> deselected;
419 deselected.insert(junction->
getGlID());
441 i->removeLaneOfAdditionalParents(undoList,
false);
442 while (i->getAdditionalChilds().size() > 0) {
448 std::vector<GNEShape*> copyOfLaneShapes = i->getShapeChilds();
449 for (
auto j : copyOfLaneShapes) {
461 std::set<GUIGlID> deselected;
462 deselected.insert(edge->
getGlID());
484 std::vector<GNEAdditional*> copyOfLaneAdditionals = i->getAdditionalChilds();
485 for (
auto j : copyOfLaneAdditionals) {
492 std::vector<GNEShape*> copyOfLaneShapes = i->getShapeChilds();
493 for (
auto j : copyOfLaneShapes) {
509 for (
auto con : connections) {
515 std::set<GUIGlID> deselected;
516 deselected.insert(which->
getGlID());
550 std::set<GUIGlID> deselected;
551 deselected.insert(edge->
getGlID());
556 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false),
true);
558 std::set<GUIGlID> deselected;
559 deselected.insert(lane->
getGlID());
591 undoList->
p_begin(
"delete crossing");
612 std::set<GUIGlID> deselected;
613 deselected.insert(shape->
getGlID());
628 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true),
true);
636 bool addRestriction =
true;
642 addRestriction =
false;
651 if (addRestriction) {
665 if (i->isRestricted(vclass)) {
680 if (i->isRestricted(vclass)) {
697 std::pair<PositionVector, PositionVector> newGeoms = oldGeom.
splitAt(linePos);
702 const std::string::size_type sep_index = baseName.rfind(
'.');
703 if (sep_index != std::string::npos) {
704 std::string posString = baseName.substr(sep_index + 1);
706 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
707 baseName = baseName.substr(0, sep_index);
714 if (newJunction == 0) {
718 undoList, baseName +
toString(posBase),
true);
719 GNEEdge* secondPart =
createEdge(newJunction, edge->getGNEJunctionDestiny(), edge,
720 undoList, baseName +
toString(posBase + (
int)linePos),
true);
724 newGeoms.first.pop_back();
725 newGeoms.first.erase(newGeoms.first.begin());
730 newGeoms.second.pop_back();
731 newGeoms.second.erase(newGeoms.second.begin());
734 for (
auto con_it : edge->getNBEdge()->getConnections()) {
746 for (
auto it : edges) {
747 newJunction =
splitEdge(it, pos, undoList, newJunction);
758 assert(reversed != 0);
771 assert(reversed != 0);
783 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
784 assert(reversed != 0);
787 std::set<GUIGlID> toSelect;
788 toSelect.insert(reversed->getGlID());
789 toSelect.insert(src->
getGlID());
790 toSelect.insert(dest->getGlID());
805 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
811 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
824 std::vector<GNECrossing*> crossingsOfOldEdge = oldEdge->
getGNECrossings();
825 for (
auto i : crossingsOfOldEdge) {
834 if (preserveShapeStart) {
837 if (preserveShapeEnd) {
849 if (i.second->getPositionInView() == pos) {
892 }
else if (failHard) {
907 }
else if (failHard) {
918 assert((from != NULL) && (to != NULL));
921 if ((i.second->getGNEJunctionSource() == from) && (i.second->getGNEJunctionDestiny() == to)) {
938 }
else if (failHard) {
951 }
else if (failHard) {
964 }
else if (failHard) {
973 std::vector<GNEEdge*>
975 std::vector<GNEEdge*> result;
978 result.push_back(it.second);
985 std::vector<GNELane*>
987 std::vector<GNELane*> result;
989 for (
auto it_lane : it.second->getLanes()) {
991 result.push_back(it_lane);
1007 if (it->getID() == id) {
1024 }
else if (failHard) {
1032 std::vector<GNEJunction*>
1034 std::vector<GNEJunction*> result;
1037 result.push_back(it.second);
1044 std::vector<GNEShape*>
1046 std::vector<GNEShape*> result;
1053 result.push_back(poly);
1059 for (
const auto& it :
getPOIs()) {
1063 result.push_back(POI);
1073 result.push_back(POILane);
1095 return "vaporizer_" +
toString(counter);
1104 if (
object != NULL) {
1110 throw ProcessError(
"GUIGlObject does not match the declared type");
1114 }
else if (failHard) {
1117 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
1122 std::vector<GNEAttributeCarrier*>
1124 std::vector<GNEAttributeCarrier*> result;
1126 for (
auto it : ids) {
1130 result.push_back(ac);
1139 std::set<GUIGlID> result;
1142 std::set<GUIGlObjectType> knownTypes;
1153 for (
const auto& it : knownTypes) {
1154 const std::set<GUIGlID> tmp =
getGlIDs(it);
1155 result.insert(tmp.begin(), tmp.end());
1161 result.insert(it.second->getGlID());
1165 for (
const auto& it :
myEdges) {
1166 result.insert(it.second->getGlID());
1170 for (
const auto& i : myEdges) {
1172 for (
auto j : i.second->getLanes()) {
1173 result.insert(j->getGlID());
1180 for (
const auto& it : myJunctions) {
1181 if (it.second->getNBNode()->isTLControlled()) {
1182 result.insert(it.second->getGlID());
1191 result.insert(it.second->getGlID());
1196 for (
const auto& i : myEdges) {
1198 for (
const auto& j : i.second->getGNEConnections()) {
1200 result.insert(j->getGlID());
1206 for (
const auto& i : myJunctions) {
1208 for (
const auto& j : i.second->getGNECrossings()) {
1210 result.insert(j->getGlID());
1217 result.insert(dynamic_cast<GNEPoly*>(i.second)->getGlID());
1222 for (
const auto& i :
myPOIs) {
1223 result.insert(dynamic_cast<GNEPOI*>(i.second)->getGlID());
1238 if (volatileOptions) {
1239 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1247 if (volatileOptions) {
1254 if (volatileOptions) {
1265 if (additionalPath !=
"") {
1279 if (shapePath !=
"") {
1285 window->getApp()->endWaitCursor();
1298 it->setParticipantsInformation();
1299 it->setTLControllingInformation();
1316 if (n.second->getGNECrossings().size() > 0) {
1339 if (selectedJunctions.size() < 2) {
1344 std::set<NBNode*> cluster;
1345 for (
auto it : selectedJunctions) {
1346 cluster.insert(it->getNBNode());
1347 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1348 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1349 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1350 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1364 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1367 WRITE_WARNING(
"Opening FXMessageBox 'Join non-selected junction'");
1370 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1377 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1379 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1385 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1396 pos.
setx(pos.
x() + 0.1);
1397 pos.
sety(pos.
y() + 0.1);
1404 for (
auto i : selectedJunctions) {
1406 while (i->getGNECrossings().size() > 0) {
1420 for (
auto it : allIncoming) {
1424 for (
auto it : allOutgoing) {
1429 for (
auto it : selectedJunctions) {
1435 if (pos != oldPos) {
1446 std::vector<GNECrossing*> myNetCrossings;
1448 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1449 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1452 std::vector<GNECrossing*> myInvalidCrossings;
1453 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1454 if ((*i)->getNBCrossing()->valid ==
false) {
1455 myInvalidCrossings.push_back(*i);
1459 if (myInvalidCrossings.empty()) {
1462 WRITE_WARNING(
"Opening FXMessageBox 'No crossing to remove'");
1465 FXMessageBox::warning(
getApp(), MBOX_OK,
1469 WRITE_WARNING(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1471 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1477 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1483 WRITE_WARNING(
"Closed FXMessageBox 'clear crossings' with 'No'");
1485 WRITE_WARNING(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1489 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1502 std::vector<GNEJunction*> toRemove;
1506 toRemove.push_back(junction);
1509 for (
auto it : toRemove) {
1520 undoList->
p_begin(
"Replace junction by geometry");
1526 for (
auto j : toJoin) {
1532 for (
auto con : connections) {
1562 undoList->
p_begin(
"clear junction connections");
1565 for (
auto i : connections) {
1574 undoList->
p_begin(
"reset junction connections");
1591 i->updateConnectionIDs();
1642 if (i.second->getID() == id) {
1647 throw ProcessError(
"Attempted to retrieve non-existant additional");
1654 std::vector<GNEAdditional*>
1656 std::vector<GNEAdditional*> result;
1659 result.push_back(it.second);
1671 return myAdditionals.at(std::pair<std::string, SumoXMLTag>(
id, type));
1678 std::vector<GNEAdditional*>
1680 std::vector<GNEAdditional*> vectorOfAdditionals;
1683 vectorOfAdditionals.push_back(i.second);
1686 return vectorOfAdditionals;
1698 if (j->getID() == rerouterIntervalID) {
1722 auto additionalToUpdate =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(oldID, additional->
getTag()));
1748 std::vector<GNEStoppingPlace*> invalidStoppingPlaces;
1749 std::vector<GNEDetector*> invalidDetectors;
1755 invalidStoppingPlaces.push_back(stoppingPlace);
1757 invalidDetectors.push_back(detector);
1761 if (invalidStoppingPlaces.size() > 0 || invalidDetectors.size() > 0) {
1765 if (fixAdditionalPositionsDialog.execute() == 0) {
1771 device.
openTag(
"additionals");
1772 for (
auto i : myAdditionals) {
1773 i.second->writeAdditional(device);
1781 device.
openTag(
"additionals");
1782 for (
auto i : myAdditionals) {
1784 if (i.second->getAdditionalParent() == NULL) {
1785 i.second->writeAdditional(device);
1803 if (i.second->getID() == id) {
1808 throw ProcessError(
"Attempted to retrieve non-existant calibrator route");
1819 if (i.second->getID() == id) {
1824 throw ProcessError(
"Attempted to retrieve non-existant calibrator vehicle type");
1835 if (i.second->getID() == id) {
1840 throw ProcessError(
"Attempted to retrieve non-existant calibrator flow");
1912 if (shape.size() > 0) {
1914 GNEPoly* shapePoly =
new GNEPoly(
this,
"edit_shape",
"edit_shape", shape,
false,
true,
RGBColor::GREEN,
GLO_POLYGON, 0,
"",
false ,
false);
1933 throw ProcessError(
"Polygon for edit shapes has to be inicializated");
1943 std::string newID =
"poly_" +
toString(counter);
1947 newID =
"poly_" +
toString(counter);
1952 std::string newID =
"POI_" +
toString(counter);
1956 newID =
"POI_" +
toString(counter);
1994 device.
openTag(
"additionals");
1997 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2000 for (
const auto& i :
myPOIs) {
2001 dynamic_cast<GNEShape*
>(i.second)->writeShape(device);
2038 auto additionalToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
2122 for (
auto name_it : nodeContainer.
getAllNames()) {
2133 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
2167 junction->
incRef(
"GNENet::registerJunction");
2184 edge->
incRef(
"GNENet::registerEdge");
2205 junction->
decRef(
"GNENet::deleteSingleJunction");
2220 edge->
decRef(
"GNENet::deleteSingleEdge");
2293 it.second->remakeGNEConnections();
2295 for (
auto it : myEdges) {
2296 it.second->updateGeometry();
2304 std::set<std::string> liveExplicitTurnarounds;
2307 liveExplicitTurnarounds.insert(it);
2313 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
2314 std::map<std::string, GNEEdge*> newEdgeMap;
2315 std::map<std::string, GNEJunction*> newJunctionMap;
2318 it.second->setMicrosimID(it.second->getNBEdge()->getID());
2319 newEdgeMap[it.second->getNBEdge()->getID()] = it.second;
2322 newJunctionMap[it.second->getNBNode()->getID()] = it.second;
2323 it.second->setMicrosimID(it.second->getNBNode()->getID());
2325 myEdges = newEdgeMap;
2326 myJunctions = newJunctionMap;
2329 if (!oc.
getBool(
"offset.disable-normalization")) {
2337 if (volatileOptions) {
2344 for (
const auto& i :
myPOIs) {
2350 for (
const auto& it : copyOfAdditionals) {
2356 for (
auto it : copyOfEdges) {
2358 myEdges.erase(it.second->getMicrosimID());
2363 for (
auto it : copyOfJunctions) {
2384 it.second->updateGeometry();
2395 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
2396 std::vector<std::string> newValues;
2397 for (
auto v : values) {
2398 newValues.push_back(v == which ? by : v);
void setViewNet(GNEViewNet *viewNet)
Set the viewNet to be notified of network changes.
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
void insertCalibratorVehicleType(GNECalibratorVehicleType *vehicleType)
insert Calibrator VehicleType in net
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
std::string getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
void initJunctionsAndEdges()
Init Junctions and edges.
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
double z() const
Returns the z-position.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
bool areStoppingPlacesPositionsFixed() const
check if Position of stoppingPlace are fixed
void close()
Closes the device and removes it from the dictionary.
GNEViewNet * myViewNet
The viewNet to be notofied of about changes.
SumoXMLTag
Numbers representing SUMO-XML - element names.
void requiereSaveAdditionals()
inform that additionals has to be saved
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
the function-object for an editing operation (abstract base)
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
void enableSaveAdditionalsMenu()
enable save additionals
GNEPOILane * retrievePOILane(const std::string &id, bool failHard=true) const
get POILane by id
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=GUESSED)
std::map< std::string, GNECalibratorFlow * > myCalibratorFlows
map with the name and pointer to Calibrator Flows of net
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
GUIGlID getGlID() const
Returns the numerical id of the object.
IDSupplier myEdgeIDSupplier
description of a vehicle type
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
GNECalibratorRoute * retrieveCalibratorRoute(const std::string &id, bool hardFail=true) const
Returns the named calibrator route.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
void append(const PositionVector &v, double sameThreshold=2.0)
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
begin/end of the description of a junction
begin/end of the description of a single lane
FXApp * getApp()
get pointer to the main App
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::map< std::pair< std::string, SumoXMLTag >, GNEAdditional * > myAdditionals
map with the name and pointer to additional elements of net
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
void enableSaveShapesMenu()
enable save shapes
The main window of the Netedit.
bool changeID(const std::string &oldId, const std::string &newId)
change ID of a stored object
a flow definition (used by router)
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
const std::vector< GNEShape * > & getShapeChilds() const
get shape childs of lane
GNECalibratorVehicleType * retrieveCalibratorVehicleType(const std::string &id, bool hardFail=true) const
Returns the named calibrator vehicle type.
void setMicrosimID(const std::string &newID)
override to also set lane ids
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.
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
double x() const
Returns the x-position.
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
connectio between two lanes
Stores the information about how to visualize structures.
std::set< GUIGlID > getGlIDs(GUIGlObjectType type=GLO_MAX)
get ids of currently active objects
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
void removeShape(GNEShape *shape)
remove created shape (but NOT delete)
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
void changeCalibratorVehicleTypeID(GNECalibratorVehicleType *vehicleType, const std::string &oldID)
change Calibrator Vehicle Type ID
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
friend class GNEChange_Lane
The representation of a single edge during network building.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
std::string generateCalibratorVehicleTypeID() const
generate a new Calibrator Vehicle Type ID
Polygons myPolygons
stored Polygons
friend class GNEChange_Additional
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
std::string generateCalibratorFlowID() const
generate a new Calibrator Flow ID
NBNode * getNBNode() const
Return net build node.
void avoid(const std::string &id)
make sure that the given id is never supplied
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
void update()
notify myViewNet
void insertJunction(GNEJunction *junction)
inserts a single junction into the net and into the underlying netbuild-container ...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
void splitEdgesBidi(const std::set< GNEEdge * > &edges, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction's connections
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
void deleteCalibratorRoute(GNECalibratorRoute *route)
delete Calibrator Route in net
A NBNetBuilder extended by visualisation and editing capabilities.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *tpl, GNEUndoList *undoList, const std::string &suggestedName="", bool wasSplit=false, bool allowDuplicateGeom=false)
creates a new edge (unless an edge with the same geometry already exists)
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
void rename(NBEdge *edge, const std::string &newID)
Renames the edge. Throws exception if newID already exists.
bool cleanInvalidCrossings(GNEUndoList *undoList)
clear invalid crossings
friend class GNEChange_Shape
Storage for geometrical objects.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
void insertEdge(GNEEdge *edge)
inserts a single edge into the net and into the underlying netbuild-container
bool checkIsRemovable() const
check if node is removable
GNERerouterInterval * getRerouterInterval(const std::string &rerouterIntervalID) const
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void setLineWidth(double lineWidth)
set a new shape and update the tesselation
Lane & getLaneStruct(int lane)
GNEViewParent * getViewParent() const
get the net object
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList)
removes edge
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
std::map< std::string, GNECalibratorVehicleType * > myCalibratorVehicleTypes
map with the name and pointer to Calibrator Vehicle Types of net
A RT-tree for efficient storing of SUMO's GL-objects.
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
first coordinate of edge shape
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
const Polygons & getPolygons() const
Returns all polygons.
int getIndex() const
returns the index of the lane
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction with GNENet containers
static const double UNSPECIFIED_WIDTH
unspecified lane width
A class that stores a 2D geometrical boundary.
void deleteCalibratorVehicleType(GNECalibratorVehicleType *vehicleType)
delete Calibrator VehicleType in net
bool myNeedRecompute
whether the net needs recomputation
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
GNEAdditional * retrieveAdditional(const std::string &id, bool hardFail=true) const
Returns the named additional.
begin/end of the description of a route
NBNetBuilder * myNetBuilder
The internal netbuilder.
#define WRITE_WARNING(msg)
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
const Boundary & getBoundary() const
returns the bounder of the network
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
static OptionsCont & getOptions()
Retrieves the options.
GNEUndoList * getUndoList() const
get the undoList object
bool priority
whether the pedestrians have priority
PositionVector reverse() const
reverse position vector
bool add(const std::string &id, T item)
Adds an item.
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
T get(const std::string &id) const
Retrieves an item.
bool myAdditionalsSaved
Flag to check if additionals has to be saved.
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
NBConnection getNBConnection() const
get NBConnection
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
IDSupplier myJunctionIDSupplier
std::map< std::string, int > myEdgesAndNumberOfLanes
map with the Edges and their number of lanes
An (internal) definition of a single lane of an edge.
const std::string & getID() const
Returns the id.
the function-object for an editing operation (abstract base)
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag=SUMO_TAG_NOTHING, bool onlySelected=false)
return all shapes
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
friend class GNEChange_Connection
const Position & getPosition() const
static const RGBColor GREEN
double getWidth() const
Returns the width of the boudary (x-axis)
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
std::string getNext()
Returns the next id.
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
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)
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GNEEdge & getParentEdge()
Returns underlying parent edge.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
virtual bool isDetectorPositionFixed() const =0
check if Position of detector is fixed
void insertShape(GNEShape *shape)
insert shape
double getHeight() const
Returns the height of the boundary (y-axis)
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
A point in 2D or 3D with translation and scaling methods.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
void setx(double x)
set position x
NBEdgeCont & getEdgeCont()
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
std::string generateCalibratorRouteID() const
generate a new Calibrator Route ID
void deleteLane(GNELane *lane, GNEUndoList *undoList)
removes lane
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void removeLaneOfAdditionalParents(GNEUndoList *undoList, bool allowEmpty)
remove lane of Additional Parent
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
void insertCalibratorRoute(GNECalibratorRoute *route)
insert Calibrator Route in net
Boundary getBoundary() const
Returns the street's geometry.
double y() const
Returns the y-position.
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
void changeCalibratorRouteID(GNECalibratorRoute *route, const std::string &oldID)
change Calibrator Route ID
int getNumLanes() const
Returns the number of lanes.
void deleteCalibratorFlow(GNECalibratorFlow *flow)
delete Calibrator Flow in net
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay ...
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
Storage for edges, including some functionality operating on multiple edges.
GNEJunction * getParentJunction() const
get parent Junction
void initGNEConnections()
initialize GNEConnections
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const PositionVector &shape, bool fill, bool geo, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
Dialog for edit rerouters.
void save(OptionsCont &oc)
save the network
edge: the shape in xml-definition
void insertCalibratorFlow(GNECalibratorFlow *flow)
insert Calibrator Flow in net
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(const std::set< GUIGlID > &ids, GUIGlObjectType type)
get the attribute carriers based on GlIDs
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
std::vector< std::string > getAllNames() const
get all node names
friend class GNEChange_Edge
const std::string getID() const
function to support debugging
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
const POIs & getPOIs() const
Returns all pois.
void incRef(const std::string &debugMsg="")
Increarse reference.
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parameter this edge (For example, Rerouters) ...
const GUIGlObject * getGUIGLObject() const
get const pointer to GUIGlObject vinculated with this Attribute Carrier
void move2side(double amount)
move position vector to side using certain ammount
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
std::set< std::string > myExplicitTurnarounds
list of edge ids for which turn-arounds must be added explicitly
void decRef(const std::string &debugMsg="")
Decrease reference.
void rename(NBNode *node, const std::string &newID)
Renames the node. Throws exception if newID already exists.
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
std::vector< GNECrossing * > getGNECrossings()
get GNECrossings vinculated with this Edge
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
begin/end of the description of an edge
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
std::vector< GNEAdditional * > getAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
get vector with additionals
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
bool checkJunctionPosition(const Position &pos)
return true if there are already a Junction in the given position, false in other case ...
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
A road/street connecting two junctions (netedit-version)
void reserveJunctionID(const std::string &id)
reserve junction ID (To avoid duplicates)
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void changeCalibratorFlowID(GNECalibratorFlow *flow, const std::string &oldID)
change Calibrator Flow ID
GNECalibratorFlow * retrieveCalibratorFlow(const std::string &id, bool hardFail=true) const
Returns the named calibrator flow.
const std::vector< GNERerouterInterval * > & getRerouterIntervals() const
get rerouter intervals
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void reset()
Resets the boundary.
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
NBNode * getToNode() const
Returns the destination node of the edge.
double width
This crossing's width.
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary...
void deselect(GUIGlID id)
Deselects the object with the given id.
int customTLIndex
the custom traffic light index of this crossing (if controlled)
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
void setShapeEditedElement(GNENetElement *element)
retrieve the netElement of which the shape is being edited
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
PositionVector customShape
optional customShape for this crossing
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
An Element which don't belongs to GNENet but has influency in the simulation.
Boundary getBoundary() const
Returns the boundary of the junction.
Instance responsible for building networks.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
friend class GNEChange_Junction
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
void analyzeCluster(std::set< NBNode * > cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type)
GUIGlID getGlID() const
Returns the numerical id of the object.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void sety(double y)
set position y
A storage for options typed value containers)
class for GNEChange_ReplaceEdgeInTLS
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
void computeEverything(GNEApplicationWindow *window, bool force=false, bool volatileOptions=false, std::string additionalPath="", std::string shapePath="")
trigger full netbuild computation param[in] window The window to inform about delay param[in] force W...
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction's connections
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
crossing between edges for pedestrians
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
static void replaceInListAttribute(GNEAttributeCarrier *ac, SumoXMLAttr key, const std::string &which, const std::string &by, GNEUndoList *undoList)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
bool netHasGNECrossings() const
check if net has GNECrossings
void removeEdgeOfAdditionalParents(GNEUndoList *undoList, bool allowEmpty)
remove Edge of Additional Parent
std::string generateVaporizerID() const
generate an ID for vaporizers
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
EdgeVector edges
The edges being crossed.
Represents a single node (junction) during network building.
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false)
return all additionals
virtual GUIGlID getGlID() const =0
Returns the numerical id of the object.
GUIGlID getGlID() const
Returns the numerical id of the object.
void deleteAdditional(GNEAdditional *additional)
delete additional element of GNENet container
SumoXMLTag getTag() const
get XML Tag assigned to this object
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
void requiereSaveShapes()
inform that shapes has to be saved
Static storage of an output device and its base (abstract) implementation.
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
last coordinate of edge shape
std::pair< PositionVector, PositionVector > splitAt(double where) const
Returns the two lists made when this list vector is splitted at the given point.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
std::string getLaneID(int lane) const
get Lane ID (Secure)
virtual void updateGeometry()=0
update pre-computed geometry information
std::map< std::string, GNEJunction * > myJunctions
map with the name and pointer to junctions of net
void unblockObject(GUIGlID id)
Marks an object as unblocked.
void reserveEdgeID(const std::string &id)
reserve edge ID (To avoid duplicates)
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
void deleteSingleEdge(GNEEdge *edge)
deletes a single edge
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
Container for nodes during the netbuilding process.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
NBEdge * getNBEdge()
returns the internal NBEdge
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
GNEPoly * addPolygonForEditShapes(GNENetElement *netElement, const PositionVector &shape, bool fill)
Builds a special polygon used for edit Junctions's shapes.
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
bool remove(const std::string &id, const bool del=true)
Removes an item.
begin/end of the description of a Point of interest over Lane (used by Netedit)
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
#define WRITE_MESSAGE(msg)
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
int getNumberOfShapes() const
get number of shapes
std::map< std::string, GNECalibratorRoute * > myCalibratorRoutes
map with the name and pointer to Calibrator Routes of net
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
C++ TraCI client API implementation.
bool addSRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
add restricted lane to edge
GUISelectedStorage gSelected
A global holder of selected objects.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void remapEdge(GNEEdge *oldEdge, GNEJunction *from, GNEJunction *to, GNEUndoList *undoList, bool preserveShapeStart, bool preserveShapeEnd)
const std::vector< Connection > & getConnections() const
Returns the connections.
bool myShapesSaved
Flag to check if shapes hast o be saved.
A window containing a gl-object's parameter.
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
GNEViewNet * getViewNet() const
get view net
bool wasSplit()
whether this edge was created from a split
void saveAdditionals(const std::string &filename)
save additional elements of the network
std::map< std::string, GNEEdge * > myEdges
map with the name and pointer to edges of net
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
void requireRecompute()
inform the net about the need for recomputation
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void duplicateLane(GNELane *lane, GNEUndoList *undoList)
duplicates lane
void setFill(bool fill)
Sets whether the polygon shall be filled.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
static bool isList(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool
begin/end of the description of a polygon
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
void saveShapes(const std::string &filename)
save shapes elements of the network
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void registerJoinedCluster(const std::set< NBNode * > &cluster)
gets all joined clusters (see doc for myClusters2Join)
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
int size() const
Returns the number of stored items within the container.
NBNode * getFromNode() const
Returns the origin node of the edge.
NBNetBuilder * getNetBuilder() const
get net builder