PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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;
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];
429 ptarray_append_point(opts, &pt, LW_TRUE);
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);
441 ptarray_append_point(opts, &pt, LW_TRUE);
442 }
443 }
444 }
446
447 return opts;
448
449}
void destroy_effectivearea(EFFECTIVE_AREAS *ea)
void ptarray_calc_areas(EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld)
We calculate the effective area for the first time.
EFFECTIVE_AREAS * initiate_effectivearea(const POINTARRAY *inpts)
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition lwgeom_api.c:107
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
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:147
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
double * res_arealist
const POINTARRAY * inpts
Structure to hold pointarray and its arealist.
double m
Definition liblwgeom.h:414
lwflags_t flags
Definition liblwgeom.h:431
uint32_t npoints
Definition liblwgeom.h:427

References destroy_effectivearea(), POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint4d(), initiate_effectivearea(), EFFECTIVE_AREAS::inpts, LW_TRUE, LWDEBUG, POINT4D::m, POINTARRAY::npoints, 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: