102 const
double GNENet::Z_INITIALIZED = 1;
111 myNetBuilder(netBuilder),
114 myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()),
115 myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()),
116 myNeedRecompute(true),
117 myAdditionalsSaved(true),
118 myShapesSaved(true) {
123 initJunctionsAndEdges();
126 if (myZBoundary.ymin() != Z_INITIALIZED) {
127 myZBoundary.add(0, 0);
135 it.second->decRef(
"GNENet::~GNENet");
138 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
144 it.second->decRef(
"GNENet::~GNENet");
147 WRITE_WARNING(
"Deleting unreferenced " +
toString(it.second->getTag()) +
" '" + it.second->getID() +
"' in GNENet destructor");
227 const std::string& suggestedName,
229 bool allowDuplicateGeom) {
232 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
233 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
234 if (!allowDuplicateGeom) {
241 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
252 edge =
new GNEEdge(*nbe,
this, wasSplit);
255 double defaultSpeed = 50 / 3.6;
256 std::string defaultType =
"";
257 int defaultNrLanes = 1;
258 int defaultPriority = 1;
262 defaultType, defaultSpeed,
263 defaultNrLanes, defaultPriority,
266 edge =
new GNEEdge(*nbe,
this, wasSplit);
292 std::vector<GNECrossing*> crossingsToRemove;
294 for (
auto i : junctionNeighbours) {
296 for (
auto j : i->getGNECrossings()) {
299 crossingsToRemove.push_back(j);
305 for (
auto i : crossingsToRemove) {
311 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
320 std::set<GUIGlID> deselected;
321 deselected.insert(junction->
getGlID());
340 for (
auto i : copyOfEdgeAdditionals) {
346 std::vector<GNEAdditional*> copyOfLaneAdditionals = i->getAdditionalChilds();
347 for (
auto j : copyOfLaneAdditionals) {
362 std::set<GUIGlID> deselected;
363 deselected.insert(edge->
getGlID());
371 for (
auto i : rerouters) {
372 if (i->getEdgeChilds().size() == 0) {
389 for (
auto i : copyOfEdgeAdditionals) {
395 std::vector<GNEAdditional*> copyOfLaneAdditionals = i->getAdditionalChilds();
396 for (
auto j : copyOfLaneAdditionals) {
414 for (
auto con : connections) {
421 std::set<GUIGlID> deselected;
422 deselected.insert(which->
getGlID());
446 for (
auto i : copyOfAdditionals) {
456 std::set<GUIGlID> deselected;
457 deselected.insert(edge->
getGlID());
463 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false),
true);
465 std::set<GUIGlID> deselected;
466 deselected.insert(lane->
getGlID());
499 undoList->
p_begin(
"delete crossing");
518 std::set<GUIGlID> deselected;
519 deselected.insert(POI->
getGlID());
533 std::set<GUIGlID> deselected;
534 deselected.insert(polygon->
getGlID());
549 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true),
true);
557 bool addRestriction =
true;
563 addRestriction =
false;
572 if (addRestriction) {
603 if (i->isRestricted(vclass)) {
618 if (i->isRestricted(vclass)) {
643 std::pair<PositionVector, PositionVector> newGeoms = oldGeom.
splitAt(linePos);
648 const std::string::size_type sep_index = baseName.rfind(
'.');
649 if (sep_index != std::string::npos) {
650 std::string posString = baseName.substr(sep_index + 1);
652 posBase = GNEAttributeCarrier::parse<int>(posString.c_str());
653 baseName = baseName.substr(0, sep_index);
660 if (newJunction == 0) {
664 undoList, baseName +
toString(posBase),
true);
665 GNEEdge* secondPart =
createEdge(newJunction, edge->getGNEJunctionDestiny(), edge,
666 undoList, baseName +
toString(posBase + (
int)linePos),
true);
670 newGeoms.first.pop_back();
671 newGeoms.first.erase(newGeoms.first.begin());
676 newGeoms.second.pop_back();
677 newGeoms.second.erase(newGeoms.second.begin());
680 for (
auto con_it : edge->getNBEdge()->getConnections()) {
692 for (
auto it : edges) {
693 newJunction =
splitEdge(it, pos, undoList, newJunction);
704 assert(reversed != 0);
717 assert(reversed != 0);
729 reversed =
createEdge(src, dest, edge, undoList,
"-" + edge->
getID(),
false,
true);
730 assert(reversed != 0);
733 std::set<GUIGlID> toSelect;
734 toSelect.insert(reversed->getGlID());
735 toSelect.insert(src->
getGlID());
736 toSelect.insert(dest->getGlID());
754 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
760 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
772 std::vector<GNECrossing*> crossingsOfOldEdge = oldEdge->
getGNECrossings();
773 for (
auto i : crossingsOfOldEdge) {
795 if (i.second->getPositionInView() == pos) {
815 std::vector<GNEStoppingPlace*> invalidStoppingPlaces;
816 std::vector<GNEDetector*> invalidDetectors;
822 invalidStoppingPlaces.push_back(stoppingPlace);
824 invalidDetectors.push_back(detector);
828 if (invalidStoppingPlaces.size() > 0 || invalidDetectors.size() > 0) {
832 if (fixAdditionalPositionsDialog.execute() == 0) {
839 for (
auto i : myAdditionals) {
840 i.second->writeAdditional(device, volatileOptionsEnabled);
849 for (
auto i : myAdditionals) {
850 i.second->writeAdditional(device, volatileOptionsEnabled);
889 }
else if (failHard) {
904 }
else if (failHard) {
915 assert((from != NULL) && (to != NULL));
918 if ((i.second->getGNEJunctionSource() == from) && (i.second->getGNEJunctionDestiny() == to)) {
931 std::vector<GNEEdge*>
933 std::vector<GNEEdge*> result;
936 result.push_back(it.second);
943 std::vector<GNELane*>
945 std::vector<GNELane*> result;
947 for (
auto it_lane : it.second->getLanes()) {
949 result.push_back(it_lane);
963 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
964 if ((*it_lane)->getID() == id) {
977 std::vector<GNEJunction*>
979 std::vector<GNEJunction*> result;
982 result.push_back(it.second);
999 GNEAdditionals::iterator positionToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
1015 return "vaporizer_" +
toString(counter);
1019 std::vector<GNEAttributeCarrier*>
1021 std::vector<GNEAttributeCarrier*> result;
1022 for (
auto it : ids) {
1033 ac =
dynamic_cast<GNEEdge*
>(object);
1036 ac =
dynamic_cast<GNELane*
>(object);
1048 ac =
dynamic_cast<GNEPoly*
>(object);
1051 ac =
dynamic_cast<GNEPOI*
>(object);
1057 throw ProcessError(
"GUIGlObject does not match the declared type");
1059 result.push_back(ac);
1062 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
1071 std::set<GUIGlID> result;
1074 std::set<GUIGlObjectType> knownTypes;
1085 for (
auto it : knownTypes) {
1086 const std::set<GUIGlID> tmp =
getGlIDs(it);
1087 result.insert(tmp.begin(), tmp.end());
1093 result.insert(it.second->getGlID());
1098 result.insert(it.second->getGlID());
1102 for (
auto i : myEdges) {
1104 for (
auto j : i.second->getLanes()) {
1105 result.insert(j->getGlID());
1112 for (
auto it : myJunctions) {
1113 if (it.second->getNBNode()->isTLControlled()) {
1114 result.insert(it.second->getGlID());
1123 result.insert(it.second->getGlID());
1128 for (
auto i : myEdges) {
1130 for (
auto j : i.second->getGNEConnections()) {
1132 result.insert(j->getGlID());
1138 for (
auto i : myJunctions) {
1140 for (
auto j : i.second->getGNECrossings()) {
1142 result.insert(j->getGlID());
1149 result.insert(dynamic_cast<GNEPoly*>(i.second)->getGlID());
1155 result.insert(dynamic_cast<GNEPOI*>(i.second)->getGlID());
1170 if (volatileOptions) {
1171 window->
setStatusBarText(
"Forced computing junctions with volatile options ...");
1179 if (volatileOptions) {
1190 if (additionalPath !=
"") {
1203 if (shapePath !=
"") {
1209 window->getApp()->endWaitCursor();
1222 it->setParticipantsInformation();
1223 it->setTLControllingInformation();
1259 if (n.second->getGNECrossings().size() > 0) {
1282 if (selectedJunctions.size() < 2) {
1287 std::set<NBNode*> cluster;
1288 for (
auto it : selectedJunctions) {
1289 cluster.insert(it->getNBNode());
1290 const EdgeVector& incoming = it->getNBNode()->getIncomingEdges();
1291 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1292 const EdgeVector& outgoing = it->getNBNode()->getOutgoingEdges();
1293 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1307 if ((i.second->getPositionInView() == pos) && (cluster.find(i.second->getNBNode()) == cluster.end())) {
1310 WRITE_WARNING(
"Opening FXMessageBox 'Join non-selected junction'");
1313 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1320 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'No'");
1322 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'ESC'");
1328 WRITE_WARNING(
"Closed FXMessageBox 'Join non-selected junction' with 'Yes'");
1339 pos.
setx(pos.
x() + 0.1);
1340 pos.
sety(pos.
y() + 0.1);
1347 for (
auto i : selectedJunctions) {
1349 while (i->getGNECrossings().size() > 0) {
1363 for (
auto it : allIncoming) {
1367 for (
auto it : allOutgoing) {
1372 for (
auto it : selectedJunctions) {
1378 if (pos != oldPos) {
1389 std::vector<GNECrossing*> myNetCrossings;
1391 myNetCrossings.reserve(myNetCrossings.size() + it.second->getGNECrossings().size());
1392 myNetCrossings.insert(myNetCrossings.end(), it.second->getGNECrossings().begin(), it.second->getGNECrossings().end());
1395 std::vector<GNECrossing*> myInvalidCrossings;
1396 for (
auto i = myNetCrossings.begin(); i != myNetCrossings.end(); i++) {
1397 if ((*i)->getNBCrossing()->valid ==
false) {
1398 myInvalidCrossings.push_back(*i);
1402 if (myInvalidCrossings.empty()) {
1405 WRITE_WARNING(
"Opening FXMessageBox 'No crossing to remove'");
1408 FXMessageBox::warning(
getApp(), MBOX_OK,
1412 WRITE_WARNING(
"Closed FXMessageBox 'No crossing to remove' with 'OK'");
1414 std::string plural = myInvalidCrossings.size() == 1 ? (
"") : (
"s");
1420 FXuint answer = FXMessageBox::question(
getApp(), MBOX_YES_NO,
1426 WRITE_WARNING(
"Closed FXMessageBox 'clear crossings' with 'No'");
1428 WRITE_WARNING(
"Closed FXMessageBox 'clear crossings' with 'ESC'");
1432 for (
auto i = myInvalidCrossings.begin(); i != myInvalidCrossings.end(); i++) {
1445 std::vector<GNEJunction*> toRemove;
1449 toRemove.push_back(junction);
1452 for (
auto it : toRemove) {
1461 undoList->
p_begin(
"Replace junction by geometry");
1464 for (
auto j : toJoin) {
1469 for (
auto con : connections) {
1503 i->updateConnectionIDs();
1553 Position delta = moveDest - moveSrc;
1555 std::set<GNEJunction*> junctionSet;
1558 for (
auto it : junctions) {
1559 Position newPos = it->getNBNode()->getPosition() + delta;
1560 it->moveJunctionGeometry(newPos);
1561 junctionSet.insert(it);
1566 for (
auto it : edges) {
1568 if (junctionSet.count(it->getGNEJunctionSource()) > 0 &&
1569 junctionSet.count(it->getGNEJunctionDestiny()) > 0) {
1571 it->moveGeometry(delta);
1574 it->moveGeometry(moveSrc, delta,
true);
1583 undoList->
p_begin(
"move selection");
1585 std::set<GNEJunction*> junctionSet;
1587 for (
auto it : junctions) {
1588 junctionSet.insert(it);
1593 for (
auto it : edges) {
1623 GNEAdditionals::iterator additionalToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
1639 GNEAdditionals::iterator additionalToUpdate =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(oldID, additional->
getTag()));
1655 if (i.second->getID() == id) {
1660 throw ProcessError(
"Attempted to retrieve non-existant additional");
1667 std::vector<GNEAdditional*>
1669 std::vector<GNEAdditional*> result;
1672 result.push_back(it.second);
1684 return myAdditionals.at(std::pair<std::string, SumoXMLTag>(
id, type));
1694 if ((it.second->getTag() == type) && (it.second->getLane() != NULL) && (it.second->getLane() == lane) && (fabs(it.second->getPositionInView().x() - pos) <
POSITION_EPS)) {
1695 return it.second->getID();
1702 std::vector<GNEAdditional*>
1704 std::vector<GNEAdditional*> vectorOfAdditionals;
1707 vectorOfAdditionals.push_back(i.second);
1710 return vectorOfAdditionals;
1729 for (
auto i : calibrators) {
1742 for (
auto i : calibrators) {
1755 for (
auto i : calibrators) {
1757 if (calibrator->
flowExists(calibratorFlowID)) {
1768 for (
auto i : calibrators) {
1781 for (
auto i : calibrators) {
1794 for (
auto i : calibrators) {
1806 const std::string& imgFile,
const PositionVector& shape,
bool fill,
bool ) {
1810 GNEPoly* poly =
new GNEPoly(
this,
id, type, shape, fill, color, layer, angle, imgFile,
false,
false);
1817 throw ProcessError(
"Error adding GNEPOly into shapeContainer");
1829 std::string polyID =
"junction_shape:" +
toString(counter);
1832 polyID =
"junction_shape:" +
toString(counter);
1838 GNEPoly* shapePoly =
new GNEPoly(
this,
"junction_shape:" +
toString(counter),
"junction_shape", junctionShape,
true,
RGBColor::GREEN,
GLO_POLYGON, 0,
"",
false ,
false);
1866 throw ProcessError(
"Polygon was already inserted in view");
1880 throw ProcessError(
"Polygon wasn't already inserted in view");
1900 std::string newID =
"poly_" +
toString(counter);
1904 newID =
"poly_" +
toString(counter);
1914 }
else if (failHard) {
1936 const std::string& imgFile,
const Position& pos,
double width,
double height,
bool ) {
1940 GNEPOI* poi =
new GNEPOI(
this,
id, type, color, layer, angle, imgFile, pos, width, height,
false);
1947 throw ProcessError(
"Error adding GNEPOI into shapeContainer");
1975 throw ProcessError(
"POI was already inserted in view");
1989 throw ProcessError(
"POI wasn't already inserted in view");
2009 std::string newID =
"POI_" +
toString(counter);
2013 newID =
"POI_" +
toString(counter);
2023 }
else if (failHard) {
2045 device.
openTag(
"additionals");
2096 for (
auto name_it : nodeContainer.
getAllNames()) {
2107 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
2141 junction->
incRef(
"GNENet::registerJunction");
2158 edge->
incRef(
"GNENet::registerEdge");
2179 junction->
decRef(
"GNENet::deleteSingleJunction");
2194 edge->
decRef(
"GNENet::deleteSingleEdge");
2229 it.second->remakeGNEConnections();
2231 for (
auto it : myEdges) {
2232 it.second->updateGeometry();
2240 std::set<std::string> liveExplicitTurnarounds;
2243 liveExplicitTurnarounds.insert(it);
2248 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
2253 it.second->setMicrosimID(it.second->getNBEdge()->getID());
2254 newEdgeMap[it.second->getNBEdge()->getID()] = it.second;
2257 newJunctionMap[it.second->getNBNode()->getID()] = it.second;
2258 it.second->setMicrosimID(it.second->getNBNode()->getID());
2260 myEdges = newEdgeMap;
2261 myJunctions = newJunctionMap;
2264 if (!oc.
getBool(
"offset.disable-normalization")) {
2272 if (volatileOptions) {
2291 for (
auto it : copyOfAdditionals) {
2297 for (
auto it : copyOfEdges) {
2299 myEdges.erase(it.second->getMicrosimID());
2304 for (
auto it : copyOfJunctions) {
2323 it.second->setLogicValid(
true);
2325 it.second->updateGeometry();
2336 std::vector<std::string> values = GNEAttributeCarrier::parse<std::vector<std::string> >(ac->
getAttribute(key));
2337 std::vector<std::string> newValues;
2338 for (
auto v : values) {
2339 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
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.
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
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
bool flowExists(std::string flowID) const
check if a flow with ID = flowID exists
IDSupplier myEdgeIDSupplier
description of a vehicle type
GNEJunction * getGNEJunctionSource() const
returns the source-junction
bool flowExists(const std::string &flowID) const
Check if exist a flow with these ID.
void removePolygonOfView(GNEPoly *p)
remove polygon of view net
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
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)
void deletePOI(GNEPOI *POI, GNEUndoList *undoList)
remove POI
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...
bool removePolygon(const std::string &id)
Removes a polygon from the container.
GNEPoly * addPolygonForEditShapes(GNEJunction *junction)
Builds a special polygon used for edit Junctions's shapes.
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
void enableSaveShapesMenu()
enable save shapes
GNEAdditionals myAdditionals
map with the name and pointer to additional elements of net
The main window of the Netedit.
bool changeID(const std::string &oldId, const std::string &newId)
change ID of a stored object
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
void setMicrosimID(const std::string &newID)
override to also set lane ids
virtual bool add(const std::string &id, T item)
Adds an item.
bool revertLaneRestriction(GNELane *lane, GNEUndoList *undoList)
revert prevously restricted lane
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
std::string generatePOIID() const
generate a POI ID
A container for traffic light definitions and built programs.
void refreshPOI(GNEPOI *p)
refresh shape in view net
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
double x() const
Returns the x-position.
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
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const Position &pos, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
bool vehicleTypeExists(const std::string &vehicleTypeID) const
Check if exist a vehicle type with these ID.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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 reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
Polygons myPolygons
stored Polygons
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.
std::vector< GNELane * > LaneVector
Definition of the lane's vector.
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
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 saveAdditionals(const std::string &filename, bool volatileOptionsEnabled=false)
save additional elements of the network
bool routeExists(const std::string &routeID) const
Check if exist a route with these ID.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in allGNEAttributeCarrier.
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
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
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...
bool routeExists(std::string routeID) const
check if a route with ID = routeID exists
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
Storage for geometrical objects.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a polygon
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
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
bool checkIsRemovable() const
check if node is removable
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 bool isDetectorPositionFixed() const =0
check if Position of detector is fixed
bool vehicleTypeExists(std::string vehicleTypeID) const
check if a vehicelType with ID = vehicleTypeID exists
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.
A RT-tree for efficient storing of SUMO's GL-objects.
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
int getIndex() const
returns the index of the lane
void remapEdge(GNEEdge *oldEdge, GNEJunction *from, GNEJunction *to, GNEUndoList *undoList, bool keepEndpoints=false)
GUIGlID getGlID() const
Returns the numerical id of the object.
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.
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.
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
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 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
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)
void refreshPolygon(GNEPoly *p)
refresh polygon in view net
void changePOIID(GNEPOI *POI, const std::string &OldID)
change POI ID
static const double Z_INITIALIZED
marker for whether the z-boundary is initialized
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
const std::vector< GNERerouter * > & getGNERerouters() const
get rerouters vinculated with this edge
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
std::string getAdditionalID(SumoXMLTag type, const GNELane *lane, const double pos) const
Returns the additional close to the given position.
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
std::map< std::string, GNEJunction * > GNEJunctions
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.
const GNECalibratorRoute & getCalibratorRoute(const std::string &routeID)
get reference calibrator route
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)
void moveJunctionGeometry(Position pos)
reposition the node at pos and informs the edges
void insertPolygonInView(GNEPoly *p)
insert created polygon in view net
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
void writeShape(OutputDevice &device)
writte shape element into a xml file
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.
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.
A point in 2D or 3D with translation and scaling methods.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
void setx(double x)
set position x
GNEJunctions myJunctions
map with the name and pointer to junctions of net
NBEdgeCont & getEdgeCont()
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
bool joinSelectedJunctions(GNEUndoList *undoList)
join selected junctions
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
void setShapeVisible(bool visible)
set flag to enable or disable if shape is visible
void deleteLane(GNELane *lane, GNEUndoList *undoList)
removes lane
void replaceIncomingEdge(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replaces edge
void deleteGeometryOrEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList)
removes geometry when pos is close to a geometry node, deletes the whole edge otherwise ...
bool isShapeSelected(SumoXMLTag tag, const std::string &ID) const
Check if shape item is selected.
virtual bool remove(const std::string &id)
Removes an item.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Boundary getBoundary() const
Returns the street's geometry.
double y() const
Returns the y-position.
void changePolygonID(GNEPoly *poly, const std::string &OldID)
change Polygon ID
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
registers completed movement with the undoList
int getNumLanes() const
Returns the number of lanes.
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) ...
const GNECalibratorFlow & getGNECalibratorFlow(const std::string &calibratorFlowID) const
Returns a reference to a calibrator flow finding in all calibrators of net.
Storage for edges, including some functionality operating on multiple edges.
GNEJunction * getParentJunction() const
get parent Junction
void initGNEConnections()
initialize GNEConnections
const GNECalibratorVehicleType & getCalibratorVehicleType(const std::string &vehicleTypeID)
get reference to calibrator vehicle type
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
std::string generatePolyID() const
generate PolyID
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
void insertPOIInView(GNEPOI *p)
insert created shape in view net
friend class GNEChange_Edge
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const std::string getID() const
function to support debugging
void moveSelection(const Position &moveSrc, const Position &moveDest)
move all selected junctions and edges
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
void incRef(const std::string &debugMsg="")
Increarse reference.
const PositionVector & getShape() const
retrieve the junction shape
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.
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 ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
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
const GNECalibratorRoute & getGNECalibratorRoute(const std::string &calibratorRouteID) const
Returns a reference to a calibrator route finding in all calibrators of net.
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.
const IDMap & getMyMap() const
Returns a reference to the internal map.
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
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 deletePolygon(GNEPoly *polygon, GNEUndoList *undoList)
remove Polygon
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
NBNode * getToNode() const
Returns the destination node of the edge.
double width
This lane'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.
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.
bool deleteGeometry(const Position &pos, GNEUndoList *undoList)
deletes the closest geometry node within SNAP_RADIUS.
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
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
declare friend class
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in allGNEAttributeCarrier.
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)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void sety(double y)
set position y
A storage for options typed value containers)
bool removePOI(const std::string &id)
Removes a PoI from the container.
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 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)
void resetLastTag()
reset last Tag and clear non-valid Additionals (For example, created E3 withouts Entry/Exit childs) ...
GNENet * getNet() const
get the net object
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
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
void deleteAdditional(GNEAdditional *additional)
delete additional element previously inserted
void writeShape(OutputDevice &device)
writte shape element into a xml file
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
GNEEdges myEdges
map with the name and pointer to edges of net
bool isShapeVisible() const
check if shape is visible (Was added into view using insertPolygon/POIInView)
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.
std::map< std::pair< std::string, SumoXMLTag >, GNEAdditional * > GNEAdditionals
void removePOIOfView(GNEPOI *p)
remove shape of view net
void push_back_noDoublePos(const Position &p)
insert in back a non double position
std::string getLaneID(int lane) const
get Lane ID (Secure)
void unblockObject(GUIGlID id)
Marks an object as unblocked.
const GNECalibratorVehicleType & getGNECalibratorVehicleType(const std::string &calibratorVehicleTypeID) const
Returns a reference to a calibrator vehicle type finding in all calibrators of net.
void setShapeEditedJunction(GNEJunction *junction)
retrieve the junction of which the shape is being edited
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::map< std::string, GNEEdge * > GNEEdges
NBEdge * getNBEdge()
returns the internal NBEdge
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
GNEAdditional * retrieveAdditional(const std::string &idl, bool hardFail=true) const
Returns the named additional.
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
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
void insertAdditional(GNEAdditional *additional, bool hardFail=true)
Insert a additional element previously created in GNEAdditionalHandler.
const GNECalibratorFlow & getCalibratorFlow(const std::string &flowID)
get reference to calibrator flow
int getNumberOfShapes() const
get number of shapes
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
void closePolygon()
ensures that the last position equals the first
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
bool addSRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
add restricted lane to edge
GUISelectedStorage gSelected
A global holder of selected objects.
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 savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
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 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.
void finishMoveSelection(GNEUndoList *undoList)
register changes to junction and edge positions with the undoList
NBNode * getFromNode() const
Returns the origin node of the edge.
NBNetBuilder * getNetBuilder() const
get net builder