SUMO - Simulation of Urban MObility

NWWriter_SUMO.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Exporter writing networks using the SUMO format
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef NWWriter_SUMO_h
00020 #define NWWriter_SUMO_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <map>
00034 #include <netbuild/NBEdge.h>
00035 #include <utils/xml/SUMOSAXHandler.h>
00036 #include <utils/common/UtilExceptions.h>
00037 #include <netbuild/NBConnectionDefs.h>
00038 
00039 
00040 // ===========================================================================
00041 // class declarations
00042 // ===========================================================================
00043 class OutputDevice;
00044 class OptionsCont;
00045 class NBNetBuilder;
00046 class NBTrafficLightLogicCont;
00047 class NBNode;
00048 class NBDistrict;
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00059 class NWWriter_SUMO {
00060 public:
00061 
00062     enum ConnectionStyle {
00063         SUMONET, // all connection information
00064         PLAIN,   // only edges and link indices
00065         TLL      // like plain but include tl information
00066     };
00067 
00073     static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
00074 
00075 
00083     static void writeConnection(OutputDevice& into, const NBEdge& from, const NBEdge::Connection& c,
00084                                 bool includeInternal, ConnectionStyle style=SUMONET);
00085 
00087     static void writeProhibitions(OutputDevice& into, const NBConnectionProhibits& prohibitions);
00088 
00090     static void writeTrafficLights(OutputDevice& into, const NBTrafficLightLogicCont& tllCont);
00091 
00093     static void writeLocation(OutputDevice& into);
00094 
00095 protected:
00098 
00104     static bool writeInternalEdges(OutputDevice& into, const NBNode& n);
00105 
00106 
00113     static void writeEdge(OutputDevice& into, const NBEdge& e, bool noNames);
00114 
00115 
00125     static void writeLane(OutputDevice& into, const std::string& lID, const std::string& eID,
00126                           const NBEdge::Lane& lane, SUMOReal length, unsigned int index);
00127 
00128 
00133     static void writeJunction(OutputDevice& into, const NBNode& n);
00134 
00135 
00140     static bool writeInternalNodes(OutputDevice& into, const NBNode& n);
00141 
00142 
00147     static bool writeInternalConnections(OutputDevice& into, const NBNode& n);
00148 
00149 
00154     static void writeRoundabout(OutputDevice& into, const std::set<NBEdge*> &r);
00155 
00156 
00161     static void writeDistrict(OutputDevice& into, const NBDistrict& d);
00162 
00163 
00164 private:
00171     static void writeInternalEdge(OutputDevice& into, const std::string& id, SUMOReal vmax, const PositionVector& shape);
00172 
00179     static void writeInternalConnection(OutputDevice& into,
00180                                         const std::string& from, const std::string& to, int toLane, const std::string& via);
00181 
00183     static std::string writeSUMOTime(SUMOTime time);
00184 
00185 
00187     static std::string prohibitionConnection(const NBConnection& c);
00188 };
00189 
00190 
00191 #endif
00192 
00193 /****************************************************************************/
00194 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines