52 #ifdef CHECK_MEMORY_LEAKS
54 #endif // CHECK_MEMORY_LEAKS
99 if (!oc.
isSet(
"matsim-files")) {
107 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
110 WRITE_ERROR(
"Could not open matsim-file '" + *file +
"'.");
113 nodesHandler.setFileName(*file);
123 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
138 matsimAttrs, MATSIM_ATTR_NOTHING,
139 "matsim - file"), myNodeCont(toFill) {
161 WRITE_ERROR(
"Unable to project coordinates for node '" +
id +
"'.");
164 if (!myNodeCont.insert(node)) {
166 WRITE_ERROR(
"Could not add node '" +
id +
"'. Probably declared twice.");
176 bool keepEdgeLengths,
bool lanesFromCapacity,
180 myNodeCont(nc), myEdgeCont(toFill), myCapacityNorm(3600),
181 myKeepEdgeLengths(keepEdgeLengths), myLanesFromCapacity(lanesFromCapacity),
182 myCapacity2Lanes(capacity2Lanes) {
198 myCapacityNorm = (
SUMOReal)(capDivider * 3600);
206 if (st.size() != 3) {
207 WRITE_ERROR(
"Bogus capacity period format; requires 'hh:mm:ss'.");
214 myCapacityNorm = (
SUMOReal)(hours * 3600 + minutes * 60 + seconds);
235 NBNode* fromNode = myNodeCont.retrieve(fromNodeID);
236 NBNode* toNode = myNodeCont.retrieve(toNodeID);
238 WRITE_ERROR(
"Could not find from-node for edge '" +
id +
"'.");
241 WRITE_ERROR(
"Could not find to-node for edge '" +
id +
"'.");
243 if (fromNode == 0 || toNode == 0) {
246 if (myLanesFromCapacity) {
247 permLanes = myCapacity2Lanes.get(capacity);
251 if (myKeepEdgeLengths) {
254 if (!myEdgeCont.insert(edge)) {
256 WRITE_ERROR(
"Could not add edge '" +
id +
"'. Probably declared twice.");
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
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
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
A helper class which computes the lane number from given capacity.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static bool runParser(GenericSAXHandler &handler, const std::string &file)
Runs the given handler on the given file; returns if everything's ok.
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
NodesHandler(NBNodeCont &toFill)
Contructor.
A handler which converts occuring elements and attributes into enums.
void setFileName(const std::string &name)
Sets the current file name.
static StringBijection< int >::Entry matsimAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
Returns the edge container.
~NodesHandler()
Destructor.
static bool exists(std::string path)
Checks whether the given file exists.
A class which extracts MATSIM-nodes from a parsed MATSIM-file.
Storage for edges, including some functionality operating on multiple edges.
#define PROGRESS_BEGIN_MESSAGE(msg)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void setLoadedLength(SUMOReal val)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
EdgesHandler(const NBNodeCont &nc, NBEdgeCont &toFill, bool keepEdgeLengths, bool lanesFromCapacity, NBCapacity2Lanes capacity2Lanes)
Constructor.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
~EdgesHandler()
Destructor.
static int _2int(const E *const data)
A class which extracts MATSIM-edges from a parsed MATSIM-file.
NBNodeCont & getNodeCont()
Returns the node container.
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 MATSIM network files.
Represents a single node (junction) during network building.
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.
Container for nodes during the netbuilding process.
static StringBijection< int >::Entry matsimTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
#define PROGRESS_DONE_MESSAGE()
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.