PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_grid()

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

Definition at line 1881 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(), and test_grid().

1882 {
1883  switch ( lwgeom->type )
1884  {
1885  case POINTTYPE:
1886  return (LWGEOM *)lwpoint_grid((LWPOINT *)lwgeom, grid);
1887  case LINETYPE:
1888  return (LWGEOM *)lwline_grid((LWLINE *)lwgeom, grid);
1889  case POLYGONTYPE:
1890  return (LWGEOM *)lwpoly_grid((LWPOLY *)lwgeom, grid);
1891  case MULTIPOINTTYPE:
1892  case MULTILINETYPE:
1893  case MULTIPOLYGONTYPE:
1894  case COLLECTIONTYPE:
1895  case COMPOUNDTYPE:
1896  return (LWGEOM *)lwcollection_grid((LWCOLLECTION *)lwgeom, grid);
1897  case CIRCSTRINGTYPE:
1898  return (LWGEOM *)lwcircstring_grid((LWCIRCSTRING *)lwgeom, grid);
1899  default:
1900  lwerror("lwgeom_grid: Unsupported geometry type: %s",
1901  lwtype_name(lwgeom->type));
1902  return NULL;
1903  }
1904 }
LWCIRCSTRING * lwcircstring_grid(const LWCIRCSTRING *line, const gridspec *grid)
Definition: lwcircstring.c:318
#define LINETYPE
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
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:282
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
LWPOLY * lwpoly_grid(const LWPOLY *poly, const gridspec *grid)
Definition: lwpoly.c:602
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
LWCOLLECTION * lwcollection_grid(const LWCOLLECTION *coll, const gridspec *grid)
Definition: lwcollection.c:582
uint8_t type
Definition: liblwgeom.h:395
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: