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