SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // ------------------- 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 00021 00022 // =========================================================================== 00023 // included modules 00024 // =========================================================================== 00025 #ifdef _MSC_VER 00026 #include <windows_config.h> 00027 #else 00028 #include <config.h> 00029 #endif 00030 00031 00032 #include <cassert> 00033 #include <utils/geom/Boundary.h> 00034 #include "NIVissimBoundedClusterObject.h" 00035 00036 #ifdef CHECK_MEMORY_LEAKS 00037 #include <foreign/nvwa/debug_new.h> 00038 #endif // CHECK_MEMORY_LEAKS 00039 00040 NIVissimBoundedClusterObject::ContType NIVissimBoundedClusterObject::myDict; 00041 00042 NIVissimBoundedClusterObject::NIVissimBoundedClusterObject() 00043 : myBoundary(0), myClusterID(-1) { 00044 myDict.insert(this); 00045 } 00046 00047 00048 NIVissimBoundedClusterObject::~NIVissimBoundedClusterObject() { 00049 delete myBoundary; 00050 } 00051 00052 00053 bool 00054 NIVissimBoundedClusterObject::crosses(const AbstractPoly& poly, 00055 SUMOReal offset) const { 00056 assert(myBoundary != 0 && myBoundary->xmax() >= myBoundary->xmin()); 00057 return myBoundary->overlapsWith(poly, offset); 00058 } 00059 00060 00061 void 00062 NIVissimBoundedClusterObject::inCluster(int id) { 00063 myClusterID = id; 00064 } 00065 00066 00067 bool 00068 NIVissimBoundedClusterObject::clustered() const { 00069 return myClusterID > 0; 00070 } 00071 00072 00073 void 00074 NIVissimBoundedClusterObject::closeLoading() { 00075 for (ContType::iterator i = myDict.begin(); i != myDict.end(); i++) { 00076 (*i)->computeBounding(); 00077 } 00078 } 00079 00080 00081 const Boundary& 00082 NIVissimBoundedClusterObject::getBoundary() const { 00083 return *myBoundary; 00084 } 00085 00086 00087 00088 /****************************************************************************/ 00089