92 const std::vector<std::string> files = oc.
getStringVector(
"matsim-files");
95 for (
const std::string& file : files) {
106 for (
const std::string& file : files) {
120 matsimAttrs, MATSIM_ATTR_NOTHING,
121 "matsim - file"), myNodeCont(toFill) {
143 WRITE_ERRORF(
TL(
"Unable to project coordinates for node '%'."),
id);
146 if (!myNodeCont.insert(node)) {
148 WRITE_ERRORF(
TL(
"Could not add node '%'. Probably declared twice."),
id);
158 bool keepEdgeLengths,
bool lanesFromCapacity,
162 myNodeCont(nc), myEdgeCont(toFill), myCapacityNorm(3600),
163 myKeepEdgeLengths(keepEdgeLengths), myLanesFromCapacity(lanesFromCapacity),
164 myCapacity2Lanes(capacity2Lanes) {
174 NBEdge* edge =
new NBEdge(
id, fromNode, toNode,
"", freeSpeed,
NBEdge::UNSPECIFIED_FRICTION, numLanes, -1,
NBEdge::UNSPECIFIED_WIDTH,
NBEdge::UNSPECIFIED_OFFSET,
LaneSpreadFunction::RIGHT);
177 if (myKeepEdgeLengths) {
180 if (!myEdgeCont.insert(edge)) {
182 WRITE_ERRORF(
TL(
"Could not add edge '%'. Probably declared twice."),
id);
190 if (modes.size() == 0) {
195 std::string mode = st.next();
198 }
else if (mode ==
"bike") {
200 }
else if (mode ==
"motorcycle") {
202 }
else if (mode ==
"truck") {
204 }
else if (mode ==
"pt") {
206 }
else if (mode ==
"drt" || mode ==
"taxi") {
208 }
else if (mode ==
"walk" || mode ==
"transit_walk") {
210 }
else if (mode ==
"train") {
212 }
else if (mode ==
"ship") {
228 myCapacityNorm = (double)(capDivider * 3600);
236 if (st.size() != 3) {
237 WRITE_ERROR(
TL(
"Bogus capacity period format; requires 'hh:mm:ss'."));
244 myCapacityNorm = (double)(hours * 3600 + minutes * 60 + seconds);
266 NBNode* fromNode = myNodeCont.retrieve(fromNodeID);
267 NBNode* toNode = myNodeCont.retrieve(toNodeID);
268 if (fromNode ==
nullptr) {
271 if (toNode ==
nullptr) {
274 if (fromNode ==
nullptr || toNode ==
nullptr) {
277 if (myLanesFromCapacity) {
278 permLanes = myCapacity2Lanes.get(capacity);
280 if (permLanes < 0.5) {
284 if (fromNode == toNode) {
287 if (myNodeCont.insert(intermediate)) {
288 insertEdge(
id +
".0", intermediate, toNode, freeSpeed, (
int)(permLanes + 0.5), capacity, length, computePermission(modes));
289 toNode = intermediate;
292 WRITE_ERRORF(
TL(
"Could not add intermediate node to split loop edge '%'."),
id);
295 insertEdge(
id, fromNode, toNode, freeSpeed, (
int)(permLanes + 0.5), capacity, length, computePermission(modes));
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
const SVCPermissions SVCAll
all VClasses are allowed
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_SHIP
is an arbitrary ship
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_MOPED
vehicle is a moped
@ SVC_TRAM
vehicle is a light rail
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A handler which converts occurring elements and attributes into enums.
void setFileName(const std::string &name)
Sets the current file name.
A helper class which computes the lane number from given capacity.
Storage for edges, including some functionality operating on multiple edges.
The representation of a single edge during network building.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
static const double UNSPECIFIED_FRICTION
unspecified lane friction
static const double UNSPECIFIED_WIDTH
unspecified lane width
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void setLoadedLength(double val)
set loaded length
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Container for nodes during the netbuilding process.
Represents a single node (junction) during network building.
const Position & getPosition() const
A class which extracts MATSIM-edges from a parsed MATSIM-file.
SVCPermissions computePermission(std::string modes)
~EdgesHandler()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
EdgesHandler(NBNodeCont &nc, NBEdgeCont &toFill, bool keepEdgeLengths, bool lanesFromCapacity, NBCapacity2Lanes capacity2Lanes)
Constructor.
void insertEdge(const std::string &id, NBNode *fromNode, NBNode *toNode, double freeSpeed, int numLanes, double capacity, double length, SVCPermissions perm=SVCAll)
A class which extracts MATSIM-nodes from a parsed MATSIM-file.
NodesHandler(NBNodeCont &toFill)
Contructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
~NodesHandler()
Destructor.
static SequentialStringBijection::Entry matsimAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given MATSIM network files.
static SequentialStringBijection::Entry matsimTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file)
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
A point in 2D or 3D with translation and scaling methods.
Encapsulated SAX-Attributes.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
static std::string makeValidID(const std::string &value)
transform the given string into a valid id for a network element (or any other id)
bool hasNext()
returns the information whether further substrings exist
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 runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.