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 {
00049 namespace geom {
00050 class Geometry;
00051 class Point;
00052 }
00053 }
00054 
00055 namespace openfluid {
00056 
00057 namespace core {
00058 class Value;
00059 
00060 }
00061 namespace landr {
00062 
00063 /**
00064  * @brief Interface for a landscape representation element.
00065  */
00066 class DLLEXPORT LandREntity: public geos::planargraph::GraphComponent
00067 {
00068   private:
00069 
00070     LandREntity();
00071 
00072     LandREntity(const LandREntity&);
00073 
00074   protected:
00075     /**
00076      * @brief The geos::geom::Geometry of this LandREntity.
00077      */
00078     const geos::geom::Geometry* mp_Geom;
00079 
00080     /**
00081      * @brief The identifier of this LandREntity.
00082      */
00083     unsigned int m_OfldId;
00084 
00085     /**
00086      * @brief The centroid of this LandREntity.
00087      */
00088     geos::geom::Point* mp_Centroid;
00089 
00090     /**
00091      * @brief The area of this LandREntity.
00092      */
00093     double m_Area;
00094 
00095     /**
00096      * @brief The length of this LandREntity.
00097      */
00098     double m_Lenght;
00099 
00100     /**
00101      * @brief A set of LandREntity neighbours of this LandREntity.
00102      */
00103     std::set<LandREntity*>* mp_Neighbours;
00104 
00105     /**
00106      * @brief A map of attributes of this LandREntity.
00107      */
00108 
00109     std::map<std::string, core::Value*> m_Attributes;
00110 
00111     // for limiting access to m_Attributes creation/deletion to LandRGraph class
00112     friend class LandRGraph;
00113 
00114     /**
00115      * @brief Computes the neighbours of this LandREntity.
00116      */
00117     virtual void computeNeighbours() = 0;
00118 
00119   public:
00120 
00121     LandREntity(const geos::geom::Geometry* Geom, unsigned int OfldId);
00122 
00123     virtual ~LandREntity();
00124 
00125     virtual LandREntity* clone() = 0;
00126 
00127     /**
00128      * @brief Returns the geos::geom::Geometry of this LandREntity.
00129      */
00130     const geos::geom::Geometry* getGeometry();
00131 
00132     /**
00133      * @brief Returns the identifier of this LandREntity.
00134      */
00135     unsigned int getOfldId() const;
00136 
00137     /**
00138      * @brief Returns the centroid of this LandREntity.
00139      */
00140     geos::geom::Point* getCentroid() const;
00141 
00142     /**
00143      * @brief Returns the area of this LandREntity.
00144      */
00145     double getArea() const;
00146 
00147     /**
00148      * @brief Returns the length of this LandREntity.
00149      */
00150     double getLength() const;
00151 
00152     /**
00153      * @brief Returns a set of LandREntity neighbours of this LandREntity.
00154      */
00155     std::set<LandREntity*>* getNeighbours();
00156 
00157     /**
00158      * @brief Gets the value of an attribute.
00159      *
00160      * @param AttributeName The name of the attribute to get.
00161      * @param Value The core::Value to assign the attribute value.
00162      * @return True if the attribute exists, false otherwise.
00163      */
00164     bool getAttributeValue(const std::string& AttributeName, core::Value& Value) const;
00165 
00166     /**
00167      * @brief Sets the value of an attribute.
00168      * @details Takes the ownership of Value.
00169      *
00170      * @param AttributeName The name of the attribute to set.
00171      * @param Value The core::Value assign to the attribute value.
00172      * @return True if the attribute exists, false otherwise.
00173      */
00174     bool setAttributeValue(const std::string& AttributeName, const core::Value* Value);
00175 
00176     /**
00177      * @brief Gets the distance between this LandREntity centroid and Other LandREntity centroid.
00178      */
00179     double getDistCentroCentro(LandREntity& Other);
00180 
00181     /**
00182      * @brief Gets the LandREntity neighbour that has the minimum centroid-to-centroid distance.
00183      */
00184     LandREntity* getNeighbour_MinDistCentroCentro();
00185 
00186 };
00187 
00188 } // namespace landr
00189 } /* namespace openfluid */
00190 #endif /* LANDRENTITY_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines