|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // ------------------- 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 NIVissimConnection_h 00020 #define NIVissimConnection_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 <utils/common/VectorHelper.h> 00035 #include "NIVissimExtendedEdgePoint.h" 00036 #include <utils/geom/Position.h> 00037 #include <utils/geom/AbstractPoly.h> 00038 #include "NIVissimAbstractEdge.h" 00039 #include "NIVissimClosedLanesVector.h" 00040 #include "NIVissimBoundedClusterObject.h" 00041 00042 00043 // =========================================================================== 00044 // class declarations 00045 // =========================================================================== 00046 class NBEdgeCont; 00047 00048 00049 // =========================================================================== 00050 // class definitions 00051 // =========================================================================== 00052 class NIVissimConnection 00053 : public NIVissimBoundedClusterObject, 00054 public NIVissimAbstractEdge { 00055 public: 00056 enum Direction { 00057 NIVC_DIR_RIGHT, 00058 NIVC_DIR_LEFT, 00059 NIVC_DIR_ALL 00060 }; 00061 00062 NIVissimConnection(int id, const std::string& name, 00063 const NIVissimExtendedEdgePoint& from_def, 00064 const NIVissimExtendedEdgePoint& to_def, 00065 const PositionVector& geom, 00066 Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, 00067 SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, 00068 const IntVector& assignedVehicles, 00069 const NIVissimClosedLanesVector& clv); 00070 virtual ~NIVissimConnection(); 00071 void computeBounding(); 00072 int getFromEdgeID() const; 00073 int getToEdgeID() const; 00074 SUMOReal getFromPosition() const; 00075 SUMOReal getToPosition() const; 00076 Position getFromGeomPosition() const; 00077 Position getToGeomPosition() const; 00078 void setNodeCluster(int nodeid); 00079 const Boundary& getBoundingBox() const; 00080 00081 unsigned int buildEdgeConnections(NBEdgeCont& ec); 00082 00083 void buildGeom(); 00084 00085 00094 void recheckLanes(const NBEdge* const fromEdge, const NBEdge* const toEdge) throw(); 00095 00096 public: 00097 const IntVector& getFromLanes() const; 00098 const IntVector& getToLanes() const; 00099 00100 00101 00102 static bool dictionary(int id, const std::string& name, 00103 const NIVissimExtendedEdgePoint& from_def, 00104 const NIVissimExtendedEdgePoint& to_def, 00105 const PositionVector& geom, 00106 Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, 00107 SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, 00108 const IntVector& assignedVehicles, 00109 const NIVissimClosedLanesVector& clv); 00110 static bool dictionary(int id, NIVissimConnection* o); 00111 static NIVissimConnection* dictionary(int id); 00112 static IntVector getWithin(const AbstractPoly& poly); 00113 static void buildNodeClusters(); 00114 static IntVector getForEdge(int edgeid, bool omitNodeAssigned=true); 00115 static void dict_buildNBEdgeConnections(NBEdgeCont& ec); 00116 static void dict_assignToEdges(); 00117 static int getMaxID(); 00118 00119 private: 00120 std::string myName; 00121 NIVissimExtendedEdgePoint myFromDef, myToDef; 00122 Direction myDirection; 00123 SUMOReal myDXNothalt, myDXEinordnen; 00124 SUMOReal myZuschlag1, myZuschlag2; 00125 IntVector myAssignedVehicles; 00126 NIVissimClosedLanesVector myClosedLanes; 00127 private: 00128 typedef std::map<int, NIVissimConnection*> DictType; 00129 static DictType myDict; 00130 static int myMaxID; 00131 }; 00132 00133 00134 #endif 00135 00136 /****************************************************************************/ 00137