PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ptarray_set_effective_area()

static POINTARRAY* ptarray_set_effective_area ( POINTARRAY inpts,
int  avoid_collaps,
int  set_area,
double  trshld 
)
static

Definition at line 402 of file effectivearea.c.

403 {
404  LWDEBUG(2, "Entered ptarray_set_effective_area");
405  uint32_t p;
406  POINT4D pt;
407  EFFECTIVE_AREAS *ea;
408  POINTARRAY *opts;
409  int set_m;
410  if(set_area)
411  set_m=1;
412  else
413  set_m=FLAGS_GET_M(inpts->flags);
414  ea=initiate_effectivearea(inpts);
415 
416  opts = ptarray_construct_empty(FLAGS_GET_Z(inpts->flags), set_m, inpts->npoints);
417 
418  ptarray_calc_areas(ea,avoid_collaps,set_area,trshld);
419 
420  if(set_area)
421  {
422  /*Only return points with an effective area above the threshold*/
423  for (p=0;p<ea->inpts->npoints;p++)
424  {
425  if(ea->res_arealist[p]>=trshld)
426  {
427  pt=getPoint4d(ea->inpts, p);
428  pt.m=ea->res_arealist[p];
430  }
431  }
432  }
433  else
434  {
435  /*Only return points with an effective area above the threshold*/
436  for (p=0;p<ea->inpts->npoints;p++)
437  {
438  if(ea->res_arealist[p]>=trshld)
439  {
440  pt=getPoint4d(ea->inpts, p);
442  }
443  }
444  }
446 
447  return opts;
448 
449 }
EFFECTIVE_AREAS * initiate_effectivearea(const POINTARRAY *inpts)
Definition: effectivearea.c:30
void destroy_effectivearea(EFFECTIVE_AREAS *ea)
Definition: effectivearea.c:42
void ptarray_calc_areas(EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld)
We calculate the effective area for the first time.
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:106
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition: ptarray.c:156
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
opts
Definition: ovdump.py:44
double * res_arealist
Definition: effectivearea.h:68
const POINTARRAY * inpts
Definition: effectivearea.h:66
Structure to hold pointarray and its arealist.
Definition: effectivearea.h:65
double m
Definition: liblwgeom.h:355
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t flags
Definition: liblwgeom.h:372
unsigned int uint32_t
Definition: uthash.h:78

References destroy_effectivearea(), POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint4d(), initiate_effectivearea(), EFFECTIVE_AREAS::inpts, LW_TRUE, LWDEBUG, POINT4D::m, POINTARRAY::npoints, ovdump::opts, ptarray_append_point(), ptarray_calc_areas(), ptarray_construct_empty(), and EFFECTIVE_AREAS::res_arealist.

Referenced by lwline_set_effective_area(), and lwpoly_set_effective_area().

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