522{
523 int64 rowcount = WinGetPartitionRowCount(winobj);
524 GEOSGeometry* geos;
525 GEOSGeometry** geoms;
526 uint32 i, ngeoms = 0, gtype;
527
528
529 geoms = palloc(rowcount * sizeof(GEOSGeometry*));
530 for (i = 0; i < rowcount; i++)
531 {
533 bool isnull, isout;
534 bool isempty, ispolygonal;
535 Datum d;
536
537
538 d = WinGetFuncArgInPartition(winobj, 0, i,
539 WINDOW_SEEK_HEAD, false, &isnull, &isout);
540
541
542
543
544
545
546
547
548
549
550
551
552 if (isnull)
553 {
554 context->
idx[i] = -1;
555 continue;
556 }
557
562
563
564 if (isempty || !ispolygonal)
565 {
566 context->
idx[i] = -1;
567 continue;
568 }
569
570
572 if (!geos)
573 {
574 context->
idx[i] = -1;
575 continue;
576 }
577
578 context->
idx[i] = ngeoms;
579 geoms[ngeoms] = geos;
580 ngeoms = ngeoms + 1;
581 }
582
583
584
585
586
587
588
589 geos = GEOSGeom_createCollection(
590 GEOS_GEOMETRYCOLLECTION,
591 geoms, ngeoms);
592
593
594
595
596
597
598 if (!geos)
599 {
601 return NULL;
602 }
603
604 pfree(geoms);
605 return geos;
606}
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
static void coverage_destroy_geoms(GEOSGeometry **geoms, uint32 ngeoms)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)