PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ mvt_clip_and_validate()

static LWGEOM* mvt_clip_and_validate ( LWGEOM lwgeom,
uint8_t  basic_type,
uint32_t  extent,
uint32_t  buffer,
bool  clip_geom 
)
static

Definition at line 1095 of file mvt.c.

1096 {
1097  GBOX clip_box = {0};
1098  LWGEOM *clipped_lwgeom;
1099 
1100  /* Wagyu only supports polygons. Default to geos for other types */
1101  lwgeom = lwgeom_to_basic_type(lwgeom, POLYGONTYPE);
1102  if (lwgeom->type != POLYGONTYPE && lwgeom->type != MULTIPOLYGONTYPE)
1103  {
1104  return mvt_clip_and_validate_geos(lwgeom, basic_type, extent, buffer, clip_geom);
1105  }
1106 
1107  if (!clip_geom)
1108  {
1109  /* With clipping disabled, we request a clip with the geometry bbox to force validation */
1110  lwgeom_calculate_gbox(lwgeom, &clip_box);
1111  }
1112  else
1113  {
1114  clip_box.xmax = clip_box.ymax = (double)extent + (double)buffer;
1115  clip_box.xmin = clip_box.ymin = -(double)buffer;
1116  }
1117 
1118  clipped_lwgeom = lwgeom_wagyu_clip_by_box(lwgeom, &clip_box);
1119 
1120  return clipped_lwgeom;
1121 }
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:121
#define POLYGONTYPE
Definition: liblwgeom.h:118
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
Definition: lwgeom.c:738
static LWGEOM * mvt_clip_and_validate_geos(LWGEOM *lwgeom, uint8_t basic_type, uint32_t extent, uint32_t buffer, bool clip_geom)
Definition: mvt.c:1057
static LWGEOM * lwgeom_to_basic_type(LWGEOM *geom, uint8_t original_type)
In place process a collection to find a concrete geometry object and expose that as the actual object...
Definition: mvt.c:787
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:371
double xmax
Definition: liblwgeom.h:369
double ymin
Definition: liblwgeom.h:370
double xmin
Definition: liblwgeom.h:368
uint8_t type
Definition: liblwgeom.h:476

References buffer(), lwgeom_calculate_gbox(), lwgeom_to_basic_type(), MULTIPOLYGONTYPE, mvt_clip_and_validate_geos(), POLYGONTYPE, LWGEOM::type, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by mvt_geom().

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