PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwgeom_startpoint()

int lwgeom_startpoint ( const LWGEOM lwgeom,
POINT4D pt 
)

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

2116 {
2117  if ( ! lwgeom )
2118  return LW_FAILURE;
2119 
2120  switch( lwgeom->type )
2121  {
2122  case POINTTYPE:
2123  return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
2124  case TRIANGLETYPE:
2125  case CIRCSTRINGTYPE:
2126  case LINETYPE:
2127  return ptarray_startpoint(((LWLINE*)lwgeom)->points, pt);
2128  case POLYGONTYPE:
2129  return lwpoly_startpoint((LWPOLY*)lwgeom, pt);
2130  case CURVEPOLYTYPE:
2131  case COMPOUNDTYPE:
2132  case MULTIPOINTTYPE:
2133  case MULTILINETYPE:
2134  case MULTIPOLYGONTYPE:
2135  case COLLECTIONTYPE:
2136  return lwcollection_startpoint((LWCOLLECTION*)lwgeom, pt);
2137  default:
2138  lwerror("int: unsupported geometry type: %s",
2139  lwtype_name(lwgeom->type));
2140  return LW_FAILURE;
2141  }
2142 }
#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:218
int lwcollection_startpoint(const LWCOLLECTION *col, POINT4D *pt)
Definition: lwcollection.c:571
int lwpoly_startpoint(const LWPOLY *lwpoly, POINT4D *pt)
Definition: lwpoly.c:531
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:1994
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
#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:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: