629 WindowObject winobj = PG_WINDOW_OBJECT();
630 int64 curpos = WinGetCurrentPosition(winobj);
631 int64 rowcount = WinGetPartitionRowCount(winobj);
634 MemoryContext uppercontext = fcinfo->flinfo->fn_mcxt;
635 MemoryContext oldcontext;
642 double tolerance = 0.0;
643 bool simplifyBoundary =
true;
644 GEOSGeometry *output = NULL;
645 GEOSGeometry *input = NULL;
648 elog(ERROR,
"%s: Could not find upper context", __func__);
658 d = WinGetFuncArgCurrent(winobj, 1, &isnull);
660 tolerance = DatumGetFloat8(d);
666 d = WinGetFuncArgCurrent(winobj, 2, &isnull);
668 simplifyBoundary = DatumGetBool(d);
681 output = GEOSCoverageSimplifyVW(input, tolerance, !simplifyBoundary);
685 GEOSCoverageIsValid(input, tolerance, &output);
689 elog(ERROR,
"Unknown mode, never get here");
692 GEOSGeom_destroy(input);
699 oldcontext = MemoryContextSwitchTo(uppercontext);
701 MemoryContextSwitchTo(oldcontext);
702 GEOSGeom_destroy(output);
712 if (context->
idx[curpos] < 0)
725 oldcontext = MemoryContextSwitchTo(uppercontext);
735 MemoryContextSwitchTo(oldcontext);
739 if (curpos == rowcount - 1)
742 if (!
result) PG_RETURN_NULL();
744 PG_RETURN_POINTER(
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
LWGEOM * lwcollection_getsubgeom(LWCOLLECTION *col, int gnum)
void lwcollection_free(LWCOLLECTION *col)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
static coverage_context * coverage_context_fetch(WindowObject winobj, int64 rowcount)
static GEOSGeometry * coverage_read_partition_into_collection(WindowObject winobj, coverage_context *context)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
#define HANDLE_GEOS_ERROR(label)