NIVissimBoundedClusterObject.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // -------------------
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 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 
00020 
00021 // ===========================================================================
00022 // included modules
00023 // ===========================================================================
00024 #ifdef _MSC_VER
00025 #include <windows_config.h>
00026 #else
00027 #include <config.h>
00028 #endif
00029 
00030 
00031 #include <cassert>
00032 #include <utils/geom/Boundary.h>
00033 #include "NIVissimBoundedClusterObject.h"
00034 
00035 #ifdef CHECK_MEMORY_LEAKS
00036 #include <foreign/nvwa/debug_new.h>
00037 #endif // CHECK_MEMORY_LEAKS
00038 
00039 NIVissimBoundedClusterObject::ContType NIVissimBoundedClusterObject::myDict;
00040 
00041 NIVissimBoundedClusterObject::NIVissimBoundedClusterObject()
00042         : myBoundary(0), myClusterID(-1) {
00043     myDict.insert(this);
00044 }
00045 
00046 
00047 NIVissimBoundedClusterObject::~NIVissimBoundedClusterObject() {
00048     delete myBoundary;
00049 }
00050 
00051 
00052 bool
00053 NIVissimBoundedClusterObject::crosses(const AbstractPoly &poly,
00054                                       SUMOReal offset) const {
00055     assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
00056     return myBoundary->overlapsWith(poly, offset);
00057 }
00058 
00059 
00060 void
00061 NIVissimBoundedClusterObject::inCluster(int id) {
00062     myClusterID = id;
00063 }
00064 
00065 
00066 bool
00067 NIVissimBoundedClusterObject::clustered() const {
00068     return myClusterID>0;
00069 }
00070 
00071 
00072 void
00073 NIVissimBoundedClusterObject::closeLoading() {
00074     for (ContType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
00075         (*i)->computeBounding();
00076     }
00077 }
00078 
00079 
00080 const Boundary &
00081 NIVissimBoundedClusterObject::getBoundary() const {
00082     return *myBoundary;
00083 }
00084 
00085 
00086 
00087 /****************************************************************************/
00088 

Generated on Wed May 5 00:06:34 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6