landr/LandREntity.hpp
Go to the documentation of this file.
00001 /*
00002 
00003   This file is part of OpenFLUID software
00004   Copyright(c) 2007, INRA - Montpellier SupAgro
00005 
00006 
00007  == GNU General Public License Usage ==
00008 
00009   OpenFLUID is free software: you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation, either version 3 of the License, or
00012   (at your option) any later version.
00013 
00014   OpenFLUID is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
00021 
00022 
00023  == Other Usage ==
00024 
00025   Other Usage means a use of OpenFLUID that is inconsistent with the GPL
00026   license, and requires a written agreement between You and INRA.
00027   Licensees for Other Usage of OpenFLUID may use this file in accordance
00028   with the terms contained in the written agreement between You and INRA.
00029   
00030 */
00031 
00032 /**
00033  \file LandREntity.hpp
00034  \brief Header of ...
00035 
00036  \author Aline LIBRES <aline.libres@gmail.com>
00037  */
00038 
00039 #ifndef LANDRENTITY_HPP_
00040 #define LANDRENTITY_HPP_
00041 
00042 #include <geos/planargraph/GraphComponent.h>
00043 #include <map>
00044 #include <set>
00045 #include <string>
00046 #include <openfluid/dllexport.hpp>
00047 
00048 namespace geos { namespace geom {
00049 class Geometry;
00050 class Point;
00051 } }
00052 
00053 namespace openfluid {
00054 namespace core {
00055 class Value;
00056 
00057 }
00058 namespace landr {
00059 
00060 /**
00061  @brief Interface for a landscape representation element.
00062  */
00063 class DLLEXPORT LandREntity: public geos::planargraph::GraphComponent
00064 {
00065   private:
00066 
00067     LandREntity();
00068 
00069     LandREntity(const LandREntity&);
00070 
00071   protected:
00072     /**
00073      @brief The geos::geom::Geometry of this LandREntity.
00074      */
00075     const geos::geom::Geometry* mp_Geom;
00076 
00077     /**
00078      @brief The identifier of this LandREntity.
00079      */
00080     unsigned int m_OfldId;
00081 
00082     /**
00083      @brief The centroid of this LandREntity.
00084      */
00085     geos::geom::Point* mp_Centroid;
00086 
00087     /**
00088      @brief The area of this LandREntity.
00089      */
00090     double m_Area;
00091 
00092     /**
00093      @brief The length of this LandREntity.
00094      */
00095     double m_Lenght;
00096 
00097     /**
00098      @brief A set of LandREntity neighbours of this LandREntity.
00099      */
00100     std::set<LandREntity*>* mp_Neighbours;
00101 
00102     /**
00103      @brief A map of attributes of this LandREntity.
00104      */
00105 
00106     std::map<std::string, core::Value*> m_Attributes;
00107 
00108     // for limiting access to m_Attributes creation/deletion to LandRGraph class
00109     friend class LandRGraph;
00110 
00111     /**
00112      @brief Computes the neighbours of this LandREntity.
00113      */
00114     virtual void computeNeighbours() = 0;
00115 
00116   public:
00117 
00118     LandREntity(const geos::geom::Geometry* Geom, unsigned int OfldId);
00119 
00120     virtual ~LandREntity();
00121 
00122     virtual LandREntity* clone() = 0;
00123 
00124     /**
00125      @brief Returns the geos::geom::Geometry of this LandREntity.
00126      */
00127     const geos::geom::Geometry* getGeometry();
00128 
00129     /**
00130      @brief Returns the identifier of this LandREntity.
00131      */
00132     unsigned int getOfldId() const;
00133 
00134     /**
00135      @brief Returns the centroid of this LandREntity.
00136      */
00137     geos::geom::Point* getCentroid() const;
00138 
00139     /**
00140      @brief Returns the area of this LandREntity.
00141      */
00142     double getArea() const;
00143 
00144     /**
00145      @brief Returns the length of this LandREntity.
00146      */
00147     double getLength() const;
00148 
00149     /**
00150      @brief Returns a set of LandREntity neighbours of this LandREntity.
00151      */
00152     std::set<LandREntity*>* getNeighbours();
00153 
00154     /**
00155      @brief Gets the value of an attribute.
00156      @param AttributeName The name of the attribute to get.
00157      @param Value The core::Value to assign the attribute value.
00158      @return True if the attribute exists, false otherwise.
00159      */
00160     bool getAttributeValue(const std::string& AttributeName, core::Value& Value) const;
00161 
00162     /**
00163      @brief Sets the value of an attribute.
00164      @details Takes the ownership of Value.
00165      @param AttributeName The name of the attribute to set.
00166      @param Value The core::Value assign to the attribute value.
00167      @return True if the attribute exists, false otherwise.
00168      */
00169     bool setAttributeValue(const std::string& AttributeName, const core::Value* Value);
00170 
00171     /**
00172      @brief Gets the distance between this LandREntity centroid and Other LandREntity centroid.
00173      */
00174     double getDistCentroCentro(LandREntity& Other);
00175 
00176     /**
00177      @brief Gets the LandREntity neighbour that has the minimum centroid-to-centroid distance.
00178      */
00179     LandREntity* getNeighbour_MinDistCentroCentro();
00180 
00181 };
00182 
00183 } } // namespaces landr, openfluid
00184 
00185 #endif /* LANDRENTITY_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines