PostGIS  2.2.7dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_grid ( const LWGEOM lwgeom,
const gridspec grid 
)

Definition at line 1868 of file lwgeom.c.

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

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

1869 {
1870  switch ( lwgeom->type )
1871  {
1872  case POINTTYPE:
1873  return (LWGEOM *)lwpoint_grid((LWPOINT *)lwgeom, grid);
1874  case LINETYPE:
1875  return (LWGEOM *)lwline_grid((LWLINE *)lwgeom, grid);
1876  case POLYGONTYPE:
1877  return (LWGEOM *)lwpoly_grid((LWPOLY *)lwgeom, grid);
1878  case MULTIPOINTTYPE:
1879  case MULTILINETYPE:
1880  case MULTIPOLYGONTYPE:
1881  case COLLECTIONTYPE:
1882  case COMPOUNDTYPE:
1883  return (LWGEOM *)lwcollection_grid((LWCOLLECTION *)lwgeom, grid);
1884  case CIRCSTRINGTYPE:
1885  return (LWGEOM *)lwcircstring_grid((LWCIRCSTRING *)lwgeom, grid);
1886  default:
1887  lwerror("lwgeom_grid: Unsupported geometry type: %s",
1888  lwtype_name(lwgeom->type));
1889  return NULL;
1890  }
1891 }
LWCIRCSTRING * lwcircstring_grid(const LWCIRCSTRING *line, const gridspec *grid)
Definition: lwcircstring.c:305
#define LINETYPE
Definition: liblwgeom.h:71
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
LWLINE * lwline_grid(const LWLINE *line, const gridspec *grid)
Definition: lwline.c:566
LWPOINT * lwpoint_grid(const LWPOINT *point, const gridspec *grid)
Definition: lwpoint.c:269
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWPOLY * lwpoly_grid(const LWPOLY *poly, const gridspec *grid)
Definition: lwpoly.c:529
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
LWCOLLECTION * lwcollection_grid(const LWCOLLECTION *coll, const gridspec *grid)
Definition: lwcollection.c:569
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: