PostGIS  2.5.7dev-r@@SVN_REVISION@@
lwgeom.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "liblwgeom_internal.h"
#include "lwgeom_log.h"
Include dependency graph for lwgeom.c:

Go to the source code of this file.

Functions

void lwgeom_force_clockwise (LWGEOM *lwgeom)
 Force Right-hand-rule on LWGEOM polygons. More...
 
int lwgeom_is_clockwise (LWGEOM *lwgeom)
 Check clockwise orientation on LWGEOM polygons. More...
 
LWGEOMlwgeom_reverse (const LWGEOM *geom)
 
void lwgeom_reverse_in_place (LWGEOM *geom)
 Reverse vertex order of LWGEOM. More...
 
LWPOINTlwgeom_as_lwpoint (const LWGEOM *lwgeom)
 
LWLINElwgeom_as_lwline (const LWGEOM *lwgeom)
 
LWCIRCSTRINGlwgeom_as_lwcircstring (const LWGEOM *lwgeom)
 
LWCOMPOUNDlwgeom_as_lwcompound (const LWGEOM *lwgeom)
 
LWCURVEPOLYlwgeom_as_lwcurvepoly (const LWGEOM *lwgeom)
 
LWPOLYlwgeom_as_lwpoly (const LWGEOM *lwgeom)
 
LWTRIANGLElwgeom_as_lwtriangle (const LWGEOM *lwgeom)
 
LWCOLLECTIONlwgeom_as_lwcollection (const LWGEOM *lwgeom)
 
LWMPOINTlwgeom_as_lwmpoint (const LWGEOM *lwgeom)
 
LWMLINElwgeom_as_lwmline (const LWGEOM *lwgeom)
 
LWMPOLYlwgeom_as_lwmpoly (const LWGEOM *lwgeom)
 
LWPSURFACElwgeom_as_lwpsurface (const LWGEOM *lwgeom)
 
LWTINlwgeom_as_lwtin (const LWGEOM *lwgeom)
 
LWGEOMlwtin_as_lwgeom (const LWTIN *obj)
 
LWGEOMlwpsurface_as_lwgeom (const LWPSURFACE *obj)
 
LWGEOMlwmpoly_as_lwgeom (const LWMPOLY *obj)
 
LWGEOMlwmline_as_lwgeom (const LWMLINE *obj)
 
LWGEOMlwmpoint_as_lwgeom (const LWMPOINT *obj)
 
LWGEOMlwcollection_as_lwgeom (const LWCOLLECTION *obj)
 
LWGEOMlwcircstring_as_lwgeom (const LWCIRCSTRING *obj)
 
LWGEOMlwcurvepoly_as_lwgeom (const LWCURVEPOLY *obj)
 
LWGEOMlwcompound_as_lwgeom (const LWCOMPOUND *obj)
 
LWGEOMlwpoly_as_lwgeom (const LWPOLY *obj)
 
LWGEOMlwtriangle_as_lwgeom (const LWTRIANGLE *obj)
 
LWGEOMlwline_as_lwgeom (const LWLINE *obj)
 
LWGEOMlwpoint_as_lwgeom (const LWPOINT *obj)
 
uint8_t lwtype_multitype (uint8_t type)
 
LWGEOMlwgeom_as_multi (const LWGEOM *lwgeom)
 Create a new LWGEOM of the appropriate MULTI* type. More...
 
LWGEOMlwgeom_as_curve (const LWGEOM *lwgeom)
 Create a new LWGEOM of the appropriate CURVE* type. More...
 
void lwgeom_release (LWGEOM *lwgeom)
 Free the containing LWGEOM and the associated BOX. More...
 
LWGEOMlwgeom_clone (const LWGEOM *lwgeom)
 Clone LWGEOM object. More...
 
LWGEOMlwgeom_clone_deep (const LWGEOM *lwgeom)
 Deep-clone an LWGEOM object. More...
 
char * lwgeom_to_ewkt (const LWGEOM *lwgeom)
 Return an alloced string. More...
 
char lwgeom_same (const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
 geom1 same as geom2 iff More...
 
int lwpoint_inside_circle (const LWPOINT *p, double cx, double cy, double rad)
 
void lwgeom_drop_bbox (LWGEOM *lwgeom)
 Call this function to drop BBOX and SRID from LWGEOM. More...
 
void lwgeom_add_bbox (LWGEOM *lwgeom)
 Ensure there's a box in the LWGEOM. More...
 
void lwgeom_refresh_bbox (LWGEOM *lwgeom)
 Drop current bbox and calculate a fresh one. More...
 
void lwgeom_add_bbox_deep (LWGEOM *lwgeom, GBOX *gbox)
 Compute a box for geom and all sub-geometries, if not already computed. More...
 
const GBOXlwgeom_get_bbox (const LWGEOM *lwg)
 Get a non-empty geometry bounding box, computing and caching it if not already there. More...
 
int lwgeom_calculate_gbox (const LWGEOM *lwgeom, GBOX *gbox)
 Calculate the gbox for this geometry, a cartesian box or geodetic box, depending on how it is flagged. More...
 
void lwgeom_drop_srid (LWGEOM *lwgeom)
 
LWGEOMlwgeom_segmentize2d (const LWGEOM *lwgeom, double dist)
 
LWGEOMlwgeom_force_2d (const LWGEOM *geom)
 Strip out the Z/M components of an LWGEOM. More...
 
LWGEOMlwgeom_force_3dz (const LWGEOM *geom)
 
LWGEOMlwgeom_force_3dm (const LWGEOM *geom)
 
LWGEOMlwgeom_force_4d (const LWGEOM *geom)
 
LWGEOMlwgeom_force_dims (const LWGEOM *geom, int hasz, int hasm)
 
LWGEOMlwgeom_force_sfs (LWGEOM *geom, int version)
 
int32_t lwgeom_get_srid (const LWGEOM *geom)
 Return SRID number. More...
 
uint32_t lwgeom_get_type (const LWGEOM *geom)
 Return LWTYPE number. More...
 
int lwgeom_has_z (const LWGEOM *geom)
 Return LW_TRUE if geometry has Z ordinates. More...
 
int lwgeom_has_m (const LWGEOM *geom)
 Return LW_TRUE if geometry has M ordinates. More...
 
int lwgeom_ndims (const LWGEOM *geom)
 Return the number of dimensions (2, 3, 4) in a geometry. More...
 
void lwgeom_set_geodetic (LWGEOM *geom, int value)
 Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists. More...
 
void lwgeom_longitude_shift (LWGEOM *lwgeom)
 
int lwgeom_is_closed (const LWGEOM *geom)
 Return true or false depending on whether a geometry is a linear feature that closes on itself. More...
 
int lwgeom_is_collection (const LWGEOM *geom)
 Determine whether a LWGEOM can contain sub-geometries or not. More...
 
int lwtype_is_collection (uint8_t type)
 Return TRUE if the geometry may contain sub-geometries, i.e. More...
 
uint32_t lwtype_get_collectiontype (uint8_t type)
 Given an lwtype number, what homogeneous collection can hold it? More...
 
void lwgeom_free (LWGEOM *lwgeom)
 
int lwgeom_needs_bbox (const LWGEOM *geom)
 Check whether or not a lwgeom is big enough to warrant a bounding box. More...
 
uint32_t lwgeom_count_vertices (const LWGEOM *geom)
 Count points in an LWGEOM. More...
 
int lwgeom_dimension (const LWGEOM *geom)
 For an LWGEOM, returns 0 for points, 1 for lines, 2 for polygons, 3 for volume, and the max dimension of a collection. More...
 
uint32_t lwgeom_count_rings (const LWGEOM *geom)
 Count rings in an LWGEOM. More...
 
int lwgeom_is_empty (const LWGEOM *geom)
 Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) More...
 
int lwgeom_has_srid (const LWGEOM *geom)
 Return true or false depending on whether a geometry has a valid SRID set. More...
 
static int lwcollection_dimensionality (const LWCOLLECTION *col)
 
int lwgeom_dimensionality (const LWGEOM *geom)
 Return the dimensionality (relating to point/line/poly) of an lwgeom. More...
 
LWGEOMlwgeom_remove_repeated_points (const LWGEOM *in, double tolerance)
 
void lwgeom_swap_ordinates (LWGEOM *in, LWORD o1, LWORD o2)
 Swap ordinate values in every vertex of the geometry. More...
 
void lwgeom_set_srid (LWGEOM *geom, int32_t srid)
 
void lwgeom_remove_repeated_points_in_place (LWGEOM *geom, double tolerance)
 
void lwgeom_simplify_in_place (LWGEOM *geom, double epsilon, int preserve_collapsed)
 
LWGEOMlwgeom_simplify (const LWGEOM *igeom, double dist, int preserve_collapsed)
 
double lwgeom_area (const LWGEOM *geom)
 
double lwgeom_perimeter (const LWGEOM *geom)
 
double lwgeom_perimeter_2d (const LWGEOM *geom)
 
double lwgeom_length (const LWGEOM *geom)
 
double lwgeom_length_2d (const LWGEOM *geom)
 
void lwgeom_affine (LWGEOM *geom, const AFFINE *affine)
 
void lwgeom_scale (LWGEOM *geom, const POINT4D *factor)
 
LWGEOMlwgeom_construct_empty (uint8_t type, int srid, char hasz, char hasm)
 
int lwgeom_startpoint (const LWGEOM *lwgeom, POINT4D *pt)
 
void lwgeom_grid_in_place (LWGEOM *geom, const gridspec *grid)
 
LWGEOMlwgeom_grid (const LWGEOM *lwgeom, const gridspec *grid)
 
static int lwgeom_subdivide_recursive (const LWGEOM *geom, uint8_t dimension, uint32_t maxvertices, uint32_t depth, LWCOLLECTION *col)
 
LWCOLLECTIONlwgeom_subdivide (const LWGEOM *geom, uint32_t maxvertices)
 
int lwgeom_is_trajectory (const LWGEOM *geom)
 Return LW_TRUE or LW_FALSE depending on whether or not a geometry is a linestring with measure value growing from start to end vertex. More...
 
static uint8_t bits_for_precision (int32_t significant_digits)
 
static double trim_preserve_decimal_digits (double d, int32_t decimal_digits)
 
void lwgeom_trim_bits_in_place (LWGEOM *geom, int32_t prec_x, int32_t prec_y, int32_t prec_z, int32_t prec_m)
 Trim the bits of an LWGEOM in place, to optimize it for compression. More...
 

Variables

uint8_t MULTITYPE [NUMTYPES]
 Look-up for the correct MULTI* type promotion for singleton types. More...