Utils.h File Reference

Utility functions for the Geometry Module. More...

#include "../sam/rtree.h"
#include "Config.h"
#include "CommonDataStructures.h"
#include "Enums.h"
#include <memory>
#include <set>
#include <vector>

Go to the source code of this file.

Namespaces

 te
 TerraLib.
 
 te::gm
 Namespace for the Vector Geometry module of TerraLib.
 

Functions

TEGEOMEXPORT LineString * te::gm::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. More...
 
TEGEOMEXPORT void te::gm::AddLineString (te::gm::LineString *lineString, te::gm::GeometryVector &pAdd)
 Add the linestring given to the vector. More...
 
TEGEOMEXPORT void te::gm::AddPolygon (te::gm::Polygon *polygon, te::gm::GeometryVector &pAdd)
 Add all line strings from the polygon given to the vector given. More...
 
TEGEOMEXPORT bool te::gm::AdjustSegment (te::gm::Point *P0, te::gm::Point *P1, double d0, te::gm::Coord2D &P0out, te::gm::Coord2D &P1out)
 
TEGEOMEXPORT Envelope te::gm::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. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::CascadedPolygonUnion (const std::vector< te::gm::Polygon * > &polygonVector)
 Provides an efficient method of unioning a collection of Polygonal geometries. This algorithm is faster and likely more robust than the simple iterated approach of repeatedly unioning each polygon to a result geometry. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::CascadedUnion (const std::vector< te::gm::Geometry * > &vecGeometries)
 Provides an efficient method of unioning a collection of geometries. This algorithm is faster and likely more robust than the simple iterated approach of repeatedly unioning each polygon to a result geometry. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::ClipGeometry (const te::gm::Geometry *geometry, const te::gm::Envelope &clipArea)
 Clips the given geometry to the given clipArea. More...
 
TEGEOMEXPORT void te::gm::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. More...
 
TEGEOMEXPORT te::gm::GeometryPtr te::gm::CreateCollectionFromGeometryVector (const te::gm::GeometryVector &geometryVector)
 Creates a geometry collection based on the given geometryVector. More...
 
TEGEOMEXPORT te::gm::Envelope te::gm::CreateEnvelope (const te::gm::Coord2D &coord, double extension)
 Creates an envelope by expanding the dimension of the given coordinate using the given extension. The extension value will be used to expand the envelope in the four directions. The result envelope will have width = (2 * extension) and height = (2 * extension) More...
 
TEGEOMEXPORT te::gm::Envelope te::gm::CreateEnvelope (const te::gm::Point &p1, const te::gm::Point &p2)
 Creates an envelope that fits the given coordinates. It makes all the adjustments needed to return a valid envelope. More...
 
TEGEOMEXPORT te::gm::Envelope te::gm::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 valid envelope. More...
 
TEGEOMEXPORT te::gm::LineString te::gm::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 coordinates. More...
 
TEGEOMEXPORT te::gm::GeometryPtr te::gm::CreatePolygon (const te::gm::Curve *curve)
 Creates a polygon from the given curve. More...
 
TEGEOMEXPORT te::gm::Polygon te::gm::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 each of its four borders lines. More...
 
TEGEOMEXPORT const std::string te::gm::Get2DGeometryType (const te::gm::GeomType &type)
 It returns the name of 2D geometry subclass. More...
 
TEGEOMEXPORT GeomType te::gm::Get2DGeomTypeId (const te::gm::GeomType &type)
 It returns the 2D geometry subclass type identifier. More...
 
TEGEOMEXPORT double te::gm::GetAngle (te::gm::Coord2D coordA, te::gm::Coord2D coordB)
 
TEGEOMEXPORT double te::gm::GetAppropriatePrecision (int srid)
 Returns the appropriate precision to be used by spatial operations that adjust geometric data from other geometric systems. More...
 
TEGEOMEXPORT double te::gm::GetArea (const te::gm::Geometry *geometry)
 Calculates the area of the given geometry. If the geometry is from dimension 0 or 1, it returns 0. More...
 
TEGEOMEXPORT std::vector< MultiLineString * > te::gm::GetAsMultiLineStringVector (const te::gm::Geometry &geometry)
 Get the vector of MultLineStrings that compose the Geometry. More...
 
int te::gm::GetCoordDimension (GeomType t)
 It returns the number of measurements or axes needed to describe a position in a coordinate system. More...
 
TEGEOMEXPORT std::unique_ptr< te::gm::Geometryte::gm::GetGeometryUnion (const te::gm::GeometryVectorConst &geomVec, double tolerance=0.000000001)
 It returns the union of a geometry vector. More...
 
TEGEOMEXPORT Geometry * te::gm::GetGeomFromEnvelope (const Envelope *const e, int srid)
 It creates a Geometry (a polygon) from the given envelope. More...
 
TEGEOMEXPORT te::gm::Coord2D te::gm::GetInteriorPoint (const te::gm::Geometry *geometry)
 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. Otherwise, the point may lie on the boundary of the geometry. More...
 
TEGEOMEXPORT te::gm::Linete::gm::GetIntersectionLine (te::gm::Geometry *geom, te::gm::Coord2D coord)
 
