te::graph::BoxLoaderStrategy Class Reference

This class implements the main functions necessary to save and load the graph data and metadata information using as strategy a bounding box to create a region that defines a group of elements. More...

#include <BoxLoaderStrategy.h>

Inheritance diagram for te::graph::BoxLoaderStrategy:
te::graph::AbstractGraphLoaderStrategy

Public Member Functions

 BoxLoaderStrategy (te::graph::GraphMetadata *metadata)
 Default constructor. More...
 
virtual ~BoxLoaderStrategy ()
 Default destructor. More...
 
Database Box Graph Loader Strategy Methods

Method used to manager a graph data

virtual void loadDataByVertexId (int vertexId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)
 Functio used to load a group of vertex elements given a base element. More...
 
virtual void loadDataByEdgeId (int edgeId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)
 Functio used to load a group of edges elements given a base element. More...
 

Protected Member Functions

te::gm::EnvelopecalculateBox (te::gm::Point *p, std::string tableName)
 Generate a box with p as center. The new box will have n% of the total graph height and n% of total graph width. More...
 

Protected Attributes

te::graph::GraphMetadatam_graphMetadata
 Graph metadata attribute. More...
 

Abstract Graph Loader Strategy Methods

Method used to manager a graph data

virtual void saveData (GraphData *data)
 Save the graph data structure in Data Source. More...
 
virtual void removeEdge (int id)
 Function used to remove a edge saved in a data source. More...
 
virtual void removeVertex (int id)
 Function used to remove a vertex saved in a data source. More...
 
te::graph::GraphMetadatagetMetadata ()
 It returns a pointer to a class that describes the graph metadata. More...
 
void saveGraphEdgeList (GraphData *data)
 Used to save the edge elements from a graph data. More...
 
void saveVertexAttributes (GraphData *data)
 Used to save the vertex elements attributes from a graph data. More...
 
void saveGraphVertexList (GraphData *data)
 Used to save the vertex elements from a graph data. More...
 
void saveEdgeAttributes (GraphData *data)
 Used to save the edges elements attributes from a graph data. More...
 
VertexloadVertex (int id)
 Function used to load one vertex given a ID. More...
 
VertexloadVertexAttrs (int id)
 Function used to load one vertex given a ID. More...
 
EdgeloadEdge (int id)
 Function used to load one edge given a ID. More...
 
EdgeloadEdgeAttrs (int id)
 Function used to load one edge given a ID. More...
 

Detailed Description

This class implements the main functions necessary to save and load the graph data and metadata information using as strategy a bounding box to create a region that defines a group of elements.

See also
AbstractGraphLoaderStrategy

Definition at line 74 of file BoxLoaderStrategy.h.

Constructor & Destructor Documentation

te::graph::BoxLoaderStrategy::BoxLoaderStrategy ( te::graph::GraphMetadata metadata)

Default constructor.

Definition at line 53 of file BoxLoaderStrategy.cpp.

References ~BoxLoaderStrategy().

te::graph::BoxLoaderStrategy::~BoxLoaderStrategy ( )
virtualdefault

Default destructor.

Referenced by BoxLoaderStrategy().

Member Function Documentation

te::gm::Envelope * te::graph::BoxLoaderStrategy::calculateBox ( te::gm::Point p,
std::string  tableName 
)
protected

Generate a box with p as center. The new box will have n% of the total graph height and n% of total graph width.

Parameters
pTerralib object that defines a geometric point.
tableNameAttribute used to define the table name that contains the graph elements
Returns
Terralib object that defines geometric region.

Definition at line 392 of file BoxLoaderStrategy.cpp.

References te::graph::GraphMetadata::getEnvelope(), te::gm::Envelope::getHeight(), te::graph::AbstractGraphLoaderStrategy::getMetadata(), te::gm::Envelope::getWidth(), te::gm::Point::getX(), te::gm::Point::getY(), te::graph::GraphMetadata::m_boxPercentSize, te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, te::gm::Envelope::m_urx, and te::gm::Envelope::m_ury.

Referenced by loadDataByEdgeId(), and loadDataByVertexId().

te::graph::GraphMetadata * te::graph::AbstractGraphLoaderStrategy::getMetadata ( )
inherited

It returns a pointer to a class that describes the graph metadata.

Returns
A valid pointer if exists and null pointer in other case

