PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lwgeom_startpoint ( const LWGEOM lwgeom,
POINT4D pt 
)

Definition at line 1692 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, and LWGEOM::type.

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

1693 {
1694  if ( ! lwgeom )
1695  return LW_FAILURE;
1696 
1697  switch( lwgeom->type )
1698  {
1699  case POINTTYPE:
1700  return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
1701  case TRIANGLETYPE:
1702  case CIRCSTRINGTYPE:
1703  case LINETYPE:
1704  return ptarray_startpoint(((LWLINE*)lwgeom)->points, pt);
1705  case POLYGONTYPE:
1706  return lwpoly_startpoint((LWPOLY*)lwgeom, pt);
1707  case CURVEPOLYTYPE:
1708  case COMPOUNDTYPE:
1709  case MULTIPOINTTYPE:
1710  case MULTILINETYPE:
1711  case MULTIPOLYGONTYPE:
1712  case COLLECTIONTYPE:
1713  return lwcollection_startpoint((LWCOLLECTION*)lwgeom, pt);
1714  default:
1715  lwerror("int: unsupported geometry type: %s",
1716  lwtype_name(lwgeom->type));
1717  return LW_FAILURE;
1718  }
1719 }
#define LINETYPE
Definition: liblwgeom.h:61
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define LW_FAILURE
Definition: liblwgeom.h:54
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
int lwcollection_startpoint(const LWCOLLECTION *col, POINT4D *pt)
Definition: lwcollection.c:550
int lwpoly_startpoint(const LWPOLY *lwpoly, POINT4D *pt)
Definition: lwpoly.c:480
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:1740
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: