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 "CommonDataStructures.h"
33 #include "Enums.h"
34 
35 // STL
36 #include <memory>
37 #include <set>
38 #include <vector>
39 
40 namespace te
41 {
42  namespace gm
43  {
44 // Forward declarations
45  class Curve;
46  class Envelope;
47  class Geometry;
48  class GeometryPtr;
49  class Point;
50  class Polygon;
51  class Line;
52  class LinearRing;
53  class LineString;
54  class MultiLineString;
55 
56  struct Coord2D;
57 
58  /*!
59  \brief It returns the number of measurements or axes needed to describe a position in a coordinate system.
60 
61  It returns:
62  <ul>
63  <li>2 for a coordinate with x, y;</li>
64  <li>3 for a coordinate with x, y and z or x, y and m;</li>
65  <li>4 for a coordinate with x, y, z and m.</li>
66  </ul>
67 
68  \param t The geomeytric type.
69 
70  \return The number of measurements or axes needed to describe a position in a coordinate system.
71  */
73  {
74  if(t & 0x100) // may be z (0x300), m (0x700) or zm (0x800)
75  {
76  if(t & 0x800) // it must be zm
77  return 4;
78 
79  return 3; // it can be z (gType & 0x300) or m (gType & 0x700)
80  }
81 
82  return 2;
83  }
84 
85  /*!
86  \brief It returns the name of 2D geometry subclass.
87 
88  The name of the 2D geometry subclass may be one of the following:
89  <ul>
90  <li>Geometry </li>
91  <li>Point </li>
92  <li>LineString </li>
93  <li>Polygon </li>
94  <li>MultiPoint </li>
95  <li>MultiLineString </li>
96  <li>MultiPolygon </li>
97  <li>GeometryCollection </li>
98  <li>CircularString </li>
99  <li>CompoundCurve </li>
100  <li>CurvePolygon </li>
101  <li>MultiSurface </li>
102  </ul>
103 
104  \return The name of the geometry subclass type ide.
105  */
106  TEGEOMEXPORT const std::string Get2DGeometryType(const te::gm::GeomType& type);
107 
108  /*!
109  \brief It returns the 2D geometry subclass type identifier.
110 
111  <ul>
112  <li>GeometryType = 0</li>
113  <li>PointType = 1</li>
114  <li>LineStringType = 2</li>
115  <li>PolygonType = 3</li>
116  <li>MultiPointType = 4</li>
117  <li>MultiLineStringType = 5</li>
118  <li>MultiPolygonType = 6</li>
119  <li>GeometryCollectionType = 7</li>
120  <li>CircularStringType = 8</li>
121  <li>CompoundCurveType = 9</li>
122  <li>CurvePolygonType = 10</li>
123  <li>MultiSurfaceType = 12</li>
124  </ul>
125 
126  \return The 2D geometry subclass type identifier
127 
128  \note Please, see GeomType enumeration for possible return values.
129 
130  \note TerraLib extended method.
131  */
133 
134  /*!
135  \brief Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a valid envelope
136 
137  \param x1 The coordinate X of the first point
138  \param y1 The coordinate Y of the first point
139  \param x2 The coordinate X of the second point
140  \param y2 The coordinate Y of the second point
141 
142  \return A valid envelope containing the two given points
143  */
144  TEGEOMEXPORT te::gm::Envelope CreateEnvelope(double x1, double y1, double x2, double y2);
145 
146  /*!
147  \brief Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a valid envelope
148 
149  \param p1 The first point
150  \param p2 The second point
151 
152  \return A valid envelope containing the two given points
153  */
155 
156  /*!
157  \brief Creates an envelope by expanding the dimension of the given coordinate using the given extension.
158  The extension value will be used to expand the envelope in the four directions.
159  The result envelope will have width = (2 * extension) and height = (2 * extension)
160 
161  \param coord The reference coordinate
162  \param extension The extension to expand the the envelope
163 
164  \return A valid envelope
165  */
167 
168  /*!
169  \brief It creates a Geometry (a polygon) from the given envelope.
170 
171  \param e The envelope to extract the coordinates. Don't call with a NULL envelope.
172  \param srid The Spatial Reference System ID to be associated to the polygon.
173 
174  \return A polygon (in counter-clock-wise) with rectangle coordinates: [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].
175 
176  \note The caller of this method will take the ownership of the returned geometry.
177  */
178  TEGEOMEXPORT Geometry* GetGeomFromEnvelope(const Envelope* const e, int srid);
179 
180  /*!
181  \brief It returns the union of a geometry vector.
182 
183  \param items Vector of itens that represents a group.
184  \param tolerance Tolerance value to be used in geometric operations
185 
186  \return Union of the geometry.
187  */
188  TEGEOMEXPORT std::unique_ptr<te::gm::Geometry> GetGeometryUnion(const te::gm::GeometryVectorConst& geomVec, double tolerance = 0.000000001);
189 
190  /*!
191  \brief It returns if two geometries satisfy a given spatial relation.
192 
193  \param g1 The first geometry
194  \param g2 The second geometry
195  \param r A given spatial relation to be tested
196 
197  \return It returns true if the given two geometries satisfy the spatial relation. Otherwise, it returns false.
198 
199  \exception Exception It throws an exception if the spatial relation is not valid or if the test can not be evaluated.
200  */
202 
203  /*!
204  \brief Tests if the given relation matrix matches with the given relation pattern. This pattern is based on the Dimensionally Extended nine-Intersection Model (DE-9IM)
205 
206  \param relation The relation matrix to be checked
207  \param relationPattern The pattern to be match
208 
209  \return It returns TRUE if the given relation matches the given relationPattern. Otherwise, it returns FALSE.
210 
211  \exception Exception It throws an exception if the spatial relation is not valid or if the test can not be evaluated.
212  */
213  TEGEOMEXPORT bool RelationMatches(const std::string& relation, const std::string& relationPattern);
214 
215  /*!
216  \brief Finds the correspondent smallest box that allows a box to be cut in blocks of a given size
217 
218  \param env Reference envelope
219  \param bWidth Block width
220  \param bHeight Block height
221 
222  \return It returns a adjusted envelope
223  */
224  TEGEOMEXPORT Envelope AdjustToCut(const Envelope & env, double bWidth, double bHeight);
225 
226  /*!
227  \brief Make the line interpolation to find a target
228 
229  \param line LineString to make the interpolation
230  \param initial Initial value
231  \param final Final value
232  \param target Target value
233 
234  \return It returns a target Coord2D in the line.
235  */
236  TEGEOMEXPORT Coord2D* locateAlong(const LineString* line, double initial, double final, double target);
237 
238  /*!
239  \brief It will get a GeometryCollection and distribute in a vector.
240 
241  \param g Input GeometryCollection.
242  \param geoms Output Geometry Vector.
243 
244  \note If the geomSource is not a te::gm::GeometryCollectionType it will return vector with the input geometry.
245  */
246  TEGEOMEXPORT void Multi2Single(const te::gm::Geometry* g, std::vector<te::gm::Geometry*>& geoms);
247 
248  /*!
249  \brief Provides an efficient method of unioning a collection of Polygonal geometries.
250  This algorithm is faster and likely more robust than the simple iterated approach of repeatedly unioning each polygon to a result geometry.
251 
252  \param polygonVector A vector of polygons.
253 
254  \return a Geometry containing the union.
255  */
256  TEGEOMEXPORT te::gm::Geometry* CascadedPolygonUnion(const std::vector<te::gm::Polygon*>& polygonVector);
257 
258  /*!
259  \brief Provides an efficient method of unioning a collection of geometries.
260  This algorithm is faster and likely more robust than the simple iterated approach of repeatedly unioning each polygon to a result geometry.
261 
262  \param vecGeometries A vector of geometries.
263 
264  \return a Geometry containing the union.
265  */
266  TEGEOMEXPORT te::gm::Geometry* CascadedUnion(const std::vector<te::gm::Geometry*>& vecGeometries);
267 
268  /*!
269  \brief It will get the union of the input geometries.
270 
271  \param geom Input Geometry.
272 
273  \return a Geometry containing the union.
274 
275  \note If no input geometries were provided, an EMPTY POINTER is returned.
276  */
278 
279  /*!
280  \brief Compute the the closest points of two geometries.
281 
282  \param geomA Input Geometry A.
283  \param geomB Input Geometry B.
284  \param coordA Output coord on Geometry A.
285  \param coordB Output coord on Geometry B.
286 
287  */
289  te::gm::Coord2D& coordA, te::gm::Coord2D& coordB);
290 
292 
294 
296 
298 
299  /*!
300  \brief It will get a list of polygons formed by the polygonization.
301 
302  \param g Input Polygon.
303  \param pols Output Polygon Vector.
304  */
305  TEGEOMEXPORT void Polygonizer(te::gm::Geometry* g, std::vector<te::gm::Polygon*>& pols);
306 
307  /*!
308  \brief It will get a list of polygons formed by the polygonization.
309 
310  \param g Input Polygon.
311  \param pols Output Polygon Vector.
312  */
314 
315  /*!
316  \brief Add all line strings from the polygon given to the vector given.
317 
318  \param polygon polygon from which to extract line strings
319  \param pAdd A reference to a vector of geometries.
320  */
322 
323  /*!
324  \brief Add the linestring given to the vector.
325 
326  \param linestring line string
327  \param pAdd A reference to a vector of geometries.
328  */
330 
331  /*!
332  \brief Prepares the geometry A with intersection points in geometry B.
333 
334  \param geom_A Geometry used to be inserted new points of intersection.
335  \param geomB The geometry to be used to intersect with Geometry B.
336  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
337  \param tolerance Tolerance value to be used in geometric operations
338 
339  \return A new geometry based on geometry A with intersection points in geometry B.
340  */
342  bool& wasChanged, double tolerance = 0.000000001);
343 
345  bool checkValidityAndFix, bool& wasChanged, double tolerance = 0.000000001);
346 
347  /*!
348  \brief Prepares the geometry A with intersection points in geometry B.
349 
350  \param geom_A Geometry used to be inserted new points of intersection.
351  \param vecGeomB The list of Geometries used to intersects with Geometry A.
352  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
353  \param tolerance Tolerance value to be used in geometric operations
354 
355  \return A new geometry based on geometry A with intersection points in geometry B.
356  */
358  bool& wasChanged, double tolerance = 0.000000001);
359 
361  bool checkValidityAndFix, bool& wasChanged, double tolerance = 0.000000001);
362 
363  /*!
364  \brief Prepares the geometries vector to be used in overlay operations.
365  \description It has two steps: 1 - Tries to snap the existing coordinates to make them be exactly the same if the are within the given tolerance;
366  2 - It breaks crossing segments in the intersection coordinates, sometimes gerating new coordinates in both segments
367 
368  \param vecGeometries The vector to be prepared.
369  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
370  \param tolerance Tolerance value to be used in geometric operations
371 
372  \return A new geometry vector prepared to overlay operations.
373  */
375  bool& wasChanged, double tolerance = 0.000000001);
376 
377  /*!
378  \brief Prepares the MultiLineString A with intersection points in MultiLineString B.
379 
380  \param mline_A MultiLineString used to be inserted new points of intersection.
381  \param rtree Rtree indexing all the segments that must be used in the prepare algorithm.
382  \param vecRtreeSegments All the segments indexed in the rtree
383  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
384  \param tolerance Tolerance value to be used in geometric operations
385 
386  \return A new MultiLineString based on MultiLineString A with intersection points in MultiLineString B.
387  */
389  std::vector<te::gm::LineString>& vecRtreeSegments, bool& wasChanged, double tolerance = 0.000000001);
390 
391  /*!
392  \brief Prepares the LineString A with intersection points in LineString B.
393 
394  \param ls_A LineString used to be inserted new points of intersection.
395  \param rtree Rtree indexing all the segments that must be used in the prepare algorithm.
396  \param vecRtreeSegments All the segments indexed in the rtree
397  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
398  \param tolerance Tolerance value to be used in geometric operations
399 
400  \return A new LineString based on LineString A with intersection points in LineString B.
401  */
403  std::vector<te::gm::LineString>& vecRtreeSegments, bool& wasChanged, double tolerance = 0.000000001);
404 
405  /*!
406  \brief Snaps a LinearRing based on a set of LineString.
407 
408  \param rtree The R-tree contains the candidates envelopes as reference to snap.
409  \param referenceSegments A vector of LineString that is used as reference to snap.
410  \param setIndexesIgnored A set of indexes of candidates that had must be ignored in the processing. This set is used for optimization purposes
411  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
412  \param linearRingToSnap A LinearRing that will be snapped.
413  \param tolerance Tolerance value to be used in geometric operations
414 
415  \return A new snapped LinearRing.
416  */
418  const std::vector<te::gm::LineString>& referenceSegments,
419  const std::set<std::size_t>& setIndexesIgnored,
420  const te::gm::LineString& linearRingToSnap, bool& wasChanged,
421  double tolerance = 0.000000001);
422 
423  /*!
424  \brief Add intersection points in a LinearRing based on a Vector of LineString as reference.
425 
426  \param rtree The R-tree contains the candidates envelopes as reference to snap.
427  \param candidateSegments A vector of LineString that is used as reference to snap.
428  \param setIndexesIgnored A set of indexes of candidates that had must be ignored in the processing. This set is used for optimization purposes
429  \param wasChanged This is an output value to inform if the geometry has been changed or not during the prepare
430  \param lr_Reference A LinearRing that will be added new points of intersection.
431  \param usePerpendicularDistance True if the new points are added by perpendicular distance algorithm.
432  \param tolerance Tolerance value to be used in geometric operations
433 
434  \return
435  */
437  const std::vector<te::gm::LineString>& candidateSegments,
438  const std::set<std::size_t>& setIndexesIgnored,
439  const te::gm::LineString& lr_Reference,
440  const bool& usePerpendicularDistance = false,
441  double tolerance = 0.000000001);
442 
443  /*!
444  \brief Gets a vector of LineString reference points including intersection points using GEOS operators.
445 
446  \param lsReference LineString used as reference.
447  \param candidates A Vector of LineString used to intersects the lsReference.
448  \param tolerance Tolerance value to be used in geometric operations
449 
450  \return A vector of LineString reference points including intersection points using GEOS operators.
451  */
452  TEGEOMEXPORT std::vector<te::gm::Coord2D> GetIntersectionPointsByOperators(const te::gm::LineString& lsReference, const std::vector<te::gm::LineString>& candidates, double tolerance = 0.000000001);
453 
454  /*!
455  \brief Gets a vector of LineString reference points including intersection points using perpendicular distance.
456 
457  \param lsReference LineString used as reference.
458  \param candidates A Vector of LineString used to intersects the lsReference.
459  \param tolerance Tolerance value to be used in geometric operations
460 
461  \return A vector of LineString reference points including intersection points using perpendicular distance.
462  */
463  TEGEOMEXPORT std::vector<te::gm::Coord2D> GetIntersectionPointsByPerpendicularDistance(const te::gm::LineString& lsReference, const std::vector<te::gm::LineString>& candidates, double tolerance = 0.000000001);
464 
465  /*!
466  \brief Get the vector of MultLineStrings that compose the Geometry
467 
468  \param geometry Used to get lineStrings.
469 
470  return A vector of MultiLineString based on geometry parameter.
471  */
472  TEGEOMEXPORT std::vector<MultiLineString *> GetAsMultiLineStringVector(const te::gm::Geometry& geometry);
473 
474 
475  /*!
476  \brief A geometry is built based on a Vector of MultiLineString and the origin geometry type.
477 
478  \param multiLineStringVector A vector of multiLineString that have all lines of a Geometry.
479 
480  return A geometry built based on a Vector of MultiLineString and the origin geometry type.
481  */
482  TEGEOMEXPORT te::gm::Geometry* MultiLineToDefinedType(const std::vector<te::gm::MultiLineString*>& multiLineStringVector,
483  te::gm::GeomType geometryType);
484 
485  /*!
486  \brief Get the LineStrings that compose the Geometry
487 
488  \param geometry Used to get lineStrings.
489 
490  return A LineString based on parameter geometry.
491  */
493 
494  /*!
495  \brief Verifies if the geomType is a collection type.
496 
497  \param geomType enum te::gm::GeomType.
498 
499  return True if the geomType is a collection type.
500  */
502 
503  /*!
504  \brief Get the simple type of GeomType.
505 
506  \param geomType enum te::gm::GeomType.
507 
508  return A simple type of GeomType.
509  */
511 
512  /*!
513  \brief Get the collection type of GeomType.
514 
515  \param geomType enum te::gm::GeomType.
516 
517  return A collection type of GeomType.
518  */
520 
521  /*!
522  \brief Creates a LineString between the given startCoord and endCoord with the given number of intermediate coordinates.
523 
524  \param startCoord The first coordinate of the line
525  \param endCoord The last coordinate of the line
526  \param srid The srid of the line
527  \param numberOfIntermediateCoords The number of intermediate coordinates of the line
528 
529  \return A LineString between startCoord and endCoord with the given number of intermediate coordinates
530  */
531  TEGEOMEXPORT te::gm::LineString CreateLine(const te::gm::Coord2D& startCoord, const te::gm::Coord2D& endCoord, const int& srid, const int& numberOfIntermediateCoords);
532 
533  /*!
534  \brief Creates a Polygon from the given envelope and with the given number of intermediate coordinates in each of its four borders lines.
535 
536  \param box The envelope from which the polygon will be created
537  \param srid The srid of the polygon
538  \param numberOfIntermediateCoords The number of intermediate coordinates of each border line
539 
540  \return A LineString between startCoord and endCoord with the given number of intermediate coordinates in each border line
541  */
542  TEGEOMEXPORT te::gm::Polygon CreatePolygon(const te::gm::Envelope& box, const int& srid, const int& numberOfIntermediateCoords);
543 
544  /*!
545  \brief Creates a parallel line from the given line. Here will use the distance for offset between the original line and the parallel.
546 
547  \param line Original line
548  \param distance for offset between the original line and the parallel. Left will be positive and right will be negative
549 
550  \return A LineString between startCoord and endCoord with the given number of intermediate coordinates in each border line
551  */
553 
554  /*!
555  \brief Checks if the given point in within the given polygon or multipolygon geometry
556 
557  \param coord The coord to be checked
558  \param geometry The Polygon or Multipolygon to be used as reference
559 
560  \return TRUE if the point is within the polygon. FALSE otherwise
561  */
562  TEGEOMEXPORT bool IsPointOnPolygon(const te::gm::Coord2D& coord, const te::gm::Geometry* geometry);
563 
564  /*!
565  \brief As geos Explanation: An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly.
566  Otherwise, the point may lie on the boundary of the geometry.
567 
568  \param geometry The input geometry
569 
570  \return An interior point inside the given Geometry, if possible.
571  */
573 
574 
575  /*!
576  \brief Normalizes and filters the given geometry based on the given simple type.
577  \description If the given geometry if already from the given simple type, it will clone the geometry and return it.
578  If the geometry is from the multi type related to the single, it will clone the geometry and return it.
579  If the geometry is a collection, it will search for geometries from the given single type and multi type, and return them in a collection related to the given type.
580 
581  \param geometry The geometry to be analysed
582  \param singleGeometryType The base single type to be used as filter
583 
584  \return The normalized geometry based onthe given singleGeometryType. Null if this given type could not be found in the given geometry.
585  */
587 
588  /*!
589  \brief Returns the appropriate precision to be used by spatial operations that adjust geometric data from other geometric systems
590 
591  \param srid The id of the SRS (Spatial Reference System)
592 
593  \return The precision appropriate to the given srid
594  */
596 
597  /*!
598  \brief Clips the given geometry to the given clipArea
599 
600  \param geometry The geometry to be clipped
601  \param clipArea The clipping area
602 
603  \return The clipped geometry
604  */
606 
607  /*!
608  \brief Checks if the geometry is null or empty
609 
610  \param geometry The geometry to be checked
611 
612  \return The result of the check. TRUE if the geometry is null or empty. FALSE otherwise
613  */
615 
616  /*!
617  \brief Checks if the geometry is null or empty
618 
619  \param geometry The geometry to be checked
620 
621  \return The result of the check. TRUE if the geometry is null or empty. FALSE otherwise
622  */
624 
625  /*!
626  \brief Creates a polygon from the given curve
627 
628  \param curve The curve to be used to create a polygon
629 
630  \return The created polygon
631  */
633 
634 
635  /*!
636  \brief Checks if a LinearRing is in Counter-clockwise orientation
637 
638  \param curve The LinearRing to be checked
639 
640  \return TRUE if the given LinearRing is in Counter-clockwise orientation. FALSE otherwise
641  */
643 
644  /*!
645  \brief Calculates the area of the given geometry. If the geometry is from dimension 0 or 1, it returns 0
646 
647  \param geometry The geometry to be analysed
648 
649  \return The area of the geometry or 0 if the dimension of the geometry is 0 or 1
650  */
651  TEGEOMEXPORT double GetArea(const te::gm::Geometry* geometry);
652 
653  /*!
654  \brief Creates a geometry collection based on the given geometryVector
655 
656  \param geometryVector The input geometry vector
657 
658  \return A geometry collection containing all the grometries from the geometry vector
659  */
661 
662  //!< Adapts a non const geometry vector to a const geometry vector. No geometry copy is made
664 
665  /*!
666  \brief Splits the given 'inputGeometry' (must be an area) using the given 'bladeLineGeometry' (must be a line)
667 
668  \param inputGeometry The input geometry to be splitted
669  \param inputGeometry The line to be used to split the input geoemtry
670 
671  \return The splitted geometry. Throws an exception if an error occur
672  */
673  TEGEOMEXPORT std::vector<te::gm::Geometry*> SplitGeometry(const te::gm::Geometry* inputGeometry, const te::gm::Geometry* bladeLineGeometry);
674 
675  } // end namespace gm
676 } // end namespace te
677 
678 #endif // __TERRALIB_GEOMETRY_INTERNAL_GEOMUTILS_H
679 
te::gm::IsPointOnPolygon
TEGEOMEXPORT bool IsPointOnPolygon(const te::gm::Coord2D &coord, const te::gm::Geometry *geometry)
Checks if the given point in within the given polygon or multipolygon geometry.
te::gm::CreatePolygon
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...
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::gm::GetIntersectionLine
TEGEOMEXPORT te::gm::Line * GetIntersectionLine(te::gm::Geometry *geom, te::gm::Coord2D coord)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::gm::IsMultiType
TEGEOMEXPORT bool IsMultiType(te::gm::GeomType geomType)
Verifies if the geomType is a collection type.
te::sam::rtree::Index< std::size_t, 8 >
te::gm::MultiLineToDefinedType
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.
te::gm::GetCoordDimension
int GetCoordDimension(GeomType t)
It returns the number of measurements or axes needed to describe a position in a coordinate system.
Definition: Utils.h:72
te::gm::AdjustToCut
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.
te::mnt::Curve
Curve
Definition: Enums.h:72
te::gm::GetInteriorPoint
TEGEOMEXPORT te::gm::Coord2D GetInteriorPoint(const te::gm::Geometry *geometry)
As geos Explanation: An interior point is guaranteed to lie in the interior of the Geometry,...
te::gm::isCCW
TEGEOMEXPORT bool isCCW(const te::gm::LinearRing *ring)
Checks if a LinearRing is in Counter-clockwise orientation.
te::gm::AddPolygon
TEGEOMEXPORT void AddPolygon(te::gm::Polygon *polygon, te::gm::GeometryVector &pAdd)
Add all line strings from the polygon given to the vector given.
te::gm::Multi2Single
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
It will get a GeometryCollection and distribute in a vector.
te::gm::ClosestPoints
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.
te::gm::GetGeomFromEnvelope
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
te::gm::Polygonizer
TEGEOMEXPORT void Polygonizer(te::gm::Geometry *g, std::vector< te::gm::Polygon * > &pols)
It will get a list of polygons formed by the polygonization.
TEGEOMEXPORT
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
te::gm::GeometryPtr
Definition: Geometry.h:968
te::gm::Polygon
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
te::gm::NormalizeGeometryByType
TEGEOMEXPORT te::gm::Geometry * NormalizeGeometryByType(const te::gm::Geometry *geometry, te::gm::GeomType singleGeometryType)
Normalizes and filters the given geometry based on the given simple type. \description If the given g...
te::gm::GetAppropriatePrecision
TEGEOMEXPORT double GetAppropriatePrecision(int srid)
Returns the appropriate precision to be used by spatial operations that adjust geometric data from ot...
te::gm::SplitGeometry
TEGEOMEXPORT std::vector< te::gm::Geometry * > SplitGeometry(const te::gm::Geometry *inputGeometry, const te::gm::Geometry *bladeLineGeometry)
Splits the given 'inputGeometry' (must be an area) using the given 'bladeLineGeometry' (must be a lin...
te::gm::GetArea
TEGEOMEXPORT double GetArea(const te::gm::Geometry *geometry)
Calculates the area of the given geometry. If the geometry is from dimension 0 or 1,...
te::gm::GeometryVectorConst
std::vector< const te::gm::Geometry * > GeometryVectorConst
Definition: CommonDataStructures.h:51
te::gm::GeometryVector
std::vector< te::gm::Geometry * > GeometryVector
Definition: CommonDataStructures.h:50
Enums.h
Enumerations of XML module.
te::gm::locateAlong
TEGEOMEXPORT Coord2D * locateAlong(const LineString *line, double initial, double final, double target)
Make the line interpolation to find a target.
te::gm::RelationMatches
TEGEOMEXPORT bool RelationMatches(const std::string &relation, const std::string &relationPattern)
Tests if the given relation matrix matches with the given relation pattern. This pattern is based on ...
te::gm::ToConstVector
TEGEOMEXPORT te::gm::GeometryVectorConst ToConstVector(const te::gm::GeometryVector &vecGeometries)
te::gm::GetMultiType
TEGEOMEXPORT te::gm::GeomType GetMultiType(te::gm::GeomType geomType)
Get the collection type of GeomType.
te::gm::SatisfySpatialRelation
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation.
te::gm::SpatialRelation
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:128
te::gm::Get2DGeometryType
TEGEOMEXPORT const std::string Get2DGeometryType(const te::gm::GeomType &type)
It returns the name of 2D geometry subclass.
te::gm::Get2DGeomTypeId
TEGEOMEXPORT GeomType Get2DGeomTypeId(const te::gm::GeomType &type)
It returns the 2D geometry subclass type identifier.
te::gm::Line
A Line is LineString with 2 points.
Definition: Line.h:51
te::gm::CreateCollectionFromGeometryVector
TEGEOMEXPORT te::gm::GeometryPtr CreateCollectionFromGeometryVector(const te::gm::GeometryVector &geometryVector)
Creates a geometry collection based on the given geometryVector.
te::gm::LineString
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
te::gm::CreateLine
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 ...
te::gm::CreateEnvelope
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 ...
te::gm::Coord2D
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
te::gm::AddLineString
TEGEOMEXPORT void AddLineString(te::gm::LineString *lineString, te::gm::GeometryVector &pAdd)
Add the linestring given to the vector.
te::gm::ClipGeometry
TEGEOMEXPORT te::gm::Geometry * ClipGeometry(const te::gm::Geometry *geometry, const te::gm::Envelope &clipArea)
Clips the given geometry to the given clipArea.
te::gm::CascadedUnion
TEGEOMEXPORT te::gm::Geometry * CascadedUnion(const std::vector< te::gm::Geometry * > &vecGeometries)
Provides an efficient method of unioning a collection of geometries. This algorithm is faster and lik...
te::gm::GetIntersectionPointsByOperators
TEGEOMEXPORT std::vector< te::gm::Coord2D > GetIntersectionPointsByOperators(const te::gm::LineString &lsReference, const std::vector< te::gm::LineString > &candidates, double tolerance=0.000000001)
Gets a vector of LineString reference points including intersection points using GEOS operators.
te::gm::GetAsMultiLineStringVector
TEGEOMEXPORT std::vector< MultiLineString * > GetAsMultiLineStringVector(const te::gm::Geometry &geometry)
Get the vector of MultLineStrings that compose the Geometry.
te::gm::AddIntersectionPoints
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, double tolerance=0.000000001)
Add intersection points in a LinearRing based on a Vector of LineString as reference.
te::gm::GetSimpleType
TEGEOMEXPORT te::gm::GeomType GetSimpleType(te::gm::GeomType geomType)
Get the simple type of GeomType.
te::gm::Rotate
TEGEOMEXPORT bool Rotate(te::gm::Coord2D pr, te::gm::LineString *l, double angle, te::gm::LineString *lOut)
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::gm::Curve
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
Definition: Curve.h:59
te::gm::MultiLineString
MultiLineString is a MultiCurve whose elements are LineStrings.
Definition: MultiLineString.h:55
te::gm::LinearRing
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:54
te::gm::UnaryUnion
TEGEOMEXPORT te::gm::Geometry * UnaryUnion(te::gm::Geometry *geom)
It will get the union of the input geometries.
te::gm::SnapLineToPoints
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, double tolerance=0.000000001)
Snaps a LinearRing based on a set of LineString.
CommonDataStructures.h
Utility classes, structures and definitions for Vector Processing.
te::gm::GetGeometryUnion
TEGEOMEXPORT std::unique_ptr< te::gm::Geometry > GetGeometryUnion(const te::gm::GeometryVectorConst &geomVec, double tolerance=0.000000001)
It returns the union of a geometry vector.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::gm::GeomType
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
te::gm::CascadedPolygonUnion
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...
te::gm::PrepareGeometriesToIntersection
TEGEOMEXPORT te::gm::Geometry * PrepareGeometriesToIntersection(const te::gm::Geometry *geom_A, te::gm::Geometry *geomB, bool &wasChanged, double tolerance=0.000000001)
Prepares the geometry A with intersection points in geometry B.
te::gm::IsNullOrEmpty
TEGEOMEXPORT bool IsNullOrEmpty(const te::gm::GeometryPtr &geometry)
Checks if the geometry is null or empty.
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51
te::gm::GetIntersectionPointsByPerpendicularDistance
TEGEOMEXPORT std::vector< te::gm::Coord2D > GetIntersectionPointsByPerpendicularDistance(const te::gm::LineString &lsReference, const std::vector< te::gm::LineString > &candidates, double tolerance=0.000000001)
Gets a vector of LineString reference points including intersection points using perpendicular distan...
te::gm::GetMultiLineStringType
TEGEOMEXPORT te::gm::GeomType GetMultiLineStringType(const te::gm::Geometry &geometry)
Get the LineStrings that compose the Geometry.
te::gm::AdjustSegment
TEGEOMEXPORT bool AdjustSegment(te::gm::Point *P0, te::gm::Point *P1, double d0, te::gm::Coord2D &P0out, te::gm::Coord2D &P1out)
te::gm::ParallelLine
TEGEOMEXPORT te::gm::LineString * ParallelLine(const te::gm::LineString *line, double distance)
Creates a parallel line from the given line. Here will use the distance for offset between the origin...
te::gm::GetAngle
TEGEOMEXPORT double GetAngle(te::gm::Coord2D coordA, te::gm::Coord2D coordB)