36 #include <xercesc/sax/HandlerBase.hpp>
37 #include <xercesc/sax/AttributeList.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
39 #include <xercesc/sax/SAXException.hpp>
55 #ifdef CHECK_MEMORY_LEAKS
57 #endif // CHECK_MEMORY_LEAKS
116 bool needConversion =
true;
120 needConversion =
false;
125 needConversion =
true;
130 needConversion =
true;
165 throw ProcessError(
"Could not insert node though checked this before (id='" +
myID +
"').");
171 for (std::set<NBTrafficLightDefinition*>::iterator i = tls.begin(); i != tls.end(); ++i) {
172 if ((*i)->getNodes().size() == 0) {
234 std::set<NBTrafficLightDefinition*> tlDefs;
243 WRITE_ERROR(
"Unknown traffic light type '" + typeS +
"' for node '" +
myID +
"'.");
249 std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
250 for (it = programs.begin(); it != programs.end(); it++) {
251 if (it->second->getType() != type) {
252 WRITE_ERROR(
"Mismatched traffic light type '" + typeS +
"' for tl '" + tlID +
"'.");
255 tlDefs.insert(it->second);
256 it->second->addNode(currentNode);
261 tlID = (tlID ==
"" ?
myID : tlID);
268 tlDefs.insert(tlDef);
271 std::vector<std::string> controlledInner;
273 if (controlledInner.size() != 0) {
274 for (std::set<NBTrafficLightDefinition*>::iterator it = tlDefs.begin(); it != tlDefs.end(); it++) {
275 (*it)->addControlledInnerEdges(controlledInner);
static StringBijection< SumoXMLNodeType > NodeTypes
GeoConvHelper * myLocation
The coordinate transformation which was used compute the node coordinates.
a list of node ids, used for controlling joining
bool insert(const std::string &id, const Position &position, NBDistrict *district)
Inserts a node into the map.
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
std::string myID
The id of the currently parsed node.
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
A container for traffic light definitions and built programs.
~NIXMLNodesHandler()
Destructor.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Position myPosition
The position of the currently parsed node.
The base class for traffic light logic definitions.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
SAX-handler base for SUMO-files.
SUMOReal x() const
Returns the x-position.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
NBNodeCont & myNodeCont
The node container to add built nodes to.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
const Position & getPosition() const
Returns the position of this node.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
Encapsulated SAX-Attributes.
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs)
Parses network location description and registers it with GeoConveHelper::setLoaded.
static StringBijection< TrafficLightType > TrafficLightTypes
void deleteNode(const SUMOSAXAttributes &attrs)
SumoXMLNodeType getType() const
Returns the type of this node.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
OptionsCont & myOptions
A reference to the program's options.
void addJoinExclusion(const SUMOSAXAttributes &attrs)
std::vector< std::string > getVector()
T get(const std::string &str)
void addCluster2Join(std::set< std::string > cluster)
add ids of nodes which shall be joined into a single node
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
void addJoinCluster(const SUMOSAXAttributes &attrs)
SUMOReal y() const
Returns the y-position.
A storage for options typed value containers)
void set(SUMOReal x, SUMOReal y)
void mul(SUMOReal val)
Multiplies both positions with the given value.
Represents a single node (junction) during network building.
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.
void addNode(const SUMOSAXAttributes &attrs)
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Container for nodes during the netbuilding process.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
A traffic light logics which must be computed (only nodes/edges are given)
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
void processTrafficLightDefinitions(const SUMOSAXAttributes &attrs, NBNode *currentNode)
Builds the defined traffic light or adds a node to it.
NIXMLNodesHandler(NBNodeCont &nc, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.