*
**********************************************************************
* $Log$
+ * Revision 1.30 2004/06/16 19:37:54 strk
+ * Added cleanup needed for GEOS > 1.0
+ *
* Revision 1.29 2004/06/16 18:47:59 strk
* Added code to detect geos version.
* Added appropriate includes in geos connectors.
#include "access/rtree.h"
#include "utils/builtins.h"
+
#include "postgis_geos_version.h"
/*
-GEOMETRY *GEOS2POSTGIS(Geometry *g,char want3d)
+GEOMETRY *
+GEOS2POSTGIS(Geometry *g,char want3d)
{
int type = GEOSGeometryTypeId(g) ;
GEOMETRY *result = NULL;
//BBOXONLYTYPE -> returns as a 2d polygon
-Geometry *POSTGIS2GEOS(GEOMETRY *g)
+Geometry *
+POSTGIS2GEOS(GEOMETRY *g)
{
POINT3D *pt;
LINE3D *line;
elog(NOTICE, "POSTGIS2GEOS: COLLECTION has %d objs, srid %d and is %s 3d", g->nobjs, g->SRID, g->is3d ? "" : "not");
#endif
geos = PostGIS2GEOS_collection(geoms,g->nobjs,g->SRID,g->is3d);
+#if GEOS_VERSION > 100
+ for (t=0; t<g->nobjs; t++)
+ GEOSdeleteGeometry(geoms[t]);
+#endif
if (geoms != NULL) pfree(geoms);
if (geos == NULL)
{
/*
* $Log$
+* Revision 1.20 2004/06/16 19:37:54 strk
+* Added cleanup needed for GEOS > 1.0
+*
* Revision 1.19 2004/06/16 18:47:59 strk
* Added code to detect geos version.
* Added appropriate includes in geos connectors.
subPolys->push_back(PostGIS2GEOS_polygon(polygons[t], SRID,is3d ));
}
g = geomFactory->createMultiPolygon(subPolys);
+#if GEOS_VERSION > 100
+ for (t=0; t<subPolys->size(); t++)
+ delete (*subPolys)[t];
+#endif
delete subPolys;
if (g== NULL)
// geometries pointed to by subLines will be owned
// by returned MultiLineString object
g = geomFactory->createMultiLineString(subLines);
+#if GEOS_VERSION > 100
+ for (t=0; t<subLines->size(); t++) delete (*subLines)[t];
+#endif
delete subLines;
if (g==NULL) return NULL;
g->setSRID(SRID);
subPoints->push_back(PostGIS2GEOS_point(points[t], SRID,is3d ));
}
g = geomFactory->createMultiPoint(subPoints);
+#if GEOS_VERSION > 100
+ for (t=0; t<subPoints->size(); t++)
+ delete (*subPoints)[t];
+#endif
delete subPoints;
if (g==NULL)
return NULL;