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