NBNodeCont.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NBNodeCont_h
00020 #define NBNodeCont_h
00021
00022
00023
00024
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 <vector>
00035 #include <set>
00036 #include <utils/geom/Position2D.h>
00037 #include "NBEdgeCont.h"
00038 #include "NBJunctionLogicCont.h"
00039 #include "NBNode.h"
00040 #include <utils/common/UtilExceptions.h>
00041
00042
00043
00044
00045
00046 class NBDistrict;
00047 class OptionsCont;
00048 class OutputDevice;
00049
00050
00051
00052
00053
00058 class NBNodeCont {
00059 public:
00061 NBNodeCont() throw();
00062
00063
00065 ~NBNodeCont() throw();
00066
00067
00068
00071
00078 bool insert(const std::string &id, const Position2D &position,
00079 NBDistrict *district) throw();
00080
00081
00087 bool insert(const std::string &id, const Position2D &position) throw();
00088
00089
00094 Position2D insert(const std::string &id) throw();
00095
00096
00101 bool insert(NBNode *node) throw();
00102
00103
00108 bool erase(NBNode *node) throw();
00109
00110
00115 NBNode *retrieve(const std::string &id) const throw();
00116
00117
00123 NBNode *retrieve(const Position2D &position, SUMOReal offset=0.) const throw();
00125
00126
00127
00130
00136 void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc);
00137
00138
00143 void joinTLS(NBTrafficLightLogicCont &tlc);
00144
00145
00152 void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, std::string id="");
00154
00156 void reshiftNodePositions(const SUMOReal xoff, const SUMOReal yoff);
00157
00159 void computeLanes2Lanes();
00160
00162 void computeLogics(const NBEdgeCont &ec, NBJunctionLogicCont &jc,
00163 OptionsCont &oc);
00164
00166 void sortNodesEdges(bool leftHand, const NBTypeCont &tc);
00167
00168 void writeXMLInternalLinks(OutputDevice &into);
00169 void writeXMLInternalSuccInfos(OutputDevice &into);
00170 void writeXMLInternalNodes(OutputDevice &into);
00171
00173 void writeXML(OutputDevice &into);
00174
00178 unsigned int size() const throw() {
00179 return (unsigned int) myNodes.size();
00180 }
00181
00183 void clear();
00184
00186 void recheckEdges(NBDistrictCont &dc, NBTrafficLightLogicCont &tlc,
00187 NBEdgeCont &ec);
00188
00196 void removeIsolatedRoads(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc);
00197
00199 void removeDummyEdges(NBDistrictCont &dc, NBEdgeCont &ec,
00200 NBTrafficLightLogicCont &tc);
00201
00202 std::string getFreeID();
00203
00204 void computeNodeShapes(bool leftHand);
00205
00219 void removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec,
00220 NBTrafficLightLogicCont &tlc,
00221 bool removeGeometryNodes) throw();
00222
00223 void guessRamps(OptionsCont &oc, NBEdgeCont &ec, NBDistrictCont &dc);
00224
00225 bool savePlain(const std::string &file);
00226
00227
00233 void printBuiltNodesStatistics() const throw();
00234
00235
00236 private:
00237 bool mayNeedOnRamp(OptionsCont &oc, NBNode *cur) const;
00238 bool mayNeedOffRamp(OptionsCont &oc, NBNode *cur) const;
00239 bool buildOnRamp(OptionsCont &oc, NBNode *cur,
00240 NBEdgeCont &ec, NBDistrictCont &dc, std::vector<NBEdge*> &incremented);
00241
00242 void buildOffRamp(OptionsCont &oc, NBNode *cur,
00243 NBEdgeCont &ec, NBDistrictCont &dc, std::vector<NBEdge*> &incremented);
00244
00245 void checkHighwayRampOrder(NBEdge *&pot_highway, NBEdge *&pot_ramp);
00246
00247
00250
00258 void generateNodeClusters(SUMOReal maxDist, std::vector<std::set<NBNode*> >&into) const throw();
00259
00260
00265 bool shouldBeTLSControlled(const std::set<NBNode*> &c) const throw();
00267
00269 int myInternalID;
00270
00272 typedef std::map<std::string, NBNode*> NodeCont;
00273
00275 NodeCont myNodes;
00276
00278 NBNodeCont(const NBNodeCont &s);
00279
00281 NBNodeCont &operator=(const NBNodeCont &s);
00282 };
00283
00284
00285 #endif
00286
00287
00288