src/terralib/edit/Utils.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 terralib/edit/Utils.cpp
22 
23 \brief Utility functions for TerraLib Edit module.
24 */
25 
26 // TerraLib
27 #include "../dataaccess/dataset/DataSet.h"
28 #include "../dataaccess/dataset/ObjectId.h"
29 #include "../dataaccess/utils/Utils.h"
30 #include "../datatype/SimpleData.h"
31 #include "../geometry/Coord2D.h"
32 #include "../geometry/Envelope.h"
33 #include "../geometry/GeometryCollection.h"
34 #include "../geometry/GeometryProperty.h"
35 #include "../geometry/LineString.h"
36 #include "../geometry/MultiLineString.h"
37 #include "../geometry/MultiPoint.h"
38 #include "../geometry/MultiPolygon.h"
39 #include "../geometry/Point.h"
40 #include "../geometry/Polygon.h"
41 #include "../geometry/Utils.h"
42 #include "../srs/Config.h"
43 #include "Feature.h"
44 #include "RepositoryManager.h"
45 #include "SnapManager.h"
46 #include "Utils.h"
47 
48 // Boost
49 #include <boost/uuid/random_generator.hpp>
50 #include <boost/uuid/uuid_io.hpp>
51 
52 // STL
53 #include <cassert>
54 #include <cmath>
55 #include <memory>
56 
58 {
59  return PickFeature(layer.get(), env, srid);
60 }
61 
63 {
64  if(layer->getVisibility() != te::map::VISIBLE || !layer->isValid())
65  return nullptr;
66 
67  te::gm::Envelope reprojectedEnvelope(env);
68 
69  if((layer->getSRID() != TE_UNKNOWN_SRS) && (srid != TE_UNKNOWN_SRS) && (layer->getSRID() != srid))
70  reprojectedEnvelope.transform(srid, layer->getSRID());
71 
72  // Try retrieves from RepositoryManager...
73  Feature* f = RepositoryManager::getInstance().getFeature(layer->getId(), env, srid);
74  if(f)
75  return f->clone();
76 
77  // ...else, retrieve from layer
78 
79  if(!reprojectedEnvelope.intersects(layer->getExtent()))
80  return nullptr;
81 
82  std::unique_ptr<const te::map::LayerSchema> schema(layer->getSchema());
83 
84  if(!schema->hasGeom())
85  return nullptr;
86 
87  std::vector<std::string> oidPropertyNames;
88  te::da::GetOIDPropertyNames(schema.get(), oidPropertyNames);
89 
91 
92  // Gets the dataset
93  std::unique_ptr<te::da::DataSet> dataset = layer->getData(gp->getName(), &reprojectedEnvelope, te::gm::INTERSECTS);
94 
95  if(dataset.get() == nullptr)
96  return nullptr;
97 
98  // Generates a geometry from the given extent. It will be used to refine the results
99  std::unique_ptr<te::gm::Geometry> geometryFromEnvelope(te::gm::GetGeomFromEnvelope(&reprojectedEnvelope, layer->getSRID()));
100 
101  // The restriction point. It will be used to refine the results
102  te::gm::Coord2D center = reprojectedEnvelope.getCenter();
103  te::gm::Point point(center.x, center.y, layer->getSRID());
104 
105  while(dataset->moveNext())
106  {
107  std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gp->getName()));
108 
109  if (g->contains(&point) || g->crosses(geometryFromEnvelope.get()) || geometryFromEnvelope->contains(g.get())) // Geometry found!
110  {
111  Feature* f = new Feature(te::da::GenerateOID(dataset.get(), oidPropertyNames), g.release());
113 
114  return f;
115  }
116  }
117 
118  return nullptr;
119 }
120 
121 void te::edit::GetLines(te::gm::Geometry* geom, std::vector<te::gm::LineString*>& lines)
122 {
123  if (geom == nullptr)
124  return;
125 
126  switch (geom->getGeomTypeId())
127  {
130  GetLines(dynamic_cast<te::gm::GeometryCollection*>(geom), lines);
131  break;
132 
133  case te::gm::PolygonType:
134  GetLines(dynamic_cast<te::gm::Polygon*>(geom), lines);
135  break;
136 
138  GetLines(dynamic_cast<te::gm::LineString*>(geom), lines);
139  break;
140 
141  default:
142  return;
143  }
144 }
145 
146 void te::edit::GetLines(te::gm::GeometryCollection* gc, std::vector<te::gm::LineString*>& lines)
147 {
148  assert(gc);
149 
150  for (std::size_t i = 0; i < gc->getNumGeometries(); ++i)
151  GetLines(gc->getGeometryN(i), lines);
152 }
153 
154 void te::edit::GetLines(te::gm::Polygon* p, std::vector<te::gm::LineString*>& lines)
155 {
156  assert(p);
157 
158  std::vector<te::gm::Curve*>& rings = p->getRings();
159 
160  for (std::size_t i = 0; i < rings.size(); ++i) // for each ring
161  GetLines(dynamic_cast<te::gm::LineString*>(rings[i]), lines);
162 }
163 
164 void te::edit::GetLines(te::gm::LineString* l, std::vector<te::gm::LineString*>& lines)
165 {
166  assert(l);
167  lines.push_back(l);
168 }
169 
170 void te::edit::MoveVertex(std::vector<te::gm::LineString*>& lines, const VertexIndex& index, const double& x, const double& y)
171 {
172  assert(index.isValid());
173  assert(index.m_line < lines.size());
174 
175  te::gm::LineString* l = lines[index.m_line];
176 
177  assert(index.m_pos < l->getNPoints());
178 
179  if (IsSpecialRingVertex(l, index))
180  {
181  l->setPoint(0, x, y);
182  l->setPoint(l->getNPoints() - 1, x, y);
183  }
184  else
185  l->setPoint(index.m_pos, x, y);
186 }
187 
188 void te::edit::RemoveVertex(std::vector<te::gm::LineString*>& lines, const VertexIndex& index)
189 {
190  assert(index.isValid());
191  assert(index.m_line < lines.size());
192 
193  te::gm::LineString* currentLine = lines[index.m_line];
194 
195  te::gm::LineString* newLine = new te::gm::LineString(currentLine->getNPoints() - 1, currentLine->getGeomTypeId(), currentLine->getSRID());
196 
197  std::size_t pos = 0;
198  for (std::size_t i = 0; i < currentLine->getNPoints(); ++i)
199  {
200  // Skip the vertex
201  if (i == index.m_pos)
202  continue;
203 
204  if (IsSpecialRingVertex(currentLine, index) && ((i == 0) || (i == currentLine->getNPoints() - 1)))
205  continue;
206 
207  newLine->setPoint(pos, currentLine->getX(i), currentLine->getY(i));
208  ++pos;
209  }
210 
211  if (currentLine->isClosed())
212  newLine->setPoint(newLine->size() - 1, newLine->getX(0), newLine->getY(0));
213 
214  // Copy the new line
215  *currentLine = *newLine;
216 
217  delete newLine;
218 }
219 
220 void te::edit::AddVertex(std::vector<te::gm::LineString*>& lines, const double& x, const double& y, const te::gm::Envelope& env, int srid)
221 {
222  VertexIndex index = FindSegment(lines, env, srid);
223  assert(index.isValid());
224 
225  te::gm::LineString* currentLine = lines[index.m_line];
226 
227  te::gm::LineString* newLine = new te::gm::LineString(currentLine->getNPoints() + 1,
228  currentLine->getGeomTypeId(), currentLine->getSRID());
229 
230  std::size_t pos = 0;
231  for (std::size_t i = 0; i < currentLine->getNPoints(); ++i)
232  {
233  newLine->setPoint(pos, currentLine->getX(i), currentLine->getY(i));
234  ++pos;
235 
236  if (i == index.m_pos)
237  {
238  newLine->setPoint(pos, x, y);
239  ++pos;
240  }
241  }
242 
243  // Copy the new line
244  *currentLine = *newLine;
245 
246  delete newLine;
247 }
248 
249 te::edit::VertexIndex te::edit::FindSegment(std::vector<te::gm::LineString*>& lines, const te::gm::Envelope& env, int srid)
250 {
251  VertexIndex index;
252  index.makeInvalid();
253 
254  bool found = false;
255 
256  std::unique_ptr<te::gm::Geometry> geometryFromEnvelope(te::gm::GetGeomFromEnvelope(&env, srid));
257 
258  for (std::size_t i = 0; i < lines.size(); ++i) // for each line
259  {
260  te::gm::LineString* line = lines[i];
261 
262  for (std::size_t j = 0; j < line->getNPoints() - 1; ++j) // for each vertex
263  {
264  // Build the segment
265  std::unique_ptr<te::gm::LineString> segment(new te::gm::LineString(2, line->getGeomTypeId(), line->getSRID()));
266  segment->setPoint(0, line->getX(j), line->getY(j));
267  segment->setPoint(1, line->getX(j + 1), line->getY(j + 1));
268 
269  if (geometryFromEnvelope->intersects(segment.get()))
270  {
271  index.m_line = i;
272  index.m_pos = j;
273  found = true;
274  break;
275  }
276  }
277 
278  if (found)
279  break;
280  }
281 
282  return index;
283 }
284 
285 void te::edit::MoveGeometry(te::gm::Geometry* geom, const double& deltax, const double& deltay)
286 {
287  assert(geom);
288 
289  switch (geom->getGeomTypeId())
290  {
291  case te::gm::PointType:
292  {
293  te::gm::Point* p = dynamic_cast<te::gm::Point*>(geom);
294  assert(p);
295 
296  p->setX(p->getX() + deltax);
297  p->setY(p->getY() + deltay);
298  }
299  break;
300 
302  {
303  te::gm::MultiPoint* mp = dynamic_cast<te::gm::MultiPoint*>(geom);
304  assert(mp);
305 
306  for (std::size_t i = 0; i < mp->getNumGeometries(); ++i)
307  {
308  te::gm::Point* point = dynamic_cast<te::gm::Point*>(mp->getGeometryN(i));
309  point->setX(point->getX() + deltax);
310  point->setY(point->getY() + deltay);
311  }
312  }
313  break;
314 
315  case te::gm::PolygonType:
319  {
320 
321  std::vector<te::gm::LineString*> lines;
322  GetLines(geom, lines);
323 
324  for (std::size_t i = 0; i < lines.size(); ++i)
325  {
326  te::gm::LineString* l = lines[i];
327  assert(l);
328 
329  for (std::size_t j = 0; j < l->getNPoints(); ++j)
330  l->setPoint(j, l->getX(j) + deltax, l->getY(j) + deltay);
331  }
332  }
333  break;
334  default:
335  return;
336  }
337 
338 }
339 
341 {
342  return l->isClosed() && ((index.m_pos == 0) || (index.m_pos == l->getNPoints() - 1));
343 }
344 
346 {
347  return sqrt(((c1.x - c2.x) * (c1.x - c2.x)) + ((c1.y - c2.y) * (c1.y - c2.y)));
348 }
349 
350 void te::edit::GetCoordinates(te::gm::Geometry* geom, std::vector<te::gm::Coord2D>& coords)
351 {
352  assert(geom);
353 
354  // Try extract lines
355  std::vector<te::gm::LineString*> lines;
356  GetLines(geom, lines);
357 
358  if (!lines.empty())
359  {
360  for (std::size_t i = 0; i < lines.size(); ++i) // for each line
361  {
362  te::gm::LineString* line = lines[i];
363  for (std::size_t j = 0; j < line->getNPoints(); ++j) // for each line point
364  coords.push_back(te::gm::Coord2D(line->getX(j), line->getY(j)));
365  }
366 
367  return;
368  }
369 
370  // Is it a point?
371  te::gm::Point* point = dynamic_cast<te::gm::Point*>(geom);
372  if (point)
373  {
374  coords.push_back(te::gm::Coord2D(point->getX(), point->getY()));
375  return;
376  }
377 
378  // Is it a multi point collection?
379  if (geom->getGeomTypeId() == te::gm::MultiPointType)
380  {
381  te::gm::MultiPoint* mp = dynamic_cast<te::gm::MultiPoint*>(geom);
382  assert(mp);
383 
384  for (std::size_t i = 0; i < mp->getNumGeometries(); ++i)
385  {
386  te::gm::Point* point = dynamic_cast<te::gm::Point*>(mp->getGeometryN(i));
387  assert(point);
388  coords.push_back(te::gm::Coord2D(point->getX(), point->getY()));
389  }
390  }
391 }
392 
393 void te::edit::TrySnap(te::gm::Coord2D& coord, int srid)
394 {
395  try
396  {
397  te::gm::Coord2D result;
398 
399  if (SnapManager::getInstance().search(coord, srid, result) == false)
400  return;
401 
402  coord.x = result.x;
403  coord.y = result.y;
404  }
405  catch (...)
406  {
407  return;
408  }
409 }
410 
412 {
413  static boost::uuids::basic_random_generator<boost::mt19937> gen;
414 
415  boost::uuids::uuid u = gen();
416  std::string id = boost::uuids::to_string(u);
417 
418  te::dt::String* data = new te::dt::String(id);
419 
421  oid->addValue(data);
422 
423  return oid;
424 }
425 
427 {
428  assert(layer.get());
429  assert(geom);
430 
431  // Get the geometry type of layer
432  std::unique_ptr<te::da::DataSetType> dt = layer->getSchema();
434 
435  te::gm::Geometry* newGeom = nullptr;
436  switch (geomProp->getGeometryType())
437  {
438  case te::gm::PolygonType:
439  {
441  {
442  te::gm::MultiPolygon* mp = dynamic_cast<te::gm::MultiPolygon*>(geom);
443  if (mp)
444  {
445  te::gm::Polygon* p = dynamic_cast<te::gm::Polygon*>(mp->getGeometryN(0));
446  if (p)
447  newGeom = p;
448  }
449  }
450  }
451  break;
452 
454  {
455  if (geom->getGeomTypeId() == te::gm::PolygonType)
456  {
457  te::gm::Polygon* p = dynamic_cast<te::gm::Polygon*>(geom);
458  if (p)
459  {
461  if (mp)
462  {
463  mp->add(p);
464  newGeom = mp;
465  }
466  }
467  }
468  }
469  break;
470 
472  {
474  {
475  te::gm::MultiLineString* ml = dynamic_cast<te::gm::MultiLineString*>(geom);
476  if (ml)
477  {
478  te::gm::LineString* l = dynamic_cast<te::gm::LineString*>(ml->getGeometryN(0));
479  if (l)
480  newGeom = l;
481  }
482  }
483  }
484  break;
485 
487  {
488  if (geom->getGeomTypeId() == te::gm::LineStringType)
489  {
490  te::gm::LineString* l = dynamic_cast<te::gm::LineString*>(geom);
491  if (l)
492  {
494  if (ml)
495  {
496  ml->add(l);
497  newGeom = ml;
498  }
499  }
500  }
501  }
502  break;
503 
504  case te::gm::PointType:
505  {
506  if (geom->getGeomTypeId() == te::gm::MultiPointType)
507  {
508  te::gm::MultiPoint* mpt = dynamic_cast<te::gm::MultiPoint*>(geom);
509  if (mpt)
510  {
511  te::gm::Point* pt = dynamic_cast<te::gm::Point*>(mpt->getGeometryN(0));
512  if (pt)
513  newGeom = pt;
514  }
515  }
516  }
517  break;
518 
520  {
521  if (geom->getGeomTypeId() == te::gm::PointType)
522  {
523  te::gm::Point* pt = dynamic_cast<te::gm::Point*>(geom);
524  if (pt)
525  {
526  te::gm::MultiPoint* mpt = new te::gm::MultiPoint(0, te::gm::MultiPointType, layer->getSRID());
527  if (mpt)
528  {
529  mpt->add(pt);
530  newGeom = mpt;
531  }
532  }
533  }
534  }
535  break;
536 
537  default:
538  newGeom = nullptr;
539  break;
540 
541  }
542 
543  if (newGeom == nullptr)
544  newGeom = geom;
545 
546  newGeom->setSRID(srid);
547 
548  // SRID
549  if (newGeom->getSRID() == layer->getSRID())
550  return newGeom;
551 
552  // else, need conversion...
553  newGeom->transform(layer->getSRID());
554 
555  return newGeom;
556 
557 }
558 
559 void te::edit::Rotate(te::gm::Geometry* geom, double angle)
560 {
561  double alfa;
562  double dx, dy;
563  double x, y;
564  double xr, yr;
565 
566  try
567  {
568  std::vector<te::gm::LineString*> lines;
569  GetLines(geom, lines);
570 
571  te::gm::Coord2D pr = geom->getCentroid();
572 
573  for (std::size_t i = 0; i < lines.size(); ++i)
574  {
575  //transform Degree to Radius
576  alfa = (4.*std::atan(1.)*angle) / 180.;
577 
578  dx = pr.getX();
579  dy = pr.getY();
580 
581  for (std::size_t count = 0; count < lines[i]->size(); count++)
582  {
583  te::gm::LineString* l = lines[i];
584 
585  std::unique_ptr<te::gm::Point> curPoint = l->getPointN(count);
586 
587  x = curPoint->getX() - dx;
588  y = curPoint->getY() - dy;
589 
590  xr = x * std::cos(alfa) - y * std::sin(alfa);
591  yr = x * std::sin(alfa) + y * std::cos(alfa);
592 
593  l->setPoint(count, xr + dx, yr + dy);
594  }
595  }
596 
597  }
598  catch (...)
599  {
600  return;
601  }
602 }
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
virtual const std::string & getId() const
It returns the layer id.
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:50
SimpleData< std::string, STRING_TYPE > String
Definition: SimpleData.h:229
Geometric property.
std::vector< Curve * > & getRings()
It returns the polygon rings.
Definition: CurvePolygon.h:294
TEEDITEXPORT void MoveVertex(std::vector< te::gm::LineString * > &lines, const VertexIndex &index, const double &x, const double &y)
double y
y-coordinate.
Definition: Coord2D.h:114
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
TEEDITEXPORT te::da::ObjectId * GenerateId()
TEDATAACCESSEXPORT ObjectId * GenerateOID(DataSet *dataset, const std::vector< std::string > &names)
This is the base class for layers.
Definition: AbstractLayer.h:77
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
static te::dt::Date dx(2010, 12, 31)
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
double x
x-coordinate.
Definition: Coord2D.h:113
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
Feature * clone() const
Definition: Feature.cpp:182
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
TEEDITEXPORT void Rotate(te::gm::Geometry *geom, double angle)
virtual Visibility getVisibility() const
It returns the layer visibility.
TEEDITEXPORT te::gm::Geometry * Convert2LayerGeomType(const te::map::AbstractLayerPtr &layer, te::gm::Geometry *geom, int srid)
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
double getY() const
It returns the y-coordinate.
Definition: Coord2D.h:108
void addValue(te::dt::AbstractData *data)
It adds a property value to uniquely identify a data set element.
This is a singleton for managing edit repositories.
This class represents a geographic feature.
TEEDITEXPORT void GetCoordinates(te::gm::Geometry *geom, std::vector< te::gm::Coord2D > &coords)
virtual bool isValid() const =0
It returns true if the layer can be used for instance to draw, otherwise, it returns false...
bool isClosed() const
It returns true if the curve is closed (startPoint = endPoint).
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
unsigned int line
te::gm::GeometryCollection * gc
te::gm::Coord2D getCentroid() const _NOEXCEPT_OP(false)
It will get the centroid of the input geometries.
Coord2D getCenter() const
It returns the rectangle&#39;s center coordinate.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
TEEDITEXPORT void RemoveVertex(std::vector< te::gm::LineString * > &lines, const VertexIndex &index)
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition: MultiPoint.h:50
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
void setOperationTypeId(const te::edit::OperationType &currentOperationType)
Definition: Feature.cpp:124
const double & getY() const
It returns the Point y-coordinate value.
Definition: Point.h:152
A point with x and y coordinate values.
Definition: Point.h:50
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
An Envelope defines a 2D rectangular region.
void ObjectId()
ObjectId example.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
This class represents an unique id for a data set element.
virtual std::unique_ptr< LayerSchema > getSchema() const =0
It returns the layer schema.
TEEDITEXPORT Feature * PickFeature(const te::map::AbstractLayerPtr &layer, const te::gm::Envelope &env, int srid)
TEEDITEXPORT double GetDistance(const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
static te::dt::TimeDuration dt(20, 30, 50, 11)
te::gm::Polygon * p
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
Definition: LineString.h:193
Utility functions for the data access module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
This is a singleton for managing geometries snap.
TEEDITEXPORT void MoveGeometry(te::gm::Geometry *geom, const double &deltax, const double &deltay)
TEEDITEXPORT void AddVertex(std::vector< te::gm::LineString * > &lines, const double &x, const double &y, const te::gm::Envelope &env, int srid)
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
MultiLineString is a MultiCurve whose elements are LineStrings.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
double getX() const
It returns the x-coordinate.
Definition: Coord2D.h:102
TEEDITEXPORT void TrySnap(te::gm::Coord2D &coord, int srid)
virtual std::unique_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const =0
It gets the dataset identified by the layer name.
void setX(const double &x)
It sets the Point x-coordinate value.
Definition: Point.h:145
void add(Geometry *g)
It adds the geometry into the collection.
TEEDITEXPORT void GetLines(te::gm::Geometry *geom, std::vector< te::gm::LineString * > &lines)
virtual void setSRID(int srid) _NOEXCEPT_OP(true)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
TEEDITEXPORT bool IsSpecialRingVertex(te::gm::LineString *l, const VertexIndex &index)
TEDATAACCESSEXPORT void GetOIDPropertyNames(const DataSetType *type, std::vector< std::string > &pnames)
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
A template for atomic data types (integers, floats, strings and others).
Definition: SimpleData.h:59
void setY(const double &y)
It sets the Point y-coordinate value.
Definition: Point.h:159
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
const double & getX() const
It returns the Point x-coordinate value.
Definition: Point.h:138
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
std::size_t size() const
It returns the number of points (vertexes) in the geometry.
Definition: LineString.h:262
TEEDITEXPORT VertexIndex FindSegment(std::vector< te::gm::LineString * > &lines, const te::gm::Envelope &env, int srid)