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 
00099     static void writePermissions(OutputDevice& into, SVCPermissions permissions);
00100 
00102     static void writePreferences(OutputDevice& into, SVCPermissions preferred);
00103 
00104 protected:
00107 
00113     static bool writeInternalEdges(OutputDevice& into, const NBNode& n);
00114 
00115 
00122     static void writeEdge(OutputDevice& into, const NBEdge& e, bool noNames);
00123 
00124 
00134     static void writeLane(OutputDevice& into, const std::string& lID, const std::string& eID,
00135                           const NBEdge::Lane& lane, SUMOReal length, unsigned int index);
00136 
00137 
00142     static void writeJunction(OutputDevice& into, const NBNode& n);
00143 
00144 
00149     static bool writeInternalNodes(OutputDevice& into, const NBNode& n);
00150 
00151 
00156     static bool writeInternalConnections(OutputDevice& into, const NBNode& n);
00157 
00158 
00163     static void writeRoundabout(OutputDevice& into, const std::set<NBEdge*> &r);
00164 
00165 
00170     static void writeDistrict(OutputDevice& into, const NBDistrict& d);
00171 
00172 
00173 private:
00180     static void writeInternalEdge(OutputDevice& into, const std::string& id, SUMOReal vmax, const PositionVector& shape);
00181 
00188     static void writeInternalConnection(OutputDevice& into,
00189                                         const std::string& from, const std::string& to, int toLane, const std::string& via);
00190 
00192     static std::string writeSUMOTime(SUMOTime time);
00193 
00194 
00196     static std::string prohibitionConnection(const NBConnection& c);
00197 };
00198 
00199 
00200 #endif
00201 
00202 /****************************************************************************/
00203 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines