Public Types | Public Member Functions | Public Attributes | List of all members
openfluid::landr::PolygonEntity Class Reference

A LandREntity representing a geos::geom::Polygon. More...

#include <landr/PolygonEntity.hpp>

Inheritance diagram for openfluid::landr::PolygonEntity:
Inheritance graph
[legend]
Collaboration diagram for openfluid::landr::PolygonEntity:
Collaboration graph
[legend]

Public Types

typedef std::map< PolygonEntity *, std::vector< PolygonEdge * > > NeighboursMap_t
 A map of the PolygonEntity neighbours and their shared PolygonEdge to this PolygonEntity. More...
 
typedef std::map< LineStringEntity *, PolygonEdge * > LineStringNeighboursMap_t
 A map of the LineStringEntity neighbours and the PolygonEdge in contact with this PolygonEntity. More...
 

Public Member Functions

 PolygonEntity (const geos::geom::Geometry *NewPolygon, unsigned int OfldId)
 Create a new PolygonEntity. More...
 
virtual ~PolygonEntity ()
 
PolygonEntityclone ()
 Clone a new PolygonEntity from this PolygonEntity. More...
 
const geos::geom::Polygon * polygon () const
 Returns the geos::geom::Polygon associated to this PolygonEntity. More...
 
void addEdge (PolygonEdge &Edge)
 Adds a PolygonEdge to this PolygonEntity. More...
 
void removeEdge (PolygonEdge *Edge)
 Removes a PolygonEdge to this PolygonEntity. More...
 
std::vector< geos::geom::LineString * > computeLineIntersectionsWith (PolygonEntity &Other)
 Returns a vector of geos::geom::LineString representing the linear intersections between two PolygonEntity. More...
 
PolygonEdgefindEdgeLineIntersectingWith (geos::geom::LineString &Segment)
 Returns the PolygonEdge containing Segment. More...
 
const NeighboursMap_tneighboursAndEdges ()
 Returns a map of this PolygonEntity neighbours with for each a vector of the shared PolygonEdge. More...
 
std::vector< int > getOrderedNeighbourOfldIds ()
 Returns a vector of the OFLD_ID of this PolygonEntity neighbours, ascending ordered. More...
 
std::multimap< double, PolygonEntity * > getOrderedNeighboursByLengthBoundary ()
 Returns a multimap of the length of the shared boundary of each neighbour of this PolygonEntity and each PolygonEntity neighbour, ascending ordered by length shared boundary (shortest to longest boundary). More...
 
bool isComplete ()
 Check if this PolygonEntity is complete, that is if all PolygonEdge of this PolygonEntity, merged in a LineString, equals this PolygonEntity polygon exterior ring. More...
 
std::vector< PolygonEdge * > getCommonEdgesWith (PolygonEntity &Other)
 Gets the PolygonEdge of this PolygonEntity that are shared with Other. More...
 
PolygonEntityneighbourWithCommonEdge (PolygonEdge *Edge)
 Gets the PolygonEntity which share the same Edge with the current PolygonEntity. More...
 
geos::geom::Geometry * getBufferedBoundary (double BufferDistance)
 Gets the boundary of this PolygonEntity polygon, with a buffer of BufferDistance. More...
 
void computeNeighbours ()
 Computes the neighbours of this PolygonEntity. More...
 
void computeLineStringNeighbours (LineStringGraph &Graph, LandRTools::Relationship Relation, double BufferDistance, double ContactLength=0)
 Computes the relations between this PolygonEntity and the LineStringEntity of an input LineStringGraph. More...
 
void computeNeighboursWithBarriers (LineStringGraph &Graph, LandRTools::Relationship Relation, double BufferDistance, double ContactLength=0)
 Computes the relations between this PolygonEntity and its PolygonEntities Neighbours by using the LineStringEntity of an input LineStringGraph which are considered as barriers. More...
 
LineStringNeighboursMap_tlineStringNeighbours ()
 Return the a map of the LineStringEntity neighbours of this PolygonEntity. More...
 
geos::geom::LineString * mergeEdges (PolygonEdge *Edge, PolygonEdge *EdgeToMerge)
 Merge a PolygonEdge into an other one. More...
 
std::pair< LandREntity *, double > computeNeighbourByLineTopology (VectorDataset LineTopology)
 Find the LandREntity neighbour of this PolygonEntity by using a line VectorDataset which indicates the neighbour relationship. More...
 
- Public Member Functions inherited from openfluid::landr::LandREntity
 LandREntity (const geos::geom::Geometry *Geom, unsigned int OfldId)
 
virtual ~LandREntity ()
 
const geos::geom::Geometry * geometry ()
 Returns the geos::geom::Geometry of this LandREntity. More...
 
unsigned int getOfldId () const
 Returns the identifier of this LandREntity. More...
 
geos::geom::Point * centroid () const
 Returns the centroid of this LandREntity. More...
 
double getArea () const
 Returns the area of this LandREntity. More...
 
double getLength () const
 Returns the length of this LandREntity. More...
 
std::set< LandREntity * > * neighbours ()
 Returns a set of LandREntity neighbours of this LandREntity. More...
 
bool getAttributeValue (const std::string &AttributeName, core::Value &Value) const
 Gets the value of an attribute. More...
 
bool setAttributeValue (const std::string &AttributeName, const core::Value *Value)
 Sets the value of an attribute. More...
 
double getDistCentroCentro (LandREntity &Other)
 Gets the distance between this LandREntity centroid and Other LandREntity centroid. More...
 
LandREntityneighbour_MinDistCentroCentro ()
 Gets the LandREntity neighbour that has the minimum centroid-to-centroid distance. More...
 

Public Attributes

NeighboursMap_tmp_NeighboursMap
 A Map of neighbours of PolygonEntity type and the related vector of PolygonEdge that are between this PolygonEntity and his neighbours. More...
 
LineStringNeighboursMap_tmp_LineStringNeighboursMap
 A Map of neighbours of LineStringEntity type and the related PolygonEdge that is between this PolygonEntity and his neighbours, if exist. More...
 
std::vector< PolygonEdge * > m_PolyEdges
 A vector of the PolygonEdge of this PolygonEntity. More...
 

Additional Inherited Members

- Protected Attributes inherited from openfluid::landr::LandREntity
const geos::geom::Geometry * mp_Geom
 The geos::geom::Geometry of this LandREntity. More...
 
unsigned int m_OfldId
 The identifier of this LandREntity. More...
 
geos::geom::Point * mp_Centroid
 The centroid of this LandREntity. More...
 
double m_Area
 The area of this LandREntity. More...
 
double m_Length
 The length of this LandREntity. More...
 
std::set< LandREntity * > * mp_Neighbours
 A set of LandREntity neighbours of this LandREntity. More...
 
std::map< std::string, core::Value * > m_Attributes
 A map of attributes of this LandREntity. More...
 

Detailed Description

A LandREntity representing a geos::geom::Polygon.

A PolygonEntity has at least a PolygonEdge, all edges representing the Polygon exterior ring.

Member Typedef Documentation

A map of the LineStringEntity neighbours and the PolygonEdge in contact with this PolygonEntity.

A map of the PolygonEntity neighbours and their shared PolygonEdge to this PolygonEntity.

Constructor & Destructor Documentation

openfluid::landr::PolygonEntity::PolygonEntity ( const geos::geom::Geometry *  NewPolygon,
unsigned int  OfldId 
)

Create a new PolygonEntity.

Takes ownership of NewPolygon.

Parameters
NewPolygonThe geos::geom::Geometry of this new PolygonEntity.
OfldIdThe identifier of this new PolygonEntity.
Exceptions
base::FrameworkExceptionif NewPolygon is not a geos::geom::Polygon or is not a valid geometry.
virtual openfluid::landr::PolygonEntity::~PolygonEntity ( )
virtual

