27 #include "../../common/Translator.h"
28 #include "../../common/StringUtils.h"
29 #include "../../dataaccess/dataset/DataSet.h"
30 #include "../../dataaccess/datasource/DataSource.h"
31 #include "../../dataaccess/query_h.h"
32 #include "../../datatype/Property.h"
33 #include "../../geometry/Envelope.h"
34 #include "../core/AbstractGraph.h"
35 #include "../core/GraphMetadata.h"
36 #include "../Config.h"
37 #include "../Exception.h"
38 #include "../Globals.h"
61 if(m_graph == 0 || m_graph->getMetadata() == 0)
63 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
66 if(m_vertexQuery.get())
68 if(m_vertexQuery->moveFirst())
72 return m_graph->getVertex(
id);
77 std::string geometryAttrName =
"";
79 for(
int i = 0; i < m_graph->getMetadata()->getVertexPropertySize(); ++i)
83 geometryAttrName = m_graph->getMetadata()->getVertexProperty(i)->getName();
90 std::string tableName = m_graph->getMetadata()->getVertexTableName();
100 int srid = m_graph->getMetadata()->getSRID();
103 std::string vAttr = tableName +
"." + geometryAttrName;
113 ob->push_back(obItem);
117 m_vertexQuery.reset(0);
118 m_vertexQuery = m_graph->getMetadata()->getDataSource()->query(select);
120 if(m_vertexQuery.get() == 0)
122 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
127 if(m_vertexQuery->moveNext())
136 return m_graph->getVertex(
id);
141 if(m_graph == 0 || m_graph->getMetadata() == 0)
143 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
146 if(m_edgeQuery.get())
148 if(m_edgeQuery->moveFirst())
152 return m_graph->getEdge(
id);
157 std::string geometryAttrName =
"";
159 for(
int i = 0; i < m_graph->getMetadata()->getVertexPropertySize(); ++i)
163 geometryAttrName = m_graph->getMetadata()->getVertexProperty(i)->getName();
170 std::string edgeTable = m_graph->getMetadata()->getEdgeTableName();
171 std::string vertexAttrTalbe = m_graph->getMetadata()->getVertexTableName();
175 fields->push_back(f);
179 from->push_back(fi1);
181 from->push_back(fi2);
183 from->push_back(fi3);
185 std::string vertexFrom =
"edges.";
188 std::string vertexTo =
"edges.";
191 std::string v1Id =
"v1.";
194 std::string v2Id =
"v2.";
208 std::string v1Attr =
"v1." + geometryAttrName;
209 std::string v2Attr =
"v2." + geometryAttrName;
211 int srid = m_graph->getMetadata()->getSRID();
226 ob->push_back(obItem);
231 m_edgeQuery.reset(0);
232 m_edgeQuery = m_graph->getMetadata()->getDataSource()->query(select);
234 if(m_edgeQuery.get() == 0)
236 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
241 if(m_edgeQuery->moveNext())
250 return m_graph->getEdge(
id);
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
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.
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
A Select models a query to be used when retrieving data from a DataSource.
Spatial intersects operator.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
A class that models the name of any property of an object.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
#define TR_GRAPH(message)
It marks a string in order to get translated. This is a special mark used in the Graph module of Terr...
virtual ~BoxIterator()
Virtual destructor.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Boolean logic operator: AND.
An abstract class that models a source of data in a query.
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From.
static const std::string sm_tableVertexModelAttrId
Attribute id.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
BoxIterator(te::graph::AbstractGraph *g)
Default constructor.
A class that models a literal for Envelope values.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
This is an abstract class that models a query expression.
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
It models the comparison operator.
An Envelope defines a 2D rectangular region.
A class that can be used to model a filter expression that can be applied to a query.