PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ST_LineCrossingDirection()

Datum ST_LineCrossingDirection ( PG_FUNCTION_ARGS  )

Definition at line 462 of file lwgeom_functions_analytic.c.

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

Referenced by LWGEOM_snaptogrid_pointoff().

463 {
464  int type1, type2, rv;
465  LWLINE *l1 = NULL;
466  LWLINE *l2 = NULL;
467  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
468  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
469 
471 
472  type1 = gserialized_get_type(geom1);
473  type2 = gserialized_get_type(geom2);
474 
475  if ( type1 != LINETYPE || type2 != LINETYPE )
476  {
477  elog(ERROR,"This function only accepts LINESTRING as arguments.");
478  PG_RETURN_NULL();
479  }
480 
483 
484  rv = lwline_crossing_direction(l1, l2);
485 
486  PG_FREE_IF_COPY(geom1, 0);
487  PG_FREE_IF_COPY(geom2, 1);
488 
489  PG_RETURN_INT32(rv);
490 
491 }
#define LINETYPE
Definition: liblwgeom.h:86
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:86
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2)
Given two lines, characterize how (and if) they cross each other.
Definition: lwalgorithm.c:460
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:371
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:138
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:100
Here is the call graph for this function:
Here is the caller graph for this function: