30 #include "../../common/Translator.h" 
   31 #include "../../common/StringUtils.h" 
   32 #include "../../dataaccess/dataset/DataSet.h" 
   33 #include "../../dataaccess/dataset/DataSetType.h" 
   34 #include "../../dataaccess/datasource/DataSource.h" 
   35 #include "../../dataaccess/query_h.h" 
   36 #include "../../datatype/AbstractData.h" 
   37 #include "../../geometry/Envelope.h" 
   38 #include "../../geometry/Point.h" 
   39 #include "../core/AbstractGraph.h" 
   40 #include "../core/Edge.h" 
   41 #include "../core/EdgeProperty.h" 
   42 #include "../core/GraphCache.h" 
   43 #include "../core/GraphData.h" 
   44 #include "../core/GraphMetadata.h" 
   45 #include "../core/Vertex.h" 
   46 #include "../core/VertexProperty.h" 
   47 #include "../Config.h" 
   48 #include "../Globals.h" 
   49 #include "../Exception.h" 
   64   if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
 
   66     throw Exception(
TE_TR(
""));
 
   73     vAux =  loadVertexAttrs(vertexId);
 
   77     vAux =  loadVertex(vertexId); 
 
   82     throw Exception(
TE_TR(
"Vertex Id not found."));
 
   88     throw Exception(
TE_TR(
"TO DO"));
 
   92   std::string vertexAttrTable = m_graphMetadata->getVertexTableName();
 
   93   std::string edgeAttrTable = m_graphMetadata->getEdgeTableName();
 
   97   std::string geometryAttrName = 
"";
 
   99   for(
int i = 0; i < m_graphMetadata->getVertexPropertySize(); ++i)
 
  103       geometryAttrName = m_graphMetadata->getVertexProperty(i)->getName();
 
  129   from->push_back(fiEdge);
 
  131   std::string vertexFrom = 
"edge.";
 
  134   std::string vertexTo = 
"edge.";
 
  137   std::string vId = 
"vertex.";
 
  152   std::string vEttr = 
"vertex." + geometryAttrName;
 
  167   std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
 
  169   std::auto_ptr<te::da::DataSetType> vertexDsType = m_graphMetadata->getDataSource()->getDataSetType(vertexAttrTable);
 
  171   int vertexProperties = vertexDsType->getProperties().size();
 
  180   while(dataset->moveNext())
 
  182     int vId   = dataset->getInt32(0);                       
 
  183     int eId   = dataset->getInt32(vertexProperties);        
 
  184     int vFrom = dataset->getInt32(vertexProperties + 1);    
 
  196         for(
int i = 1; i < vertexProperties; ++i)
 
  228   if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
 
  230     throw Exception(
TE_TR(
""));
 
  237     e =  loadEdge(edgeId);
 
  241     e =  loadEdgeAttrs(edgeId);
 
  246     throw Exception(
TE_TR(
"Edge Id not found."));
 
  255     vAux =  loadVertexAttrs(vAuxId);
 
  259     vAux =  loadVertex(vAuxId); 
 
  264     throw Exception(
TE_TR(
"Vertex Id not found."));
 
  272     throw Exception(
TE_TR(
"TO DO"));
 
  276   std::string vertexAttrTable = m_graphMetadata->getVertexTableName();
 
  277   std::string edgeAttrTable = m_graphMetadata->getEdgeTableName();
 
  281   std::string geometryAttrName = 
"";
 
  283   for(
int i = 0; i < m_graphMetadata->getVertexPropertySize(); ++i)
 
  287       geometryAttrName = m_graphMetadata->getVertexProperty(i)->getName();
 
  313   from->push_back(fiEdge);
 
  315   std::string vertexFrom = 
"edge.";
 
  318   std::string vertexTo = 
"edge.";
 
  321   std::string vId = 
"vertex.";
 
  336   std::string vEttr = 
"vertex." + geometryAttrName;
 
  351   std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
 
  353   std::auto_ptr<te::da::DataSetType> vertexDsType = m_graphMetadata->getDataSource()->getDataSetType(vertexAttrTable);
 
  354   std::auto_ptr<te::da::DataSetType> edgeDsType = m_graphMetadata->getDataSource()->getDataSetType(edgeAttrTable);
 
  356   int vertexProperties = vertexDsType->getProperties().size();
 
  357   int edgeProperties = edgeDsType->getProperties().size();
 
  364   while(dataset->moveNext())
 
  366     int eId   = dataset->getInt32(vertexProperties);        
 
  367     int vFrom = dataset->getInt32(vertexProperties + 1);    
 
  368     int vTo   = dataset->getInt32(vertexProperties + 2);    
 
  379         for(
int i = 3; i < edgeProperties; ++i)
 
  381           e->
addAttribute(i - 3, dataset->getValue(i + vertexProperties).release());
 
  400   double h = e->
getHeight() / (100. / getMetadata()->m_boxPercentSize);
 
  401   double w = e->
getWidth() / (100. / getMetadata()->m_boxPercentSize);
 
int getSRID() const 
It returns the Spatial Reference System ID associated to this geometric object. 
 
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements. 
 
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements. 
 
An abstract class that models a source of data in a query. 
 
The Field class can be used to model an expression that takes part of the output items of a SELECT...
 
static const std::string sm_tableVertexModelAttrId
Attribute id. 
 
Spatial intersects operator. 
 
A class that models the name of a dataset used in a From clause. 
 
Expression * getExpression() const 
It returns the expression set for an output select query. 
 
std::set< int > & getPredecessors()
Returns the Predecessors vector. 
 
double m_urx
Upper right corner x-coordinate. 
 
double getWidth() const 
It returns the envelope width. 
 
BoxLoaderStrategy(te::graph::GraphMetadata *metadata)
Default constructor. 
 
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. 
 
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
GraphData * checkCacheByVertexId(int id)
This functions check in cache if the vertex element with a given id was alredy in memory...
 
virtual void add(Vertex *v)=0
Add a new vertex element to a graph. 
 
Boolean logic operator: AND. 
 
This is an abstract class that models a query expression. 
 
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
 
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata. 
 
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
 
double m_llx
Lower left corner x-coordinate. 
 
const double & getY() const 
It returns the Point y-coordinate value. 
 
A point with x and y coordinate values. 
 
An Envelope defines a 2D rectangular region. 
 
Abstract class used to define the main functions of graph struct. All graph implementations must used...
 
This class implements the main functions necessary to save and load the graph data and metadata infor...
 
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers. 
 
A class that can be used to model a filter expression that can be applied to a query. 
 
This class define the main functions necessary to save and load the graph data and metadata informati...
 
std::set< int > & getSuccessors()
Returns the Successors vector. 
 
int getIdFrom()
It returns the vertex origin identification. 
 
A Select models a query to be used when retrieving data from a DataSource. 
 
boost::ptr_vector< FromItem > From
It models the FROM clause for a query. 
 
double m_lly
Lower left corner y-coordinate. 
 
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
 
virtual ~BoxLoaderStrategy()
Default destructor. 
 
GraphData * checkCacheByEdgeId(int id)
This functions check in cache if the edge element with a given id was alredy in memory. 
 
double m_ury
Upper right corner y-coordinate. 
 
It models the comparison operator. 
 
A class that models a literal for Envelope values. 
 
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. 
 
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element. 
 
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From. 
 
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element. 
 
te::gm::Envelope * calculateBox(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 g...
 
double getHeight() const 
It returns the envelope height. 
 
#define TE_GRAPH_FACTORY_GRAPH_TYPE_BIDIRECTIONALGRAPH
 
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To. 
 
const double & getX() const 
It returns the Point x-coordinate value.