SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // ------------------- 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef NIVissimConnection_h 00022 #define NIVissimConnection_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <string> 00035 #include <map> 00036 #include "NIVissimExtendedEdgePoint.h" 00037 #include <utils/geom/Position.h> 00038 #include <utils/geom/AbstractPoly.h> 00039 #include "NIVissimAbstractEdge.h" 00040 #include "NIVissimClosedLanesVector.h" 00041 #include "NIVissimBoundedClusterObject.h" 00042 00043 00044 // =========================================================================== 00045 // class declarations 00046 // =========================================================================== 00047 class NBEdgeCont; 00048 00049 00050 // =========================================================================== 00051 // class definitions 00052 // =========================================================================== 00053 class NIVissimConnection 00054 : public NIVissimBoundedClusterObject, 00055 public NIVissimAbstractEdge { 00056 public: 00057 enum Direction { 00058 NIVC_DIR_RIGHT, 00059 NIVC_DIR_LEFT, 00060 NIVC_DIR_ALL 00061 }; 00062 00063 NIVissimConnection(int id, const std::string& name, 00064 const NIVissimExtendedEdgePoint& from_def, 00065 const NIVissimExtendedEdgePoint& to_def, 00066 const PositionVector& geom, 00067 Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, 00068 SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, 00069 const std::vector<int>& assignedVehicles, 00070 const NIVissimClosedLanesVector& clv); 00071 virtual ~NIVissimConnection(); 00072 void computeBounding(); 00073 int getFromEdgeID() const; 00074 int getToEdgeID() const; 00075 SUMOReal getFromPosition() const; 00076 SUMOReal getToPosition() const; 00077 Position getFromGeomPosition() const; 00078 Position getToGeomPosition() const; 00079 void setNodeCluster(int nodeid); 00080 const Boundary& getBoundingBox() const; 00081 00082 unsigned int buildEdgeConnections(NBEdgeCont& ec); 00083 00084 void buildGeom(); 00085 00086 00095 void recheckLanes(const NBEdge* const fromEdge, const NBEdge* const toEdge) ; 00096 00097 public: 00098 const std::vector<int>& getFromLanes() const; 00099 const std::vector<int>& getToLanes() const; 00100 00101 00102 00103 static bool dictionary(int id, const std::string& name, 00104 const NIVissimExtendedEdgePoint& from_def, 00105 const NIVissimExtendedEdgePoint& to_def, 00106 const PositionVector& geom, 00107 Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, 00108 SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, 00109 const std::vector<int>& assignedVehicles, 00110 const NIVissimClosedLanesVector& clv); 00111 static bool dictionary(int id, NIVissimConnection* o); 00112 static NIVissimConnection* dictionary(int id); 00113 static std::vector<int> getWithin(const AbstractPoly& poly); 00114 static void buildNodeClusters(); 00115 static std::vector<int> getForEdge(int edgeid, bool omitNodeAssigned = true); 00116 static void dict_buildNBEdgeConnections(NBEdgeCont& ec); 00117 static void dict_assignToEdges(); 00118 static int getMaxID(); 00119 00120 private: 00121 std::string myName; 00122 NIVissimExtendedEdgePoint myFromDef, myToDef; 00123 Direction myDirection; 00124 SUMOReal myDXNothalt, myDXEinordnen; 00125 SUMOReal myZuschlag1, myZuschlag2; 00126 std::vector<int> myAssignedVehicles; 00127 NIVissimClosedLanesVector myClosedLanes; 00128 private: 00129 typedef std::map<int, NIVissimConnection*> DictType; 00130 static DictType myDict; 00131 static int myMaxID; 00132 }; 00133 00134 00135 #endif 00136 00137 /****************************************************************************/ 00138