All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PolygonEdge.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 PolygonEdge.hpp
34  \brief Header of ...
35 
36  \author Aline LIBRES <aline.libres@gmail.com>
37  */
38 
39 #ifndef POLYGONEDGE_HPP_
40 #define POLYGONEDGE_HPP_
41 
42 #include <geos/planargraph/Edge.h>
43 #include <openfluid/dllexport.hpp>
44 
45 #include <map>
46 
47 namespace geos {
48 namespace geom {
49 class LineString;
50 class CoordinateSequence;
51 }
52 namespace planargraph {
53 class Edge;
54 } }
55 
56 namespace openfluid {
57 namespace core {
58 class Value;
59 }
60 
61 namespace landr {
62 
63 class PolygonEntity;
64 
65 /**
66  @brief A part of a PolygonEntity exterior ring, that may be share between to adjacent PolygonEntity.
67  @details A PolygonEdge has one or two Faces. The Faces are the PolygonEntity that share this PolygonEdge.
68  */
69 class DLLEXPORT PolygonEdge: public geos::planargraph::Edge
70 {
71  private:
72 
73  /**
74  @brief The geos::geom::LineString associated to this PolygonEdge.
75  */
76  geos::geom::LineString& m_Line;
77 
78  /**
79  @brief A vector of the PolygonEntity associated to this PolygonEdge.
80  @details At most two elements vector.
81  */
82  std::vector<PolygonEntity*> m_Faces;
83 
84 
85  public:
86 
87  PolygonEdge(geos::geom::LineString& Line);
88 
89  ~PolygonEdge();
90 
91  /**
92  @brief Map of Attributes which are carried by this PolygonEdge.
93  */
94  std::map<std::string, core::Value*> m_EdgeAttributes;
95 
96 
97  /**
98  @brief Returns the geos::geom::LineString representing this PolygonEdge.
99  */
100  geos::geom::LineString* getLine();
101 
102  /**
103  @brief Add a PolygonEntity as a Face to this PolygonEdge.
104  @param NewFace A PolygonEntity.
105  @throw base::OFException if this PolygonEdge is not in the boundary of the input PolygonEntity,
106  or if this PolygonEdge has already two Faces.
107  */
108  void addFace(PolygonEntity& NewFace);
109 
110  /**
111  @brief Returns true if this PolygonEdge is in the boundary of the input PolygonEntity.
112  @param Face A PolygonEntity.
113  @return True if this PolygonEdge is in the boundary of the input PolygonEntity, false otherwise.
114  */
115  bool isLineInFace(PolygonEntity& Face);
116 
117  /**
118  @brief Returns a vector of PolygonEntity which represent the Faces of this PolygonEdge.
119  */
120  const std::vector<PolygonEntity*> getFaces();
121 
122  /**
123  @brief Removes a Face from the Faces of this PolygonEdge.
124  @details Does nothing if the input Face is not a part of this PolygonEdge Faces.
125  @param Face A PolygonEntity.
126  */
127  void removeFace(PolygonEntity* Face);
128 
129  /**
130  @brief Gets the value of an attribute of this PolygonEdge.
131  @param AttributeName The name of the attribute to get.
132  @param Value The core::Value to assign the attribute value.
133  @return True if the attribute exists, false otherwise.
134  */
135  bool getAttributeValue(const std::string& AttributeName, core::Value& Value) const;
136 
137  /**
138  @brief Sets the value of an attribute of this PolygonEdge.
139  @details Takes the ownership of Value.
140  @param AttributeName The name of the attribute to set.
141  @param Value The core::Value assign to the attribute value.
142  @return True if the attribute exists, false otherwise.
143  */
144  bool setAttributeValue(const std::string& AttributeName, const core::Value* Value);
145 
146  /**
147  @brief Removes an attribute of this PolygonEdge.
148  @param AttributeName The name of the attribute to set.
149  */
150  void removeAttribute(const std::string& AttributeName);
151 
152  /**
153  @brief Returns true if this PolygonEdge is coincident with an other PolygonEdge.
154  @param Edge The PolygonEdge to test the coincidence.
155  @return True if the two PolygonEdge are coincidents, false otherwise.
156  */
157  bool isCoincident(PolygonEdge *Edge);
158 
159 };
160 
161 } } // namespace landr, openfluid
162 #endif /* POLYGONEDGE_HPP_ */
std::map< std::string, core::Value * > m_EdgeAttributes
Map of Attributes which are carried by this PolygonEdge.
Definition: PolygonEdge.hpp:94
A LandREntity representing a geos::geom::Polygon.
Definition: PolygonEntity.hpp:64
Definition: Value.hpp:64
A part of a PolygonEntity exterior ring, that may be share between to adjacent PolygonEntity.
Definition: PolygonEdge.hpp:69
#define DLLEXPORT
Definition: dllexport.hpp:51