51 #ifdef CHECK_MEMORY_LEAKS
53 #endif // CHECK_MEMORY_LEAKS
117 if (!oc.
isSet(
"itsumo-files")) {
125 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
128 WRITE_ERROR(
"Could not open itsumo-file '" + *file +
"'.");
145 :
GenericSAXHandler(itsumoTags, ITSUMO_TAG_NOTHING, itsumoAttrs, ITSUMO_ATTR_NOTHING,
"itsumo - file"), myNetBuilder(toFill) {
173 myParameter[
"id"] = mc;
176 myParameter[
"name"] = mc;
179 myParameter[
"x"] = mc;
182 myParameter[
"y"] = mc;
186 myParameter[
"sectionID"] = mc;
190 myParameter[
"lanesetID"] = mc;
193 myParameter[
"pos"] = mc;
196 myParameter[
"from"] = mc;
199 myParameter[
"to"] = mc;
203 myParameter[
"laneID"] = mc;
206 myParameter[
"i"] = mc;
209 myParameter[
"v"] = mc;
221 for (std::vector<Section*>::iterator i = mySections.begin(); i != mySections.end(); ++i) {
222 for (std::vector<LaneSet*>::iterator j = (*i)->laneSets.begin(); j != (*i)->laneSets.end(); ++j) {
225 if (!myNetBuilder.getEdgeCont().insert(edge)) {
227 WRITE_ERROR(
"Could not add edge '" + ls->
id +
"'. Probably declared twice.");
237 std::string
id = myParameter[
"id"];
242 WRITE_ERROR(
"Unable to project coordinates for node '" +
id +
"'.");
245 if (!myNetBuilder.getNodeCont().insert(node)) {
247 WRITE_ERROR(
"Could not add node '" +
id +
"'. Probably declared twice.");
250 WRITE_ERROR(
"Not numeric position information for node '" + myParameter[
"id"] +
"'.");
252 WRITE_ERROR(
"Missing data in node '" + myParameter[
"id"] +
"'.");
257 mySections.push_back(
new Section(myParameter[
"sectionID"], myCurrentLaneSets));
258 myCurrentLaneSets.clear();
263 std::string
id = myParameter[
"lanesetID"];
265 std::string fromID = myParameter[
"from"];
266 std::string toID = myParameter[
"to"];
267 NBNode* from = myNetBuilder.getNodeCont().retrieve(fromID);
268 NBNode* to = myNetBuilder.getNodeCont().retrieve(toID);
269 if (from == 0 || to == 0) {
270 WRITE_ERROR(
"Missing node in laneset '" + myParameter[
"lanesetID"] +
"'.");
272 if (myLaneSets.find(
id) != myLaneSets.end()) {
273 WRITE_ERROR(
"Fond laneset-id '" +
id +
"' twice.");
276 for (std::vector<Lane>::iterator j = myCurrentLanes.begin(); j != myCurrentLanes.end(); ++j) {
279 vSum /= (
SUMOReal) myCurrentLanes.size();
282 myCurrentLaneSets.push_back(ls);
283 myCurrentLanes.clear();
287 WRITE_ERROR(
"Not numeric value in laneset '" + myParameter[
"lanesetID"] +
"'.");
289 WRITE_ERROR(
"Missing data in laneset '" + myParameter[
"lanesetID"] +
"'.");
295 std::string
id = myParameter[
"laneID"];
298 myCurrentLanes.push_back(
Lane(
id, (
unsigned int) i, v));
300 WRITE_ERROR(
"Not numeric value in lane '" + myParameter[
"laneID"] +
"'.");
302 WRITE_ERROR(
"Missing data in lane '" + myParameter[
"laneID"] +
"'.");
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
std::vector< Lane > lanes
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
static SUMOReal _2SUMOReal(const E *const data)
The representation of a single edge during network building.
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
static StringBijection< int >::Entry itsumoAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
A handler which converts occuring elements and attributes into enums.
static StringBijection< int >::Entry itsumoTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
void setFileName(const std::string &name)
Sets the current file name.
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
static bool exists(std::string path)
Checks whether the given file exists.
void myCharacters(int element, const std::string &chars)
Callback method for characters to implement by derived classes.
#define PROGRESS_BEGIN_MESSAGE(msg)
static int _2int(const E *const data)
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
Instance responsible for building networks.
A storage for options typed value containers)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given ITSUMO network files.
Represents a single node (junction) during network building.
#define PROGRESS_DONE_MESSAGE()
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Handler(NBNetBuilder &toFill)
Contructor.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.