Member Function Documentation

void openfluid::landr::PolygonEntity::addEdge ( PolygonEdge Edge)

Adds a PolygonEdge to this PolygonEntity.

PolygonEntity* openfluid::landr::PolygonEntity::clone ( )
virtual

Clone a new PolygonEntity from this PolygonEntity.

Attention
Doesn't deep-copy m_PolyEdges nor neighbours.

Implements openfluid::landr::LandREntity.

std::vector<geos::geom::LineString*> openfluid::landr::PolygonEntity::computeLineIntersectionsWith ( PolygonEntity Other)

Returns a vector of geos::geom::LineString representing the linear intersections between two PolygonEntity.

Parameters
OtherThe PolygonEntity to compare to.
Returns
A vector of new allocated geos::geom::LineString representing the linear intersections (eventually merged) between this PolygonEntity and Other.
void openfluid::landr::PolygonEntity::computeLineStringNeighbours ( LineStringGraph Graph,
LandRTools::Relationship  Relation,
double  BufferDistance,
double  ContactLength = 0 
)

Computes the relations between this PolygonEntity and the LineStringEntity of an input LineStringGraph.

A LineStringEntity is considered as a neighbour if it lies within the buffer of this PolygonEntity polygon boundary.

Parameters
GraphThe LineStringGraph to compare to.
RelationThe Relationship to use for comparison.
BufferDistanceThe distance below which we consider that two elements are related.
ContactLengthMin Length of the LineString in intersection with polygon Buffered Boundaries to be taking acccount (only for LandRTools::TOUCHES RelationShip)
std::pair< LandREntity*, double> openfluid::landr::PolygonEntity::computeNeighbourByLineTopology ( VectorDataset  LineTopology)

Find the LandREntity neighbour of this PolygonEntity by using a line VectorDataset which indicates the neighbour relationship.

   **************    Following the directions of the
   *   |-*-->   *    lines of the VectorDataset,
   *  1  *   3  *    the neighbour of PolygonEntity 2 is
   *     *      *    the PolygonEntity 1 and the neighbour
   *  ^  ********    of PolygonEntity 1 is the PolygonEntity
   *  |  *           3. If a line of the VectorDataset crosses
   *******           a LineStringNeighbour of the PolygonEntity,
   *  |  *           it becomes the neighbour :e.g, if LineStringNeighbour
   *  -  *           exists between PolygonEntity 1 and 2, the neighbour
   *  2  *           of PolygonEntity becomes this LineStringNeighbour.
   *     *
   *******
Parameters
LineTopologyA line VectorDataset
Returns
A pair of openfluid::landr:landREntity and the length of the line of the VectorDataset or an empty pair if not found.
void openfluid::landr::PolygonEntity::computeNeighbours ( )
virtual

Computes the neighbours of this PolygonEntity.

A neighbour is another PolygonEntity that shares at least a PolygonEdge with this PolygonEntity.

Implements openfluid::landr::LandREntity.

void openfluid::landr::PolygonEntity::computeNeighboursWithBarriers ( LineStringGraph Graph,
LandRTools::Relationship  Relation,
double  BufferDistance,
double  ContactLength = 0 
)

Computes the relations between this PolygonEntity and its PolygonEntities Neighbours by using the LineStringEntity of an input LineStringGraph which are considered as barriers.

A barrier between two PolygonEntity will avoid to considered them as neighbours.

A LineStringEntity is considered as a barrier if it lies within the buffer of this PolygonEntity polygon boundary.

Parameters
GraphThe LineStringGraph to compare to.
RelationThe Relationship to use for comparison, the LandRTools::Relationship INTERSECTS is not allowed.
BufferDistanceThe distance below which we consider that two elements are related.
ContactLengthMin Length of the LineString in intersection with polygon Buffered Boundaries to be taking acccount (only for LandRTools::TOUCHES RelationShip)
PolygonEdge* openfluid::landr::PolygonEntity::findEdgeLineIntersectingWith ( geos::geom::LineString &  Segment)

