SFCGAL  1.3.0
Public Types | Public Member Functions | List of all members
SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties > Class Template Reference

[private]Represents the vertices and edges for a list of geometries. More...

#include <GeometryGraph.h>

Public Types

typedef VertexProperties vertex_properties
 
typedef EdgeProperties edge_properties
 
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, vertex_properties, edge_propertiesgraph_t
 the wrapped graphEdgeProperties More...
 
typedef boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor
 
typedef boost::graph_traits< graph_t >::edge_descriptor edge_descriptor
 
typedef boost::graph_traits< graph_t >::vertex_iterator vertex_iterator
 
typedef boost::graph_traits< graph_t >::edge_iterator edge_iterator
 
typedef std::pair< edge_descriptor, EdgeDirectiondirected_edge_descriptor
 An edge descriptor, with a direction. More...
 
typedef boost::graph_traits< graph_t >::in_edge_iterator in_edge_iterator
 
typedef boost::graph_traits< graph_t >::out_edge_iterator out_edge_iterator
 

Public Member Functions

size_t numVertices () const
 [vertex]returns the number of vertices More...
 
std::pair< vertex_iterator, vertex_iteratorvertices () const
 [iterator]return vertex iterator More...
 
vertex_descriptor addVertex (const vertex_properties &properties=vertex_properties())
 [vertex]add a vertex to the graph More...
 
void removeVertex (const vertex_descriptor &vertex)
 [vertex]Remove a vertex (and all its adjacent edges) More...
 
size_t numEdges () const
 [edge]returns the number of vertices More...
 
std::pair< edge_iterator, edge_iteratoredges () const
 [iterator]return edge iterator More...
 
edge_descriptor addEdge (const vertex_descriptor &source, const vertex_descriptor &target, const EdgeProperties &properties=EdgeProperties())
 [edge]Add an Edge to the Graph More...
 
vertex_descriptor source (const edge_descriptor &edge) const
 [edge]get the source vertex for an edge More...
 
vertex_descriptor source (const edge_descriptor &edge, const EdgeDirection &direction) const
 [edge]get the source vertex for an edge More...
 
vertex_descriptor source (const directed_edge_descriptor &edge) const
 [edge]get the source vertex for an edge with a direction More...
 
vertex_descriptor target (const edge_descriptor &edge) const
 [edge]get the target vertex for an edge More...
 
vertex_descriptor target (const edge_descriptor &edge, const EdgeDirection &direction) const
 [edge]get the target vertex for an edge with a direction More...
 
vertex_descriptor target (const directed_edge_descriptor &edge) const
 [edge]get the target vertex for an edge with a direction More...
 
void removeEdge (const edge_descriptor &edge)
 [edge]Remove an edge More...
 
std::vector< directed_edge_descriptoredges (const vertex_descriptor &a, const vertex_descriptor &b) const
 [edge]Get edges from a to b and from b to a More...
 
size_t degree (const vertex_descriptor &vertex) const
 returns the degree of a vertex More...
 
std::vector< edge_descriptorinEdges (const vertex_descriptor &vertex)
 [adjacency]get in edges More...
 
std::vector< edge_descriptoroutEdges (const vertex_descriptor &vertex) const
 [adjacency]get out edges More...
 
std::vector< directed_edge_descriptorinOutEdges (const vertex_descriptor &vertex) const
 [adjacency]get in/out edges More...
 
std::set< vertex_descriptoradjacentVertices (const vertex_descriptor &vertex, bool withReverseDirection=true)
 [adjacency]Returns the list of the adjacent vertices using both DIRECT and REVERSE direction More...
 
bool areOpposite (const edge_descriptor &a, const edge_descriptor &b) const
 [helper]indicates if edges are opposite More...
 
bool areParallel (const edge_descriptor &a, const edge_descriptor &b) const
 [helper]indicates if edges are opposite More...
 
void reverse (std::vector< edge_descriptor > &edges)
 [EdgeString]revert the order of a list of edges. More...
 
const vertex_propertiesoperator[] (const vertex_descriptor &vertex) const
 returns the VertexProperties attached to a Vertex More...
 
