 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
41 const std::map<int, std::string>& predefinedTagsMML,
42 const std::string& objectType,
46 unsigned char attrByte;
52 attr += 256 * attrByte;
54 int type = in->
peek();
73 const int type = in->
peek();
77 throw ProcessError(
"Invalid binary file, only supporting position vectors.");
122 std::ostringstream into(std::ios::binary);
128 int intsToRead = size - 1;
133 if (bitsOrEntry < 0) {
134 intsToRead = (-bitsOrEntry * (size - 1) - 1) /
sizeof(int) / 8 + 2;
136 while (intsToRead > 0) {
147 throw ProcessError(
"Binary file is invalid, attribute type is unknown.");
166 const std::map<int, char>::const_iterator i =
myCharValues.find(
id);
170 return i->second != 0;
176 const std::map<int, int>::const_iterator i =
myIntValues.find(
id);
192 const std::map<int, std::string>::const_iterator i =
myStringValues.find(
id);
202 const std::string& str)
const {
203 const std::map<int, std::string>::const_iterator i =
myStringValues.find(
id);
213 const std::map<int, double>::const_iterator i =
myFloatValues.find(
id);
235 const std::string& )
const {
244 const char func = i->second;
258 const char type = i->second;
300 const int val = i->second;
301 return RGBColor(val & 0xff, (val >> 8) & 0xff, (val >> 16) & 0xff, (val >> 24) & 0xff);
307 const std::map<int, PositionVector>::const_iterator i =
myPositionVectors.find(attr);
317 const std::map<int, PositionVector>::const_iterator i =
myPositionVectors.find(attr);
321 if (i->second.size() != 2) {
324 return Boundary(i->second[0].x(), i->second[0].y(), i->second[1].x(), i->second[1].y());
339 for (std::set<int>::const_iterator i =
myAttrs.begin(); i !=
myAttrs.end(); ++i) {
345 std::vector<std::string>
347 std::vector<std::string> result;
348 for (std::set<int>::const_iterator i =
myAttrs.begin(); i !=
myAttrs.end(); ++i) {
357 std::map<std::string, std::string> attrs;
359 const std::string attrName =
myAttrIds.find(it->first)->second;
360 attrs[attrName] =
toString(it->second);
363 const std::string attrName =
myAttrIds.find(it->first)->second;
364 attrs[attrName] =
toString(it->second);
367 const std::string attrName =
myAttrIds.find(it->first)->second;
368 attrs[attrName] =
toString(it->second);
371 const std::string attrName =
myAttrIds.find(it->first)->second;
372 attrs[attrName] = it->second;
375 const std::string attrName =
myAttrIds.find(it->first)->second;
376 attrs[attrName] =
toString(it->second);
FringeType
algorithms for computing right of way
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
std::map< int, int > myIntValues
Map of attribute ids to integers.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
std::map< int, char > myCharValues
Map of attribute ids to char.
std::map< int, double > myFloatValues
Map of attribute ids to floats.
virtual ~SUMOSAXAttributesImpl_Binary()
Destructor.
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
static std::ostream & writeInt(std::ostream &strm, int value)
Writes an integer binary.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
@ SUMO_ATTR_COLOR
A color information.
RGBColor getColor() const
Returns the value of the named attribute.
static std::ostream & writeByte(std::ostream &strm, unsigned char value)
Writes a byte binary.
std::map< int, PositionVector > myPositionVectors
Map of attribute ids to string.
std::set< int > myAttrs
the attributes which are set
Encapsulated Xerces-SAX-attributes.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
T get(const std::string &str) const
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
A class that stores a 2D geometrical boundary.
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
A point in 2D or 3D with translation and scaling methods.
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
const std::map< int, std::string > & myAttrIds
Map of attribute ids to names.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list.
FringeType getFringeType(bool &ok) const
returns fringe type
RightOfWay
algorithms for computing right of way
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
static StringBijection< FringeType > FringeTypeValues
fringe types
@ SUMO_ATTR_FRINGE
Fringe type of node.
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,...
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
std::map< int, std::string > myStringValues
Map of attribute ids to string.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
Encapsulated SAX-Attributes.
SUMOSAXAttributesImpl_Binary(const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType, BinaryInputDevice *in, const char version)
Constructor.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.