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 LineStringEntity.hpp 00034 \brief Header of ... 00035 00036 \author Aline LIBRES <aline.libres@gmail.com> 00037 */ 00038 00039 #ifndef LINESTRINGENTITY_HPP_ 00040 #define LINESTRINGENTITY_HPP_ 00041 00042 #include <openfluid/landr/LandREntity.hpp> 00043 #include <openfluid/dllexport.hpp> 00044 #include <geos/planargraph/Edge.h> 00045 00046 00047 namespace geos { 00048 namespace geom { 00049 class LineString; 00050 } 00051 } 00052 00053 namespace openfluid { 00054 namespace landr { 00055 00056 /** 00057 * @brief A LandREntity representing a geos::geom::LineString. 00058 * @details A LineStringEntity has a StartNode and an EndNode, relatives to its LineString orientation. 00059 */ 00060 class DLLEXPORT LineStringEntity: public LandREntity, public geos::planargraph::Edge 00061 { 00062 private: 00063 00064 const geos::geom::LineString* mp_Line; 00065 00066 /** 00067 * @brief Up neighbours of LineStringEntity type, according to the LineString orientation. 00068 * @details An up neighbour is another LineStringEntity whose EndNode is this LineStringEntity StartNode. 00069 */ 00070 std::vector<LineStringEntity*>* mp_LOUpNeighbours; 00071 00072 /** 00073 * @brief Down neighbours of LineStringEntity type, according to the LineString orientation. 00074 * @details A down neighbour is another LineStringEntity whose StartNode is this LineStringEntity EndNode. 00075 */ 00076 std::vector<LineStringEntity*>* mp_LODownNeighbours; 00077 00078 LineStringEntity(); 00079 LineStringEntity(const LineStringEntity&); 00080 00081 /** 00082 * @brief Computes the down neighbour of this LineStringEntity. 00083 */ 00084 void computeLineOrientUpNeighbours(); 00085 00086 /** 00087 * @brief Computes the up neighbour of this LineStringEntity. 00088 */ 00089 void computeLineOrientDownNeighbours(); 00090 00091 public: 00092 00093 /** 00094 * @brief Creates a new LineStringEntity. 00095 * @details Takes ownership of NewLine. 00096 * 00097 * @throw base::OFException if NewLine is not a geos::geom::LineString or is an empty geometry. 00098 */ 00099 LineStringEntity(const geos::geom::Geometry* NewLine, unsigned int OfldId); 00100 00101 virtual ~LineStringEntity(); 00102 00103 /** 00104 * @brief Clones a LineStringEntity into a new LineStringEntity. 00105 */ 00106 LineStringEntity* clone(); 00107 00108 /** 00109 * @brief Returns the geos::geom::LineString of this LineStringEntity. 00110 */ 00111 const geos::geom::LineString* getLine() const; 00112 00113 /** 00114 * @brief Returns the start geos::planargraph::Node of this LineStringEntity. 00115 */ 00116 geos::planargraph::Node* getStartNode(); 00117 00118 /** 00119 * @brief Returns the end geos::planargraph::Node of this LineStringEntity. 00120 */ 00121 geos::planargraph::Node* getEndNode(); 00122 00123 /** 00124 * @brief Return a vector of up-neighbours LineStringEntity using the line orientation of this LineStringEntity. 00125 */ 00126 std::vector<LineStringEntity*> getLineOrientUpNeighbours(); 00127 00128 /** 00129 * @brief Return a vector of down-neighbours LineStringEntity using the line orientation of this LineStringEntity. 00130 */ 00131 std::vector<LineStringEntity*> getLineOrientDownNeighbours(); 00132 00133 /** 00134 * @brief Compute the neighbours using line orientation of this LineStringEntity. 00135 */ 00136 void computeNeighbours(); 00137 00138 }; 00139 00140 } // namespace landr 00141 } /* namespace openfluid */ 00142 00143 #endif /* LINESTRINGENTITY_HPP_ */