/****************************************************************************/ // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. // This program and the accompanying materials // are made available under the terms of the Eclipse Public License v2.0 // which accompanies this distribution, and is available at // http://www.eclipse.org/legal/epl-v20.html // SPDX-License-Identifier: EPL-2.0 /****************************************************************************/ /// @file NWWriter_SUMO.h /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Leonhard Luecken /// @date Tue, 04.05.2011 /// @version $Id$ /// // Exporter writing networks using the SUMO format /****************************************************************************/ #ifndef NWWriter_SUMO_h #define NWWriter_SUMO_h // =========================================================================== // included modules // =========================================================================== #include #include #include #include #include #include #include // =========================================================================== // class declarations // =========================================================================== class OutputDevice; class OptionsCont; class NBNetBuilder; class NBTrafficLightLogicCont; class NBNode; class NBDistrict; class NBEdgeControl; // =========================================================================== // class definitions // =========================================================================== /** * @class NWWriter_SUMO * @brief Exporter writing networks using the SUMO format * */ class NWWriter_SUMO { public: enum ConnectionStyle { SUMONET, // all connection information PLAIN, // only edges and link indices TLL // like plain but include tl information }; /** @brief Writes the network into a SUMO-file * * @param[in] oc The options to use * @param[in] nb The network builder to fill */ static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb); /** @brief Writes connections outgoing from the given edge (also used in NWWriter_XML) * @param[in] into The device to write the edge into * @param[in] from The edge to write connections for * @param[in] c The connection to write * @param[in] includeInternal Whether information about inner-lanes used to cross the intersection shall be written * @param[in] plain Whether only plain-xml output should be written (omit some attributes) */ static void writeConnection(OutputDevice& into, const NBEdge& from, const NBEdge::Connection& c, bool includeInternal, ConnectionStyle style = SUMONET); /// @brief writes the given prohibitions static void writeProhibitions(OutputDevice& into, const NBConnectionProhibits& prohibitions); /// @brief writes the traffic light logics to the given device static void writeTrafficLights(OutputDevice& into, const NBTrafficLightLogicCont& tllCont); /** @brief Writes roundabouts * @param[in] into The device to write the edge into * @param[in] roundaboutes The roundabouts to write * @param[in] ec The edge control to retrieve named edges from */ static void writeRoundabouts(OutputDevice& into, const std::set& roundabouts, const NBEdgeCont& ec); /** @brief Write a stopOffset element into output device */ static void writeStopOffsets(OutputDevice& into, const std::map& stopOffsets); private: /// @name Methods for writing network parts /// @{ /** @brief Writes internal edges ( stopOffsets, double width, PositionVector shape, const Parameterised* params, double length, int index, const std::string& oppositeID, bool accelRamp = false, bool customShape = false); /** @brief Writes a junction (& r, const NBEdgeCont& ec); /// @brief retrieve the id of the opposite direction internal lane if it exists static std::string getOppositeInternalID(const NBEdgeCont& ec, const NBEdge* from, const NBEdge::Connection& con, double& oppositeLength); }; #endif /****************************************************************************/