TEGEOMEXPORT std::vector< te::gm::Coord2Dte::gm::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. More...
 
TEGEOMEXPORT std::vector< te::gm::Coord2Dte::gm::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 distance. More...
 
TEGEOMEXPORT te::gm::GeomType te::gm::GetMultiLineStringType (const te::gm::Geometry &geometry)
 Get the LineStrings that compose the Geometry. More...
 
TEGEOMEXPORT te::gm::GeomType te::gm::GetMultiType (te::gm::GeomType geomType)
 Get the collection type of GeomType. More...
 
TEGEOMEXPORT te::gm::GeomType te::gm::GetSimpleType (te::gm::GeomType geomType)
 Get the simple type of GeomType. More...
 
TEGEOMEXPORT bool te::gm::isCCW (const te::gm::LinearRing *ring)
 Checks if a LinearRing is in Counter-clockwise orientation. More...
 
TEGEOMEXPORT bool te::gm::IsMultiType (te::gm::GeomType geomType)
 Verifies if the geomType is a collection type. More...
 
TEGEOMEXPORT bool te::gm::IsNullOrEmpty (const te::gm::Geometry *geometry)
 Checks if the geometry is null or empty. More...
 
TEGEOMEXPORT bool te::gm::IsNullOrEmpty (const te::gm::GeometryPtr &geometry)
 Checks if the geometry is null or empty. More...
 
TEGEOMEXPORT bool te::gm::IsPointOnPolygon (const te::gm::Coord2D &coord, const te::gm::Geometry *geometry)
 Checks if the given point in within the given polygon or multipolygon geometry. More...
 
TEGEOMEXPORT Coord2D * te::gm::locateAlong (const LineString *line, double initial, double final, double target)
 Make the line interpolation to find a target. More...
 
TEGEOMEXPORT void te::gm::Multi2Single (const te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
 It will get a GeometryCollection and distribute in a vector. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::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. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::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 geometry if already from the given simple type, it will clone the geometry and return it. If the geometry is from the multi type related to the single, it will clone the geometry and return it. 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. More...
 
TEGEOMEXPORT te::gm::LineStringte::gm::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 original line and the parallel. More...
 
TEGEOMEXPORT void te::gm::Polygonizer (const te::gm::GeometryVector &vecInput, te::gm::GeometryVector &vecOutput)
 It will get a list of polygons formed by the polygonization. More...
 
TEGEOMEXPORT void te::gm::Polygonizer (te::gm::Geometry *g, std::vector< te::gm::Polygon * > &pols)
 It will get a list of polygons formed by the polygonization. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::PrepareGeometriesToIntersection (const te::gm::Geometry *geom_A, const te::gm::GeometryVector &vecGeomB, bool &wasChanged, double tolerance=0.000000001)
 Prepares the geometry A with intersection points in geometry B. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::PrepareGeometriesToIntersection (const te::gm::Geometry *geom_A, const te::gm::GeometryVector &vecGeomB, bool checkValidityAndFix, bool &wasChanged, double tolerance=0.000000001)
 
TEGEOMEXPORT te::gm::Geometryte::gm::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. More...
 
TEGEOMEXPORT te::gm::Geometryte::gm::PrepareGeometriesToIntersection (const te::gm::Geometry *geom_A, te::gm::Geometry *geomB, bool checkValidityAndFix, bool &wasChanged, double tolerance=0.000000001)
 
TEGEOMEXPORT te::gm::GeometryVector te::gm::PrepareGeometriesToIntersection (const te::gm::GeometryVectorConst &vecGeometries, bool &wasChanged, double tolerance=0.000000001)
 Prepares the geometries vector to be used in overlay operations. \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; 2 - It breaks crossing segments in the intersection coordinates, sometimes gerating new coordinates in both segments. More...
 
TEGEOMEXPORT te::gm::LineStringte::gm::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, double tolerance=0.000000001)
 Prepares the LineString A with intersection points in LineString B. More...
 
TEGEOMEXPORT te::gm::MultiLineStringte::gm::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, double tolerance=0.000000001)
 Prepares the MultiLineString A with intersection points in MultiLineString B. More...
 
TEGEOMEXPORT bool te::gm::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 the Dimensionally Extended nine-Intersection Model (DE-9IM) More...
 
TEGEOMEXPORT bool te::gm::Rotate (te::gm::Coord2D pr, te::gm::LineString *l, double angle, te::gm::LineString *lOut)
 
TEGEOMEXPORT bool te::gm::SatisfySpatialRelation (const Geometry *g1, const Geometry *g2, SpatialRelation relation)
 It returns if two geometries satisfy a given spatial relation. More...
 
TEGEOMEXPORT LineString * te::gm::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. More...
 
TEGEOMEXPORT std::vector< te::gm::Geometry * > te::gm::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 line) More...
 
TEGEOMEXPORT te::gm::GeometryVectorConst te::gm::ToConstVector (const te::gm::GeometryVector &vecGeometries)
 
TEGEOMEXPORT te::gm::Geometryte::gm::UnaryUnion (te::gm::Geometry *geom)
 It will get the union of the input geometries. More...
 

Detailed Description

Utility functions for the Geometry Module.

Definition in file Utils.h.