PostGIS  3.0.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 1131 of file mvt.c.

1132 {
1133  GBOX clip_box = {0};
1134  LWGEOM *clipped_lwgeom;
1135 
1136  /* Wagyu only supports polygons. Default to geos for other types */
1137  lwgeom = lwgeom_to_basic_type(lwgeom, POLYGONTYPE);
1138  if (lwgeom->type != POLYGONTYPE && lwgeom->type != MULTIPOLYGONTYPE)
1139  {
1140  return mvt_clip_and_validate_geos(lwgeom, basic_type, extent, buffer, clip_geom);
1141  }
1142 
1143  if (!clip_geom)
1144  {
1145  /* With clipping disabled, we request a clip with the geometry bbox to force validation */
1146  lwgeom_calculate_gbox(lwgeom, &clip_box);
1147  }
1148  else
1149  {
1150  clip_box.xmax = clip_box.ymax = (double)extent + (double)buffer;
1151  clip_box.xmin = clip_box.ymin = -(double)buffer;
1152  }
1153 
1154  clipped_lwgeom = lwgeom_wagyu_clip_by_box(lwgeom, &clip_box);
1155 
1156  return clipped_lwgeom;
1157 }
#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:737
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:1093
static LWGEOM * lwgeom_to_basic_type(LWGEOM *geom, uint8 original_type)
In place process a collection to find a concrete geometry object and expose that as the actual object...
Definition: mvt.c:823
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:343
double xmax
Definition: liblwgeom.h:341
double ymin
Definition: liblwgeom.h:342
double xmin
Definition: liblwgeom.h:340
uint8_t type
Definition: liblwgeom.h:448

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: