Composite geometries end up with nested BBOX caches (#1254)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 2 Nov 2011 04:28:05 +0000 (04:28 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 2 Nov 2011 04:28:05 +0000 (04:28 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8078 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/Makefile.in
liblwgeom/g_serialized.c
liblwgeom/liblwgeom.h.in
liblwgeom/lwgeom_api.c
postgis/MISSING_OBJECTS [deleted file]
postgis/lwgeom_debug.c

index 1ab3e98f7679c99991c83381d45ba0eed31df21c..2c7a9f16073717401485afe053d905bb6f3234fe 100644 (file)
@@ -141,13 +141,14 @@ $(LT_SA_OBJS): %.lo: %.c
 $(LT_NM_OBJS): %.lo: %.c
        $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(NUMERICFLAGS) -c -o $@ $<
 
-# Generate WKT parser from Flex/Yacc inputs
-lwin_wkt_parse.c: lwin_wkt_parse.y
-       $(YACC) -o'$@' -d $^
-#       $(YACC) --debug --verbose -o'$@' -d $<
-#       $(YACC) -o'$@' -d $^
-
-lwin_wkt_lex.c: lwin_wkt_lex.l
-       $(LEX) -i $<
+# Manually generate WKT parser from Flex/Bison inputs
+# Bison 2.5, Flex 2.5.35
+parser:
+       $(YACC) -o'lwin_wkt_parse.c' -d lwin_wkt_parse.y
+       $(LEX) -i lwin_wkt_lex.l
+       
+#      $(YACC) --debug --verbose -o'$@' -d $<
+#      $(YACC) -o'$@' -d $^
+#      $(LEX) -i $<
 
 
index c9fc2f42629a696ece05fc6e14b80772bbd50449..5edc9d5e96d0d146cf6dabe214a9efe877031c28 100644 (file)
@@ -1080,6 +1080,9 @@ static LWCOLLECTION* lwcollection_from_gserialized_buffer(uint8_t *data_ptr, uin
        else
                collection->geoms = NULL;
 
+       /* Sub-geometries are never de-serialized with boxes (#1254) */
+       FLAGS_SET_BBOX(g_flags, 0);
+
        for ( i = 0; i < ngeoms; i++ )
        {
                uint32_t subtype = lw_get_uint32_t(data_ptr);
index f21a974b3b5719cfd2ccd26eabad7e6e581a45a3..96f7ac98d3d0d9d22f7fb8be5b5533ef592eda60 100644 (file)
@@ -675,11 +675,6 @@ extern int lwtype_is_collection(uint8_t type);
 */
 extern int lwtype_get_collectiontype(uint8_t type);
 
-/**
-* Return a char string with ASCII version of type flags 
-*/
-extern char *lwtype_zmflags(uint8_t type);
-
 /**
 * Return the type name string associated with a type number 
 * (e.g. Point, LineString, Polygon)
@@ -756,8 +751,6 @@ extern void ptarray_set_point4d(POINTARRAY *pa, int n, POINT4D *p4d);
  */
 extern uint8_t *getPoint_internal(const POINTARRAY *pa, int n);
 
-
-
 /*
  * size of point represeneted in the POINTARRAY
  * 16 for 2d, 24 for 3d, 32 for 4d
index 77d6fd1852aa73a6145266031151bacc4441375e..65c8bbdadc90999119e09c4199b9214ce9c5e084 100644 (file)
@@ -568,22 +568,6 @@ ptarray_isccw(const POINTARRAY *pa)
        else return 1;
 }
 
-static char tflags[4];
-
-char *
-lwtype_zmflags(uint8_t flags)
-{
-       int flagno = 0;
-       if ( FLAGS_GET_Z(flags) ) tflags[flagno++] = 'Z';
-       if ( FLAGS_GET_M(flags) ) tflags[flagno++] = 'M';
-       if ( FLAGS_GET_BBOX(flags) ) tflags[flagno++] = 'B';
-       tflags[flagno] = '\0';
-
-       LWDEBUGF(4, "Flags: %s - returning %p", flags, tflags);
-
-       return tflags;
-}
-
 /**
  * Given a string with at least 2 chars in it, convert them to
  * a byte value.  No error checking done!
diff --git a/postgis/MISSING_OBJECTS b/postgis/MISSING_OBJECTS
deleted file mode 100644 (file)
index 2d940fb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# This is a list of objects still missing lwgeom support
---- OBSOLETED ?
-geometry_size(geometry, internal)
-optimistic_overlap(geometry, geometry, double precision)
-
index 7aa486b42a03278e78ff1a31d59bbd25c65d5dd4..5a08aeb09278eea6a37a05f1165c3d8942c13eaa 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
+/* Place to hold the ZM string used in other summaries */
+static char tflags[4];
 
-char *lwcollection_summary(LWCOLLECTION *collection, int offset);
-char *lwpoly_summary(LWPOLY *poly, int offset);
-char *lwline_summary(LWLINE *line, int offset);
-char *lwpoint_summary(LWPOINT *point, int offset);
-
-char *
-lwgeom_summary(const LWGEOM *lwgeom, int offset)
+static char *
+lwtype_zmflags(uint8_t flags)
 {
-       char *result;
+       int flagno = 0;
+       if ( FLAGS_GET_Z(flags) ) tflags[flagno++] = 'Z';
+       if ( FLAGS_GET_M(flags) ) tflags[flagno++] = 'M';
+       if ( FLAGS_GET_BBOX(flags) ) tflags[flagno++] = 'B';
+       tflags[flagno] = '\0';
 
-       switch (lwgeom->type)
-       {
-       case POINTTYPE:
-               return lwpoint_summary((LWPOINT *)lwgeom, offset);
+       POSTGIS_DEBUGF(4, "Flags: %s - returning %p", flags, tflags);
 
-       case LINETYPE:
-               return lwline_summary((LWLINE *)lwgeom, offset);
-
-       case POLYGONTYPE:
-               return lwpoly_summary((LWPOLY *)lwgeom, offset);
-
-       case MULTIPOINTTYPE:
-       case MULTILINETYPE:
-       case MULTIPOLYGONTYPE:
-       case COLLECTIONTYPE:
-               return lwcollection_summary((LWCOLLECTION *)lwgeom, offset);
-       default:
-               result = lwalloc(256);
-               sprintf(result, "Object is of unknown type: %d",
-                       lwgeom->type);
-               return result;
-       }
-
-       return NULL;
+       return tflags;
 }
 
 /*
  * Returns an alloced string containing summary for the LWGEOM object
  */
-char *
+static char *
 lwpoint_summary(LWPOINT *point, int offset)
 {
        char *result;
        char *pad="";
        char *zmflags = lwtype_zmflags(point->flags);
 
-       result = lwalloc(128+offset);
+       result = palloc(128+offset);
 
        sprintf(result, "%*.s%s[%s]\n",
                offset, pad, lwtype_name(point->type),
@@ -71,14 +51,14 @@ lwpoint_summary(LWPOINT *point, int offset)
        return result;
 }
 
-char *
+static char *
 lwline_summary(LWLINE *line, int offset)
 {
        char *result;
        char *pad="";
        char *zmflags = lwtype_zmflags(line->flags);
 
-       result = lwalloc(128+offset);
+       result = palloc(128+offset);
 
        sprintf(result, "%*.s%s[%s] with %d points\n",
                offset, pad, lwtype_name(line->type),
@@ -88,7 +68,7 @@ lwline_summary(LWLINE *line, int offset)
 }
 
 
-char *
+static char *
 lwcollection_summary(LWCOLLECTION *col, int offset)
 {
        size_t size = 128;
@@ -100,7 +80,7 @@ lwcollection_summary(LWCOLLECTION *col, int offset)
 
        POSTGIS_DEBUG(2, "lwcollection_summary called");
 
-       result = (char *)lwalloc(size);
+       result = (char *)palloc(size);
 
        sprintf(result, "%*.s%s[%s] with %d elements\n",
                offset, pad, lwtype_name(col->type),
@@ -124,7 +104,7 @@ lwcollection_summary(LWCOLLECTION *col, int offset)
        return result;
 }
 
-char *
+static char *
 lwpoly_summary(LWPOLY *poly, int offset)
 {
        char tmp[256];
@@ -136,7 +116,7 @@ lwpoly_summary(LWPOLY *poly, int offset)
 
        POSTGIS_DEBUG(2, "lwpoly_summary called");
 
-       result = lwalloc(size);
+       result = palloc(size);
 
        sprintf(result, "%*.s%s[%s] with %i rings\n",
                offset, pad, lwtype_name(poly->type),
@@ -155,3 +135,33 @@ lwpoly_summary(LWPOLY *poly, int offset)
        return result;
 }
 
+char *
+lwgeom_summary(const LWGEOM *lwgeom, int offset)
+{
+       char *result;
+
+       switch (lwgeom->type)
+       {
+       case POINTTYPE:
+               return lwpoint_summary((LWPOINT *)lwgeom, offset);
+
+       case LINETYPE:
+               return lwline_summary((LWLINE *)lwgeom, offset);
+
+       case POLYGONTYPE:
+               return lwpoly_summary((LWPOLY *)lwgeom, offset);
+
+       case MULTIPOINTTYPE:
+       case MULTILINETYPE:
+       case MULTIPOLYGONTYPE:
+       case COLLECTIONTYPE:
+               return lwcollection_summary((LWCOLLECTION *)lwgeom, offset);
+       default:
+               result = palloc(256);
+               sprintf(result, "Object is of unknown type: %d",
+                       lwgeom->type);
+               return result;
+       }
+
+       return NULL;
+}
\ No newline at end of file