PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_startpoint()

int lwgeom_startpoint ( const LWGEOM lwgeom,
POINT4D pt 
)

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

1882 {
1883  if ( ! lwgeom )
1884  return LW_FAILURE;
1885 
1886  switch( lwgeom->type )
1887  {
1888  case POINTTYPE:
1889  return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
1890  case TRIANGLETYPE:
1891  case CIRCSTRINGTYPE:
1892  case LINETYPE:
1893  return ptarray_startpoint(((LWLINE*)lwgeom)->points, pt);
1894  case POLYGONTYPE:
1895  return lwpoly_startpoint((LWPOLY*)lwgeom, pt);
1896  case CURVEPOLYTYPE:
1897  case COMPOUNDTYPE:
1898  case MULTIPOINTTYPE:
1899  case MULTILINETYPE:
1900  case MULTIPOLYGONTYPE:
1901  case COLLECTIONTYPE:
1902  return lwcollection_startpoint((LWCOLLECTION*)lwgeom, pt);
1903  default:
1904  lwerror("int: unsupported geometry type: %s",
1905  lwtype_name(lwgeom->type));
1906  return LW_FAILURE;
1907  }
1908 }
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define LW_FAILURE
Definition: liblwgeom.h:79
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
int lwcollection_startpoint(const LWCOLLECTION *col, POINT4D *pt)
Definition: lwcollection.c:580
int lwpoly_startpoint(const LWPOLY *lwpoly, POINT4D *pt)
Definition: lwpoly.c:614
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:1873
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
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: