85 #ifdef CHECK_MEMORY_LEAKS 87 #endif // CHECK_MEMORY_LEAKS 104 myNetBuilder(netBuilder),
107 myEdgeIDSupplier(
"gneE", netBuilder->getEdgeCont().getAllNames()),
108 myJunctionIDSupplier(
"gneJ", netBuilder->getNodeCont().getAllNames()),
109 myShapeContainer(myGrid),
110 myNeedRecompute(true) {
115 const std::vector<std::string>& nodeNames = nc.
getAllNames();
116 for (std::vector<std::string>::const_iterator name_it = nodeNames.begin(); name_it != nodeNames.end(); ++name_it) {
123 const std::vector<std::string>& edgeNames = ec.
getAllNames();
124 for (std::vector<std::string>::const_iterator name_it = edgeNames.begin(); name_it != edgeNames.end(); ++name_it) {
128 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
176 for (GNEEdges::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
177 it->second->decRef(
"GNENet::~GNENet");
181 it->second->decRef(
"GNENet::~GNENet");
254 const std::string& suggestedName,
256 bool allowDuplicateGeom) {
259 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
260 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
261 if (!allowDuplicateGeom) {
268 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
279 edge =
new GNEEdge(*nbe,
this, wasSplit);
283 std::string defaultType =
"";
284 int defaultNrLanes = 1;
285 int defaultPriority = 1;
289 defaultType, defaultSpeed,
290 defaultNrLanes, defaultPriority,
293 edge =
new GNEEdge(*nbe,
this, wasSplit);
320 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
328 std::set<GUIGlID> deselected;
329 deselected.insert(junction->
getGlID());
341 for (std::vector<GNEAdditional*>::iterator i = copyOfEdgeAdditionals.begin(); i != copyOfEdgeAdditionals.end(); i++) {
345 for (std::vector<GNELane*>::const_iterator i = edge->
getLanes().begin(); i != edge->
getLanes().end(); i++) {
346 std::vector<GNEAdditional*> copyOfLaneAdditionals = (*i)->getAdditionalChilds();
347 for (std::vector<GNEAdditional*>::iterator j = copyOfLaneAdditionals.begin(); j != copyOfLaneAdditionals.end(); j++) {
363 std::set<GUIGlID> deselected;
364 deselected.insert(edge->
getGlID());
383 for (std::vector<GNEAdditional*>::const_iterator i = copyOfAdditionals.begin(); i != copyOfAdditionals.end(); i++) {
394 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false),
true);
396 std::set<GUIGlID> deselected;
397 deselected.insert(lane->
getGlID());
415 std::set<GUIGlID> deselected;
416 deselected.insert(connection->
getGlID());
426 undoList->
p_begin(
"delete crossing");
430 std::set<GUIGlID> deselected;
431 deselected.insert(crossing->
getGlID());
444 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true),
true);
452 bool addRestriction =
true;
455 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
458 addRestriction =
false;
467 if (addRestriction) {
497 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
498 if ((*i)->isRestricted(vclass)) {
512 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
513 if ((*i)->isRestricted(vclass)) {
538 std::pair<PositionVector, PositionVector> newGeoms = oldGeom.
splitAt(linePos);
543 const std::string::size_type sep_index = baseName.rfind(
'.');
544 if (sep_index != std::string::npos) {
545 std::string posString = baseName.substr(sep_index + 1);
548 baseName = baseName.substr(0, sep_index);
555 if (newJunction == 0) {
559 undoList, baseName +
toString(posBase),
true);
560 GNEEdge* secondPart =
createEdge(newJunction, edge->getGNEJunctionDestiny(), edge,
561 undoList, baseName +
toString(posBase + (
int)linePos),
true);
565 newGeoms.first.pop_back();
566 newGeoms.first.erase(newGeoms.first.begin());
571 newGeoms.second.pop_back();
572 newGeoms.second.erase(newGeoms.second.begin());
575 std::vector<NBEdge::Connection>& connections = edge->getNBEdge()->getConnections();
576 for (std::vector<NBEdge::Connection>::iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
588 for (std::set<GNEEdge*>::const_iterator it = edges.begin(); it != edges.end(); ++it) {
589 newJunction =
splitEdge(*it, pos, undoList, newJunction);
600 assert(reversed != 0);
612 assert(reversed != 0);
625 assert(reversed != 0);
628 std::set<GUIGlID> toSelect;
629 toSelect.insert(reversed->getGlID());
630 toSelect.insert(src->
getGlID());
631 toSelect.insert(dest->getGlID());
648 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
654 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
692 i->second->writeAdditional(device);
722 }
else if (failHard) {
733 GNEEdges::const_iterator i =
myEdges.find(
id);
737 }
else if (failHard) {
746 std::vector<GNEEdge*>
748 std::vector<GNEEdge*> result;
749 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
751 result.push_back(it->second);
758 std::vector<GNELane*>
760 std::vector<GNELane*> result;
761 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
763 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
765 result.push_back(*it_lane);
779 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
780 if ((*it_lane)->getID() == id) {
793 std::vector<GNEJunction*>
795 std::vector<GNEJunction*> result;
798 result.push_back(it->second);
815 GNEAdditionals::iterator positionToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
825 std::vector<GNEAttributeCarrier*>
827 std::vector<GNEAttributeCarrier*> result;
828 for (std::set<GUIGlID>::iterator it = ids.begin(); it != ids.end(); it++) {
839 ac =
dynamic_cast<GNEEdge*
>(object);
842 ac =
dynamic_cast<GNELane*
>(object);
851 throw ProcessError(
"GUIGlObject does not match the declared type");
853 result.push_back(ac);
856 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
865 std::set<GUIGlID> result;
868 std::set<GUIGlObjectType> knownTypes;
875 for (std::set<GUIGlObjectType>::const_iterator it = knownTypes.begin(); it != knownTypes.end(); it++) {
876 const std::set<GUIGlID> tmp =
getGlIDs(*it);
877 result.insert(tmp.begin(), tmp.end());
883 result.insert(it->second->getGlID());
887 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
888 result.insert(it->second->getGlID());
892 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
893 const std::set<GUIGlID> laneIDs = it->second->getLaneGlIDs();
894 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
895 result.insert(*lid_it);
903 if (it->second->getNBNode()->isTLControlled()) {
904 result.insert(it->second->getGlID());
913 result.insert(it->second->getGlID());
918 for (GNEEdges::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
920 const std::vector<GNEConnection*>& connections = i->second->getGNEConnections();
922 for (std::vector<GNEConnection*>::const_iterator j = connections.begin(); j != connections.end(); j++) {
924 result.insert((*j)->getGlID());
952 window->getApp()->endWaitCursor();
966 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
986 if (i->second->getCrossings().size() > 0) {
1009 if (selected.size() < 2) {
1016 std::set<NBNode*> cluster;
1017 for (std::vector<GNEJunction*>::iterator it = selected.begin(); it != selected.end(); it++) {
1018 cluster.insert((*it)->getNBNode());
1019 const EdgeVector& incoming = (*it)->getNBNode()->getIncomingEdges();
1020 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
1021 const EdgeVector& outgoing = (*it)->getNBNode()->getOutgoingEdges();
1022 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1039 for (EdgeVector::const_iterator it = allIncoming.begin(); it != allIncoming.end(); it++) {
1043 for (EdgeVector::const_iterator it = allOutgoing.begin(); it != allOutgoing.end(); it++) {
1048 for (std::vector<GNEJunction*>::iterator it = selected.begin(); it != selected.end(); it++) {
1059 std::vector<GNEJunction*> toRemove;
1063 toRemove.push_back(junction);
1066 for (std::vector<GNEJunction*>::iterator it = toRemove.begin(); it != toRemove.end(); ++it) {
1075 undoList->
p_begin(
"Replace junction by geometry");
1078 for (std::vector<std::pair<NBEdge*, NBEdge*> >::iterator j = toJoin.begin(); j != toJoin.end(); j++) {
1148 Position delta = moveDest - moveSrc;
1150 std::set<GNEJunction*> junctionSet;
1152 for (std::vector<GNEJunction*>::iterator it = junctions.begin(); it != junctions.end(); it++) {
1153 Position newPos = (*it)->getNBNode()->getPosition() + delta;
1154 (*it)->move(newPos);
1155 junctionSet.insert(*it);
1160 for (std::vector<GNEEdge*>::iterator it = edges.begin(); it != edges.end(); it++) {
1178 undoList->
p_begin(
"move selection");
1180 std::set<GNEJunction*> junctionSet;
1182 for (std::vector<GNEJunction*>::iterator it = junctions.begin(); it != junctions.end(); it++) {
1183 (*it)->registerMove(undoList);
1184 junctionSet.insert(*it);
1189 for (std::vector<GNEEdge*>::iterator it = edges.begin(); it != edges.end(); it++) {
1224 GNEAdditionals::iterator additionalToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
1238 GNEAdditionals::iterator additionalToUpdate =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(oldID, additional->
getTag()));
1252 if (i->second->getID() == id) {
1257 throw ProcessError(
"Attempted to retrieve non-existant additional");
1269 return myAdditionals.at(std::pair<std::string, SumoXMLTag>(
id, type));
1279 if ((it->second->getTag() == type) && (it->second->getLane() != NULL) && (it->second->getLane() == lane) && (fabs(it->second->getPositionInView().x() - pos) <
POSITION_EPS)) {
1280 return it->second->getID();
1287 std::vector<GNEAdditional*>
1289 std::vector<GNEAdditional*> vectorOfAdditionals;
1292 vectorOfAdditionals.push_back(i->second);
1295 return vectorOfAdditionals;
1334 junction->
incRef(
"GNENet::registerJunction");
1351 edge->
incRef(
"GNENet::registerEdge");
1372 junction->
decRef(
"GNENet::deleteSingleJunction");
1387 edge->
decRef(
"GNENet::deleteSingleEdge");
1421 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1422 it->second->remakeGNEConnections();
1424 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1425 it->second->updateGeometry();
1432 std::set<std::string> liveExplicitTurnarounds;
1435 liveExplicitTurnarounds.insert(*it);
1440 if (oc.
getBool(
"numerical-ids") || oc.
isSet(
"reserved-ids")) {
1443 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1444 it->second->setMicrosimID(it->second->getNBEdge()->getID());
1445 newEdgeMap[it->second->getNBEdge()->getID()] = it->second;
1448 newJunctionMap[it->second->getNBNode()->getID()] = it->second;
1449 it->second->setMicrosimID(it->second->getNBNode()->getID());
1455 if (!oc.
getBool(
"offset.disable-normalization")) {
1456 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1466 it->second->setLogicValid(
true);
1468 it->second->updateGeometry();
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 computeAndUpdate(OptionsCont &oc)
recompute the network and update lane geometries
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
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
ShapeContainer & getShapeContainer()
get shape container
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
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 setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
SUMOReal getHeight() const
Returns the height of the boundary (y-axis)
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
SUMOReal width
This lane's width.
IDSupplier myEdgeIDSupplier
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
SUMOReal getWidth() const
Returns the width of the boudary (x-axis)
NBNode::Crossing & getNBCrossing() const
get referente to NBode::Crossing
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
void joinSelectedJunctions(GNEUndoList *undoList)
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...
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
GNEAdditionals myAdditionals
map with the name and pointer to additional elements of net
The main window of the Netedit.
static const RGBColor selectedLaneColor
color of selected lane
void setMicrosimID(const std::string &newID)
override to also set lane ids
bool revertLaneRestriction(GNELane *lane, GNEUndoList *undoList)
revert prevously restricted lane
A container for traffic light definitions and built programs.
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
SUMOReal ymin() const
Returns minimum y-coordinate.
connectio between two lanes
Stores the information about how to visualize structures.
std::set< GUIGlID > getGlIDs(GUIGlObjectType type=GLO_MAX)
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
virtual void setTLControllingInformation() const =0
Informs edges about being controlled by a tls.
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
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)
Position moveGeometry(const Position &oldPos, const Position &newPos, bool relative=false)
change the edge geometry It is up to the Edge to decide whether an new geometry node should be genera...
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.
void computeEverything(GNEApplicationWindow *window, bool force=false)
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
The base class for traffic light logic definitions.
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.
SUMOReal getTotalWidth() const
Returns the combined width of all lanes of this edge.
std::string getAttribute(SumoXMLAttr key) const
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.
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.
GUIShapeContainer myShapeContainer
the container for additional pois and polygons
Storage for geometrical objects.
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
Lane & getLaneStruct(int lane)
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList)
removes edge
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
void registerMove(GNEUndoList *undoList)
registers completed movement with the undoList
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
std::string getAdditionalID(SumoXMLTag type, const GNELane *lane, const SUMOReal pos) const
Returns the additional close to the given position.
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
A class that stores a 2D geometrical boundary.
bool myNeedRecompute
whether the net needs recomputation
NBNetBuilder * myNetBuilder
The internal netbuilder.
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
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
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.
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
friend class GNEChange_Connection
const Position & getPosition() const
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.
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.
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
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
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
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
void deleteLane(GNELane *lane, GNEUndoList *undoList)
removes lane
void deleteGeometryOrEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList)
removes geometry when pos is close to a geometry node, deletes the whole edge otherwise ...
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Boundary getBoundary() const
Returns the street's geometry.
SUMOReal z() const
Returns the z-position.
void removeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
int getNumLanes() const
Returns the number of lanes.
std::vector< GNEAdditional * > getAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING)
get vector with additionals
void computeJunction(GNEJunction *junction)
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
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING)
Returns the number of additionals of the net.
void save(OptionsCont &oc)
save the network
edge: the shape in xml-definition
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
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
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="")
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
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="")
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< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
begin/end of the description of an edge
std::pair< PositionVector, PositionVector > splitAt(SUMOReal where) const
Returns the two lists made when this list vector is splitted at the given point.
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
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
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
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
NBNode * getToNode() const
Returns the destination node of the edge.
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
void add(SUMOReal x, SUMOReal y, SUMOReal z=0)
Makes the boundary include the given coordinate.
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)
GNENet(NBNetBuilder *netBuilder)
Constructor.
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
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)
static const RGBColor selectedConnectionColor
color of selected connection
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void move(Position pos)
reposition the node at pos and informs the edges
A storage for options typed value containers)
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
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)
void deleteAdditional(GNEAdditional *additional)
delete additional element previously inserted
SumoXMLTag getTag() const
get XML Tag assigned to this object
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
void move2side(SUMOReal amount)
move position vector to side using certain ammount
Static storage of an output device and its base (abstract) implementation.
GNEEdges myEdges
map with the name and pointer to edges of net
last coordinate of edge shape
static const RGBColor selectionColor
color of selection
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.
Container for nodes during the netbuilding process.
std::map< std::string, GNEEdge * > GNEEdges
NBEdge * getNBEdge()
returns the internal NBEdge
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.
bool netHasCrossings() const
check if net has crossings
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.
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
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.
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
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
void saveAdditionals(const std::string &filename)
save additional elements of the network
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.
static const SUMOReal Z_INITIALIZED
marker for whether the z-boundary is initialized
void duplicateLane(GNELane *lane, GNEUndoList *undoList)
duplicates lane
void append(const PositionVector &v, SUMOReal sameThreshold=2.0)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
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
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