PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_startpoint()

int lwgeom_startpoint ( const LWGEOM lwgeom,
POINT4D pt 
)

Definition at line 2122 of file lwgeom.c.

2123 {
2124  if ( ! lwgeom )
2125  return LW_FAILURE;
2126 
2127  switch( lwgeom->type )
2128  {
2129  case POINTTYPE:
2130  return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
2131  case TRIANGLETYPE:
2132  case CIRCSTRINGTYPE:
2133  case LINETYPE:
2134  return ptarray_startpoint(((LWLINE*)lwgeom)->points, pt);
2135  case POLYGONTYPE:
2136  return lwpoly_startpoint((LWPOLY*)lwgeom, pt);
2137  case CURVEPOLYTYPE:
2138  case COMPOUNDTYPE:
2139  case MULTIPOINTTYPE:
2140  case MULTILINETYPE:
2141  case MULTIPOLYGONTYPE:
2142  case COLLECTIONTYPE:
2143  return lwcollection_startpoint((LWCOLLECTION*)lwgeom, pt);
2144  default:
2145  lwerror("int: unsupported geometry type: %s",
2146  lwtype_name(lwgeom->type));
2147  return LW_FAILURE;
2148  }
2149 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define LW_FAILURE
Definition: liblwgeom.h:79
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TRIANGLETYPE
Definition: liblwgeom.h:98
int lwpoly_startpoint(const LWPOLY *lwpoly, POINT4D *pt)
Definition: lwpoly.c:531
int lwcollection_startpoint(const LWCOLLECTION *col, POINT4D *pt)
Definition: lwcollection.c:571
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:2001
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
uint8_t type
Definition: liblwgeom.h:399

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 LWPOINT::type.

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

Here is the call graph for this function:
Here is the caller graph for this function: