PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_grid()

LWGEOM* lwgeom_grid ( const LWGEOM lwgeom,
const gridspec grid 
)

Definition at line 1912 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, LINETYPE, lwcircstring_grid(), lwcollection_grid(), lwerror(), lwgeom_subdivide_recursive(), lwline_grid(), lwpoint_grid(), lwpoly_grid(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, LWGEOM::type, and LWCIRCSTRING::type.

Referenced by lwcollection_grid(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), lwgeom_to_text(), mvt_geom(), and test_grid().

1913 {
1914  switch ( lwgeom->type )
1915  {
1916  case POINTTYPE:
1917  return (LWGEOM *)lwpoint_grid((LWPOINT *)lwgeom, grid);
1918  case LINETYPE:
1919  return (LWGEOM *)lwline_grid((LWLINE *)lwgeom, grid);
1920  case POLYGONTYPE:
1921  return (LWGEOM *)lwpoly_grid((LWPOLY *)lwgeom, grid);
1922  case MULTIPOINTTYPE:
1923  case MULTILINETYPE:
1924  case MULTIPOLYGONTYPE:
1925  case COLLECTIONTYPE:
1926  case COMPOUNDTYPE:
1927  return (LWGEOM *)lwcollection_grid((LWCOLLECTION *)lwgeom, grid);
1928  case CIRCSTRINGTYPE:
1929  return (LWGEOM *)lwcircstring_grid((LWCIRCSTRING *)lwgeom, grid);
1930  default:
1931  lwerror("lwgeom_grid: Unsupported geometry type: %s",
1932  lwtype_name(lwgeom->type));
1933  return NULL;
1934  }
1935 }
LWCIRCSTRING * lwcircstring_grid(const LWCIRCSTRING *line, const gridspec *grid)
Definition: lwcircstring.c:318
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
LWLINE * lwline_grid(const LWLINE *line, const gridspec *grid)
Definition: lwline.c:595
LWPOINT * lwpoint_grid(const LWPOINT *point, const gridspec *grid)
Definition: lwpoint.c:300
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
LWPOLY * lwpoly_grid(const LWPOLY *poly, const gridspec *grid)
Definition: lwpoly.c:642
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
LWCOLLECTION * lwcollection_grid(const LWCOLLECTION *coll, const gridspec *grid)
Definition: lwcollection.c:589
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTILINETYPE
Definition: liblwgeom.h:89
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: