SUMO - Simulation of Urban MObility

ShapeContainer.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Storage for geometrical objects, sorted by the layers they are in
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 ShapeContainer_h
00020 #define ShapeContainer_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 <utils/common/NamedObjectCont.h>
00034 
00035 
00036 // ===========================================================================
00037 // class declarations
00038 // ===========================================================================
00039 class Polygon;
00040 class PointOfInterest;
00041 class Position;
00042 class PositionVector;
00043 class RGBColor;
00044 
00045 
00046 // ===========================================================================
00047 // class definitions
00048 // ===========================================================================
00053 class ShapeContainer {
00054 public:
00056     ShapeContainer() throw();
00057 
00058 
00060     virtual ~ShapeContainer() throw();
00061 
00062 
00063 
00073     virtual bool addPoI(const std::string& name, int layer, const std::string& type,
00074                         const RGBColor& c, const Position& pos) throw();
00075 
00076 
00086     virtual bool addPolygon(const std::string& name, int layer,
00087                             const std::string& type, const RGBColor& c, bool filled, const PositionVector& shape) throw();
00088 
00089 
00090 
00096     virtual bool removePolygon(int layer, const std::string& id) throw();
00097 
00098 
00104     virtual bool removePoI(int layer, const std::string& id) throw();
00105 
00106 
00107 
00113     virtual void movePoI(int layer, const std::string& id, const Position& pos) throw();
00114 
00115 
00121     virtual void reshapePolygon(int layer, const std::string& id, const PositionVector& shape) throw();
00122 
00123 
00124 
00130     const NamedObjectCont<Polygon*> &getPolygonCont(int layer) const throw();
00131 
00132 
00138     const NamedObjectCont<PointOfInterest*> &getPOICont(int layer) const throw();
00139 
00140 
00141 
00145     int getMinLayer() const throw() {
00146         return myMinLayer;
00147     }
00148 
00149 
00153     int getMaxLayer() const throw() {
00154         return myMaxLayer;
00155     }
00156 
00157 
00158 protected:
00164     bool add(int layer, Polygon* p) throw();
00165 
00166 
00172     bool add(int layer, PointOfInterest* p) throw();
00173 
00174 
00175 protected:
00176     typedef std::map<std::string, Polygon*> PolyMap;
00178     mutable std::map<int, NamedObjectCont<Polygon*> > myPolygonLayers;
00179 
00181     mutable std::map<int, NamedObjectCont<PointOfInterest*> > myPOILayers;
00182 
00184     mutable int myMinLayer, myMaxLayer;
00185 
00186 };
00187 
00188 
00189 #endif
00190 
00191 /****************************************************************************/
00192 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines