23 #include <xercesc/sax2/Attributes.hpp>
24 #include <xercesc/sax2/DefaultHandler.hpp>
25 #include <xercesc/util/XercesVersion.hpp>
26 #include <xercesc/util/TransService.hpp>
27 #include <xercesc/util/TranscodingException.hpp>
42 const std::map<std::string, std::string>& attrs,
43 const std::vector<std::string>& predefinedTagsMML,
44 const std::string& objectType) :
47 myPredefinedTagsMML(predefinedTagsMML) { }
88 return result.size() == 0 ? str : result;
120 const std::string& str)
const {
121 std::map<std::string, std::string>::const_iterator it =
myAttrs.find(
id);
122 if (it !=
myAttrs.end() && it->second !=
"") {
195 if ((pos.
size() != 2) && (pos.
size() != 3)) {
202 if (pos.
size() == 2) {
221 if (pos.
size() != 2 && pos.
size() != 3) {
226 if (pos.
size() == 2) {
241 if (st.
size() != 4) {
248 return Boundary(xmin, ymin, xmax, ymax);
262 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
263 os <<
" " << it->first;
264 os <<
"=\"" << it->second <<
"\"";
268 std::vector<std::string>
270 std::vector<std::string> result;
271 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
272 result.push_back(it->first);
FringeType
classifying boundary nodes
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
RightOfWay
algorithms for computing right of way
@ SUMO_ATTR_FRINGE
Fringe type of node.
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
A class that stores a 2D geometrical boundary.
A point in 2D or 3D with translation and scaling methods.
static RGBColor parseColor(std::string coldef)
Parses a color information.
Encapsulated SAX-Attributes.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
Position getPosition(int attr) const
Tries to read given attribute assuming it is a Position.
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
~SUMOSAXAttributesImpl_Cached()
Destructor.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
FringeType getFringeType(bool &ok) const
returns fringe type
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
std::map< std::string, std::string > myAttrs
The encapsulated attributes.
SUMOSAXAttributesImpl_Cached(const std::map< std::string, std::string > &attrs, const std::vector< std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
const std::string & getAttributeValueSecure(int id) const
Returns Xerces-value of the named attribute.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
RGBColor getColor() const
Returns the value of the named attribute.
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
const std::vector< std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
static StringBijection< FringeType > FringeTypeValues
fringe types
T get(const std::string &str) const
int size() const
returns the number of existing substrings
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter