83 #ifdef CHECK_MEMORY_LEAKS 85 #endif // CHECK_MEMORY_LEAKS 102 myNetBuilder(netBuilder),
105 myEdgeIDSupplier(
"gneE", netBuilder->getEdgeCont().getAllNames()),
106 myJunctionIDSupplier(
"gneJ", netBuilder->getNodeCont().getAllNames()),
107 myShapeContainer(myGrid),
108 myNeedRecompute(true) {
113 const std::vector<std::string>& edgeNames = ec.
getAllNames();
114 for (std::vector<std::string>::const_iterator name_it = edgeNames.begin(); name_it != edgeNames.end(); ++name_it) {
118 throw ProcessError(
"Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
124 const std::vector<std::string>& nodeNames = nc.
getAllNames();
125 for (std::vector<std::string>::const_iterator name_it = nodeNames.begin(); name_it != nodeNames.end(); ++name_it) {
174 for (GNEEdges::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
175 it->second->decRef(
"GNENet::~GNENet");
179 it->second->decRef(
"GNENet::~GNENet");
253 const std::string& suggestedName,
255 bool allowDuplicateGeom) {
258 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
259 if ((*it)->getToNode() == dest->
getNBNode() && (*it)->getGeometry().size() == 2) {
260 if (!allowDuplicateGeom) {
267 if (suggestedName !=
"" && !
retrieveEdge(suggestedName,
false)) {
278 edge =
new GNEEdge(*nbe,
this, wasSplit);
282 std::string defaultType =
"";
283 int defaultNrLanes = 1;
284 int defaultPriority = 1;
288 defaultType, defaultSpeed,
289 defaultNrLanes, defaultPriority,
292 edge =
new GNEEdge(*nbe,
this, wasSplit);
294 undoList->
p_begin(
"create edge");
310 undoList->
p_begin(
"delete junction");
314 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
322 std::set<GUIGlID> deselected;
323 deselected.insert(junction->
getGlID());
332 undoList->
p_begin(
"delete edge");
345 std::set<GUIGlID> deselected;
346 deselected.insert(edge->
getGlID());
362 undoList->
p_begin(
"delete lane");
371 undoList->add(
new GNEChange_Lane(edge, lane, laneAttrs,
false),
true);
373 std::set<GUIGlID> deselected;
374 deselected.insert(lane->
getGlID());
385 undoList->
p_begin(
"delete connection");
392 std::set<GUIGlID> deselected;
393 deselected.insert(connection->
getGlID());
403 undoList->
p_begin(
"duplicate lane");
407 undoList->add(
new GNEChange_Lane(edge, newLane, laneAttrs,
true),
true);
417 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
418 if ((*i)->isRestricted(vclass)) {
424 std::vector<std::string> disallowedVClasses;
425 std::string restriction =
toString(vclass);
428 for (
int i = 0; i < (int)VClasses.size(); i++) {
429 if ((VClasses.at(i) != restriction) && (VClasses.at(i) != ignoring)) {
430 disallowedVClasses.push_back(VClasses.at(i));
461 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
462 if ((*i)->isRestricted(vclass)) {
476 for (std::vector<GNELane*>::const_iterator i = edge.
getLanes().begin(); i != edge.
getLanes().end(); i++) {
477 if ((*i)->isRestricted(vclass)) {
497 undoList->
p_begin(
"split edge");
502 std::pair<PositionVector, PositionVector> newGeoms = oldGeom.
splitAt(linePos);
507 const std::string::size_type sep_index = baseName.rfind(
'.');
508 if (sep_index != std::string::npos) {
509 std::string posString = baseName.substr(sep_index + 1);
512 baseName = baseName.substr(0, sep_index);
519 if (newJunction == 0) {
523 undoList, baseName +
toString(posBase),
true);
525 undoList, baseName +
toString(posBase + (
int)linePos),
true);
529 newGeoms.first.pop_back();
530 newGeoms.first.erase(newGeoms.first.begin());
535 newGeoms.second.pop_back();
536 newGeoms.second.erase(newGeoms.second.begin());
539 std::vector<NBEdge::Connection>& connections = edge->getNBEdge()->getConnections();
540 for (std::vector<NBEdge::Connection>::iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
551 undoList->
p_begin(
"split edges");
552 for (std::set<GNEEdge*>::const_iterator it = edges.begin(); it != edges.end(); ++it) {
553 newJunction =
splitEdge(*it, pos, undoList, newJunction);
561 undoList->
p_begin(
"reverse edge");
564 assert(reversed != 0);
572 undoList->
p_begin(
"add reversed edge");
576 assert(reversed != 0);
589 assert(reversed != 0);
592 std::set<GUIGlID> toSelect;
593 toSelect.insert(reversed->getGlID());
594 toSelect.insert(src->
getGlID());
595 toSelect.insert(dest->getGlID());
605 undoList->
p_begin(
"merge junctions");
612 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
618 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
652 std::string path = filename;
653 while (!path.empty() && path[path.size() - 1] !=
'\\') {
654 path = path.substr(0, path.size() - 1);
660 if (i->second->getAdditionalSetParent() == NULL) {
661 i->second->writeAdditional(device, path);
692 }
else if (failHard) {
703 GNEEdges::const_iterator i =
myEdges.find(
id);
707 }
else if (failHard) {
716 std::vector<GNEEdge*>
718 std::vector<GNEEdge*> result;
719 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
721 result.push_back(it->second);
728 std::vector<GNELane*>
730 std::vector<GNELane*> result;
731 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
733 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
735 result.push_back(*it_lane);
749 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
750 if ((*it_lane)->getID() == id) {
763 std::vector<GNEJunction*>
765 std::vector<GNEJunction*> result;
768 result.push_back(it->second);
785 GNEAdditionals::iterator positionToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
795 std::vector<GNEAttributeCarrier*>
797 std::vector<GNEAttributeCarrier*> result;
798 for (std::set<GUIGlID>::iterator it = ids.begin(); it != ids.end(); it++) {
809 ac =
dynamic_cast<GNEEdge*
>(object);
812 ac =
dynamic_cast<GNELane*
>(object);
815 if (dynamic_cast<GNEAdditional*>(
object)) {
817 }
else if (dynamic_cast<GNEAdditionalSet*>(
object)) {
825 throw ProcessError(
"GUIGlObject does not match the declared type");
827 result.push_back(ac);
830 throw ProcessError(
"Attempted to retrieve non-existant GUIGlObject");
839 std::set<GUIGlID> result;
842 std::set<GUIGlObjectType> knownTypes;
849 for (std::set<GUIGlObjectType>::const_iterator it = knownTypes.begin(); it != knownTypes.end(); it++) {
850 const std::set<GUIGlID> tmp =
getGlIDs(*it);
851 result.insert(tmp.begin(), tmp.end());
857 result.insert(it->second->getGlID());
861 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
862 result.insert(it->second->getGlID());
866 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
867 const std::set<GUIGlID> laneIDs = it->second->getLaneGlIDs();
868 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
869 result.insert(*lid_it);
877 if (it->second->getNBNode()->isTLControlled()) {
878 result.insert(it->second->getGlID());
887 result.insert(it->second->getGlID());
892 for (GNEEdges::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
894 const std::vector<GNEConnection*>& connections = i->second->getGNEConnections();
896 for (std::vector<GNEConnection*>::const_iterator j = connections.begin(); j != connections.end(); j++) {
898 result.insert((*j)->getGlID());
926 window->getApp()->endWaitCursor();
940 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
955 i->second->updateShapesAndGeometries();
977 if (selected.size() < 2) {
980 undoList->
p_begin(
"Join selected junctions");
984 std::set<NBNode*> cluster;
985 for (std::vector<GNEJunction*>::iterator it = selected.begin(); it != selected.end(); it++) {
986 cluster.insert((*it)->getNBNode());
987 const EdgeVector& incoming = (*it)->getNBNode()->getIncomingEdges();
988 allIncoming.insert(allIncoming.end(), incoming.begin(), incoming.end());
989 const EdgeVector& outgoing = (*it)->getNBNode()->getOutgoingEdges();
990 allOutgoing.insert(allOutgoing.end(), outgoing.begin(), outgoing.end());
1007 for (EdgeVector::const_iterator it = allIncoming.begin(); it != allIncoming.end(); it++) {
1011 for (EdgeVector::const_iterator it = allOutgoing.begin(); it != allOutgoing.end(); it++) {
1016 for (std::vector<GNEJunction*>::iterator it = selected.begin(); it != selected.end(); it++) {
1026 undoList->
p_begin(
"Clean junctions");
1027 std::vector<GNEJunction*> toRemove;
1031 toRemove.push_back(junction);
1034 for (std::vector<GNEJunction*>::iterator it = toRemove.begin(); it != toRemove.end(); ++it) {
1043 undoList->
p_begin(
"Replace junction by geometry");
1046 for (std::vector<std::pair<NBEdge*, NBEdge*> >::iterator j = toJoin.begin(); j != toJoin.end(); j++) {
1116 Position delta = moveDest - moveSrc;
1118 std::set<GNEJunction*> junctionSet;
1120 for (std::vector<GNEJunction*>::iterator it = junctions.begin(); it != junctions.end(); it++) {
1121 Position newPos = (*it)->getNBNode()->getPosition() + delta;
1122 (*it)->move(newPos);
1123 junctionSet.insert(*it);
1128 for (std::vector<GNEEdge*>::iterator it = edges.begin(); it != edges.end(); it++) {
1146 undoList->
p_begin(
"move selection");
1148 std::set<GNEJunction*> junctionSet;
1150 for (std::vector<GNEJunction*>::iterator it = junctions.begin(); it != junctions.end(); it++) {
1151 (*it)->registerMove(undoList);
1152 junctionSet.insert(*it);
1157 for (std::vector<GNEEdge*>::iterator it = edges.begin(); it != edges.end(); it++) {
1192 throw ProcessError(
"additional element with ID='" + additional->
getID() +
"' already exist");
1215 GNEAdditionals::iterator positionToRemove =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(additional->
getID(), additional->
getTag()));
1218 throw ProcessError(
"additional element with ID='" + additional->
getID() +
"' don't exist");
1240 GNEAdditionals::iterator additionalToUpdate =
myAdditionals.find(std::pair<std::string, SumoXMLTag>(oldID, additional->
getTag()));
1254 return myAdditionals.at(std::pair<std::string, SumoXMLTag>(
id, type));
1264 if ((it->second->getTag() == type) && (it->second->getLane() != NULL) && (it->second->getLane() == lane) && (fabs(it->second->getPositionInView().x() - pos) <
POSITION_EPS)) {
1265 return it->second->getID();
1272 std::vector<GNEAdditional*>
1274 std::vector<GNEAdditional*> vectorOfAdditionals;
1277 vectorOfAdditionals.push_back(i->second);
1280 return vectorOfAdditionals;
1320 junction->
incRef(
"GNENet::registerJunction");
1337 edge->
incRef(
"GNENet::registerEdge");
1352 junction->
decRef(
"GNENet::deleteSingleJunction");
1366 edge->
decRef(
"GNENet::deleteSingleEdge");
1397 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1398 it->second->remakeGNEConnections();
1400 for (GNEEdges::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1401 it->second->updateGeometry();
1408 std::set<std::string> liveExplicitTurnarounds;
1411 liveExplicitTurnarounds.insert(*it);
1418 it->second->setLogicValid(
true);
1420 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
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
void computeAndUpdate(OptionsCont &oc)
recompute the network and update lane geometries
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
GNELane * getLane() const
get lane of additional, or NULL if additional isn't placed over a Lane
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
ShapeContainer & getShapeContainer()
get shape container
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.
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void registerJoinedCluster(const std::set< NBNode *> &cluster)
gets all joined clusters (see doc for myClusters2Join)
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
IDSupplier myEdgeIDSupplier
SUMORTree myGrid
the rtree which contains all GUIGlObjects (so named for historical reasons)
void joinSelectedJunctions(GNEUndoList *undoList)
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.
SUMOReal getHeight() const
Returns the height of the boundary (y-axis)
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.
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool removeElements=true)
Performs the network building steps.
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
Stores the information about how to visualize structures.
std::set< GUIGlID > getGlIDs(GUIGlObjectType type=GLO_MAX)
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
void removeAdditionalChild(GNEAdditional *additional)
remove additional child to this 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)
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...
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.
SUMOReal ymin() const
Returns minimum y-coordinate.
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.
std::string getAdditionalID(SumoXMLTag type, const GNELane *lane, const SUMOReal pos) const
Returns the additional close to the given position.
void updateJunctionShapes()
update junction shapes
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connectino
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
std::pair< PositionVector, PositionVector > splitAt(SUMOReal where) const
Returns the two lists made when this list vector is splitted at the given point.
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.
PositionVector reverse() const
reverse position vector
GUIShapeContainer myShapeContainer
the container for additional pois and polygons
Storage for geometrical objects.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void insertEdge(GNEEdge *edge)
inserts a single edge into the net and into the underlying netbuild-container
SUMOReal getWidth() const
Returns the width of the boudary (x-axis)
const std::string & getID() const
Returns the id.
Lane & getLaneStruct(int lane)
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
An Element wich group additionalSet elements.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList)
removes edge
const Boundary & getBoundary() const
returns the bounder of the network
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.
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
Boundary getBoundary() const
Returns the boundary of the junction.
void remapEdge(GNEEdge *oldEdge, GNEJunction *from, GNEJunction *to, GNEUndoList *undoList, bool keepEndpoints=false)
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.
static OptionsCont & getOptions()
Retrieves the options.
GNEAdditionalSet * getAdditionalSetParent() const
get additionalSet parent, or NULL if don't belongs to an additionalSet
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
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
IDSupplier myJunctionIDSupplier
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
An (internal) definition of a single lane of an edge.
std::string getAttribute(SumoXMLAttr key) const
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
friend class GNEChange_Connection
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
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
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
GNEEdge & getParentEdge()
Returns underlying parent edge.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
SUMOReal z() const
Returns the z-position.
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.
int getNumLanes() const
Returns the number of lanes.
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
void addAdditionalChild(GNEAdditional *additional)
add additional child to this lane
NBEdgeCont & getEdgeCont()
Returns the edge container.
bool removeAdditionalGeometryChild(GNEAdditional *additional)
remove additional element to this set
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
Boundary myZBoundary
the z boundary (stored in the x-coordinate), values of 0 are ignored
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
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 ...
bool addAdditionalChild(GNEAdditional *additional)
add additional element to this set
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
void removeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
const EdgeVector & getEdges() const
Returns all edges which participate in this node.
std::vector< GNEAdditional * > getAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING)
get vector with additionals
void computeJunction(GNEJunction *junction)
Storage for edges, including some functionality operating on multiple edges.
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
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(const std::set< GUIGlID > &ids, GUIGlObjectType type)
get the attribute carriers based on GlIDs
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
friend class GNEChange_Edge
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
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 splitEdgesBidi(const std::set< GNEEdge *> &edges, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void incRef(const std::string &debugMsg="")
void analyzeCluster(std::set< NBNode *> cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type)
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
void setAdditionalsOutputFile(const std::string &additionalOutputFile)
set additionals File
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)
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void setAdditionalsFile(const std::string &additionalFile)
set additionals File
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
A road/street connecting two junctions (netedit-version)
void reserveJunctionID(const std::string &id)
reserve junction ID (To avoid duplicates)
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
std::vector< std::string > getAllNames() const
get all node names
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
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
void deselect(GUIGlID id)
Deselects the object with the given id.
const Boundary & getZBoundary() const
Returns the Z boundary (stored in the x() coordinate) values of 0 do not affect the boundary...
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
bool deleteGeometry(const Position &pos, GNEUndoList *undoList)
deletes the closest geometry node within SNAP_RADIUS.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
NBConnection getNBConnection() const
get NBConnection
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 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.
Instance responsible for building networks.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
friend class GNEChange_Junction
declare friend class
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
void removeSolitaryJunctions(GNEUndoList *undoList)
std::vector< NBEdge * > EdgeVector
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
SUMOReal getTotalWidth() const
Returns the combined width of all lanes of this edge.
static const RGBColor selectedConnectionColor
color of selected connection
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 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
const Position & getPosition() const
Returns the position of this node.
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
Represents a single node (junction) during network building.
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
GUIGlID getGlID() const
Returns the numerical id of the object.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
void deleteAdditional(GNEAdditional *additional)
delete additional element previously inserted
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
static const RGBColor selectionColor
color of selection
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this edge
void unblockObject(GUIGlID id)
Marks an object as unblocked.
void reserveEdgeID(const std::string &id)
reserve edge ID (To avoid duplicates)
NBNode * getFromNode() const
Returns the origin node of the edge.
void deleteSingleEdge(GNEEdge *edge)
deletes a single edge
Container for nodes during the netbuilding process.
NBEdge * getNBEdge()
returns the internal NBEdge
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.
Boundary getBoundary() const
Returns the street's geometry.
#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.
NBDistrictCont & getDistrictCont()
Returns the districts container.
bool checkIsRemovable() const
NBNode * getNBNode() const
Return net build node.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
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
bool wasSplit()
whether this edge was created from a split
void setStatusBarText(const std::string &)
set text of the statusBar
NBNode * getToNode() const
Returns the destination node of the edge.
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)
vehicles ignoring classes
void requireRecompute()
inform the net about the need for recomputation
GNEEdge * getEdge() const
get edge of additional, or NULL if additional isn't placed over an edge
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
virtual void setTLControllingInformation() const =0
Informs edges about being controlled by a tls.
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
GNEViewNet * getViewNet() const
get view net
void finishMoveSelection(GNEUndoList *undoList)
register changes to junction and edge positions with the undoList
SumoXMLTag getTag() const
get Tag assigned to this object