All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LandREntity.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  \file LandREntity.hpp
34  \brief Header of ...
35 
36  \author Aline LIBRES <aline.libres@gmail.com>
37  */
38 
39 #ifndef LANDRENTITY_HPP_
40 #define LANDRENTITY_HPP_
41 
42 #include <geos/planargraph/GraphComponent.h>
43 #include <map>
44 #include <set>
45 #include <string>
46 #include <openfluid/dllexport.hpp>
47 
48 namespace geos { namespace geom {
49 class Geometry;
50 class Point;
51 } }
52 
53 namespace openfluid {
54 namespace core {
55 class Value;
56 
57 }
58 namespace landr {
59 
60 /**
61  @brief Interface for a landscape representation element.
62  */
63 class DLLEXPORT LandREntity: public geos::planargraph::GraphComponent
64 {
65  private:
66 
67  LandREntity();
68 
69  LandREntity(const LandREntity&);
70 
71  protected:
72  /**
73  @brief The geos::geom::Geometry of this LandREntity.
74  */
75  const geos::geom::Geometry* mp_Geom;
76 
77  /**
78  @brief The identifier of this LandREntity.
79  */
80  unsigned int m_OfldId;
81 
82  /**
83  @brief The centroid of this LandREntity.
84  */
85  geos::geom::Point* mp_Centroid;
86 
87  /**
88  @brief The area of this LandREntity.
89  */
90  double m_Area;
91 
92  /**
93  @brief The length of this LandREntity.
94  */
95  double m_Lenght;
96 
97  /**
98  @brief A set of LandREntity neighbours of this LandREntity.
99  */
100  std::set<LandREntity*>* mp_Neighbours;
101 
102  /**
103  @brief A map of attributes of this LandREntity.
104  */
105 
106  std::map<std::string, core::Value*> m_Attributes;
107 
108  // for limiting access to m_Attributes creation/deletion to LandRGraph class
109  friend class LandRGraph;
110 
111  /**
112  @brief Computes the neighbours of this LandREntity.
113  */
114  virtual void computeNeighbours() = 0;
115 
116  public:
117 
118  LandREntity(const geos::geom::Geometry* Geom, unsigned int OfldId);
119 
120  virtual ~LandREntity();
121 
122  virtual LandREntity* clone() = 0;
123 
124  /**
125  @brief Returns the geos::geom::Geometry of this LandREntity.
126  */
127  const geos::geom::Geometry* getGeometry();
128 
129  /**
130  @brief Returns the identifier of this LandREntity.
131  */
132  unsigned int getOfldId() const;
133 
134  /**
135  @brief Returns the centroid of this LandREntity.
136  */
137  geos::geom::Point* getCentroid() const;
138 
139  /**
140  @brief Returns the area of this LandREntity.
141  */
142  double getArea() const;
143 
144  /**
145  @brief Returns the length of this LandREntity.
146  */
147  double getLength() const;
148 
149  /**
150  @brief Returns a set of LandREntity neighbours of this LandREntity.
151  */
152  std::set<LandREntity*>* getNeighbours();
153 
154  /**
155  @brief Gets the value of an attribute.
156  @param AttributeName The name of the attribute to get.
157  @param Value The core::Value to assign the attribute value.
158  @return True if the attribute exists, false otherwise.
159  */
160  bool getAttributeValue(const std::string& AttributeName, core::Value& Value) const;
161 
162  /**
163  @brief Sets the value of an attribute.
164  @details Takes the ownership of Value.
165  @param AttributeName The name of the attribute to set.
166  @param Value The core::Value assign to the attribute value.
167  @return True if the attribute exists, false otherwise.
168  */
169  bool setAttributeValue(const std::string& AttributeName, const core::Value* Value);
170 
171  /**
172  @brief Gets the distance between this LandREntity centroid and Other LandREntity centroid.
173  */
174  double getDistCentroCentro(LandREntity& Other);
175 
176  /**
177  @brief Gets the LandREntity neighbour that has the minimum centroid-to-centroid distance.
178  */
179  LandREntity* getNeighbour_MinDistCentroCentro();
180 
181 };
182 
183 } } // namespaces landr, openfluid
184 
185 #endif /* LANDRENTITY_HPP_ */
std::map< std::string, core::Value * > m_Attributes
A map of attributes of this LandREntity.
Definition: LandREntity.hpp:106
geos::geom::Point * mp_Centroid
The centroid of this LandREntity.
Definition: LandREntity.hpp:85
double m_Area
The area of this LandREntity.
Definition: LandREntity.hpp:90
const geos::geom::Geometry * mp_Geom
The geos::geom::Geometry of this LandREntity.
Definition: LandREntity.hpp:75
Interface for a landscape representation element.
Definition: LandREntity.hpp:63
Interface for a graph composed of LandREntity.
Definition: LandRGraph.hpp:78
std::set< LandREntity * > * mp_Neighbours
A set of LandREntity neighbours of this LandREntity.
Definition: LandREntity.hpp:100
unsigned int m_OfldId
The identifier of this LandREntity.
Definition: LandREntity.hpp:80
Definition: Value.hpp:64
double m_Lenght
The length of this LandREntity.
Definition: LandREntity.hpp:95
#define DLLEXPORT
Definition: dllexport.hpp:51