Definition at line 62 of file AbstractGraphLoaderStrategy.cpp.

References te::graph::AbstractGraphLoaderStrategy::m_graphMetadata.

Referenced by calculateBox(), te::graph::Graph::Graph(), and te::graph::GraphCache::GraphCache().

void te::graph::BoxLoaderStrategy::loadDataByEdgeId ( int  edgeId,
te::graph::AbstractGraph g,
te::graph::GraphCache gc = 0 
)
virtual

Functio used to load a group of edges elements given a base element.

Parameters
edgeIdAttribute used to identify the base element
gPointer to a graph, parent of this element
gcThis is a optional attribute, if present the cache will be check if the already been loaded

Implements te::graph::AbstractGraphLoaderStrategy.

Definition at line 223 of file BoxLoaderStrategy.cpp.

References te::graph::AbstractGraph::add(), te::graph::Edge::addAttribute(), calculateBox(), te::graph::GraphCache::checkCacheByEdgeId(), te::graph::Edge_List, te::dt::GEOMETRY_TYPE, te::graph::Vertex::getAttributes(), te::da::DataSource::getDataSetType(), te::graph::GraphMetadata::getDataSource(), te::graph::GraphMetadata::getEdgeTableName(), te::da::Field::getExpression(), te::graph::Edge::getIdFrom(), te::graph::AbstractGraph::getMetadata(), te::dt::Property::getName(), te::gm::Geometry::getSRID(), te::graph::GraphMetadata::getStorageMode(), te::graph::GraphMetadata::getType(), te::dt::Property::getType(), te::graph::GraphMetadata::getVertexProperty(), te::graph::GraphMetadata::getVertexPropertySize(), te::graph::GraphMetadata::getVertexTableName(), te::graph::AbstractGraphLoaderStrategy::loadEdge(), te::graph::AbstractGraphLoaderStrategy::loadEdgeAttrs(), te::graph::AbstractGraphLoaderStrategy::loadVertex(), te::graph::AbstractGraphLoaderStrategy::loadVertexAttrs(), te::graph::AbstractGraphLoaderStrategy::m_graphMetadata, te::da::DataSource::query(), te::graph::Edge::setAttributeVecSize(), te::graph::Globals::sm_tableEdgeModelAttrVFrom, te::graph::Globals::sm_tableEdgeModelAttrVTo, te::graph::Globals::sm_tableVertexModelAttrId, TE_TR, and te::graph::Vertex_List.

void te::graph::BoxLoaderStrategy::loadDataByVertexId ( int  vertexId,
te::graph::AbstractGraph g,
te::graph::GraphCache gc = 0 
)
virtual

Functio used to load a group of vertex elements given a base element.

Parameters
vertexIdAttribute used to identify the base element
gPointer to a graph, parent of this element
gcThis is a optional attribute, if present the cache will be check if the already been loaded

Implements te::graph::AbstractGraphLoaderStrategy.

Definition at line 59 of file BoxLoaderStrategy.cpp.

References te::graph::AbstractGraph::add(), te::graph::Vertex::addAttribute(), calculateBox(), te::graph::GraphCache::checkCacheByVertexId(), te::graph::Edge_List, te::dt::GEOMETRY_TYPE, te::graph::Vertex::getAttributes(), te::da::DataSource::getDataSetType(), te::graph::GraphMetadata::getDataSource(), te::graph::GraphMetadata::getEdgeTableName(), te::da::Field::getExpression(), te::graph::AbstractGraph::getMetadata(), te::dt::Property::getName(), te::graph::Vertex::getPredecessors(), te::gm::Geometry::getSRID(), te::graph::GraphMetadata::getStorageMode(), te::graph::Vertex::getSuccessors(), te::graph::GraphMetadata::getType(), te::dt::Property::getType(), te::graph::GraphMetadata::getVertexProperty(), te::graph::GraphMetadata::getVertexPropertySize(), te::graph::GraphMetadata::getVertexTableName(), te::graph::AbstractGraphLoaderStrategy::loadVertex(), te::graph::AbstractGraphLoaderStrategy::loadVertexAttrs(), te::graph::AbstractGraphLoaderStrategy::m_graphMetadata, te::da::DataSource::query(), te::graph::Vertex::setAttributeVecSize(), te::graph::Globals::sm_tableEdgeModelAttrVFrom, te::graph::Globals::sm_tableEdgeModelAttrVTo, te::graph::Globals::sm_tableVertexModelAttrId, TE_GRAPH_FACTORY_GRAPH_TYPE_BIDIRECTIONALGRAPH, TE_TR, and te::graph::Vertex_List.

