 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
54 if (oc.
isSet(
"plain-output-prefix")) {
62 if (oc.
isSet(
"junctions.join-output")) {
65 if (oc.
isSet(
"street-sign-output")) {
68 if (oc.
exists(
"ptstop-output") && oc.
isSet(
"ptstop-output")) {
71 if (oc.
exists(
"ptline-output") && oc.
isSet(
"ptline-output")) {
75 if (oc.
exists(
"parking-output") && oc.
isSet(
"parking-output")) {
78 if (oc.
exists(
"taz-output") && oc.
isSet(
"taz-output")) {
87 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
89 WRITE_WARNING(
"Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined");
95 std::map<SumoXMLAttr, std::string> attrs;
105 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
127 std::set<std::string> tlsIDs;
128 std::set<std::string> controlledInnerEdges;
129 for (std::set<NBTrafficLightDefinition*>::const_iterator it_tl = tlss.begin(); it_tl != tlss.end(); it_tl++) {
130 tlsIDs.insert((*it_tl)->getID());
131 std::vector<std::string> cie = (*it_tl)->getControlledInnerEdges();
132 controlledInnerEdges.insert(cie.begin(), cie.end());
134 std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
135 sort(sortedIDs.begin(), sortedIDs.end());
137 if (controlledInnerEdges.size() > 0) {
138 std::vector<std::string> sortedCIEs(controlledInnerEdges.begin(), controlledInnerEdges.end());
139 sort(sortedCIEs.begin(), sortedCIEs.end());
168 std::map<SumoXMLAttr, std::string> attrs;
179 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
182 std::map<SumoXMLAttr, std::string> attrs;
187 cdevice.
writeXMLHeader(
"connections",
"connections_file.xsd", attrs);
188 const bool writeNames = oc.
getBool(
"output.street-names");
189 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
237 for (
int i = 0; i < (int)e->
getLanes().size(); ++i) {
262 if (lane.
type !=
"") {
278 const std::vector<NBEdge::Connection> connections = e->
getConnections();
279 if (connections.empty()) {
282 if (numOutgoing > 0) {
286 outPerm |= out->getPermissions();
288 if ((inPerm & outPerm) != 0 && (inPerm & outPerm) !=
SVC_PEDESTRIAN) {
298 for (
int i = 0; i < (int) c.customShape.size(); i++) {
314 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
318 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
319 const std::vector<NBNode::Crossing*>& crossings = (*it_node).second->getCrossings();
320 for (
auto c : crossings) {
328 if (c->customTLIndex != -1) {
331 if (c->customTLIndex2 != -1) {
334 if (c->customShape.size() != 0) {
341 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
342 for (
const auto& wacs : it_node->second->getWalkingAreaCustomShapes()) {
358 std::map<SumoXMLAttr, std::string> attrs;
365 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
368 const std::vector<NBEdge::Connection> connections = e->
getConnections();
369 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
381 std::map<SumoXMLAttr, std::string> attrs;
386 for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
387 assert((*it).size() > 0);
390 std::ostringstream oss;
391 for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
392 oss << *it_id <<
" ";
395 std::string ids = oss.str();
407 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
409 const std::vector<NBSign>& signs = e->
getSigns();
410 for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
411 it->writeAsPOI(device, e);
420 for (std::map<std::string, NBPTStop*>::const_iterator i = sc.
begin(); i != sc.
end(); ++i) {
421 i->second->write(device);
428 for (
const auto& item : lc.
getLines()) {
429 item.second->write(device, ec);
447 for (std::map<std::string, NBDistrict*>::const_iterator i = dc.
begin(); i != dc.
end(); i++) {
455 for (
int i = 0; i < (int) shape.size(); i++) {
static void writeLocation(OutputDevice &into)
writes the location element
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
@ SVC_PEDESTRIAN
pedestrian
double speed
The speed allowed on this lane.
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
#define WRITE_WARNING(msg)
Storage for edges, including some functionality operating on multiple edges.
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
std::string type
the type of this lane
Instance responsible for building networks.
A container for traffic light definitions and built programs.
Static storage of an output device and its base (abstract) implementation.
const double NETWORK_VERSION
version for written networks and default version for loading
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
bool exists(const std::string &name) const
Returns the information whether the named option is known.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static void writeStreetSigns(const OptionsCont &oc, NBEdgeCont &ec)
Writes street signs as POIs to file.
SumoXMLNodeType getType() const
Returns the type of this node.
int getPriority() const
Returns the priority of the edge.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
bool getKeepClear() const
Returns the keepClear flag.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void close()
Closes the device and removes it from the dictionary.
A container for districts.
static methods for processing the coordinates conversion for the current net
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
Container for nodes during the netbuilding process.
NBEdgeCont & getEdgeCont()
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
The representation of a single edge during network building.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
@ SUMO_TAG_WALKINGAREA
walking area for pedestrians
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
const Position & getPosition() const
static void writeTrafficLights(const OptionsCont &oc, NBTrafficLightLogicCont &tc, NBEdgeCont &ec)
Writes the traffic lights file.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
@ SUMO_TAG_NEIGH
begin/end of the description of a neighboring lane
static void writeEdgesAndConnections(const OptionsCont &oc, NBNodeCont &nc, NBEdgeCont &ec)
Writes the edges and connections files.
NBNode * getToNode() const
Returns the destination node of the edge.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
double getLaneWidth() const
Returns the default width of lanes of this edge.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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)
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
NBParkingCont & getParkingCont()
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
double getRadius() const
Returns the turning radius of this node.
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
const std::map< std::string, NBPTLine * > & getLines() const
@ SUMO_ATTR_EDGES
the edges of a route
int getNumLanes() const
Returns the number of lanes.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
bool hasLoadedLength() const
Returns whether a length was set explicitly.
std::map< int, double > stopOffsets
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
A point in 2D or 3D with translation and scaling methods.
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
const std::vector< NBSign > & getSigns() const
get Signs
A storage for options typed value containers)
static void writeParkingAreas(const OptionsCont &cont, NBParkingCont &pc, NBEdgeCont &ec)
writes imported parking areas to file
double width
This lane's width.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
const std::vector< std::set< std::string > > & getJoinedClusters() const
gets all joined clusters (see doc for myClusters2Join)
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
bool hasCustomShape() const
return whether the shape was set by the user
const std::string & getStreetName() const
Returns the street name of this edge.
@ SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
@ SUMO_ATTR_CONTROLLED_INNER
static void writeTypes(const OptionsCont &oc, NBTypeCont &tc)
Writes the types file.
double getEndOffset() const
Returns the offset to the destination node.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const PositionVector & getShape() const
retrieve the junction shape
PositionVector customShape
A custom shape for this lane set by the user.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
int size() const
Returns the number of known types.
void writeTypes(OutputDevice &into) const
writes all types a s XML
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
A storage for available types of edges.
The representation of a single pt stop.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
double getSpeed() const
Returns the speed allowed on this edge.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
An (internal) definition of a single lane of an edge.
FringeType getFringeType() const
Returns fringe type.
std::string oppositeID
An opposite lane ID, if given.
static const double UNSPECIFIED_RADIUS
unspecified lane width
void lf()
writes a line feed if applicable
static void writeNodes(const OptionsCont &oc, NBNodeCont &nc)
Writes the nodes file.
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_TAG_CONNECTION
connectio between two lanes
static void writeDistrict(OutputDevice &into, const NBDistrict &d)
Writes a district.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
static const double UNSPECIFIED_WIDTH
unspecified lane width
static void writeStopOffsets(OutputDevice &into, const std::map< SVCPermissions, double > &stopOffsets)
Write a stopOffset element into output device.
const std::string & getTypeID() const
get ID of type
bool accelRamp
Whether this lane is an acceleration lane.
bool usingInverseGeoProjection() const
Returns the information whether an inverse transformation will happen.
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
static void writePTLines(const OptionsCont &cont, NBPTLineCont &lc, NBEdgeCont &ec)
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
@ SUMO_TAG_JOIN
Join operation.
@ SUMO_ATTR_FRINGE
Fringe type of node.
static void writeRoundabouts(OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec)
Writes roundabouts.
double endOffset
This lane's offset to the intersection begin.
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.
static void writeShape(OutputDevice &out, const GeoConvHelper &gch, PositionVector shape, SumoXMLAttr attr, bool useGeo, bool geoAccuracy)
Represents a single node (junction) during network building.
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
NBNodeCont & getNodeCont()
Returns a reference to the node container.
A structure which describes a connection between edges or lanes.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
const std::string & getID() const
Returns the id.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNode * getFromNode() const
Returns the origin node of the edge.
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
static void writeDistricts(const OptionsCont &oc, NBDistrictCont &dc)
writes imported districts (TAZ) to file
static void writePTStops(const OptionsCont &oc, NBPTStopCont &ec)
Writes the pt stops file.
double getDistance() const
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool hasLaneSpecificWidth() const
whether lanes differ in width
@ SUMO_ATTR_NODES
a list of node ids, used for controlling joining
@ SUMO_TAG_NODE
alternative definition for junction
const std::string & getID() const