Changeset: 37b3a553874f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/37b3a553874f
Modified Files:
        geom/lib/libgeom.c
        geom/lib/libgeom.h
Branch: geo-update
Log Message:

Clean up commented/dead code. Left comments for future work


diffs (162 lines):

diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c
--- a/geom/lib/libgeom.c
+++ b/geom/lib/libgeom.c
@@ -32,6 +32,7 @@ void
 libgeom_init(void)
 {
        initGEOS((GEOSMessageHandler) geomerror, (GEOSMessageHandler) 
geomerror);
+    // TODO: deprecated call REMOVE    
        GEOS_setWKBByteOrder(1);        /* NDR (little endian) */
        printf("# MonetDB/GIS module loaded\n");
        fflush(stdout);         /* make merovingian see this *now* */
@@ -51,70 +52,6 @@ is_wkb_nil(const wkb *w)
        return 0;
 }
 
-
-/* Function getMbrGeos
- * Creates an mbr holding the lower left and upper right coordinates
- * of a GEOSGeom.
- */
-#if 0
-int
-getMbrGeos(mbr *res, const GEOSGeom geosGeometry)
-{
-       GEOSGeom envelope;
-       //int coordinatesNum  = 0;
-       double xmin = 0, ymin = 0, xmax = 0, ymax = 0;
-
-       if (!geosGeometry || (envelope = GEOSEnvelope(geosGeometry)) == NULL)
-               return 0;
-
-       // get the number of coordinates the geometry has
-       //coordinatesNum = GEOSGeom_getCoordinateDimension(geosGeometry);
-
-       if (GEOSGeomTypeId(envelope) == GEOS_POINT) {
-#if GEOS_CAPI_VERSION_MAJOR >= 1 && GEOS_CAPI_VERSION_MINOR >= 3
-               const GEOSCoordSequence *coords = 
GEOSGeom_getCoordSeq(envelope);
-#else
-               const GEOSCoordSeq coords = GEOSGeom_getCoordSeq(envelope);
-#endif
-               GEOSCoordSeq_getX(coords, 0, &xmin);
-               GEOSCoordSeq_getY(coords, 0, &ymin);
-               assert(GDK_flt_min <= xmin && xmin <= GDK_flt_max);
-               assert(GDK_flt_min <= ymin && ymin <= GDK_flt_max);
-               res->xmin = (float) xmin;
-               res->ymin = (float) ymin;
-               res->xmax = (float) xmin;
-               res->ymax = (float) ymin;
-       } else {                // GEOSGeomTypeId(envelope) == GEOS_POLYGON
-#if GEOS_CAPI_VERSION_MAJOR >= 1 && GEOS_CAPI_VERSION_MINOR >= 3
-               const GEOSGeometry *ring = GEOSGetExteriorRing(envelope);
-#else
-               const GEOSGeom ring = GEOSGetExteriorRing(envelope);
-#endif
-               if (ring) {
-#if GEOS_CAPI_VERSION_MAJOR >= 1 && GEOS_CAPI_VERSION_MINOR >= 3
-                       const GEOSCoordSequence *coords = 
GEOSGeom_getCoordSeq(ring);
-#else
-                       const GEOSCoordSeq coords = GEOSGeom_getCoordSeq(ring);
-#endif
-                       GEOSCoordSeq_getX(coords, 0, &xmin);
-                       GEOSCoordSeq_getY(coords, 0, &ymin);
-                       GEOSCoordSeq_getX(coords, 2, &xmax);
-                       GEOSCoordSeq_getY(coords, 2, &ymax);
-                       assert(GDK_flt_min <= xmin && xmin <= GDK_flt_max);
-                       assert(GDK_flt_min <= ymin && ymin <= GDK_flt_max);
-                       assert(GDK_flt_min <= xmax && xmax <= GDK_flt_max);
-                       assert(GDK_flt_min <= ymax && ymax <= GDK_flt_max);
-                       res->xmin = (float) xmin;
-                       res->ymin = (float) ymin;
-                       res->xmax = (float) xmax;
-                       res->ymax = (float) ymax;
-               }
-       }
-       GEOSGeom_destroy(envelope);
-       return 1;
-}
-#endif
-
 GEOSGeom
 wkb2geos(const wkb *geomWKB)
 {
@@ -131,24 +68,6 @@ wkb2geos(const wkb *geomWKB)
        return geosGeometry;
 }
 
-/* Function getMbrGeom
- * A wrapper for getMbrGeos on a geom_geometry.
- */
-#if 0
-int
-getMbrGeom(mbr *res, wkb *geom)
-{
-       GEOSGeom geosGeometry = wkb2geos(geom);
-
-       if (geosGeometry) {
-               int r = getMbrGeos(res, geosGeometry);
-               GEOSGeom_destroy(geosGeometry);
-               return r;
-       }
-       return 0;
-}
-#endif
-
 const char *
 geom_type2str(int t, int flag)
 {
@@ -198,23 +117,3 @@ geom_type2str(int t, int flag)
        return "UKNOWN";
 }
 
-
-#if 0
-str
-geomerty_2_geometry(wkb *res, wkb **geom, int *columnType, int *columnSRID, 
int *valueSRID)
-{
-
-       //char* geomStr;
-       //size_t len = 0;
-       //fprintf(stderr, "geometry_2_geometry\n");
-       //wkbTOSTR(&geomStr, &len, *geom);
-       if (*geom != NULL)
-               fprintf(stderr, "type:%d - wkbTOSTR cannot be seen at this 
point\n", *columnType);
-
-       if (res == NULL)
-               fprintf(stderr, "-> ");
-
-       fprintf(stderr, "%d vs %d\n", *columnSRID, *valueSRID);
-       return "0";
-}
-#endif
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -95,6 +95,7 @@ 11 = MULTIPOLYGON
 */
 
 typedef enum wkb_type {
+    // TODO: deprecated        type REMOVE
        //wkbGeometry_mbd = 0,
        wkbPoint_mdb = 1,
        wkbLineString_mdb = 2,
@@ -129,19 +130,9 @@ typedef struct {
 libgeom_export void libgeom_init(void);
 libgeom_export void libgeom_exit(void);
 
-
-/* Macro wkb2geos
- * Returns a GEOSGeom, created from a geom_geometry.
- * On failure, returns NULL.
- */
-//#define wkb2geos( geom ) is_wkb_nil((geom))? NULL: 
GEOSGeomFromWKB_buf((unsigned char *)((geom)->data), (geom)->len)
 #define mbr_nil mbrFromGeos(NULL);
 
 libgeom_export bool is_wkb_nil(const wkb *wkbp);
-libgeom_export int getMbrGeos(mbr *mbr, const GEOSGeom geosGeometry);
-libgeom_export int getMbrGeom(mbr *res, wkb *geom);
 libgeom_export GEOSGeom wkb2geos(const wkb *geomWKB);
 
-//libgeom_export str geomerty_2_geometry(wkb *res, wkb **geom, int* 
columnType, int* columnSRID, int* valueSRID);
-
 #endif /* LIBGEOM_H */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to