PostGIS  3.3.9dev-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 897 of file mvt.c.

898 {
899  GBOX clip_box = {0};
900  LWGEOM *clipped_lwgeom;
901 
902  /* Wagyu only supports polygons. Default to geos for other types */
903  lwgeom = lwgeom_to_basic_type(lwgeom, POLYGONTYPE);
904  if (lwgeom->type != POLYGONTYPE && lwgeom->type != MULTIPOLYGONTYPE)
905  {
906  return mvt_clip_and_validate_geos(lwgeom, basic_type, extent, buffer, clip_geom);
907  }
908 
909  if (!clip_geom)
910  {
911  /* With clipping disabled, we request a clip with the geometry bbox to force validation */
912  lwgeom_calculate_gbox(lwgeom, &clip_box);
913  }
914  else
915  {
916  clip_box.xmax = clip_box.ymax = (double)extent + (double)buffer;
917  clip_box.xmin = clip_box.ymin = -(double)buffer;
918  }
919 
920  clipped_lwgeom = lwgeom_wagyu_clip_by_box(lwgeom, &clip_box);
921 
922  return clipped_lwgeom;
923 }
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:122
#define POLYGONTYPE
Definition: liblwgeom.h:119
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:755
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:872
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:815
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:372
double xmax
Definition: liblwgeom.h:370
double ymin
Definition: liblwgeom.h:371
double xmin
Definition: liblwgeom.h:369
uint8_t type
Definition: liblwgeom.h:477

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: