All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LineStringEntity.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 LineStringEntity.hpp
34 
35  @author Aline LIBRES <aline.libres@gmail.com>
36  @author Michael RABOTIN <michael.rabotin@supagro.inra.fr>
37  */
38 
39 #ifndef __OPENFLUID_LANDR_LINESTRINGENTITY_HPP__
40 #define __OPENFLUID_LANDR_LINESTRINGENTITY_HPP__
41 
43 #include <openfluid/dllexport.hpp>
44 #include <geos/planargraph/Edge.h>
45 
46 
47 namespace geos { namespace geom {
48 class LineString;
49 } }
50 
51 namespace openfluid { namespace landr {
52 
53 /**
54  @brief A LandREntity representing a geos::geom::LineString.
55  @details A LineStringEntity has a StartNode and an EndNode, relatives to its LineString orientation.
56 */
57 class OPENFLUID_API LineStringEntity: public LandREntity, public geos::planargraph::Edge
58 {
59  private:
60 
61  const geos::geom::LineString* mp_Line;
62 
63  /**
64  @brief Up neighbours of LineStringEntity type, according to the LineString orientation.
65  @details An up neighbour is another LineStringEntity whose EndNode is this LineStringEntity StartNode.
66  */
67  std::vector<LineStringEntity*>* mp_LOUpNeighbours;
68 
69  /**
70  @brief Down neighbours of LineStringEntity type, according to the LineString orientation.
71  @details A down neighbour is another LineStringEntity whose StartNode is this LineStringEntity EndNode.
72  */
73  std::vector<LineStringEntity*>* mp_LODownNeighbours;
74 
77 
78  /**
79  @brief Computes the down neighbour of this LineStringEntity.
80  */
81  void computeLineOrientUpNeighbours();
82 
83  /**
84  @brief Computes the up neighbour of this LineStringEntity.
85  */
86  void computeLineOrientDownNeighbours();
87 
88  public:
89 
90  /**
91  @brief Creates a new LineStringEntity.
92  @details Takes ownership of NewLine.
93  @throw base::FrameworkException if NewLine is not a geos::geom::LineString or is an empty geometry.
94  */
95  LineStringEntity(const geos::geom::Geometry* NewLine, unsigned int OfldId);
96 
97  virtual ~LineStringEntity();
98 
99  /**
100  @brief Clones a LineStringEntity into a new LineStringEntity.
101  */
102  LineStringEntity* clone();
103 
104  /**
105  @brief Returns the geos::geom::LineString of this LineStringEntity.
106  */
107  const geos::geom::LineString* line() const;
108 
109  /**
110  @brief Returns the start geos::planargraph::Node of this LineStringEntity.
111  */
112  geos::planargraph::Node* startNode();
113 
114  /**
115  @brief Returns the end geos::planargraph::Node of this LineStringEntity.
116  */
117  geos::planargraph::Node* endNode();
118 
119  /**
120  @brief Return a vector of up-neighbours LineStringEntity using the line orientation of this LineStringEntity.
121  */
122  std::vector<LineStringEntity*> getLineOrientUpNeighbours();
123 
124  /**
125  @brief Return a vector of down-neighbours LineStringEntity using the line orientation of this LineStringEntity.
126  */
127  std::vector<LineStringEntity*> getLineOrientDownNeighbours();
128 
129  /**
130  @brief Compute the neighbours using line orientation of this LineStringEntity.
131  */
132  void computeNeighbours();
133 
134  /**
135  @brief Returns a vector of LineStringEntity down and upneighbours with NodeDegree=2.
136  @return A vector of LineStringEntity.
137  */
138  std::vector<LineStringEntity*> getLineNeighboursDegree2();
139 
140 };
141 
142 } } // namespace landr, openfluid
143 
144 #endif /* __OPENFLUID_LANDR_LINESTRINGENTITY_HPP__ */
Interface for a landscape representation element.
Definition: LandREntity.hpp:63
#define OPENFLUID_API
Definition: dllexport.hpp:87
A LandREntity representing a geos::geom::LineString.
Definition: LineStringEntity.hpp:57