From: Sandro Santilli Date: Mon, 8 Aug 2011 08:59:32 +0000 (+0000) Subject: Put PG_LWGEOM stuff where it belongs (out of liblwgeom) [RT-SIGTA] X-Git-Tag: 2.0.0alpha1~1141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58789b8ee29656e89591c0c3287ae7e6b69bf736;p=postgis Put PG_LWGEOM stuff where it belongs (out of liblwgeom) [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@7706 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/liblwgeom.h b/liblwgeom/liblwgeom.h index ad0a5d50a..e61d3109b 100644 --- a/liblwgeom/liblwgeom.h +++ b/liblwgeom/liblwgeom.h @@ -944,29 +944,6 @@ extern int lwgeom_getType(uchar type); /* returns the tttt value */ extern uchar lwgeom_makeType(char hasZ, char hasM, char has_srid, int type); extern uchar lwgeom_makeType_full(char hasZ, char hasM, char has_srid, int type, char hasBBOX); -/* - * This is the binary representation of lwgeom compatible - * with postgresql varlena struct - */ -typedef struct -{ - uint32 size; /* varlena header (do not touch directly!) */ - uchar type; /* encodes ndims, type, bbox presence, - srid presence */ - uchar data[1]; -} -PG_LWGEOM; - -/* - * Construct a full PG_LWGEOM type (including size header) - * from a serialized form. - * The constructed PG_LWGEOM object will be allocated using palloc - * and the serialized form will be copied. - * If you specify a SRID other then -1 it will be set. - * If you request bbox (wantbbox=1) it will be extracted or computed - * from the serialized form. - */ - /* * Compute bbox of serialized geom */ diff --git a/postgis/lwgeom_pg.h b/postgis/lwgeom_pg.h index 00c2b0381..d7302271d 100644 --- a/postgis/lwgeom_pg.h +++ b/postgis/lwgeom_pg.h @@ -16,6 +16,19 @@ void pg_free(void *ptr); void pg_error(const char *msg, va_list vp); void pg_notice(const char *msg, va_list vp); +/* + * This is the binary representation of lwgeom compatible + * with postgresql varlena struct + */ +typedef struct +{ + uint32 size; /* varlena header (do not touch directly!) */ + uchar type; /* encodes ndims, type, bbox presence, + srid presence */ + uchar data[1]; +} +PG_LWGEOM; + /* Debugging macros */ #if POSTGIS_DEBUG_LEVEL > 0 @@ -90,6 +103,19 @@ GSERIALIZED* gserialized_drop_gidx(GSERIALIZED *g); /* Serialize/deserialize a PG_LWGEOM (postgis datatype) */ extern PG_LWGEOM *pglwgeom_serialize(LWGEOM *lwgeom); extern LWGEOM *pglwgeom_deserialize(PG_LWGEOM *pglwgeom); + +/* + * Construct a full PG_LWGEOM type (including size header) + * from a serialized form. + * The constructed PG_LWGEOM object will be allocated using palloc + * and the serialized form will be copied. + * If you specify a SRID other then -1 it will be set. + * If you request bbox (wantbbox=1) it will be extracted or computed + * from the serialized form. + * + * NOTE: only available when GSERIALIZED_ON is undefined + * TODO: wrap in #ifndef GSERIALIZED_ON + */ extern PG_LWGEOM *PG_LWGEOM_construct(uchar *serialized, int srid, int wantbbox); /* PG_LWGEOM SRID get/set */