SUMO - Simulation of Urban MObility
ShapeContainer.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Storage for geometrical objects, sorted by the layers they are in
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 ShapeContainer_h
00022 #define ShapeContainer_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 <utils/common/NamedObjectCont.h>
00036 
00037 
00038 // ===========================================================================
00039 // class declarations
00040 // ===========================================================================
00041 class Polygon;
00042 class PointOfInterest;
00043 class Position;
00044 class PositionVector;
00045 class RGBColor;
00046 
00047 
00048 // ===========================================================================
00049 // class definitions
00050 // ===========================================================================
00055 class ShapeContainer {
00056 public:
00058     ShapeContainer() ;
00059 
00060 
00062     virtual ~ShapeContainer() ;
00063 
00064 
00065 
00075     virtual bool addPoI(const std::string& name, int layer, const std::string& type,
00076                         const RGBColor& c, const Position& pos) ;
00077 
00078 
00088     virtual bool addPolygon(const std::string& name, int layer,
00089                             const std::string& type, const RGBColor& c, bool filled, const PositionVector& shape) ;
00090 
00091 
00092 
00098     virtual bool removePolygon(int layer, const std::string& id) ;
00099 
00100 
00106     virtual bool removePoI(int layer, const std::string& id) ;
00107 
00108 
00109 
00115     virtual void movePoI(int layer, const std::string& id, const Position& pos) ;
00116 
00117 
00123     virtual void reshapePolygon(int layer, const std::string& id, const PositionVector& shape) ;
00124 
00125 
00126 
00132     const NamedObjectCont<Polygon*> &getPolygonCont(int layer) const ;
00133 
00134 
00140     const NamedObjectCont<PointOfInterest*> &getPOICont(int layer) const ;
00141 
00142 
00143 
00147     int getMinLayer() const {
00148         return myMinLayer;
00149     }
00150 
00151 
00155     int getMaxLayer() const {
00156         return myMaxLayer;
00157     }
00158 
00159 
00160 protected:
00166     bool add(int layer, Polygon* p) ;
00167 
00168 
00174     bool add(int layer, PointOfInterest* p) ;
00175 
00176 
00177 protected:
00178     typedef std::map<std::string, Polygon*> PolyMap;
00180     mutable std::map<int, NamedObjectCont<Polygon*> > myPolygonLayers;
00181 
00183     mutable std::map<int, NamedObjectCont<PointOfInterest*> > myPOILayers;
00184 
00186     mutable int myMinLayer, myMaxLayer;
00187 
00188 };
00189 
00190 
00191 #endif
00192 
00193 /****************************************************************************/
00194 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines