55 myLastParameterised(nullptr) {
126 bool needConversion =
true;
127 if (node !=
nullptr) {
130 needConversion =
false;
137 needConversion =
true;
142 needConversion =
true;
162 bool updateEdgeGeometries,
168 if (node !=
nullptr) {
180 std::set<NBTrafficLightDefinition*> oldTLS;
182 const bool isPatch = node !=
nullptr;
183 if (node ==
nullptr) {
184 node =
new NBNode(nodeID, position, type);
186 throw ProcessError(
TLF(
"Could not insert node though checked this before (id='%').", nodeID));
195 node->
reinit(position, type, updateEdgeGeometries);
200 }
else if (isPatch && typeS !=
"") {
204 for (std::set<NBTrafficLightDefinition*>::iterator i = oldTLS.begin(); i != oldTLS.end(); ++i) {
205 if ((*i)->getNodes().size() == 0) {
217 if (shape.size() > 2) {
249 if (node ==
nullptr) {
262 const std::string clusterString = attrs.
get<std::string>(
SUMO_ATTR_NODES,
nullptr, ok);
303 std::set<NBTrafficLightDefinition*> tlDefs;
306 std::string oldTlID =
"";
311 oldTlID = oldDef->
getID();
316 if (tlID != oldTlID || typeS != oldTypeS) {
323 WRITE_ERRORF(
TL(
"Unknown traffic light type '%' for node '%'."), typeS, currentNode->
getID());
332 WRITE_ERRORF(
TL(
"Unknown traffic light layout '%' for node '%'."), typeS, currentNode->
getID());
336 if (tlID !=
"" && tlc.
getPrograms(tlID).size() > 0) {
350 dynamic_cast<NBOwnTLDef*
>(def)->setLayout(layout);
355 tlID = (tlID ==
"" ? currentNode->
getID() : tlID);
363 tlDefs.insert(tlDef);
367 if (controlledInner.size() != 0) {
368 for (std::set<NBTrafficLightDefinition*>::iterator it = tlDefs.begin(); it != tlDefs.end(); it++) {
369 (*it)->addControlledInnerEdges(controlledInner);
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
@ SUMO_TAG_JOINEXCLUDE
join exlude operation
@ SUMO_TAG_JOIN
Join operation.
@ SUMO_TAG_NODE
alternative definition for junction
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_DEL
delete certain element (note: DELETE is a macro)
FringeType
classifying boundary nodes
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
RightOfWay
algorithms for computing right of way
@ SUMO_ATTR_NODES
a list of node ids, used for controlling joining
@ SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
@ SUMO_ATTR_TLLAYOUT
node: the layout of the traffic light program
@ SUMO_ATTR_FRINGE
Fringe type of node.
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_ATTR_CONTROLLED_INNER
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string & getFileName() const
returns the current file name
static methods for processing the coordinates conversion for the current net
static void setLoadedPlain(const std::string &nodFile, const GeoConvHelper &loaded)
registers the coordinate transformation as having been loaded from the given file
Storage for edges, including some functionality operating on multiple edges.
void removeRoundabout(const NBNode *node)
remove roundabout that contains the given node
A loaded (complete) traffic light logic.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Container for nodes during the netbuilding process.
void markAsNotTLS(const NBNode *node)
mark a node as explicitly not controlled by a TLS
std::string createClusterId(const NodeSet &cluster, const std::string &prefix="cluster_")
generate id from cluster node ids
void addJoinExclusion(const std::vector< std::string > &ids)
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
void addCluster2Join(const std::set< std::string > &cluster, NBNode *node)
add ids of nodes which shall be joined into a single node
Represents a single node (junction) during network building.
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
FringeType getFringeType() const
Returns fringe type.
SumoXMLNodeType getType() const
Returns the type of this node.
bool isTrafficLight() const
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
void setCustomShape(const PositionVector &shape)
set the junction shape
void setKeepClear(bool keepClear)
set the keepClear flag
void removeTrafficLights(bool setAsPriority=false)
Removes all references to traffic lights that control this tls.
void setRadius(double radius)
set the turning radius
void setName(const std::string &name)
set intersection name
const Position & getPosition() const
void setFringeType(FringeType fringeType)
set method for computing right-of-way
bool isTLControlled() const
Returns whether this node is controlled by any tls.
A traffic light logics which must be computed (only nodes/edges are given)
void setLayout(TrafficLightLayout layout)
sets the layout for the generated signal plan
The base class for traffic light logic definitions.
TrafficLightType getType() const
get the algorithm type (static etc..)
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
virtual void setType(TrafficLightType type)
set the algorithm type (static etc..)
A container for traffic light definitions and built programs.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs, bool setLoaded=true)
Parses network location description and registers it with GeoConveHelper::setLoaded.
~NIXMLNodesHandler()
Destructor.
std::string myID
The id of the currently parsed node.
void addJoinCluster(const SUMOSAXAttributes &attrs)
GeoConvHelper * myLocation
The coordinate transformation which was used compute the node coordinates.
Position myPosition
The position of the currently parsed node.
NBNodeCont & myNodeCont
The node container to add built nodes to.
void deleteNode(const SUMOSAXAttributes &attrs)
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
static NBNode * processNodeType(const SUMOSAXAttributes &attrs, NBNode *node, const std::string &nodeID, const Position &position, bool updateEdgeGeometries, NBNodeCont &nc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, GeoConvHelper *from_srs=nullptr)
parses node attributes (not related to positioning)
static void processTrafficLightDefinitions(const SUMOSAXAttributes &attrs, NBNode *currentNode, NBTrafficLightLogicCont &tlc)
Builds the defined traffic light or adds a node to it.
NBEdgeCont & myEdgeCont
The node container to add built nodes to.
Parameterised * myLastParameterised
last item the could receive parameters
void myEndElement(int element)
Called when a closing tag occurs.
void addNode(const SUMOSAXAttributes &attrs)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIXMLNodesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.
void addJoinExclusion(const SUMOSAXAttributes &attrs)
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
void set(double x, double y)
set positions x and y
static const Position INVALID
used to indicate that a position is valid
double x() const
Returns the x-position.
double y() const
Returns the y-position.
void closePolygon()
ensures that the last position equals the first
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SAX-handler base for SUMO-files.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static StringBijection< TrafficLightLayout > TrafficLightLayouts
traffic light layouts
T get(const std::string &str) const
std::set< std::string > getSet()
return set of strings
std::vector< std::string > getVector()
return vector of strings