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(
TE_TR(
"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(
TE_TR(
"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(
TE_TR(
"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(
TE_TR(
"Iterator not initialized."));
241 if(m_edgeQuery->moveNext())
250 return m_graph->getEdge(
id);
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.
virtual ~BoxIterator()
Virtual destructor.
Spatial intersects operator.
A class that models the name of a dataset used in a From clause.
A class that models the name of any property of an object.
Expression * getExpression() const
It returns the expression set for an output select query.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
#define TE_TR(message)
It marks a string in order to get translated.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of 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...
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
An Envelope defines a 2D rectangular region.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
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.
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.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
BoxIterator(te::graph::AbstractGraph *g)
Default constructor.
It models the comparison operator.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
A class that models a literal for Envelope values.
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.