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

◆ ptarray_calculate_gbox_cartesian()

int ptarray_calculate_gbox_cartesian ( const POINTARRAY pa,
GBOX gbox 
)

Calculate box (x/y) and add values to gbox.

Return LW_SUCCESS on success.

Definition at line 613 of file gbox.c.

614{
615 if (!pa || pa->npoints == 0)
616 return LW_FAILURE;
617 if (!gbox)
618 return LW_FAILURE;
619
620 int has_z = FLAGS_GET_Z(pa->flags);
621 int has_m = FLAGS_GET_M(pa->flags);
622 gbox->flags = lwflags(has_z, has_m, 0);
623 LWDEBUGF(4, "ptarray_calculate_gbox Z: %d M: %d", has_z, has_m);
624 int coordinates = 2 + has_z + has_m;
625
626 switch (coordinates)
627 {
628 case 2:
629 {
631 break;
632 }
633 case 3:
634 {
635 if (has_z)
636 {
638 }
639 else
640 {
641 double zmin = gbox->zmin;
642 double zmax = gbox->zmax;
644 gbox->mmin = gbox->zmin;
645 gbox->mmax = gbox->zmax;
646 gbox->zmin = zmin;
647 gbox->zmax = zmax;
648 }
649 break;
650 }
651 default:
652 {
654 break;
655 }
656 }
657 return LW_SUCCESS;
658}
static void ptarray_calculate_gbox_cartesian_2d(const POINTARRAY *pa, GBOX *gbox)
Definition gbox.c:549
static void ptarray_calculate_gbox_cartesian_3d(const POINTARRAY *pa, GBOX *gbox)
Definition gbox.c:568
static void ptarray_calculate_gbox_cartesian_4d(const POINTARRAY *pa, GBOX *gbox)
Definition gbox.c:589
#define LW_FAILURE
Definition liblwgeom.h:96
#define LW_SUCCESS
Definition liblwgeom.h:97
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition lwutil.c:477
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
double zmax
Definition liblwgeom.h:359
double zmin
Definition liblwgeom.h:358
double mmax
Definition liblwgeom.h:361
double mmin
Definition liblwgeom.h:360
lwflags_t flags
Definition liblwgeom.h:353
lwflags_t flags
Definition liblwgeom.h:431
uint32_t npoints
Definition liblwgeom.h:427

References GBOX::flags, POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, LW_FAILURE, LW_SUCCESS, LWDEBUGF, lwflags(), GBOX::mmax, GBOX::mmin, POINTARRAY::npoints, ptarray_calculate_gbox_cartesian_2d(), ptarray_calculate_gbox_cartesian_3d(), ptarray_calculate_gbox_cartesian_4d(), GBOX::zmax, and GBOX::zmin.

Referenced by box3d_transform(), LWGEOM_interiorringn_polygon(), lwline_calculate_gbox_cartesian(), lwpoint_calculate_gbox_cartesian(), lwpoly_calculate_gbox_cartesian(), and lwtriangle_calculate_gbox_cartesian().

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