BufferQuery.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 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 BufferQuery.h
22 
23  \brief Buffer Vector Processing functions.
24 */
25 
26 //Terralib
27 
28 #include "../core/logger/Logger.h"
29 #include "../core/translator/Translator.h"
30 
31 #include "../dataaccess/dataset/DataSet.h"
32 #include "../dataaccess/dataset/DataSetAdapter.h"
33 #include "../dataaccess/dataset/DataSetTypeConverter.h"
34 
35 #include "../datatype/Property.h"
36 #include "../datatype/SimpleProperty.h"
37 #include "../datatype/StringProperty.h"
38 
39 #include "../dataaccess/dataset/ObjectIdSet.h"
40 #include "../dataaccess/query/And.h"
41 #include "../dataaccess/query/Cast.h"
42 #include "../dataaccess/query/DataSetName.h"
43 #include "../dataaccess/query/Expression.h"
44 #include "../dataaccess/query/Field.h"
45 #include "../dataaccess/query/Fields.h"
46 #include "../dataaccess/query/From.h"
47 #include "../dataaccess/query/FromItem.h"
48 #include "../dataaccess/query/IsNull.h"
49 #include "../dataaccess/query/LiteralDouble.h"
50 #include "../dataaccess/query/LiteralInt32.h"
51 #include "../dataaccess/query/Not.h"
52 #include "../dataaccess/query/NotEqualTo.h"
53 #include "../dataaccess/query/Or.h"
54 #include "../dataaccess/query/PropertyName.h"
55 #include "../dataaccess/query/Select.h"
56 #include "../dataaccess/query/ST_Buffer.h"
57 #include "../dataaccess/query/ST_Difference.h"
58 #include "../dataaccess/query/ST_Transform.h"
59 #include "../dataaccess/query/Where.h"
60 #include "../dataaccess/utils/Utils.h"
61 
62 #include "../geometry/Geometry.h"
63 #include "../geometry/GeometryCollection.h"
64 #include "../geometry/GeometryProperty.h"
65 #include "../geometry/Utils.h"
66 
67 #include "../memory/DataSet.h"
68 #include "../memory/DataSetItem.h"
69 
70 #include "../sam/rtree.h"
71 
72 #include "BufferQuery.h"
73 #include "Config.h"
74 #include "Exception.h"
75 #include "Utils.h"
76 
77 // STL
78 #include <map>
79 #include <cmath>
80 #include <string>
81 #include <vector>
82 
83 // BOOST
84 #include <boost/lexical_cast.hpp>
85 #include <boost/algorithm/string.hpp>
86 
88 
90 
91 bool te::vp::BufferQuery::run() throw(te::common::Exception)
92 {
93  te::da::Fields* fields = new te::da::Fields;
94 
95  std::vector<te::dt::Property*> props = m_converter->getResult()->getProperties();
96 
98  {
99  for(std::size_t i=0; i < props.size(); ++i)
100  {
101  if(props[i]->getType() != te::dt::GEOMETRY_TYPE)
102  {
103  te::da::Field* f_props = new te::da::Field(te::da::PropertyName(props[i]->getName()));
104  fields->push_back(f_props);
105  }
106  }
107  }
108 
110  int sourceSRID = geom->getSRID();
111 
112  te::da::Expression* e_buffer = 0;
113  te::da::Expression* e_aux = 0;
114  te::da::Expression* e_distance = 0;
115 
116  te::da::Field* f_buffer = 0;
117  te::da::Field* f_distance = 0;
118 
119  for(int i=1; i <= m_levels; ++i)
120  {
121  std::stringstream ss;
122  ss << i;
123  std::string index = ss.str();
124 
125  //buffer
126  te::da::Expression* e_buffer1 = 0;
127  te::da::Expression* e_buffer2 = 0;
128 
130  {
131  if(m_attributePosition >= 0 && m_attributePosition < (int)props.size())
132  {
133  std::string distancePropName = props[m_attributePosition]->getName();
134  e_distance = new te::da::PropertyName(distancePropName + "*" + boost::lexical_cast<std::string>(i));
135 
136  if(sourceSRID == m_newSRID)
137  {
138  e_buffer1 = new te::da::ST_Buffer(
139  te::da::PropertyName(geom->getName()),
140  distancePropName + "*" + boost::lexical_cast<std::string>(i));
141  e_buffer2 = new te::da::ST_Buffer(
142  te::da::PropertyName(geom->getName()),
143  "-" + distancePropName + "*" + boost::lexical_cast<std::string>(i));
144  }
145  else
146  {
147  e_buffer1 = new te::da::ST_Buffer(
149  distancePropName + "*" + boost::lexical_cast<std::string>(i));
150  e_buffer2 = new te::da::ST_Buffer(
152  "-" + distancePropName + "*" + boost::lexical_cast<std::string>(i));
153  }
154  }
155  else
156  {
157  e_distance = new te::da::LiteralDouble(m_distance*i);
158  if(sourceSRID == m_newSRID)
159  {
160  e_buffer1 = new te::da::ST_Buffer(te::da::PropertyName(geom->getName()), m_distance*i);
161  e_buffer2 = new te::da::ST_Buffer(te::da::PropertyName(geom->getName()), -m_distance*i);
162  }
163  else
164  {
165  e_buffer1 = new te::da::ST_Buffer(
167  e_buffer2 = new te::da::ST_Buffer(
169  }
170  }
171 
172  e_buffer = new te::da::ST_Difference(e_buffer1, e_buffer2);
173 
174  f_distance = new te::da::Field(*e_distance, "distance");
175  f_buffer = new te::da::Field(*e_buffer, "geom"+index);
176  }
178  {
179  if(m_attributePosition >= 0 && m_attributePosition < (int)props.size())
180  {
181  std::string distancePropName = props[m_attributePosition]->getName();
182  e_distance = new te::da::PropertyName(distancePropName + "*" + boost::lexical_cast<std::string>(i));
183  if(sourceSRID == m_newSRID)
184  {
185  e_buffer1 = new te::da::ST_Buffer(
186  te::da::PropertyName(geom->getName()),
187  distancePropName + "*" + boost::lexical_cast<std::string>(i));
188  }
189  else
190  {
191  e_buffer1 = new te::da::ST_Buffer(
193  distancePropName + "*" + boost::lexical_cast<std::string>(i));
194  }
195  }
196  else
197  {
198  e_distance = new te::da::LiteralDouble(m_distance*i);
199  if(sourceSRID == m_newSRID)
200  e_buffer1 = new te::da::ST_Buffer(te::da::PropertyName(geom->getName()), m_distance*i);
201  else
202  e_buffer1 = new te::da::ST_Buffer(
204  }
205 
206  if(sourceSRID == m_newSRID)
207  e_buffer2 = new te::da::PropertyName(geom->getName());
208  else
209  e_buffer2 = new te::da::ST_Transform(te::da::PropertyName(geom->getName()), m_newSRID);
210 
211  e_buffer = new te::da::ST_Difference(e_buffer1, e_buffer2);
212 
213  f_distance = new te::da::Field(*e_distance, "distance");
214  f_buffer = new te::da::Field(*e_buffer, "geom"+index);
215  }
216  else
217  {
218  if(m_attributePosition >= 0 && m_attributePosition < (int)props.size())
219  {
220  std::string distancePropName = props[m_attributePosition]->getName();
221  e_distance = new te::da::PropertyName(distancePropName + "*" + boost::lexical_cast<std::string>(i));
222  if(sourceSRID == m_newSRID)
223  e_buffer1 = new te::da::ST_Buffer(
224  te::da::PropertyName(geom->getName()),
225  "-" + distancePropName + "*" + boost::lexical_cast<std::string>(i));
226  else
227  e_buffer1 = new te::da::ST_Buffer(
229  "-" + distancePropName + "*" + boost::lexical_cast<std::string>(i));
230  }
231  else
232  {
233  e_distance = new te::da::LiteralDouble(m_distance*i);
234  if(sourceSRID == m_newSRID)
235  e_buffer1 = new te::da::ST_Buffer(
237  else
238  e_buffer1 = new te::da::ST_Buffer(
240  }
241 
242  if(sourceSRID == m_newSRID)
243  e_buffer2 = new te::da::PropertyName(geom->getName());
244  else
245  e_buffer2 = new te::da::ST_Transform(te::da::PropertyName(geom->getName()), m_newSRID);
246 
247  e_buffer = new te::da::ST_Difference(e_buffer2, e_buffer1);
248 
249  f_distance = new te::da::Field(*e_distance, "distance");
250  f_buffer = new te::da::Field(*e_buffer, "geom"+index);
251  }
252 
253  if(!e_aux)
254  {
255  fields->push_back(f_buffer);
256  e_aux = e_buffer;
257  }
258  else
259  {
260  te::da::Expression* e_diff = new te::da::ST_Difference(e_buffer, e_aux);
261  f_buffer = new te::da::Field(*e_diff, "geom"+index);
262  fields->push_back(f_buffer);
263  e_aux = e_buffer;
264  }
265 
266  fields->push_back(f_distance);
267  }
268 
269  te::da::FromItem* fromItem = new te::da::DataSetName(m_converter->getResult()->getName());
270  te::da::From* from = new te::da::From;
271  from->push_back(fromItem);
272 
273  te::da::Where* where = 0;
274 
275  if(m_attributePosition >= 0 && m_attributePosition < (int)props.size())
276  {
277  te::da::PropertyName propName(props[m_attributePosition]->getName());
278 
279  te::da::LiteralInt32 literalZero(0);
280  te::da::NotEqualTo notEqualTo(propName, literalZero);
281 
282  te::da::IsNull isNull(propName);
283  te::da::Not isNot(isNull);
284 
285  te::da::Or or_ex(notEqualTo, isNot);
286 
287  if(m_oidSet)
288  {
289  te::da::And and_ex(or_ex, *m_oidSet->getExpression());
290  where = new te::da::Where(and_ex);
291  }
292  else
293  {
294  where = new te::da::Where(or_ex);
295  }
296  }
297  else
298  {
299  if(m_oidSet)
300  where = new te::da::Where(m_oidSet->getExpression());
301  }
302 
303  te::da::Select select(fields, from, where);
304  std::unique_ptr<te::da::DataSet> dsQuery = m_inDsrc->query(select);
305 
306  std::unique_ptr<te::da::DataSetType> outDSType(GetDataSetType());
307  std::unique_ptr<te::mem::DataSet> outDSet(new te::mem::DataSet(outDSType.get()));
308 
310  {
311  std::vector<std::vector<te::gm::Geometry*> > vecDissolvedGeom = dissolveQuery(dsQuery.get(), m_levels);
312  prepareDataSet(vecDissolvedGeom, outDSet.get(), sourceSRID, m_distance);
313  }
314  else
315  {
316  prepareDataSet(dsQuery.get(), outDSet.get(), sourceSRID);
317  }
318 
319 // Converter to use SRID from layer.
320  te::gm::GeometryProperty* geomPropertyLayer = te::da::GetFirstGeomProperty(m_converter->getResult());
321  int layerSRID = geomPropertyLayer->getSRID();
322 
323  te::da::DataSetTypeConverter* converter = new te::da::DataSetTypeConverter(outDSType.get(), m_outDsrc->getCapabilities(), m_outDsrc->getEncoding());
324  te::da::AssociateDataSetTypeConverterSRID(converter, layerSRID);
325  te::da::DataSetType* dsTypeResult = converter->getResult();
326  std::unique_ptr<te::da::DataSetAdapter> dsAdapter(te::da::CreateAdapter(outDSet.get(), converter));
327 
328  te::vp::Save(m_outDsrc.get(), dsAdapter.get(), dsTypeResult);
329  return true;
330 
331 }
332 
333 std::vector<std::vector<te::gm::Geometry*> > te::vp::BufferQuery::dissolveQuery(te::da::DataSet* dsQuery,
334  const int& levels)
335 {
336  std::vector<std::vector<te::gm::Geometry*> > vecGeom;
337 
338  for(int i = 0; i < levels*2; ++i)
339  {
341 
342  dsQuery->moveBeforeFirst();
343  while(dsQuery->moveNext())
344  {
345  if (dsQuery->isNull(i))
346  continue;
347 
348  te::gm::Geometry* geom = dsQuery->getGeometry(i).release();
349 
350  std::vector<te::gm::Geometry*> vec;
351 
352  rtree.search(*(geom->getMBR()), vec);
353 
354  if(!vec.empty())
355  {
356  for(std::size_t t = 0; t < vec.size(); ++t)
357  {
358  if(geom->intersects(vec[t]))
359  {
360  geom = geom->Union(vec[t]);
361  rtree.remove(*(vec[t]->getMBR()), vec[t]);
362  }
363  }
364  }
365  rtree.insert(*(geom->getMBR()), geom);
366  }
367 
368  std::vector<te::gm::Geometry*> geomVec;
369  std::unique_ptr<te::gm::Envelope> e = dsQuery->getExtent(i);
370  rtree.search(*(e.get()), geomVec);
371  vecGeom.push_back(geomVec);
372 
373  rtree.clear();
374  ++i; //Because the next position is de distance of buffer.
375  }
376 
377  std::size_t vecSize = vecGeom.size();
378 
379  if(levels > 1)
380  {
381  for(std::size_t i = vecSize - 1; i > 0; --i)
382  {
383  std::vector<te::gm::Geometry*> currentVec = vecGeom[i];
384  std::size_t c_vecSize = currentVec.size();
385 
386  for(std::size_t j = 0; j < i; ++j)
387  {
388  std::vector<te::gm::Geometry*> innerVec = vecGeom[j];
389  std::size_t i_vecSize = innerVec.size();
390 
391  for(std::size_t k = 0; k < c_vecSize; ++k)
392  {
393  for(std::size_t l = 0; l < i_vecSize; ++l)
394  {
395  te::gm::Geometry* k_geom = currentVec[k];
396  te::gm::Geometry* l_geom = innerVec[l];
397 
398  if(k_geom->intersects(l_geom))
399  {
400  te::gm::Geometry* tGeom = k_geom->difference(l_geom);
401  if(tGeom->isValid())
402  {
403  delete currentVec[k];
404  currentVec[k] = tGeom;
405  vecGeom[i] = currentVec;
406  }
407  }
408  }
409  }
410  }
411  }
412  }
413 
414  return vecGeom;
415 }
416 
418  te::mem::DataSet* outputDataSet,
419  const int& sourceSRID)
420 {
421  std::size_t numProps = dataSetQuery->getNumProperties();
422  std::size_t firstGeomPos = te::da::GetFirstSpatialPropertyPos(dataSetQuery);
423  int numItems = (int)numProps - (int)firstGeomPos;
424  int pk = 0;
425  dataSetQuery->moveBeforeFirst();
426 
427  unsigned int type;
428 
429  while(dataSetQuery->moveNext())
430  {
431  int level = 1;
432 
433  for(int i = 0; i < numItems; ++i)
434  {
435  te::mem::DataSetItem* dataSetItem = new te::mem::DataSetItem(outputDataSet);
436 
437  for(std::size_t j = 0; j < numProps; ++j)
438  {
439  type = dataSetQuery->getPropertyDataType(j);
440 
441  if(dataSetQuery->isNull(j))
442  continue;
443 
444  switch (type){
445  case te::dt::INT32_TYPE:
446  dataSetItem->setInt32(j+3, dataSetQuery->getInt32(j));
447  break;
448  case te::dt::INT64_TYPE:
449  dataSetItem->setInt64(j+3, dataSetQuery->getInt64(j));
450  break;
451  case te::dt::DOUBLE_TYPE:
452  dataSetItem->setDouble(j+3, dataSetQuery->getDouble(j));
453  break;
454  case te::dt::STRING_TYPE:
455  dataSetItem->setString(j+3, dataSetQuery->getString(j));
456  break;
458  dataSetItem->setNumeric(j+3, dataSetQuery->getNumeric(j));
459  break;
461  {
462  dataSetItem->setInt32(0, pk); //pk
463  dataSetItem->setInt32(1, level); //level
464 
465  double distance = 0;
466  unsigned int typeDistance = dataSetQuery->getPropertyDataType(j+i+1);
467  switch (typeDistance){
468  case te::dt::INT32_TYPE:
469  distance = (double)dataSetQuery->getInt32(j+i+1);
470  dataSetItem->setDouble(2, distance);
471  break;
472  case te::dt::INT64_TYPE:
473  distance = (double)dataSetQuery->getInt64(j+i+1);
474  dataSetItem->setDouble(2, distance);
475  break;
477  {
478  std::string strDistance = dataSetQuery->getNumeric(j+i+1);
479  distance = boost::lexical_cast<double>(strDistance);
480  dataSetItem->setDouble(2, distance);
481  }
482  break;
483  case te::dt::DOUBLE_TYPE:
484  distance = dataSetQuery->getDouble(j+i+1);
485  dataSetItem->setDouble(2, distance);
486  break;
487  default:
488  dataSetItem->setDouble(2, distance);
489  break;
490  }
491 
492  std::unique_ptr<te::gm::Geometry> geom = dataSetQuery->getGeometry(j+i);
493 
494  if(geom->isValid())
495  {
496  if(geom->getSRID() != sourceSRID)
497  geom->transform(sourceSRID);
498 
499  if(geom->getGeomTypeId() == te::gm::MultiPolygonType)
500  {
501  dataSetItem->setGeometry(j+3, geom.release());
502  }
503  else
504  {
505  std::unique_ptr<te::gm::GeometryCollection> mPolygon(new te::gm::GeometryCollection(0, te::gm::MultiPolygonType, geom->getSRID()));
506  mPolygon->add(geom.release());
507  dataSetItem->setGeometry(j+3, mPolygon.release());
508  }
509 
510  outputDataSet->add(dataSetItem);
511 
512  ++pk;
513  }
514 
515  ++level;
516  j = numProps;
517  ++i;
518  }
519  break;
520  default:
521  TE_LOG_INFO("Vector Processing - Buffer - Type not found.");
522  break;
523  }
524  }
525  }
526  }
527 }
528 
529 void te::vp::BufferQuery::prepareDataSet(std::vector<std::vector<te::gm::Geometry*> > vecDissolvedGeom,
530  te::mem::DataSet* outputDataSet,
531  const int& sourceSRID,
532  const double& distance)
533 {
534  int pk = 0;
535 
536  for(std::size_t i = 0; i < vecDissolvedGeom.size(); ++i)
537  {
538  std::vector<te::gm::Geometry*> vecGeom = vecDissolvedGeom[i];
539  std::size_t sizeVecGeom = vecGeom.size();
540 
541  for(std::size_t j=0; j < sizeVecGeom; ++j)
542  {
543  te::mem::DataSetItem* dataSetItem = new te::mem::DataSetItem(outputDataSet);
544  dataSetItem->setInt32(0, pk); //pk
545  dataSetItem->setInt32(1, (int)i+1); //level
546  dataSetItem->setDouble(2, distance*((int)i+1)); //distance
547 
548  std::unique_ptr<te::gm::Geometry> geom(vecGeom[j]);
549 
550  if(geom->getSRID() != sourceSRID)
551  geom->transform(sourceSRID);
552 
553  if(geom->getGeomTypeId() == te::gm::MultiPolygonType)
554  {
555  dataSetItem->setGeometry(3, geom.release());
556  }
557  else
558  {
559  std::unique_ptr<te::gm::GeometryCollection> mPolygon(new te::gm::GeometryCollection(0, te::gm::MultiPolygonType, geom->getSRID()));
560  mPolygon->add(geom.release());
561  dataSetItem->setGeometry(3, mPolygon.release());
562  }
563 
564  outputDataSet->add(dataSetItem);
565 
566  ++pk;
567  }
568  }
569 }
An exception class for the Vector processing module.
bool remove(const te::gm::Envelope &mbr, const DATATYPE &data)
It removes an item from the tree.
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
virtual Geometry * difference(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set difference with another geometry...
Geometric property.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value.
double m_distance
The fixed distance.
Definition: BufferOp.h:142
An abstract class that models a source of data in a query.
Definition: FromItem.h:50
The Field class can be used to model an expression that takes part of the output items of a SELECT...
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
A class that models the name of a dataset used in a From clause.
Definition: DataSetName.h:43
TEDATAACCESSEXPORT void AssociateDataSetTypeConverterSRID(DataSetTypeConverter *converter, const int &inputSRID, const int &outputSRID=TE_UNKNOWN_SRS)
A class that represents an R-tree.
A class that models the name of any property of an object.
Base exception class for plugin module.
A class that models the description of a dataset.
Definition: DataSetType.h:72
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value.
const te::da::ObjectIdSet * m_oidSet
The input objectid set.
Definition: BufferOp.h:140
std::vector< std::vector< te::gm::Geometry * > > dissolveQuery(te::da::DataSet *dsQuery, const int &levels)
It dissolves the bounders between buffers.
~BufferQuery()
Destructor.
Buffer Vector Processing functions.
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
The input datasettype.
Definition: BufferOp.h:139
virtual Geometry * Union(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set union with another geometry.
virtual bool intersects(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially intersects rhs geometry.
#define TE_LOG_INFO(message)
Use this tag in order to log a message to the TerraLib default logger with the INFO level...
Definition: Logger.h:315
Boolean logic operator: AND.
void setNumeric(std::size_t i, const std::string &value)
It sets the value of the i-th property.
This is an abstract class that models a query expression.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
An converter for DataSetType.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
TEVPEXPORT void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType, const bool &enableProgress=true)
The buffer is generated only outside of the polygons.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
int m_bufferPolygonRule
The buffer polygon rule (INSIDE_OUTSIDE = 0, ONLY_OUTSIDE = 1, ONLY_INSIDE = 2).
Definition: BufferOp.h:144
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
int m_levels
The number of levels buffer will have.
Definition: BufferOp.h:147
int getSRID() const
It returns the spatial reference system identifier associated to this property.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
Boolean NOT operator.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
Spatial Buffer operator.
Definition: ST_Buffer.h:51
te::da::DataSetType * GetDataSetType()
It builds the output DataSetType.
Definition: BufferOp.cpp:96
int m_bufferBoundariesRule
The buffer boundary rule (DISSOLVE = 0 and NOT_DISSOLVE = 1).
Definition: BufferOp.h:145
Tells if two values are not equal.
Definition: NotEqualTo.h:46
URI C++ Library.
Definition: Attributes.h:37
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long).
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Definition: Fields.h:37
Spatial difference operator.
Definition: ST_Difference.h:46
A class that can be used to model a filter expression that can be applied to a query.
Definition: Where.h:47
BufferQuery()
Default constructor.
Tells if a value is NULL.
Definition: IsNull.h:46
A class that models a literal for double values.
Definition: LiteralDouble.h:43
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
Utility functions for the data access module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
Definition: From.h:37
The buffer is generated Inside and outside of the polygons.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A dataset is the unit of information manipulated by the data access module of TerraLib.
bool run()
It executes the operation.
Definition: BufferQuery.cpp:91
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
Configuration flags for the Terrralib Vector Processing module.
int m_attributePosition
The buffer can be calculated by attribute values. The attribute must be numeric type.
Definition: BufferOp.h:148
bool m_copyInputColumns
Copy columns from input DataSet.
Definition: BufferOp.h:146
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
virtual boost::int64_t getInt64(std::size_t i) const =0
Method for retrieving a 64-bit integer attribute value (8 bytes long).
te::da::DataSourcePtr m_inDsrc
The input datasource.
Definition: BufferOp.h:137
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
te::da::DataSourcePtr m_outDsrc
The output datasource.
Definition: BufferOp.h:150
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
void setInt64(std::size_t i, boost::int64_t value)
It sets the value of the i-th property.
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
virtual std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)=0
It computes the bounding rectangle for a spatial property of the dataset.
Expression * getExpression() const
It returns the expression that can be used to retrieve the data set that contains the all indentified...
void prepareDataSet(te::da::DataSet *dataSetQuery, te::mem::DataSet *outputDataSet, const int &sourceSRID)
It prepare the dataset to be persisted.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
int m_newSRID
A new SRID if it&#39;s necessary to transform the data.
Definition: BufferOp.h:143
The boundaries between buffers will be dissolved.
const std::string & getName() const
It returns the property name.
Definition: Property.h:127