Returns the PolygonEdge containing Segment.

Parameters
SegmentThe geos::geom::LineString to find.
Returns
The PolygonEdge of this PolygonEntity containing the input geos::geom::LineString, or 0 if not found.
geos::geom::Geometry* openfluid::landr::PolygonEntity::getBufferedBoundary ( double  BufferDistance)

Gets the boundary of this PolygonEntity polygon, with a buffer of BufferDistance.

Parameters
BufferDistanceThe buffer distance.
Returns
A geos::geom::Geometry representing the buffered boundaries of this PolygonEntity.
std::vector<PolygonEdge*> openfluid::landr::PolygonEntity::getCommonEdgesWith ( PolygonEntity Other)

Gets the PolygonEdge of this PolygonEntity that are shared with Other.

Parameters
OtherA PolygonEntity.
Returns
A vector of PolygonEdge.
std::vector<int> openfluid::landr::PolygonEntity::getOrderedNeighbourOfldIds ( )

Returns a vector of the OFLD_ID of this PolygonEntity neighbours, ascending ordered.

std::multimap<double,PolygonEntity*> openfluid::landr::PolygonEntity::getOrderedNeighboursByLengthBoundary ( )

Returns a multimap of the length of the shared boundary of each neighbour of this PolygonEntity and each PolygonEntity neighbour, ascending ordered by length shared boundary (shortest to longest boundary).

bool openfluid::landr::PolygonEntity::isComplete ( )

Check if this PolygonEntity is complete, that is if all PolygonEdge of this PolygonEntity, merged in a LineString, equals this PolygonEntity polygon exterior ring.

Returns
True if complete, false otherwise.
LineStringNeighboursMap_t* openfluid::landr::PolygonEntity::lineStringNeighbours ( )

Return the a map of the LineStringEntity neighbours of this PolygonEntity.

geos::geom::LineString* openfluid::landr::PolygonEntity::mergeEdges ( PolygonEdge Edge,
PolygonEdge EdgeToMerge 
)

Merge a PolygonEdge into an other one.

Parameters
EdgeAn existent PolygonEdge.
EdgeToMergeAnother PolygonEdge to merge.
Returns
A geos::geom:LineString which have the geometry of the merged PolygonEdge.
const NeighboursMap_t* openfluid::landr::PolygonEntity::neighboursAndEdges ( )

Returns a map of this PolygonEntity neighbours with for each a vector of the shared PolygonEdge.

PolygonEntity* openfluid::landr::PolygonEntity::neighbourWithCommonEdge ( PolygonEdge Edge)

Gets the PolygonEntity which share the same Edge with the current PolygonEntity.

Parameters
EdgeA PolygonEdge.
Returns
A vector a PolygonEntity.
const geos::geom::Polygon* openfluid::landr::PolygonEntity::polygon ( ) const

Returns the geos::geom::Polygon associated to this PolygonEntity.

void openfluid::landr::PolygonEntity::removeEdge ( PolygonEdge Edge)

Removes a PolygonEdge to this PolygonEntity.

Attention
Also delete input parameter Edge.

Member Data Documentation

std::vector<PolygonEdge*> openfluid::landr::PolygonEntity::m_PolyEdges

A vector of the PolygonEdge of this PolygonEntity.

LineStringNeighboursMap_t* openfluid::landr::PolygonEntity::mp_LineStringNeighboursMap

A Map of neighbours of LineStringEntity type and the related PolygonEdge that is between this PolygonEntity and his neighbours, if exist.

NeighboursMap_t* openfluid::landr::PolygonEntity::mp_NeighboursMap

A Map of neighbours of PolygonEntity type and the related vector of PolygonEdge that are between this PolygonEntity and his neighbours.


The documentation for this class was generated from the following file: