All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BoxLoaderStrategy.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file BoxLoaderStrategy.cpp
22 
23  \brief This class implements the main functions necessary to
24  save and load the graph data and metadata information
25  using as strategy a bounding box to create a region
26  that defines a group of elements.
27 */
28 
29 // Terralib Includes
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"
50 #include "BoxLoaderStrategy.h"
51 
52 
54 {
55 }
56 
58 {
59 }
60 
61 
63 {
64  if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
65  {
66  throw Exception(TR_GRAPH(""));
67  }
68 
69  Vertex* vAux = 0;
70 
71  if(m_graphMetadata->getStorageMode() == te::graph::Edge_List)
72  {
73  vAux = loadVertexAttrs(vertexId);
74  }
75  else if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
76  {
77  vAux = loadVertex(vertexId);
78  }
79 
80  if(vAux == 0)
81  {
82  throw Exception(TR_GRAPH("Vertex Id not found."));
83  }
84 
85  //ONLY WORKS FOR te::graph::Edge_List
86  if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
87  {
88  throw Exception(TR_GRAPH("TO DO"));
89  }
90 
91  //get the tables names
92  std::string vertexAttrTable = m_graphMetadata->getVertexTableName();
93  std::string edgeAttrTable = m_graphMetadata->getEdgeTableName();
94 
95  //get the vertex coord
96  te::gm::Point* point = 0;
97  std::string geometryAttrName = "";
98 
99  for(int i = 0; i < m_graphMetadata->getVertexPropertySize(); ++i)
100  {
101  if(m_graphMetadata->getVertexProperty(i)->getType() == te::dt::GEOMETRY_TYPE)
102  {
103  geometryAttrName = m_graphMetadata->getVertexProperty(i)->getName();
104 
105  point = dynamic_cast<te::gm::Point*>(vAux->getAttributes()[i]);
106 
107  break;
108  }
109  }
110 
111  assert(point);
112 
113  //calculate box
114  te::gm::Envelope* envelope = calculateBox(point, vertexAttrTable);
115 
116  //get all id's from vertex and edges that is inside that box
117 
118  //filds
119  te::da::Fields* all = new te::da::Fields;
120  all->push_back(new te::da::Field("*"));
121 
122  //from
123  te::da::From* from = new te::da::From;
124 
125  te::da::FromItem* fi = new te::da::DataSetName(vertexAttrTable, "vertex");
126  from->push_back(fi);
127 
128  te::da::FromItem* fiEdge = new te::da::DataSetName(edgeAttrTable, "edge");
129  from->push_back(fiEdge);
130 
131  std::string vertexFrom = "edge.";
133 
134  std::string vertexTo = "edge.";
136 
137  std::string vId = "vertex.";
139 
140  //where
141  te::da::Field* fvf = new te::da::Field(vertexFrom);
142  te::da::Field* fv1id = new te::da::Field(vId);
143  te::da::Expression* exp1 = new te::da::EqualTo(fv1id->getExpression(), fvf->getExpression());
144 
145  te::da::Field* fvt = new te::da::Field(vertexTo);
146  te::da::Field* fv2id = new te::da::Field(vId);
147  te::da::Expression* exp2 = new te::da::EqualTo(fv2id->getExpression(), fvt->getExpression());
148 
149  te::da::Or* ora = new te::da::Or(exp1, exp2);
150 
151 
152  std::string vEttr = "vertex." + geometryAttrName;
153 
154  int srid = point->getSRID();
155  te::da::LiteralEnvelope* lenv = new te::da::LiteralEnvelope(*envelope, srid);
156  te::da::Field* fvattr = new te::da::Field(vEttr);
157  te::da::ST_Intersects* intersects = new te::da::ST_Intersects(fvattr->getExpression(), lenv);
158 
159  te::da::And* andd = new te::da::And(intersects, ora);
160 
161  te::da::Where* wh = new te::da::Where(andd);
162 
163  //select
164  te::da::Select select(all, from, wh);
165 
166  //query
167  std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
168 
169  std::auto_ptr<te::da::DataSetType> vertexDsType = m_graphMetadata->getDataSource()->getDataSetType(vertexAttrTable);
170 
171  int vertexProperties = vertexDsType->getProperties().size();
172 
173  std::string graphType = g->getMetadata()->getType();
174 
175  te::graph::Vertex* v = 0;
176 
177  int currentId = -1;
178 
179  //list of all attributes: edge table + vertex table + vertex table
180  while(dataset->moveNext())
181  {
182  int vId = dataset->getInt32(0); //first item is the vertex id
183  int eId = dataset->getInt32(vertexProperties); //first after vertexProperties item is the edge id
184  int vFrom = dataset->getInt32(vertexProperties + 1); //second after vertexPropertie item is the vertex from id
185 // int vTo = dataset->getInt32(vertexProperties + 2); //third after vertexPropertie item is the vertex to id
186 
187  if(currentId != vId)
188  {
189  //verify if its already in cache
190  if(gc->checkCacheByVertexId(vId) == false)
191  {
192  v = new te::graph::Vertex(vId, false);
193 
194  v->setAttributeVecSize(vertexProperties - 1);
195 
196  for(int i = 1; i < vertexProperties; ++i)
197  {
198  v->addAttribute(i - 1, dataset->getValue(i).release());
199  }
200 
201  g->add(v);
202  }
203 
204  currentId = vId;
205  }
206 
207  if(v)
208  {
210  {
211  if(vId == vFrom)
212  v->getSuccessors().insert(eId);
213  else
214  v->getPredecessors().insert(eId);
215  }
216 
217  //TODO for other graph types
218  }
219  }
220 
221  delete vAux;
222  delete envelope;
223 }
224 
225 
227 {
228  if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
229  {
230  throw Exception(TR_GRAPH(""));
231  }
232 
233  Edge* e = 0;
234 
235  if(m_graphMetadata->getStorageMode() == te::graph::Edge_List)
236  {
237  e = loadEdge(edgeId);
238  }
239  else if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
240  {
241  e = loadEdgeAttrs(edgeId);
242  }
243 
244  if(e == 0)
245  {
246  throw Exception(TR_GRAPH("Edge Id not found."));
247  }
248 
249  Vertex* vAux = 0;
250 
251  int vAuxId = e->getIdFrom();
252 
253  if(m_graphMetadata->getStorageMode() == te::graph::Edge_List)
254  {
255  vAux = loadVertexAttrs(vAuxId);
256  }
257  else if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
258  {
259  vAux = loadVertex(vAuxId);
260  }
261 
262  if(vAux == 0)
263  {
264  throw Exception(TR_GRAPH("Vertex Id not found."));
265  }
266 
267  delete e;
268 
269  //ONLY WORKS FOR te::graph::Edge_List
270  if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
271  {
272  throw Exception(TR_GRAPH("TO DO"));
273  }
274 
275  //get the tables names
276  std::string vertexAttrTable = m_graphMetadata->getVertexTableName();
277  std::string edgeAttrTable = m_graphMetadata->getEdgeTableName();
278 
279  //get the vertex coord
280  te::gm::Point* point = 0;
281  std::string geometryAttrName = "";
282 
283  for(int i = 0; i < m_graphMetadata->getVertexPropertySize(); ++i)
284  {
285  if(m_graphMetadata->getVertexProperty(i)->getType() == te::dt::GEOMETRY_TYPE)
286  {
287  geometryAttrName = m_graphMetadata->getVertexProperty(i)->getName();
288 
289  point = dynamic_cast<te::gm::Point*>(vAux->getAttributes()[i]);
290 
291  break;
292  }
293  }
294 
295  assert(point);
296 
297  //calculate box
298  te::gm::Envelope* envelope = calculateBox(point, vertexAttrTable);
299 
300  //get all id's from vertex and edges that is inside that box
301 
302  //filds
303  te::da::Fields* all = new te::da::Fields;
304  all->push_back(new te::da::Field("*"));
305 
306  //from
307  te::da::From* from = new te::da::From;
308 
309  te::da::FromItem* fi = new te::da::DataSetName(vertexAttrTable, "vertex");
310  from->push_back(fi);
311 
312  te::da::FromItem* fiEdge = new te::da::DataSetName(edgeAttrTable, "edge");
313  from->push_back(fiEdge);
314 
315  std::string vertexFrom = "edge.";
317 
318  std::string vertexTo = "edge.";
320 
321  std::string vId = "vertex.";
323 
324  //where
325  te::da::Field* fvf = new te::da::Field(vertexFrom);
326  te::da::Field* fv1id = new te::da::Field(vId);
327  te::da::Expression* exp1 = new te::da::EqualTo(fv1id->getExpression(), fvf->getExpression());
328 
329  te::da::Field* fvt = new te::da::Field(vertexTo);
330  te::da::Field* fv2id = new te::da::Field(vId);
331  te::da::Expression* exp2 = new te::da::EqualTo(fv2id->getExpression(), fvt->getExpression());
332 
333  te::da::Or* ora = new te::da::Or(exp1, exp2);
334 
335 
336  std::string vEttr = "vertex." + geometryAttrName;
337 
338  int srid = point->getSRID();
339  te::da::LiteralEnvelope* lenv = new te::da::LiteralEnvelope(*envelope, srid);
340  te::da::Field* fvattr = new te::da::Field(vEttr);
341  te::da::ST_Intersects* intersects = new te::da::ST_Intersects(fvattr->getExpression(), lenv);
342 
343  te::da::And* andd = new te::da::And(intersects, ora);
344 
345  te::da::Where* wh = new te::da::Where(andd);
346 
347  //select
348  te::da::Select select(all, from, wh);
349 
350  //query
351  std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
352 
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);
355 
356  int vertexProperties = vertexDsType->getProperties().size();
357  int edgeProperties = edgeDsType->getProperties().size();
358 
359  std::string graphType = g->getMetadata()->getType();
360 
361  int currentId = -1;
362 
363  //list of all attributes: edge table + vertex table + vertex table
364  while(dataset->moveNext())
365  {
366  int eId = dataset->getInt32(vertexProperties); //first after vertexProperties item is the edge id
367  int vFrom = dataset->getInt32(vertexProperties + 1); //second after vertexPropertie item is the vertex from id
368  int vTo = dataset->getInt32(vertexProperties + 2); //third after vertexPropertie item is the vertex to id
369 
370  if(currentId != eId)
371  {
372  //verify if its already in cache
373  if(gc->checkCacheByEdgeId(eId) == 0)
374  {
375  te::graph::Edge* e = new te::graph::Edge(eId, vFrom, vTo, false);
376 
377  e->setAttributeVecSize(edgeProperties - 3);
378 
379  for(int i = 3; i < edgeProperties; ++i)
380  {
381  e->addAttribute(i - 3, dataset->getValue(i + vertexProperties).release());
382  };
383 
384  g->add(e);
385  }
386 
387  currentId = eId;
388  }
389  }
390 
391  delete vAux;
392  delete envelope;
393 }
394 
395 
397 {
398  te::gm::Envelope* e = getMetadata()->getEnvelope();
399 
400  double h = e->getHeight() / (100. / getMetadata()->m_boxPercentSize);
401  double w = e->getWidth() / (100. / getMetadata()->m_boxPercentSize);
402 
403  te::gm::Envelope* env = new te::gm::Envelope();
404 
405  //env->m_llx = p->getX();
406  //env->m_urx = p->getX() + w;
407  //env->m_lly = p->getY() - h;
408  //env->m_ury = p->getY();
409 
410  env->m_llx = p->getX() - ( w / 2.);
411  env->m_urx = p->getX() + ( w / 2.);
412  env->m_lly = p->getY() - ( h / 2.);
413  env->m_ury = p->getY() + ( h / 2.);
414 
415  return env;
416 }
417 
418 
419 /*
420 void te::graph::BoxLoaderStrategy::loadDataByVertexId(int vertexId, te::graph::AbstractGraph* g, te::graph::GraphCache* gc)
421 {
422  if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
423  {
424  throw Exception(TR_GRAPH(""));
425  }
426 
427  Vertex* vAux = 0;
428 
429  if(m_graphMetadata->getStorageMode() == te::graph::Edge_List)
430  {
431  vAux = loadVertexAttrs(vertexId);
432  }
433  else if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
434  {
435  vAux = loadVertex(vertexId);
436  }
437 
438  if(vAux == 0)
439  {
440  throw Exception(TR_GRAPH("Vertex Id not found."));
441  }
442 
443  //ONLY WORKS FOR te::graph::Edge_List
444  if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
445  {
446  throw Exception(TR_GRAPH("TO DO"));
447  }
448 
449  //get the tables names
450  std::string edgeTable = m_graphMetadata->getEdgeTableName();
451  std::string vertexAttrTalbe = m_graphMetadata->getVertexTableName();
452 
453  //get the vertex coord
454  te::gm::Point* point = 0;
455  std::string geometryAttrName = "";
456 
457  for(int i = 0; i < m_graphMetadata->getVertexPropertySize(); ++i)
458  {
459  if(m_graphMetadata->getVertexProperty(i)->getType() == te::dt::GEOMETRY_TYPE)
460  {
461  geometryAttrName = m_graphMetadata->getVertexProperty(i)->getName();
462 
463  point = dynamic_cast<te::gm::Point*>(vAux->getAttributes()[i]);
464 
465  break;
466  }
467  }
468 
469  assert(point);
470 
471  //calculate box
472  te::gm::Envelope* envelope = calculateBox(point, vertexAttrTalbe);
473 
474  //get all id's from vertex and edges that is inside that box
475 
476  //filds
477  te::da::Fields* all = new te::da::Fields;
478  all->push_back(new te::da::Field("*"));
479 
480  //from
481  te::da::From* from = new te::da::From;
482 
483  te::da::FromItem* fi1 = new te::da::DataSetName(edgeTable, "edges");
484  from->push_back(fi1);
485  te::da::FromItem* fi2 = new te::da::DataSetName(vertexAttrTalbe, "v1");
486  from->push_back(fi2);
487  te::da::FromItem* fi3 = new te::da::DataSetName(vertexAttrTalbe, "v2");
488  from->push_back(fi3);
489 
490 
491  std::string vertexFrom = "edges.";
492  vertexFrom += Globals::sm_tableEdgeModelAttrVFrom;
493 
494  std::string vertexTo = "edges.";
495  vertexTo += Globals::sm_tableEdgeModelAttrVTo;
496 
497  std::string v1Id = "v1.";
498  v1Id += Globals::sm_tableVertexModelAttrId;
499 
500  std::string v2Id = "v2.";
501  v2Id += Globals::sm_tableVertexModelAttrId;
502 
503  //where
504  te::da::Field* fvf = new te::da::Field(vertexFrom);
505  te::da::Field* fv1id = new te::da::Field(v1Id);
506  te::da::Expression* exp1 = new te::da::EqualTo(fvf->getExpression(), fv1id->getExpression());
507 
508  te::da::Field* fvt = new te::da::Field(vertexTo);
509  te::da::Field* fv2id = new te::da::Field(v2Id);
510  te::da::Expression* exp2 = new te::da::EqualTo(fvt->getExpression(), fv2id->getExpression());
511 
512  te::da::And* and = new te::da::And(exp1, exp2);
513 
514 
515  std::string v1Attr = "v1." + geometryAttrName;
516  std::string v2Attr = "v2." + geometryAttrName;
517 
518  int srid = point->getSRID();
519  te::da::LiteralEnvelope* lenv1 = new te::da::LiteralEnvelope(*envelope, srid);
520  te::da::LiteralEnvelope* lenv2 = new te::da::LiteralEnvelope(*envelope, srid);
521  te::da::Field* fv1attr = new te::da::Field(v1Attr);
522  te::da::Field* fv2attr = new te::da::Field(v2Attr);
523  te::da::ST_Intersects* intersects1 = new te::da::ST_Intersects(fv1attr->getExpression(), lenv1);
524  te::da::ST_Intersects* intersects2 = new te::da::ST_Intersects(fv2attr->getExpression(), lenv2);
525  te::da::Or* or = new te::da::Or(intersects1, intersects2);
526 
527  te::da::And* andd = new te::da::And(and, or);
528 
529  te::da::Where* wh = new te::da::Where(andd);
530 
531  //select
532  te::da::Select select(all, from, wh);
533 
534  //query
535  te::da::DataSourceTransactor* transactor = m_graphMetadata->getDataSource()->getTransactor();
536 
537  if(!transactor)
538  {
539  throw Exception(TR_GRAPH("Error getting Transactor."));
540  }
541 
542  te::da::DataSourceCatalogLoader* catalog = transactor->getCatalogLoader();
543 
544  te::da::DataSet* dataset = transactor->query(select);
545  te::da::DataSetType* edgeDsType = catalog->getDataSetType(edgeTable);
546  te::da::DataSetType* vertexDsType = catalog->getDataSetType(vertexAttrTalbe);
547 
548  int edgeProperties = edgeDsType->getProperties().size();
549  int vertexProperties = vertexDsType->getProperties().size();
550 
551  //list of all attributes: edge table + vertex table + vertex table
552  while(dataset->moveNext())
553  {
554  int edgeId = dataset->getInt32(0); //first item is the edge id
555  int vFromId = dataset->getInt32(1); //second item is the vertefFrom id
556  int vToId = dataset->getInt32(2); //third item is the verteTo id
557 
558  //verify if its already in cache
559  if(gc->checkCacheByEdgeId(edgeId) == 0)
560  {
561  te::graph::Edge* e = new te::graph::Edge(edgeId, vFromId, vToId, false);
562 
563  e->setAttributeVecSize(edgeDsType->getProperties().size() - 3);
564 
565  for(size_t i = 3; i < edgeDsType->getProperties().size(); ++i)
566  {
567  e->addAttribute(i - 3, dataset->getValue(i));
568  };
569 
570  g->add(e);
571  }
572 
573  if(gc->checkCacheByVertexId(vFromId) == false)
574  {
575  te::graph::Vertex* v = new te::graph::Vertex(vFromId, false);
576 
577  v->setAttributeVecSize(vertexDsType->getProperties().size() - 1);
578 
579  for(size_t i = 1; i < vertexDsType->getProperties().size(); ++i)
580  {
581  v->addAttribute(i - 1, dataset->getValue(i + edgeProperties));
582  }
583 
584  g->add(v);
585  }
586 
587  if(gc->checkCacheByVertexId(vToId) == false)
588  {
589  te::graph::Vertex* v = new te::graph::Vertex(vToId, false);
590 
591  v->setAttributeVecSize(vertexDsType->getProperties().size() - 1);
592 
593  for(size_t i = 1; i < vertexDsType->getProperties().size(); ++i)
594  {
595  v->addAttribute(i - 1, dataset->getValue(i + edgeProperties + vertexProperties));
596  }
597 
598  g->add(v);
599  }
600  }
601 
602  delete vAux;
603  delete envelope;
604  delete dataset;
605  delete catalog;
606  delete transactor;
607 }
608 
609 
610 void te::graph::BoxLoaderStrategy::loadDataByEdgeId(int edgeId, te::graph::AbstractGraph* g, te::graph::GraphCache* gc)
611 {
612  if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
613  {
614  throw Exception(TR_GRAPH(""));
615  }
616 
617  Edge* e = 0;
618 
619  if(m_graphMetadata->getStorageMode() == te::graph::Edge_List)
620  {
621  e = loadEdge(edgeId);
622  }
623  else if(m_graphMetadata->getStorageMode() == te::graph::Vertex_List)
624  {
625  e = loadEdgeAttrs(edgeId);
626  }
627 
628  if(e == 0)
629  {
630  throw Exception(TR_GRAPH("Edge Id not found."));
631  }
632 
633  int vId = e->getIdFrom();
634 
635  delete e;
636 
637  loadDataByVertexId(vId, g, gc);
638 }
639 */
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:56
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:58
int getSRID() const
It returns the Spatial Reference System ID associated to this geometric object.
Definition: Geometry.h:189
This class define the main functions necessary to save and load the graph data and metadata informati...
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
Definition: Edge.cpp:86
A class that models the name of a dataset used in a From clause.
Definition: DataSetName.h:43
double getWidth() const
It returns the envelope width.
Definition: Envelope.h:443
Expression * getExpression() const
It returns the expression set for an output select query.
Definition: Field.cpp:80
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements.
Definition: Vertex.cpp:79
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
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.
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
Definition: GraphCache.h:60
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...
Spatial intersects operator.
Definition: ST_Intersects.h:46
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Definition: Vertex.h:68
The Field class can be used to model an expression that takes part of the output items of a SELECT...
Definition: Field.h:50
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata.
int getIdFrom()
It returns the vertex origin identification.
Definition: Edge.cpp:71
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
Definition: From.h:37
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
Definition: Edge.cpp:91
#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...
Definition: Config.h:58
double getHeight() const
It returns the envelope height.
Definition: Envelope.h:448
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Definition: Fields.h:37
#define TE_GRAPH_FACTORY_GRAPH_TYPE_BIDIRECTIONALGRAPH
Definition: Config.h:144
Boolean logic operator: AND.
Definition: And.h:46
GraphData * checkCacheByEdgeId(int id)
This functions check in cache if the edge element with a given id was alredy in memory.
Definition: GraphCache.cpp:270
const double & getX() const
It returns the Point x-coordinate value.
Definition: Point.h:136
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
Definition: Vertex.cpp:84
An abstract class that models a source of data in a query.
Definition: FromItem.h:50
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From.
Definition: Globals.h:96
virtual ~BoxLoaderStrategy()
Default destructor.
static const std::string sm_tableVertexModelAttrId
Attribute id.
Definition: Globals.h:101
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
A point with x and y coordinate values.
Definition: Point.h:50
A class that models a literal for Envelope values.
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
std::set< int > & getPredecessors()
Returns the Predecessors vector.
Definition: Vertex.cpp:101
virtual void add(Vertex *v)=0
Add a new vertex element to a graph.
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element.
Definition: Vertex.cpp:74
BoxLoaderStrategy(te::graph::GraphMetadata *metadata)
Default constructor.
Definition: Or.h:46
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.
This class implements the main functions necessary to save and load the graph data and metadata infor...
This is an abstract class that models a query expression.
Definition: Expression.h:47
GraphData * checkCacheByVertexId(int id)
This functions check in cache if the vertex element with a given id was alredy in memory...
Definition: GraphCache.cpp:246
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
std::string getType()
It returns the graph type (defined in Enums file)
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
Definition: Globals.h:97
It models the comparison operator.
Definition: EqualTo.h:46
Class used to define the graph metadata informations.
Definition: GraphMetadata.h:56
const double & getY() const
It returns the Point y-coordinate value.
Definition: Point.h:150
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
A class that can be used to model a filter expression that can be applied to a query.
Definition: Where.h:47
std::set< int > & getSuccessors()
Returns the Successors vector.
Definition: Vertex.cpp:106