result->nlines = 0;
result->npolys = 0;
+#ifdef DEBUG
+ elog(NOTICE, "lwgeom_explode called");
+#endif
+
if ( ! inspected->ngeometries )
{
pfree(result->points);
pfree(result->polys);
result->SRID = -1;
result->ndims = 0;
+ pfree_inspected(inspected);
+#ifdef DEBUG
+ elog(NOTICE, "lwgeom_explode: no geometries");
+#endif
return result;
}
if ( type == POINTTYPE )
{
result->points = repalloc(result->points,
- result->npoints+1);
+ (result->npoints+1)*sizeof(LWPOINT *));
result->points[result->npoints] = subgeom;
result->npoints++;
continue;
if ( type == LINETYPE )
{
result->lines = repalloc(result->lines,
- result->nlines+1);
+ (result->nlines+1)*sizeof(LWLINE *));
result->lines[result->nlines] = subgeom;
result->nlines++;
continue;
if ( type == POLYGONTYPE )
{
result->polys = repalloc(result->polys,
- result->npolys+1);
+ (result->npolys+1)*sizeof(LWPOLY *));
result->polys[result->npolys] = subgeom;
result->npolys++;
continue;
}
+#ifdef DEBUG
+ elog(NOTICE, "subtype is %d, recursing", type);
+#endif
+
// it's a multi geometry, recurse
subexploded = lwgeom_explode(subgeom);
}
+ pfree_inspected(inspected);
+
return result;
}
for (i=0; i<exploded->npoints; i++)
{
elog(NOTICE, "Point%d @ %p", i, exploded->points[i]);
+ if ( (int)exploded->points[i] < 100 )
+ {
+ elog(ERROR, "dirty point pointer");
+ }
}
for (i=0; i<exploded->nlines; i++)
{
elog(NOTICE, "Line%d @ %p", i, exploded->lines[i]);
+ if ( (int)exploded->lines[i] < 100 )
+ {
+ elog(ERROR, "dirty line pointer");
+ }
}
for (i=0; i<exploded->npolys; i++)
{
elog(NOTICE, "Poly%d @ %p", i, exploded->polys[i]);
+ if ( (int)exploded->polys[i] < 100 )
+ {
+ elog(ERROR, "dirty poly pointer");
+ }
}
+
+ return 0;
}
// collect( geom, geom ) returns a geometry which contains
}
//DEBUG
- dump_lwexploded(expcoll);
+ //elog(NOTICE, "[exp1]");
+ //dump_lwexploded(exp1);
+ //elog(NOTICE, "[exp2]");
+ //dump_lwexploded(exp2);
+ //elog(NOTICE, "[expcoll]");
+ //dump_lwexploded(expcoll);
// Now serialized collected LWGEOM_EXPLODED
serialized_result = lwexploded_serialize(expcoll, wantbbox);
PG_RETURN_NULL();
}
+#ifdef DEBUG
elog(NOTICE, "Serialized lwexploded");
+#endif
// And create LWGEOM type (could provide a _buf version of
// the serializer instead)