Utils.h
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/geometry/Utils.h
22 
23  \brief Utility functions for the Geometry Module.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOMUTILS_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_GEOMUTILS_H
28 
29 // TerraLib
30 #include "../sam/rtree.h"
31 #include "Config.h"
32 #include "Coord2D.h"
33 #include "Enums.h"
34 #include "Point.h"
35 
36 // STL
37 #include <memory>
38 #include <set>
39 #include <vector>
40 
41 namespace te
42 {
43  namespace gm
44  {
45 // Forward declarations
46  class Envelope;
47  class Geometry;
48  class Polygon;
49  class Line;
50  class MultiLineString;
51 
52  /*!
53  \struct TopologyValidationError
54 
55  \brief This struct contains informations about GEOS TopologyValidationError
56  */
58  {
59  public:
60 
62  std::string m_message;
63  };
64 
65  /*!
66  \struct DistanceOrderFunctor
67 
68  \brief This struct is used sorts a vector of points by distance.
69  */
71  {
74  {
75  _reference = reference;
76  }
77 
78  bool operator()(const te::gm::Point& p1, const te::gm::Point& p2) const
79  {
80  double distance1 = p1.distance(&_reference);
81  double distance2 = p2.distance(&_reference);
82 
83  if (distance1 < distance2)
84  return true;
85 
86  return false;
87  }
88  };
89 
90  /*!
91  \brief It returns the number of measurements or axes needed to describe a position in a coordinate system.
92 
93  It returns:
94  <ul>
95  <li>2 for a coordinate with x, y;</li>
96  <li>3 for a coordinate with x, y and z or x, y and m;</li>
97  <li>4 for a coordinate with x, y, z and m.</li>
98  </ul>
99 
100  \param t The geomeytric type.
101 
102  \return The number of measurements or axes needed to describe a position in a coordinate system.
103  */
105  {
106  if(t & 0x100) // may be z (0x300), m (0x700) or zm (0x800)
107  {
108  if(t & 0x800) // it must be zm
109  return 4;
110 
111  return 3; // it can be z (gType & 0x300) or m (gType & 0x700)
112  }
113 
114  return 2;
115  }
116 
117  /*!
118  \brief Checks if a point p1 is exactly equal to the point p2
119 
120  \param p1 The first point
121  \param p2 The second point
122 
123  \return TRUE if the points are equal. FALSE otherwise
124  */
125  TEGEOMEXPORT bool IsEqual(const te::gm::Point& p1, const te::gm::Point& p2);
126 
127  /*!
128  \brief Checks if a point p1 is equal to the point p2 considering the given tolerance
129 
130  \param p1 The first point
131  \param p2 The second point
132  \param tol The tolerance to be used
133 
134  \return TRUE if the points are equal. FALSE otherwise
135  */
136  TEGEOMEXPORT bool IsEqual(const te::gm::Point& p1, const te::gm::Point& p2, double tol);
137 
138  /*!
139  \brief Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a valid envelope
140 
141  \param x1 The coordinate X of the first point
142  \param y1 The coordinate Y of the first point
143  \param x2 The coordinate X of the second point
144  \param y2 The coordinate Y of the second point
145 
146  \return A valid envelope containing the two given points
147  */
148  TEGEOMEXPORT te::gm::Envelope CreateEnvelope(double x1, double y1, double x2, double y2);
149 
150  /*!
151  \brief Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a valid envelope
152 
153  \param p1 The first point
154  \param p2 The second point
155 
156  \return A valid envelope containing the two given points
157  */
159 
160  /*!
161  \brief It creates a Geometry (a polygon) from the given envelope.
162 
163  \param e The envelope to extract the coordinates. Don't call with a NULL envelope.
164  \param srid The Spatial Reference System ID to be associated to the polygon.
165 
166  \return A polygon (in counter-clock-wise) with rectangle coordinates: [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].
167 
168  \note The caller of this method will take the ownership of the returned geometry.
169  */
170  TEGEOMEXPORT Geometry* GetGeomFromEnvelope(const Envelope* const e, int srid);
171 
172  /*!
173  \brief It returns the union of a geometry vector.
174 
175  \param items Vector of itens that represents a group.
176 
177  \return Union of the geometry.
178  */
179  TEGEOMEXPORT std::unique_ptr<te::gm::Geometry> GetGeometryUnion(const std::vector<te::gm::Geometry*>& geomVec);
180 
181  /*!
182  \brief It returns if two geometries satisfy a given spatial relation.
183 
184  \param g1 The first geometry
185  \param g2 The second geometry
186  \param r A given spatial relation to be tested
187 
188  \return It returns true if the given two geometries satisfy the spatial relation. Otherwise, it returns false.
189 
190  \exception Exception It throws an exception if the spatial relation is not valid or if the test can not be evaluated.
191  */
192  TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry* g1, const Geometry* g2, SpatialRelation relation);
193 
194  /*!
195  \brief Finds the correspondent smallest box that allows a box to be cut in blocks of a given size
196 
197  \param env Reference envelope
198  \param bWidth Block width
199  \param bHeight Block height
200 
201  \return It returns a adjusted envelope
202  */
203  TEGEOMEXPORT Envelope AdjustToCut(const Envelope & env, double bWidth, double bHeight);
204 
205  /* \brief It checks if one object intersects another object. */
206  template<class T1, class T2> bool Intersects(const T1& o1, const T2& o2);
207 
208  /* \brief Specialized function that checks if point intersects envelope. */
209  template<> TEGEOMEXPORT bool Intersects(const te::gm::Point& point, const te::gm::Envelope& e);
210 
211  /*!
212  \brief Make the line interpolation to find a target
213 
214  \param line LineString to make the interpolation
215  \param initial Initial value
216  \param final Final value
217  \param target Target value
218 
219  \return It returns a target Coord2D in the line.
220  */
221  TEGEOMEXPORT Coord2D* locateAlong(const LineString* line, double initial, double final, double target);
222 
223  /*!
224  \brief It will get a GeometryCollection and distribute in a vector.
225 
226  \param g Input GeometryCollection.
227  \param geoms Output Geometry Vector.
228 
229  \note If the geomSource is not a te::gm::GeometryCollectionType it will return vector with the input geometry.
230  */
231  TEGEOMEXPORT void Multi2Single(const te::gm::Geometry* g, std::vector<te::gm::Geometry*>& geoms);
232 
233  /*!
234  \brief Provides an efficient method of unioning a collection of Polygonal geometries.
235  This algorithm is faster and likely more robust than the simple iterated approach of repeatedly unioning each polygon to a result geometry.
236 
237  \param polygonVector A vector of polygons.
238 
239  \return a Geometry containing the union.
240  */
241  TEGEOMEXPORT te::gm::Geometry* CascadedPolygonUnion(const std::vector<te::gm::Polygon*>& polygonVector);
242 
243  /*!
244  \brief It will get the union of the input geometries.
245 
246  \param geom Input Geometry.
247 
248  \return a Geometry containing the union.
249 
250  \note If no input geometries were provided, an EMPTY POINTER is returned.
251  */
253 
254  /*!
255  \brief Compute the the closest points of two geometries.
256 
257  \param geomA Input Geometry A.
258  \param geomB Input Geometry B.
259  \param coordA Output coord on Geometry A.
260  \param coordB Output coord on Geometry B.
261 
262  */
264  te::gm::Coord2D& coordA, te::gm::Coord2D& coordB);
265 
267 
268  TEGEOMEXPORT double GetAngle(te::gm::Coord2D coordA, te::gm::Coord2D coordB);
269 
270  TEGEOMEXPORT bool Rotate(te::gm::Coord2D pr, te::gm::LineString* l, double angle, te::gm::LineString* lOut);
271 
272  TEGEOMEXPORT bool AdjustSegment(te::gm::Point* P0, te::gm::Point* P1, double d0, te::gm::Coord2D& P0out, te::gm::Coord2D& P1out);
273 
274  /*!
275  \brief It will get a list of polygons formed by the polygonization.
276 
277  \param g Input Polygon.
278  \param pols Output Polygon Vector.
279  */
280  TEGEOMEXPORT void Polygonizer(te::gm::Geometry* g, std::vector<te::gm::Polygon*>& pols);
281 
282  /*!
283  \brief It check geometry validity using GEOS.
284 
285  \param geom Geometry that will be verified.
286  \param error TopologyValidationError struct.
287 
288  \return True if geometry is valid.
289  */
290  TEGEOMEXPORT bool CheckValidity(const Geometry* geom, te::gm::TopologyValidationError& error);
291 
292  /*!
293  \brief Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon, self intersections /
294  inconsistencies are fixed. Otherwise the geometry is returned.
295 
296  \param geom
297  \return a geometry
298  */
300 
301  /*!
302  \brief Add all line strings from the polygon given to the vector given.
303 
304  \param polygon polygon from which to extract line strings
305  \param pAdd A reference to a vector of geometries.
306  */
307  TEGEOMEXPORT void AddPolygon(te::gm::Polygon* polygon, std::vector<te::gm::Geometry*>& pAdd);
308 
309  /*!
310  \brief Add the linestring given to the vector.
311 
312  \param linestring line string
313  \param pAdd A reference to a vector of geometries.
314  */
315  TEGEOMEXPORT void AddLineString(te::gm::LineString* lineString, std::vector<te::gm::Geometry*>& pAdd);
316 
317  /*!
318  \brief Calculate the perpendicular distance of a point in a segment.
319 
320  \param first The first segment point.
321  \param last The last segment point.
322  \param pin The point to be calculated.
323  \param pinter A intern point calculated based on pin projected intersection with the segment.
324 
325  \return The perpendicular distance.
326  */
327  TEGEOMEXPORT double PerpendicularDistance(const te::gm::Point& first, const te::gm::Point& last, te::gm::Point& pin, Point& pinter);
328 
329  /*!
330  \brief Prepares the geometry A with intersection points in geometry B.
331 
332  \param geom_A Geometry used to be inserted new points of intersection.
333  \param geomB The geometry to be used to intersect with Geometry B.
334  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
335 
336  \return A new geometry based on geometry A with intersection points in geometry B.
337  */
339 
340  /*!
341  \brief Prepares the geometry A with intersection points in geometry B.
342 
343  \param geom_A Geometry used to be inserted new points of intersection.
344  \param vecGeomB The list of Geometries used to intersects with Geometry A.
345  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
346 
347  \return A new geometry based on geometry A with intersection points in geometry B.
348  */
349  TEGEOMEXPORT te::gm::Geometry* PrepareGeometriesToIntersection(const te::gm::Geometry* geom_A, const std::vector<te::gm::Geometry*>& vecGeomB, bool& wasChanged);
350 
351  /*!
352  \brief Prepares the MultiLineString A with intersection points in MultiLineString B.
353 
354  \param mline_A MultiLineString used to be inserted new points of intersection.
355  \param rtree Rtree indexing all the segments that must be used in the prepare algorithm.
356  \param vecRtreeSegments All the segments indexed in the rtree
357  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
358 
359  \return A new MultiLineString based on MultiLineString A with intersection points in MultiLineString B.
360  */
361  TEGEOMEXPORT te::gm::MultiLineString* PrepareGeometriesToIntersection(const te::gm::MultiLineString& mline_A, const te::sam::rtree::Index<std::size_t, 8>& rtree, std::vector<te::gm::LineString>& vecRtreeSegments, bool& wasChanged);
362 
363  /*!
364  \brief Prepares the LineString A with intersection points in LineString B.
365 
366  \param ls_A LineString used to be inserted new points of intersection.
367  \param rtree Rtree indexing all the segments that must be used in the prepare algorithm.
368  \param vecRtreeSegments All the segments indexed in the rtree
369  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
370 
371  \return A new LineString based on LineString A with intersection points in LineString B.
372  */
373  TEGEOMEXPORT te::gm::LineString* PrepareGeometriesToIntersection(const te::gm::LineString& ls_A, const te::sam::rtree::Index<std::size_t, 8>& rtree, std::vector<te::gm::LineString>& vecRtreeSegments, bool& wasChanged);
374 
375  /*!
376  \brief Snaps a LinearRing based on a set of LineString.
377 
378  \param rtree The R-tree contains the candidates envelopes as reference to snap.
379  \param referenceSegments A vector of LineString that is used as reference to snap.
380  \param setIndexesIgnored A set of indexes of candidates that had must be ignored in the processing. This set is used for optimization purposes
381  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
382  \param linearRingToSnap A LinearRing that will be snapped.
383 
384  \return A new snapped LinearRing.
385  */
387  const std::vector<te::gm::LineString>& referenceSegments,
388  const std::set<std::size_t>& setIndexesIgnored,
389  const te::gm::LineString& linearRingToSnap, bool& wasChanged);
390 
391  /*!
392  \brief Add intersection points in a LinearRing based on a Vector of LineString as reference.
393 
394  \param rtree The R-tree contains the candidates envelopes as reference to snap.
395  \param candidateSegments A vector of LineString that is used as reference to snap.
396  \param setIndexesIgnored A set of indexes of candidates that had must be ignored in the processing. This set is used for optimization purposes
397  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
398  \param lr_Reference A LinearRing that will be added new points of intersection.
399  \param usePerpendicularDistance True if the new points are added by perpendicular distance algorithm.
400 
401  \return
402  */
404  const std::vector<te::gm::LineString>& candidateSegments,
405  const std::set<std::size_t>& setIndexesIgnored,
406  const te::gm::LineString& lr_Reference,
407  const bool& usePerpendicularDistance = false);
408 
409  /*!
410  \brief Gets a vector of LineString reference points including intersection points using GEOS operators.
411 
412  \param lsReference LineString used as reference.
413  \param candidates A Vector of LineString used to intersects the lsReference.
414 
415  \return A vector of LineString reference points including intersection points using GEOS operators.
416  */
417  TEGEOMEXPORT std::vector<te::gm::Point> GetIntersectionPointsByOperators(const te::gm::LineString& lsReference, const std::vector<te::gm::LineString>& candidates);
418 
419  /*!
420  \brief Gets a vector of LineString reference points including intersection points using perpendicular distance.
421 
422  \param lsReference LineString used as reference.
423  \param candidates A Vector of LineString used to intersects the lsReference.
424 
425  \return A vector of LineString reference points including intersection points using perpendicular distance.
426  */
427  TEGEOMEXPORT std::vector<te::gm::Point> GetIntersectionPointsByPerpendicularDistance(const te::gm::LineString& lsReference, const std::vector<te::gm::LineString>& candidates);
428 
429  /*!
430  \brief Get the vector of MultLineStrings that compose the Geometry
431 
432  \param geometry Used to get lineStrings.
433 
434  return A vector of MultiLineString based on geometry parameter.
435  */
436  TEGEOMEXPORT std::vector<MultiLineString *> GetAsMultiLineStringVector(const te::gm::Geometry& geometry);
437 
438 
439  /*!
440  \brief A geometry is built based on a Vector of MultiLineString and the origin geometry type.
441 
442  \param multiLineStringVector A vector of multiLineString that have all lines of a Geometry.
443 
444  return A geometry built based on a Vector of MultiLineString and the origin geometry type.
445  */
446  TEGEOMEXPORT te::gm::Geometry* MultiLineToDefinedType(const std::vector<te::gm::MultiLineString*>& multiLineStringVector,
447  te::gm::GeomType geometryType);
448 
449  /*!
450  \brief Get the LineStrings that compose the Geometry
451 
452  \param geometry Used to get lineStrings.
453 
454  return A LineString based on parameter geometry.
455  */
457 
458  /*!
459  \brief Verifies if the geomType is a collection type.
460 
461  \param geomType enum te::gm::GeomType.
462 
463  return True if the geomType is a collection type.
464  */
466 
467  /*!
468  \brief Get the simple type of GeomType.
469 
470  \param geomType enum te::gm::GeomType.
471 
472  return A simple type of GeomType.
473  */
475 
476  /*!
477  \brief Get the collection type of GeomType.
478 
479  \param geomType enum te::gm::GeomType.
480 
481  return A collection type of GeomType.
482  */
484 
485  /*!
486  \brief Creates a LineString between the given startCoord and endCoord with the given number of intermediate coordinates.
487 
488  \param startCoord The first coordinate of the line
489  \param endCoord The last coordinate of the line
490  \param srid The srid of the line
491  \param numberOfIntermediateCoords The number of intermediate coordinates of the line
492 
493  \return A LineString between startCoord and endCoord with the given number of intermediate coordinates
494  */
495  TEGEOMEXPORT te::gm::LineString CreateLine(const te::gm::Coord2D& startCoord, const te::gm::Coord2D& endCoord, const int& srid, const int& numberOfIntermediateCoords);
496 
497  /*!
498  \brief Creates a Polygon from the given envelope and with the given number of intermediate coordinates in each of its four borders lines.
499 
500  \param box The envelope from which the polygon will be created
501  \param srid The srid of the polygon
502  \param numberOfIntermediateCoords The number of intermediate coordinates of each border line
503 
504  \return A LineString between startCoord and endCoord with the given number of intermediate coordinates in each border line
505  */
506  TEGEOMEXPORT te::gm::Polygon CreatePolygon(const te::gm::Envelope& box, const int& srid, const int& numberOfIntermediateCoords);
507 
508  } // end namespace gm
509 } // end namespace te
510 
511 #endif // __TERRALIB_GEOMETRY_INTERNAL_GEOMUTILS_H
512 
TEGEOMEXPORT te::gm::GeomType GetMultiLineStringType(const te::gm::Geometry &geometry)
Get the LineStrings that compose the Geometry.
DistanceOrderFunctor(const te::gm::Point &reference)
Definition: Utils.h:73
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
A Line is LineString with 2 points.
Definition: Line.h:50
TEGEOMEXPORT double PerpendicularDistance(const te::gm::Point &first, const te::gm::Point &last, te::gm::Point &pin, Point &pinter)
Calculate the perpendicular distance of a point in a segment.
TEGEOMEXPORT te::gm::Geometry * CascadedPolygonUnion(const std::vector< te::gm::Polygon *> &polygonVector)
Provides an efficient method of unioning a collection of Polygonal geometries. This algorithm is fast...
TEGEOMEXPORT void ClosestPoints(te::gm::Geometry *geomA, te::gm::Geometry *geomB, te::gm::Coord2D &coordA, te::gm::Coord2D &coordB)
Compute the the closest points of two geometries.
TEGEOMEXPORT bool Rotate(te::gm::Coord2D pr, te::gm::LineString *l, double angle, te::gm::LineString *lOut)
TEGEOMEXPORT te::gm::Envelope CreateEnvelope(double x1, double y1, double x2, double y2)
Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a ...
A point with x and y coordinate values.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:127
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
TEGEOMEXPORT te::gm::Polygon CreatePolygon(const te::gm::Envelope &box, const int &srid, const int &numberOfIntermediateCoords)
Creates a Polygon from the given envelope and with the given number of intermediate coordinates in ea...
TEGEOMEXPORT te::gm::GeomType GetSimpleType(te::gm::GeomType geomType)
Get the simple type of GeomType.
int GetCoordDimension(GeomType t)
It returns the number of measurements or axes needed to describe a position in a coordinate system...
Definition: Utils.h:104
TEGEOMEXPORT bool IsMultiType(te::gm::GeomType geomType)
Verifies if the geomType is a collection type.
TEGEOMEXPORT LineString * AddIntersectionPoints(const te::sam::rtree::Index< std::size_t, 8 > &rtree, const std::vector< te::gm::LineString > &candidateSegments, const std::set< std::size_t > &setIndexesIgnored, const te::gm::LineString &lr_Reference, const bool &usePerpendicularDistance=false)
Add intersection points in a LinearRing based on a Vector of LineString as reference.
This struct is used sorts a vector of points by distance.
Definition: Utils.h:70
TEGEOMEXPORT te::gm::GeomType GetMultiType(te::gm::GeomType geomType)
Get the collection type of GeomType.
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
TEGEOMEXPORT te::gm::Geometry * MultiLineToDefinedType(const std::vector< te::gm::MultiLineString *> &multiLineStringVector, te::gm::GeomType geometryType)
A geometry is built based on a Vector of MultiLineString and the origin geometry type.
TEGEOMEXPORT Envelope AdjustToCut(const Envelope &env, double bWidth, double bHeight)
Finds the correspondent smallest box that allows a box to be cut in blocks of a given size...
Enumerations related to Geometry module.
TEGEOMEXPORT LineString * SnapLineToPoints(const te::sam::rtree::Index< std::size_t, 8 > &rtree, const std::vector< te::gm::LineString > &referenceSegments, const std::set< std::size_t > &setIndexesIgnored, const te::gm::LineString &linearRingToSnap, bool &wasChanged)
Snaps a LinearRing based on a set of LineString.
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
A point with x and y coordinate values.
Definition: Point.h:50
TEGEOMEXPORT te::gm::Geometry * PrepareGeometriesToIntersection(const te::gm::Geometry *geom_A, te::gm::Geometry *geomB, bool &wasChanged)
Prepares the geometry A with intersection points in geometry B.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
TEGEOMEXPORT void Polygonizer(te::gm::Geometry *g, std::vector< te::gm::Polygon *> &pols)
It will get a list of polygons formed by the polygonization.
TerraLib.
TEGEOMEXPORT te::gm::Geometry * UnaryUnion(te::gm::Geometry *geom)
It will get the union of the input geometries.
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation.
TEGEOMEXPORT bool CheckValidity(const Geometry *geom, te::gm::TopologyValidationError &error)
It check geometry validity using GEOS.
TEGEOMEXPORT te::gm::Geometry * Validate(te::gm::Geometry *geom)
Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:75
TEGEOMEXPORT std::vector< te::gm::Point > GetIntersectionPointsByPerpendicularDistance(const te::gm::LineString &lsReference, const std::vector< te::gm::LineString > &candidates)
Gets a vector of LineString reference points including intersection points using perpendicular distan...
TEGEOMEXPORT std::vector< te::gm::Point > GetIntersectionPointsByOperators(const te::gm::LineString &lsReference, const std::vector< te::gm::LineString > &candidates)
Gets a vector of LineString reference points including intersection points using GEOS operators...
bool Intersects(const T1 &o1, const T2 &o2)
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
te::gm::Point _reference
Definition: Utils.h:72
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry *> &geoms)
It will get a GeometryCollection and distribute in a vector.
TEGEOMEXPORT double GetAngle(te::gm::Coord2D coordA, te::gm::Coord2D coordB)
bool operator()(const te::gm::Point &p1, const te::gm::Point &p2) const
Definition: Utils.h:78
TEGEOMEXPORT bool AdjustSegment(te::gm::Point *P0, te::gm::Point *P1, double d0, te::gm::Coord2D &P0out, te::gm::Coord2D &P1out)
TEGEOMEXPORT void AddPolygon(te::gm::Polygon *polygon, std::vector< te::gm::Geometry *> &pAdd)
Add all line strings from the polygon given to the vector given.
TEGEOMEXPORT std::unique_ptr< te::gm::Geometry > GetGeometryUnion(const std::vector< te::gm::Geometry *> &geomVec)
It returns the union of a geometry vector.
TEGEOMEXPORT te::gm::LineString CreateLine(const te::gm::Coord2D &startCoord, const te::gm::Coord2D &endCoord, const int &srid, const int &numberOfIntermediateCoords)
Creates a LineString between the given startCoord and endCoord with the given number of intermediate ...
TEGEOMEXPORT Coord2D * locateAlong(const LineString *line, double initial, double final, double target)
Make the line interpolation to find a target.
Configuration flags for the Vector Geometry Model of TerraLib.
This struct contains informations about GEOS TopologyValidationError.
Definition: Utils.h:57
An utility struct for representing 2D coordinates.
TEGEOMEXPORT std::vector< MultiLineString * > GetAsMultiLineStringVector(const te::gm::Geometry &geometry)
Get the vector of MultLineStrings that compose the Geometry.
TEGEOMEXPORT void AddLineString(te::gm::LineString *lineString, std::vector< te::gm::Geometry *> &pAdd)
Add the linestring given to the vector.
TEGEOMEXPORT bool IsEqual(const te::gm::Point &p1, const te::gm::Point &p2)
Checks if a point p1 is exactly equal to the point p2.
TEGEOMEXPORT te::gm::Line * GetIntersectionLine(te::gm::Geometry *geom, te::gm::Coord2D coord)
virtual double distance(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns the shortest distance between any two points in the two geometry objects.