te::graph::Edge * te::graph::AbstractGraphLoaderStrategy::loadEdge ( int  id)
protectedinherited
te::graph::Edge * te::graph::AbstractGraphLoaderStrategy::loadEdgeAttrs ( int  id)
protectedinherited

Function used to load one edge given a ID.

Parameters
idThe edge identifier
Note
This function is used in case the graph was saved using the vertex list
Returns
A valid vertex pointer if the element was found and a null pointer in other case

Definition at line 414 of file AbstractGraphLoaderStrategy.cpp.

References TE_TR.

Referenced by loadDataByEdgeId().

te::graph::Vertex * te::graph::AbstractGraphLoaderStrategy::loadVertex ( int  id)
protectedinherited

Function used to load one vertex given a ID.

Parameters
idThe vertex identifier
Note
This function is used in case the graph was saved using the vertex list
Returns
A valid vertex pointer if the element was found and a null pointer in other case

Definition at line 314 of file AbstractGraphLoaderStrategy.cpp.

References TE_TR.

Referenced by loadDataByEdgeId(), and loadDataByVertexId().

te::graph::Vertex * te::graph::AbstractGraphLoaderStrategy::loadVertexAttrs ( int  id)
protectedinherited

Function used to load one vertex given a ID.

Parameters
idThe vertex identifier
Note
This function is used in case the graph was saved using the edge list
Returns
A valid vertex pointer if the element was found and a null pointer in other case

Definition at line 320 of file AbstractGraphLoaderStrategy.cpp.

References te::graph::Vertex::addAttribute(), te::common::Convert2String(), te::da::DataSource::getDataSetType(), te::graph::GraphMetadata::getDataSource(), te::graph::GraphMetadata::getVertexTableName(), te::graph::AbstractGraphLoaderStrategy::m_graphMetadata, te::da::DataSource::query(), te::graph::Vertex::setAttributeVecSize(), and te::graph::Globals::sm_tableVertexModelAttrId.

Referenced by loadDataByEdgeId(), and loadDataByVertexId().

void te::graph::AbstractGraphLoaderStrategy::removeEdge ( int  id)
virtualinherited

Function used to remove a edge saved in a data source.

Parameters
idThe edge identifier

Reimplemented in te::graph::BottomUpLoaderStrategy, and te::graph::TopDownLoaderStrategy.

Definition at line 81 of file AbstractGraphLoaderStrategy.cpp.

References te::graph::GraphMetadata::getDataSource(), te::graph::AbstractGraphLoaderStrategy::m_graphMetadata, and TE_TR.

Referenced by te::graph::GraphDataManager::removeEdge().

void te::graph::AbstractGraphLoaderStrategy::removeVertex ( int  id)
virtualinherited

Function used to remove a vertex saved in a data source.

Parameters
idThe vertex identifier

Reimplemented in te::graph::BottomUpLoaderStrategy, and te::graph::TopDownLoaderStrategy.

Definition at line 89 of file AbstractGraphLoaderStrategy.cpp.

References te::graph::GraphMetadata::getDataSource(), te::graph::AbstractGraphLoaderStrategy::m_graphMetadata, and TE_TR.

Referenced by te::graph::GraphDataManager::removeVertex().

void te::graph::AbstractGraphLoaderStrategy::saveData ( GraphData data)
virtualinherited
void te::graph::AbstractGraphLoaderStrategy::saveEdgeAttributes ( GraphData data)
protectedinherited

Used to save the edges elements attributes from a graph data.

Parameters
dataPointer to a valid graph data

Definition at line 308 of file AbstractGraphLoaderStrategy.cpp.

References TE_TR.

void te::graph::AbstractGraphLoaderStrategy::saveGraphVertexList ( GraphData data)
protectedinherited

Used to save the vertex elements from a graph data.

Parameters
dataPointer to a valid graph data

Definition at line 302 of file AbstractGraphLoaderStrategy.cpp.

References TE_TR.

Member Data Documentation


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