vertex_propertiesoperator[] (const vertex_descriptor &vertex)
 returns the VertexProperties attached to a Vertex More...
 
const edge_propertiesoperator[] (const edge_descriptor &edge) const
 returns the VertexProperties attached to a Vertex More...
 
edge_propertiesoperator[] (const edge_descriptor &edge)
 returns the VertexProperties attached to a Vertex More...
 
graph_tgraph ()
 returns the wrapped boost::graph More...
 
const graph_tgraph () const
 returns the wrapped boost::graph More...
 
 operator graph_t & (void)
 implicit cast to the wrapped boost graph in order to keep boost graph interface More...
 
 operator const graph_t & (void) const
 implicit cast to the wrapped boost graph in order to keep boost graph interface More...
 

Detailed Description

template<typename VertexProperties, typename EdgeProperties>
class SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >

[private]Represents the vertices and edges for a list of geometries.

A boost::adjancency_list is wrapped in order to be able to annex some information and to provide basic functionalities.

Warning
duplicate matching is performed in GeometryGraphBuilder (allows to modify position once it's done)

Member Typedef Documentation

template<typename VertexProperties , typename EdgeProperties >
typedef std::pair< edge_descriptor, EdgeDirection> SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::directed_edge_descriptor

An edge descriptor, with a direction.

From the vertex point of view, out edges are DIRECT, in edges are REVERSE.

template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::edge_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::edge_descriptor
template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::edge_iterator SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::edge_iterator
template<typename VertexProperties , typename EdgeProperties >
typedef EdgeProperties SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::edge_properties
template<typename VertexProperties , typename EdgeProperties >
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, vertex_properties, edge_properties > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::graph_t

the wrapped graphEdgeProperties

template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::in_edge_iterator SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::in_edge_iterator
template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::out_edge_iterator SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::out_edge_iterator
template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::vertex_descriptor
template<typename VertexProperties , typename EdgeProperties >
typedef boost::graph_traits< graph_t >::vertex_iterator SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::vertex_iterator
template<typename VertexProperties , typename EdgeProperties >
typedef VertexProperties SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::vertex_properties

Member Function Documentation

template<typename VertexProperties , typename EdgeProperties >
edge_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::addEdge ( const vertex_descriptor source,
const vertex_descriptor target,
const EdgeProperties &  properties = EdgeProperties() 
)
inline

[edge]Add an Edge to the Graph

Returns
the identifier of the vertex
template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::addVertex ( const vertex_properties properties = vertex_properties())
inline

[vertex]add a vertex to the graph

Returns
the identifier of the vertex
template<typename VertexProperties , typename EdgeProperties >
std::set< vertex_descriptor > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::adjacentVertices ( const vertex_descriptor vertex,
bool  withReverseDirection = true 
)
inline

[adjacency]Returns the list of the adjacent vertices using both DIRECT and REVERSE direction

Parameters
vertexinput vertex
withReverseDirectionindicates if in_edges are used
template<typename VertexProperties , typename EdgeProperties >
bool SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::areOpposite ( const edge_descriptor a,
const edge_descriptor b 
) const
inline

[helper]indicates if edges are opposite

template<typename VertexProperties , typename EdgeProperties >
bool SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::areParallel ( const edge_descriptor a,
const edge_descriptor b 
) const
inline

[helper]indicates if edges are opposite

template<typename VertexProperties , typename EdgeProperties >
size_t SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::degree ( const vertex_descriptor vertex) const
inline

returns the degree of a vertex

template<typename VertexProperties , typename EdgeProperties >
std::pair< edge_iterator, edge_iterator > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::edges ( ) const
inline

[iterator]return edge iterator

typename GeometryGraph<V,E>::edge_iterator it, end ;
for ( boost::tie( it, end ) = g.edges(); it != end; ++it ){
typename GeometryGraph<V,E>::edge_descriptor edge = *it ;
std::cout << g.source(edge) << "," << g.target(edge) << std::endl;
}
template<typename VertexProperties , typename EdgeProperties >
std::vector< directed_edge_descriptor > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::edges ( const vertex_descriptor a,
const vertex_descriptor b 
) const
inline

[edge]Get edges from a to b and from b to a

template<typename VertexProperties , typename EdgeProperties >
graph_t& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::graph ( )
inline

returns the wrapped boost::graph

template<typename VertexProperties , typename EdgeProperties >
const graph_t& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::graph ( ) const
inline

returns the wrapped boost::graph

template<typename VertexProperties , typename EdgeProperties >
std::vector< edge_descriptor > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::inEdges ( const vertex_descriptor vertex)
inline

[adjacency]get in edges

template<typename VertexProperties , typename EdgeProperties >
std::vector< directed_edge_descriptor > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::inOutEdges ( const vertex_descriptor vertex) const
inline

[adjacency]get in/out edges

template<typename VertexProperties , typename EdgeProperties >
size_t SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::numEdges ( ) const
inline

[edge]returns the number of vertices

template<typename VertexProperties , typename EdgeProperties >
size_t SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::numVertices ( ) const
inline

[vertex]returns the number of vertices

template<typename VertexProperties , typename EdgeProperties >
SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator const graph_t & ( void  ) const
inline

implicit cast to the wrapped boost graph in order to keep boost graph interface

template<typename VertexProperties , typename EdgeProperties >
SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator graph_t & ( void  )
inline

implicit cast to the wrapped boost graph in order to keep boost graph interface

template<typename VertexProperties , typename EdgeProperties >
const vertex_properties& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator[] ( const vertex_descriptor vertex) const
inline

returns the VertexProperties attached to a Vertex

template<typename VertexProperties , typename EdgeProperties >
vertex_properties& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator[] ( const vertex_descriptor vertex)
inline

returns the VertexProperties attached to a Vertex

template<typename VertexProperties , typename EdgeProperties >
const edge_properties& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator[] ( const edge_descriptor edge) const
inline

returns the VertexProperties attached to a Vertex

template<typename VertexProperties , typename EdgeProperties >
edge_properties& SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::operator[] ( const edge_descriptor edge)
inline

returns the VertexProperties attached to a Vertex

template<typename VertexProperties , typename EdgeProperties >
std::vector< edge_descriptor > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::outEdges ( const vertex_descriptor vertex) const
inline

[adjacency]get out edges

template<typename VertexProperties , typename EdgeProperties >
void SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::removeEdge ( const edge_descriptor edge)
inline

[edge]Remove an edge

template<typename VertexProperties , typename EdgeProperties >
void SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::removeVertex ( const vertex_descriptor vertex)
inline

[vertex]Remove a vertex (and all its adjacent edges)

template<typename VertexProperties , typename EdgeProperties >
void SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::reverse ( std::vector< edge_descriptor > &  edges)
inline

[EdgeString]revert the order of a list of edges.

Old edges are removed from the graph, new ones are created.

Warning
properties are kept but oriented one (left face, right face, etc.) are lost.
template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::source ( const edge_descriptor edge) const
inline

[edge]get the source vertex for an edge

template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::source ( const edge_descriptor edge,
const EdgeDirection direction 
) const
inline

[edge]get the source vertex for an edge

template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::source ( const directed_edge_descriptor edge) const
inline

[edge]get the source vertex for an edge with a direction

template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::target ( const edge_descriptor edge) const
inline

[edge]get the target vertex for an edge

template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::target ( const edge_descriptor edge,
const EdgeDirection direction 
) const
inline

[edge]get the target vertex for an edge with a direction

template<typename VertexProperties , typename EdgeProperties >
vertex_descriptor SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::target ( const directed_edge_descriptor edge) const
inline

[edge]get the target vertex for an edge with a direction

template<typename VertexProperties , typename EdgeProperties >
std::pair< vertex_iterator, vertex_iterator > SFCGAL::graph::GeometryGraphT< VertexProperties, EdgeProperties >::vertices ( ) const
inline

[iterator]return vertex iterator

typename GeometryGraph<V,E>::vertex_iterator it, end ;
for ( boost::tie( it, end ) = g.vertices(); it != end; ++it ){
typename GeometryGraph<V,E>::vertex_descriptor vertex = *it ;
std::cout << g[ vertex ].coordinate << std::endl;
}