SUMO - Simulation of Urban MObility

NWWriter_SUMO.h

Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Exporter writing networks using the SUMO format
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef NWWriter_SUMO_h
00023 #define NWWriter_SUMO_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <string>
00036 #include <map>
00037 #include <netbuild/NBEdge.h>
00038 #include <utils/xml/SUMOSAXHandler.h>
00039 #include <utils/common/UtilExceptions.h>
00040 #include <netbuild/NBConnectionDefs.h>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class OutputDevice;
00047 class OptionsCont;
00048 class NBNetBuilder;
00049 class NBTrafficLightLogicCont;
00050 class NBNode;
00051 class NBDistrict;
00052 
00053 
00054 // ===========================================================================
00055 // class definitions
00056 // ===========================================================================
00062 class NWWriter_SUMO {
00063 public:
00064 
00065     enum ConnectionStyle {
00066         SUMONET, // all connection information
00067         PLAIN,   // only edges and link indices
00068         TLL      // like plain but include tl information
00069     };
00070 
00076     static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
00077 
00078 
00086     static void writeConnection(OutputDevice& into, const NBEdge& from, const NBEdge::Connection& c,
00087                                 bool includeInternal, ConnectionStyle style = SUMONET);
00088 
00090     static void writeProhibitions(OutputDevice& into, const NBConnectionProhibits& prohibitions);
00091 
00093     static void writeTrafficLights(OutputDevice& into, const NBTrafficLightLogicCont& tllCont);
00094 
00096     static void writeLocation(OutputDevice& into);
00097 
00098 protected:
00101 
00107     static bool writeInternalEdges(OutputDevice& into, const NBNode& n);
00108 
00109 
00116     static void writeEdge(OutputDevice& into, const NBEdge& e, bool noNames);
00117 
00118 
00128     static void writeLane(OutputDevice& into, const std::string& lID, const std::string& eID,
00129                           const NBEdge::Lane& lane, SUMOReal length, unsigned int index);
00130 
00131 
00136     static void writeJunction(OutputDevice& into, const NBNode& n);
00137 
00138 
00143     static bool writeInternalNodes(OutputDevice& into, const NBNode& n);
00144 
00145 
00150     static bool writeInternalConnections(OutputDevice& into, const NBNode& n);
00151 
00152 
00157     static void writeRoundabout(OutputDevice& into, const std::set<NBEdge*> &r);
00158 
00159 
00164     static void writeDistrict(OutputDevice& into, const NBDistrict& d);
00165 
00166 
00167 private:
00174     static void writeInternalEdge(OutputDevice& into, const std::string& id, SUMOReal vmax, const PositionVector& shape);
00175 
00182     static void writeInternalConnection(OutputDevice& into,
00183                                         const std::string& from, const std::string& to, int toLane, const std::string& via);
00184 
00186     static std::string writeSUMOTime(SUMOTime time);
00187 
00188 
00190     static std::string prohibitionConnection(const NBConnection& c);
00191 };
00192 
00193 
00194 #endif
00195 
00196 /****************************************************************************/
00197 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines