NBEdgeCont.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Storage for edges, including some functionality operating on multiple edges
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 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 NBEdgeCont_h
00020 #define NBEdgeCont_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 <map>
00033 #include <iostream>
00034 #include <string>
00035 #include <vector>
00036 #include <set>
00037 #include "NBCont.h"
00038 #include <utils/common/SUMOVehicleClass.h>
00039 #include <utils/common/UtilExceptions.h>
00040 #include <utils/geom/Position2DVector.h>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class NBNodeCont;
00047 class NBNetBuilder;
00048 class NBEdge;
00049 class NBNode;
00050 class OptionsCont;
00051 class NBDistrictCont;
00052 class NBTrafficLightLogicCont;
00053 class OutputDevice;
00054 
00055 
00056 // ===========================================================================
00057 // class definitions
00058 // ===========================================================================
00063 class NBEdgeCont {
00064 public:
00068     NBEdgeCont(NBNetBuilder &tc) throw();
00069 
00070 
00072     ~NBEdgeCont() throw();
00073 
00074 
00083     void applyOptions(OptionsCont &oc);
00084 
00085 
00087     void clear() throw();
00088 
00089 
00090 
00091 
00094 
00108     bool insert(NBEdge *edge, bool ignorePrunning=false) throw();
00109 
00110 
00118     NBEdge *retrieve(const std::string &id) const throw();
00119 
00120 
00133     NBEdge *retrievePossiblySplitted(const std::string &id,
00134                                      const std::string &hint, bool incoming) const throw();
00135 
00136 
00147     NBEdge *retrievePossiblySplitted(const std::string &id, SUMOReal pos) const throw();
00148 
00149 
00156     void erase(NBDistrictCont &dc, NBEdge *edge) throw();
00158 
00159 
00160 
00163 
00177     bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node) throw(ProcessError);
00178 
00179 
00200     bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node,
00201                  const std::string &firstEdgeName, const std::string &secondEdgeName,
00202                  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) throw(ProcessError);
00203 
00204 
00217     bool splitAt(NBDistrictCont &dc, NBEdge *edge, SUMOReal edgepos, NBNode *node,
00218                  const std::string &firstEdgeName, const std::string &secondEdgeName,
00219                  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) throw(ProcessError);
00221 
00222 
00223 
00226 
00230     unsigned int size() const throw() {
00231         return (unsigned int) myEdges.size();
00232     }
00233 
00234 
00239     std::vector<std::string> getAllNames() const throw();
00240 
00241 
00245     unsigned int getNoEdgeSplits() const throw() {
00246         return myEdgesSplit;
00247     }
00249 
00250 
00251 
00254 
00262     void computeTurningDirections() throw();
00263 
00264 
00272     void sortOutgoingLanesConnections() throw();
00273 
00274 
00282     void computeEdge2Edges() throw();
00283 
00284 
00292     void computeLanes2Edges() throw();
00293 
00294 
00302     void recheckLanes() throw();
00303 
00304 
00313     void appendTurnarounds(bool noTLSControlled) throw();
00314 
00315 
00324     void reshiftEdgePositions(SUMOReal xoff, SUMOReal yoff) throw();
00325 
00326 
00335     void computeEdgeShapes() throw();
00336 
00337 
00346     void recomputeLaneShapes() throw();
00347 
00348 
00356     void joinSameNodeConnectingEdges(NBDistrictCont &dc,
00357                                      NBTrafficLightLogicCont &tlc, EdgeVector edges) throw();
00358 
00359 
00365     void removeUnwishedEdges(NBDistrictCont &dc) throw();
00366 
00367 
00376     void splitGeometry(NBNodeCont &nc) throw();
00377 
00378 
00383     void recheckLaneSpread() throw();
00385 
00386 
00387 
00390 
00398     void writeXMLStep1(OutputDevice &into) throw(IOError);
00399 
00400 
00409     void writeXMLStep2(OutputDevice &into, bool includeInternal) throw(IOError);
00410 
00411 
00417     void savePlain(const std::string &efile, const std::string &cfile) throw(IOError);
00419 
00420 
00421 
00425     void guessRoundabouts(std::vector<std::set<NBEdge*> > &marked) throw();
00426 
00427 
00431     bool isLeftHanded() const throw() {
00432         return myAmLeftHanded;
00433     }
00434 
00435 
00436 private:
00443     EdgeVector getGeneratedFrom(const std::string &id) const throw();
00444 
00445 
00446 private:
00448     typedef std::map<std::string, NBEdge*> EdgeCont;
00449 
00451     EdgeCont myEdges;
00452 
00454     unsigned int myEdgesSplit;
00455 
00457     bool myAmLeftHanded;
00458 
00459 
00462 
00464     SUMOReal myEdgesMinSpeed;
00465 
00467     bool myRemoveEdgesAfterJoining;
00468 
00470     std::vector<std::string> myEdges2Keep;
00471 
00473     std::vector<std::string> myEdges2Remove;
00474 
00476     std::set<SUMOVehicleClass> myVehicleClasses2Keep;
00477 
00479     std::set<SUMOVehicleClass> myVehicleClasses2Remove;
00480 
00482     Position2DVector myPrunningBoundary;
00484 
00485 
00487     NBNetBuilder &myNetBuilder;
00488 
00489 
00490 private:
00492     NBEdgeCont(const NBEdgeCont &s);
00493 
00495     NBEdgeCont &operator=(const NBEdgeCont &s);
00496 
00497 
00498 };
00499 
00500 
00501 #endif
00502 
00503 /****************************************************************************/
00504 

Generated on Wed May 5 00:06:33 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6