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