PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_startpoint()

int lwgeom_startpoint ( const LWGEOM lwgeom,
POINT4D pt 
)

Definition at line 1850 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, LW_FAILURE, lwcollection_startpoint(), lwerror(), lwpoly_startpoint(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, ptarray_startpoint(), TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by geography_distance_cache_tolerance(), geography_tree_distance(), and lwcollection_startpoint().

1851 {
1852  if ( ! lwgeom )
1853  return LW_FAILURE;
1854 
1855  switch( lwgeom->type )
1856  {
1857  case POINTTYPE:
1858  return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
1859  case TRIANGLETYPE:
1860  case CIRCSTRINGTYPE:
1861  case LINETYPE:
1862  return ptarray_startpoint(((LWLINE*)lwgeom)->points, pt);
1863  case POLYGONTYPE:
1864  return lwpoly_startpoint((LWPOLY*)lwgeom, pt);
1865  case CURVEPOLYTYPE:
1866  case COMPOUNDTYPE:
1867  case MULTIPOINTTYPE:
1868  case MULTILINETYPE:
1869  case MULTIPOLYGONTYPE:
1870  case COLLECTIONTYPE:
1871  return lwcollection_startpoint((LWCOLLECTION*)lwgeom, pt);
1872  default:
1873  lwerror("int: unsupported geometry type: %s",
1874  lwtype_name(lwgeom->type));
1875  return LW_FAILURE;
1876  }
1877 }
#define LINETYPE
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define LW_FAILURE
Definition: liblwgeom.h:78
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
int lwcollection_startpoint(const LWCOLLECTION *col, POINT4D *pt)
Definition: lwcollection.c:573
int lwpoly_startpoint(const LWPOLY *lwpoly, POINT4D *pt)
Definition: lwpoly.c:574
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:1826
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
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: