48 #ifdef CHECK_MEMORY_LEAKS 50 #endif // CHECK_MEMORY_LEAKS 63 if (oc.
isSet(
"plain-output-prefix")) {
71 if (oc.
isSet(
"junctions.join-output")) {
74 if (oc.
isSet(
"street-sign-output")) {
83 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
85 WRITE_WARNING(
"Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined");
91 device.
writeXMLHeader(
"nodes",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/nodes_file.xsd\"");
99 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
121 std::set<std::string> tlsIDs;
122 std::set<std::string> controlledInnerEdges;
123 for (std::set<NBTrafficLightDefinition*>::const_iterator it_tl = tlss.begin(); it_tl != tlss.end(); it_tl++) {
124 tlsIDs.insert((*it_tl)->getID());
125 std::vector<std::string> cie = (*it_tl)->getControlledInnerEdges();
126 controlledInnerEdges.insert(cie.begin(), cie.end());
128 std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
129 sort(sortedIDs.begin(), sortedIDs.end());
131 if (controlledInnerEdges.size() > 0) {
132 std::vector<std::string> sortedCIEs(controlledInnerEdges.begin(), controlledInnerEdges.end());
133 sort(sortedCIEs.begin(), sortedCIEs.end());
155 device.
writeXMLHeader(
"types",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/types_file.xsd\"");
164 bool useGeo = oc.
exists(
"proj.plain-geo") && oc.
getBool(
"proj.plain-geo");
168 edevice.
writeXMLHeader(
"edges",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/edges_file.xsd\"");
170 cdevice.
writeXMLHeader(
"connections",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/connections_file.xsd\"");
171 const bool writeNames = oc.
getBool(
"output.street-names");
172 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
195 for (
int i = 0; i < (int) geom.size(); i++) {
226 for (
int i = 0; i < (int)e->
getLanes().size(); ++i) {
256 const std::vector<NBEdge::Connection> connections = e->
getConnections();
257 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
260 if (connections.size() > 0) {
271 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
275 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
276 const std::vector<NBNode::Crossing>& crossings = (*it_node).second->getCrossings();
277 for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
289 for (std::map<std::string, NBNode*>::const_iterator it_node = nc.
begin(); it_node != nc.
end(); ++it_node) {
291 for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) {
307 device.
writeXMLHeader(
"tlLogics",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/tllogic_file.xsd\"");
311 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
314 const std::vector<NBEdge::Connection> connections = e->
getConnections();
315 for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
328 device.
writeXMLHeader(
"nodes",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/nodes_file.xsd\"");
330 for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
331 assert((*it).size() > 0);
334 std::ostringstream oss;
335 for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
336 oss << *it_id <<
" ";
339 std::string ids = oss.str();
350 device.
writeXMLHeader(
"additional",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\"");
351 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
353 const std::vector<NBSign>& signs = e->
getSigns();
354 for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
355 it->writeAsPOI(device, e);
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
SUMOReal endOffset
This lane's offset to the intersection begin.
a list of node ids, used for controlling joining
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
NBTypeCont & getTypeCont()
Returns the type container.
SUMOReal getEndOffset() const
Returns the offset to the destination node.
Whether vehicles must keep the junction clear.
SUMOReal getRadius() const
Returns the turning radius of this node.
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::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;
int getPriority() const
Returns the priority of the edge.
#define GEO_OUTPUT_ACCURACY
const std::string & getTypeID() const
get ID of type
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 std::string escapeXML(const std::string &orig)
Replaces the standard escapes by their XML entities.
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
void setPrecision(int precision=OUTPUT_ACCURACY)
Sets the precison or resets it to default.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
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
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
#define WRITE_WARNING(msg)
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
SUMOReal speed
The speed allowed on this lane.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
std::map< std::string, PositionVector > CustomShapeMap
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.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
The turning radius at an intersection in m.
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
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
int getNumLanes() const
Returns the number of lanes.
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
Returns the edge container.
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.
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.
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
static void writeTypes(const OptionsCont &oc, NBTypeCont &tc)
Writes the types file.
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
const PositionVector & getShape() const
retrieve the junction shape
const PositionVector & getGeometry() const
Returns the geometry of the edge.
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 the node container.
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.
A storage for options typed value containers)
static const SUMOReal DEFAULT_CROSSING_WIDTH
default width of pedetrian crossings
SumoXMLNodeType getType() const
Returns the type of this node.
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
NBTrafficLightLogicCont & getTLLogicCont()
Returns the traffic light logics container.
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.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
const Position & getPosition() const
Returns the position of this node.
Represents a single node (junction) during network building.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
static const SUMOReal UNSPECIFIED_RADIUS
unspecified lane width
NBNode * getFromNode() const
Returns the origin node of the edge.
Container for nodes during the netbuilding process.
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
static const std::string MAJOR_VERSION
The version number for written files.
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.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
SUMOReal width
This lane's width.
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