PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum ST_LineCrossingDirection ( PG_FUNCTION_ARGS  )

Definition at line 661 of file lwgeom_functions_analytic.c.

References error_if_srid_mismatch(), gserialized_get_srid(), gserialized_get_type(), LINETYPE, lwgeom_as_lwline(), lwgeom_from_gserialized(), and lwline_crossing_direction().

662 {
663  int type1, type2, rv;
664  LWLINE *l1 = NULL;
665  LWLINE *l2 = NULL;
666  GSERIALIZED *geom1 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
667  GSERIALIZED *geom2 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
668 
670 
671  type1 = gserialized_get_type(geom1);
672  type2 = gserialized_get_type(geom2);
673 
674  if ( type1 != LINETYPE || type2 != LINETYPE )
675  {
676  elog(ERROR,"This function only accepts LINESTRING as arguments.");
677  PG_RETURN_NULL();
678  }
679 
682 
683  rv = lwline_crossing_direction(l1, l2);
684 
685  PG_FREE_IF_COPY(geom1, 0);
686  PG_FREE_IF_COPY(geom2, 1);
687 
688  PG_RETURN_INT32(rv);
689 
690 }
#define LINETYPE
Definition: liblwgeom.h:61
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
Definition: g_serialized.c:56
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:317
int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2)
Given two lines, characterize how (and if) they cross each other.
Definition: lwalgorithm.c:461
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:89
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:70

Here is the call graph for this function: