61 if (oc.
isSet(
"junctions.join-output")) {
64 if (oc.
isSet(
"street-sign-output")) {
67 if (oc.
exists(
"ptstop-output") && oc.
isSet(
"ptstop-output")) {
70 if (oc.
exists(
"ptline-output") && oc.
isSet(
"ptline-output")) {
74 if (oc.
exists(
"parking-output") && oc.
isSet(
"parking-output")) {
77 if (oc.
exists(
"taz-output") && oc.
isSet(
"taz-output")) {
86 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
88 WRITE_WARNING(
TL(
"Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined"));
94 std::map<SumoXMLAttr, std::string> attrs;
105 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
126 std::set<std::string> tlsIDs;
127 std::set<std::string> controlledInnerEdges;
128 std::string tlType =
"";
130 tlsIDs.insert(tl->getID());
131 std::vector<std::string> cie = tl->getControlledInnerEdges();
132 controlledInnerEdges.insert(cie.begin(), cie.end());
133 if (tl->getType() != tlsDefaultType) {
137 std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
138 sort(sortedIDs.begin(), sortedIDs.end());
143 if (controlledInnerEdges.size() > 0) {
144 std::vector<std::string> sortedCIEs(controlledInnerEdges.begin(), controlledInnerEdges.end());
145 sort(sortedCIEs.begin(), sortedCIEs.end());
177 std::map<SumoXMLAttr, std::string> attrs;
189 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
192 std::map<SumoXMLAttr, std::string> attrs;
197 cdevice.
writeXMLHeader(
"connections",
"connections_file.xsd", attrs);
198 const bool writeNames = oc.
getBool(
"output.street-names");
199 const bool writeLanes = oc.
getBool(
"plain-output.lanes");
206 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
281 if (lane.accelRamp) {
284 if (lane.customShape.size() > 0 || writeLanes) {
285 writeShape(edevice, gch, lane.customShape.size() > 0 ? lane.customShape : lane.shape,
SUMO_ATTR_SHAPE, useGeo, geoAccuracy);
287 if (lane.type !=
"") {
296 if (lane.oppositeID !=
"") {
301 lane.writeParams(edevice);
309 const std::vector<NBEdge::Connection> connections = e->
getConnections();
310 if (connections.empty()) {
313 if (numOutgoing > 0) {
317 outPerm |= out->getPermissions();
319 if ((inPerm & outPerm) != 0 && (inPerm & outPerm) !=
SVC_PEDESTRIAN) {
345 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
349 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
350 const std::vector<NBNode::Crossing*>& crossings = (*it_node).second->getCrossings();
351 for (
auto c : crossings) {
359 if (c->customTLIndex != -1) {
362 if (c->customTLIndex2 != -1) {
365 if (c->customShape.size() != 0) {
368 if (c->outlineShape.size() != 0) {
371 c->writeParams(cdevice);
376 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
377 for (
const auto& wacs : it_node->second->getWalkingAreaCustomShapes()) {
381 if (wacs.shape.size() != 0) {
398 std::map<SumoXMLAttr, std::string> attrs;
405 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
408 const std::vector<NBEdge::Connection> connections = e->
getConnections();
409 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
421 std::map<SumoXMLAttr, std::string> attrs;
426 for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
427 assert((*it).size() > 0);
430 std::ostringstream oss;
431 for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
432 oss << *it_id <<
" ";
435 std::string ids = oss.str();
447 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
449 const std::vector<NBSign>& signs = e->
getSigns();
450 for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
451 it->writeAsPOI(device, e);
462 for (
const auto& stopIt : sc.
getStops()) {
463 stopIt.second->write(device);
472 for (
const auto& item : lc.
getLines()) {
473 item.second->write(device);
493 for (std::map<std::string, NBDistrict*>::const_iterator i = dc.
begin(); i != dc.
end(); i++) {
502 for (
int i = 0; i < (int) shape.size(); i++) {
#define WRITE_WARNING(msg)
const SVCPermissions SVCAll
all VClasses are allowed
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_JOIN
Join operation.
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_WALKINGAREA
walking area for pedestrians
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_NODE
alternative definition for junction
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_NEIGH
begin/end of the description of a neighboring lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_NODES
a list of node ids, used for controlling joining
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_FRINGE
Fringe type of node.
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_ATTR_OUTLINESHAPE
edge: the outline shape in xml-definition
@ SUMO_ATTR_CONTROLLED_INNER
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
const MMVersion NETWORK_VERSION(1, 20)
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static methods for processing the coordinates conversion for the current net
static void writeLocation(OutputDevice &into)
writes the location element
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool usingInverseGeoProjection() const
Returns the information whether an inverse transformation will happen.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
A container for districts.
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
Storage for edges, including some functionality operating on multiple edges.
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
std::set< std::string > getUsedTypes() const
return all edge types in used
The representation of a single edge during network building.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
const std::vector< Connection > & getConnections() const
Returns the connections.
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
bool hasLaneSpecificFriction() const
whether lanes differ in friction
double getLaneWidth() const
Returns the default width of lanes of this edge.
NBNode * getToNode() const
Returns the destination node of the edge.
static const double UNSPECIFIED_FRICTION
unspecified lane friction
const std::vector< NBSign > & getSigns() const
get Signs
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
const PositionVector & getGeometry() const
Returns the geometry of the edge.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
double getSpeed() const
Returns the speed allowed on this edge.
const std::string & getID() const
double getDistance() const
get distance
const StopOffset & getEdgeStopOffset() const
Returns the stopOffset to the end of the edge.
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
int getNumLanes() const
Returns the number of lanes.
bool hasLaneSpecificWidth() const
whether lanes differ in width
double getFriction() const
Returns the friction on this edge.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
const std::string & getTypeID() const
get ID of type
const std::string & getStreetName() const
Returns the street name of this edge.
const NBEdge * getBidiEdge() const
NBNode * getFromNode() const
Returns the origin node of the edge.
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
int getPriority() const
Returns the priority of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
double getEndOffset() const
Returns the offset to the destination node.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Instance responsible for building networks.
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
NBParkingCont & getParkingCont()
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Container for nodes during the netbuilding process.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
const std::vector< std::set< std::string > > & getJoinedClusters() const
gets all joined clusters (see doc for myClusters2Join)
Represents a single node (junction) during network building.
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
static const double UNSPECIFIED_RADIUS
unspecified lane width
FringeType getFringeType() const
Returns fringe type.
SumoXMLNodeType getType() const
Returns the type of this node.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
bool hasCustomShape() const
return whether the shape was set by the user
const std::string & getName() const
Returns intersection name.
const Position & getPosition() const
const PositionVector & getShape() const
retrieve the junction shape
double getRadius() const
Returns the turning radius of this node.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
bool getKeepClear() const
Returns the keepClear flag.
const std::map< std::string, NBPTLine * > & getLines() const
Container for public transport stops during the net building process.
const std::map< std::string, std::shared_ptr< NBPTStop > > & getStops() const
Returns an unmodifiable reference to the stored pt stops.
The representation of an imported parking area.
The base class for traffic light logic definitions.
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
int size() const
Returns the number of known edgeTypes.
void writeEdgeTypes(OutputDevice &into, const std::set< std::string > &typeIDs=std::set< std::string >()) const
writes all EdgeTypes (and their lanes) as XML
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
static void writeConnection(OutputDevice &into, const NBEdge &from, const NBEdge::Connection &c, bool includeInternal, ConnectionStyle style=SUMONET, bool geoAccuracy=false)
Writes connections outgoing from the given edge (also used in NWWriter_XML)
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
static void writeDistrict(OutputDevice &into, const NBDistrict &d)
Writes a district.
static void writeRoundabouts(OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec)
Writes roundabouts.
static void writeStopOffsets(OutputDevice &into, const StopOffset &stopOffset)
Write a stopOffset element into output device.
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
static void writeStreetSigns(const OptionsCont &oc, NBEdgeCont &ec)
Writes street signs as POIs to file.
static void writeTrafficLights(const std::string &prefix, NBTrafficLightLogicCont &tc, NBEdgeCont &ec)
Writes the traffic lights file.
static void writeTypes(const std::string &prefix, NBEdgeCont &ec, NBTypeCont &tc)
Writes the types file.
static void writeParkingAreas(const OptionsCont &cont, NBParkingCont &pc, NBEdgeCont &ec)
writes imported parking areas to file
static void writeJoinedJunctions(const std::string &filename, NBNodeCont &nc)
Writes the joined-juncionts to file.
static void writeNetwork(const OptionsCont &oc, const std::string &prefix, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
static void writePTLines(const OptionsCont &cont, NBPTLineCont &lc)
static void writeEdgesAndConnections(const OptionsCont &oc, const std::string &prefix, NBNodeCont &nc, NBEdgeCont &ec)
Writes the edges and connections files.
static void writePTStops(const OptionsCont &oc, NBPTStopCont &ec)
Writes the pt stops file.
static void writeShape(OutputDevice &out, const GeoConvHelper &gch, PositionVector shape, SumoXMLAttr attr, bool useGeo, bool geoAccuracy)
static void writeDistricts(const OptionsCont &oc, NBDistrictCont &dc)
writes imported districts (TAZ) to file
static void writeNodes(const OptionsCont &oc, const std::string &prefix, NBNodeCont &nc)
Writes the nodes file.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
void lf()
writes a line feed if applicable
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
bool isDefined() const
check if stopOffset was defined
T get(const std::string &str) const
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
A structure which describes a connection between edges or lanes.
An (internal) definition of a single lane of an edge.