55 if (oc.
isSet(
"plain-output-prefix")) {
63 if (oc.
isSet(
"junctions.join-output")) {
66 if (oc.
isSet(
"street-sign-output")) {
69 if (oc.
exists(
"ptstop-output") && oc.
isSet(
"ptstop-output")) {
72 if (oc.
exists(
"ptline-output") && oc.
isSet(
"ptline-output")) {
76 if (oc.
exists(
"parking-output") && oc.
isSet(
"parking-output")) {
85 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
87 WRITE_WARNING(
"Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined");
93 std::map<SumoXMLAttr, std::string> attrs;
103 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
125 std::set<std::string> tlsIDs;
126 std::set<std::string> controlledInnerEdges;
127 for (std::set<NBTrafficLightDefinition*>::const_iterator it_tl = tlss.begin(); it_tl != tlss.end(); it_tl++) {
128 tlsIDs.insert((*it_tl)->getID());
129 std::vector<std::string> cie = (*it_tl)->getControlledInnerEdges();
130 controlledInnerEdges.insert(cie.begin(), cie.end());
132 std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
133 sort(sortedIDs.begin(), sortedIDs.end());
135 if (controlledInnerEdges.size() > 0) {
136 std::vector<std::string> sortedCIEs(controlledInnerEdges.begin(), controlledInnerEdges.end());
137 sort(sortedCIEs.begin(), sortedCIEs.end());
166 std::map<SumoXMLAttr, std::string> attrs;
177 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
180 std::map<SumoXMLAttr, std::string> attrs;
185 cdevice.
writeXMLHeader(
"connections",
"connections_file.xsd", attrs);
186 const bool writeNames = oc.
getBool(
"output.street-names");
187 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
210 for (
int i = 0; i < (int) geom.size(); i++) {
247 for (
int i = 0; i < (int)e->
getLanes().size(); ++i) {
272 if (lane.
type !=
"") {
288 const std::vector<NBEdge::Connection> connections = e->
getConnections();
289 if (connections.empty()) {
292 if (numOutgoing > 0) {
296 outPerm |= out->getPermissions();
298 if ((inPerm & outPerm) != 0 && (inPerm & outPerm) !=
SVC_PEDESTRIAN) {
306 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
319 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
323 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
324 const std::vector<NBNode::Crossing*>& crossings = (*it_node).second->getCrossings();
325 for (
auto c : crossings) {
333 if (c->customTLIndex != -1) {
336 if (c->customTLIndex2 != -1) {
339 if (c->customShape.size() != 0) {
346 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
347 for (
const auto& wacs : it_node->second->getWalkingAreaCustomShapes()) {
363 std::map<SumoXMLAttr, std::string> attrs;
370 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
373 const std::vector<NBEdge::Connection> connections = e->
getConnections();
374 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
386 std::map<SumoXMLAttr, std::string> attrs;
391 for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
392 assert((*it).size() > 0);
395 std::ostringstream oss;
396 for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
397 oss << *it_id <<
" ";
400 std::string ids = oss.str();
412 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
414 const std::vector<NBSign>& signs = e->
getSigns();
415 for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
416 it->writeAsPOI(device, e);
425 for (std::map<std::string, NBPTStop*>::const_iterator i = sc.
begin(); i != sc.
end(); ++i) {
426 i->second->write(device);
433 for (
const auto& item : lc.
getLines()) {
434 item.second->write(device, ec);
bool getKeepClear() const
Returns the keepClear flag.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
The information about how to spread the lanes from the given position.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void close()
Closes the device and removes it from the dictionary.
const std::vector< std::set< std::string > > & getJoinedClusters() const
gets all joined clusters (see doc for myClusters2Join)
static void writeLocation(OutputDevice &into)
writes the location element
a list of node ids, used for controlling joining
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Whether vehicles must keep the junction clear.
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
static void writeStreetSigns(const OptionsCont &oc, NBEdgeCont &ec)
Writes street signs as POIs to file.
std::string type
the type of this lane
begin/end of the description of a single lane
const std::map< std::string, NBPTLine * > & getLines() const
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
A container for traffic light definitions and built programs.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
connectio between two lanes
int getPriority() const
Returns the priority of the edge.
const std::string & getTypeID() const
get ID of type
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
bool hasCustomShape() const
return whether the shape was set by the user
const std::vector< NBSign > & getSigns() const
get Signs
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
The representation of a single edge during network building.
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
static const double UNSPECIFIED_RADIUS
unspecified lane width
static const double UNSPECIFIED_OFFSET
unspecified lane offset
link,node: the traffic light id responsible for this link
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
double endOffset
This lane's offset to the intersection begin.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
NBParkingCont & getParkingCont()
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
double getDistance() const
static void writeStopOffsets(OutputDevice &into, const std::map< SVCPermissions, double > &stopOffsets)
Write a stopOffset element into output device.
bool accelRamp
Whether this lane is an acceleration lane.
link: the index of the opposite direction link of a pedestrian crossing
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
An (internal) definition of a single lane of an edge.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
The representation of a single pt stop.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static void writeParkingAreas(const OptionsCont &cont, NBParkingCont &pc, NBEdgeCont &ec)
writes imported parking areas to file
How to compute right of way.
The turning radius at an intersection in m.
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
bool hasLaneSpecificWidth() const
whether lanes differ in width
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
static void writeNodes(const OptionsCont &oc, NBNodeCont &nc)
Writes the nodes file.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
static methods for processing the coordinates conversion for the current net
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
int getNumLanes() const
Returns the number of lanes.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
A point in 2D or 3D with translation and scaling methods.
walking area for pedestrians
NBEdgeCont & getEdgeCont()
static void writeTrafficLights(const OptionsCont &oc, NBTrafficLightLogicCont &tc, NBEdgeCont &ec)
Writes the traffic lights file.
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
const std::string & getID() const
Storage for edges, including some functionality operating on multiple edges.
const std::string & getStreetName() const
Returns the street name of this edge.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
edge: the shape in xml-definition
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
double getEndOffset() const
Returns the offset to the destination node.
begin/end of the description of a neighboring lane
static void writeTypes(const OptionsCont &oc, NBTypeCont &tc)
Writes the types file.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
double speed
The speed allowed on this lane.
double width
This lane's width.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
static void writePTStops(const OptionsCont &oc, NBPTStopCont &ec)
Writes the pt stops file.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
begin/end of the description of an edge
const PositionVector & getShape() const
retrieve the junction shape
double getSpeed() const
Returns the speed allowed on this edge.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
double getLaneWidth() const
Returns the default width of lanes of this edge.
FringeType getFringeType() const
Returns fringe type.
double getRadius() const
Returns the turning radius of this node.
std::string oppositeID
An opposite lane ID, if given.
static void writeEdgesAndConnections(const OptionsCont &oc, NBNodeCont &nc, NBEdgeCont &ec)
Writes the edges and connections files.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
std::map< int, double > stopOffsets
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
Instance responsible for building networks.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
alternative definition for junction
A storage for options typed value containers)
SumoXMLNodeType getType() const
Returns the type of this node.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
crossing between edges for pedestrians
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool usingInverseGeoProjection() const
Returns the information whether an inverse transformation will happen.
const Position & getPosition() const
Represents a single node (junction) during network building.
const double NETWORK_VERSION
version for written networks and default version for loading
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
link: the index of the link within the traffic light
NBNode * getFromNode() const
Returns the origin node of the edge.
Container for nodes during the netbuilding process.
static void writePTLines(const OptionsCont &cont, NBPTLineCont &lc, NBEdgeCont &ec)
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
PositionVector customShape
A custom shape for this lane set by the user.
int size() const
Returns the number of known types.
static void writeRoundabouts(OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec)
Writes roundabouts.
NBNode * getToNode() const
Returns the destination node of the edge.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
static void writeConnection(OutputDevice &into, const NBEdge &from, const NBEdge::Connection &c, bool includeInternal, ConnectionStyle style=SUMONET)
Writes connections outgoing from the given edge (also used in NWWriter_XML)
A storage for available types of edges.
void writeTypes(OutputDevice &into) const
writes all types a s XML