25 #include <xercesc/sax2/Attributes.hpp> 26 #include <xercesc/sax2/DefaultHandler.hpp> 27 #include <xercesc/util/XercesVersion.hpp> 28 #include <xercesc/util/TransService.hpp> 29 #include <xercesc/util/TranscodingException.hpp> 44 const std::map<std::string, std::string>& attrs,
45 const std::map<int, std::string>& predefinedTagsMML,
46 const std::string& objectType) :
49 myPredefinedTagsMML(predefinedTagsMML) { }
53 const std::map<SumoXMLAttr, std::string>& attrs,
54 const std::map<int, std::string>& predefinedTagsMML,
55 const std::string& objectType) :
59 for (
const auto& i : attrs) {
105 return result.size() == 0 ? str : result;
119 return myAttrs.find(i->second)->second;
137 const std::string& str)
const {
138 std::map<std::string, std::string>::const_iterator it =
myAttrs.find(
id);
139 if (it !=
myAttrs.end() && it->second !=
"") {
209 if (pos.size() != 2 && pos.size() != 3) {
214 if (pos.size() == 2) {
229 if (st.
size() != 4) {
236 return Boundary(xmin, ymin, xmax, ymax);
251 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
252 os <<
" " << it->first;
253 os <<
"=\"" << it->second <<
"\"";
257 std::vector<std::string>
259 std::vector<std::string> result;
260 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
261 result.push_back(it->first);
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static RGBColor parseColor(std::string coldef)
Parses a color information.
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
const std::string & getObjectType() const
return the objecttype to which these attributes belong
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
bool hasNext()
returns the information whether further substrings exist
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
RightOfWay
algorithms for computing right of way
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
A class that stores a 2D geometrical boundary.
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter ...
RGBColor getColor() const
Returns the value of the named attribute.
const std::string & getAttributeValueSecure(int id) const
Returns Xerces-value of the named attribute.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
const std::map< int, std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
How to compute right of way.
int size() const
returns the number of existing substrings
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Encapsulated SAX-Attributes.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
A point in 2D or 3D with translation and scaling methods.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
T get(const std::string &str) const
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
~SUMOSAXAttributesImpl_Cached()
Destructor.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
static StringBijection< FringeType > FringeTypeValues
fringe types
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
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, which
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
FringeType
algorithms for computing right of way
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
SUMOSAXAttributesImpl_Cached(const std::map< std::string, std::string > &attrs, const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
std::map< std::string, std::string > myAttrs
The encapsulated attributes.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list...