PostGIS  3.4.0dev-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 896 of file mvt.c.

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

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: