POLYGON Read a WKB polygon, starting just after the endian byte, type number and optional srid number.
Advance the parse state forward appropriately. First read the number of rings, then read each ring (which are structured as point arrays)
Definition at line 538 of file lwin_wkb.c.
539{
542 return NULL;
543 uint32_t i = 0;
545
546 LWDEBUGF(4,
"Polygon has %d rings", nrings);
547
548
549 if( nrings == 0 )
550 return poly;
551
552 for( i = 0; i < nrings; i++ )
553 {
555 if (pa == NULL)
556 {
558 return NULL;
559 }
560
561
563 {
568 return NULL;
569 }
570
571
573 {
578 return NULL;
579 }
580
581
583 {
586 LWDEBUG(2,
"Unable to add ring to polygon");
587 lwerror(
"Unable to add ring to polygon");
588 return NULL;
589 }
590
591 }
592 return poly;
593}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define LW_PARSER_CHECK_CLOSURE
int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
Add a ring, allocating extra space if necessary.
#define LW_PARSER_CHECK_MINPOINTS
Parser check flags.
void ptarray_free(POINTARRAY *pa)
int ptarray_is_closed_2d(const POINTARRAY *pa)
void lwpoly_free(LWPOLY *poly)
LWPOLY * lwpoly_construct_empty(int32_t srid, char hasz, char hasm)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint32_t integer_from_wkb_state(wkb_parse_state *s)
Int32 Read 4-byte integer and advance the parse state forward.
static POINTARRAY * ptarray_from_wkb_state(wkb_parse_state *s)
POINTARRAY Read a dynamically sized point array and advance the parse state forward.
References integer_from_wkb_state(), LW_FAILURE, LW_PARSER_CHECK_CLOSURE, LW_PARSER_CHECK_MINPOINTS, LWDEBUG, LWDEBUGF, lwerror(), lwpoly_add_ring(), lwpoly_construct_empty(), lwpoly_free(), lwtype_name(), POINTARRAY::npoints, ptarray_free(), ptarray_from_wkb_state(), ptarray_is_closed_2d(), and s.
Referenced by lwgeom_from_wkb_state().