Changeset: 716c0574943a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=716c0574943a
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geom.h
Branch: sfcgal
Log Message:

Improve error messages and make wkbNULLcopy available through the header file


diffs (112 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -18,28 +18,6 @@ int TYPE_mbr;
 
 static str BATgroupWKBWKBtoWKB(bat *outBAT_id, BAT *b, BAT *g, BAT *e, int 
skip_nils, oid min, oid max, BUN ngrp, BUN start, BUN end, wkb **empty_geoms, 
str (*func) (wkb **, wkb **, wkb**), char* name);
 
-static inline int
-geometryHasZ(int info)
-{
-       return (info & 0x02);
-}
-
-static inline int
-geometryHasM(int info)
-{
-       return (info & 0x01);
-}
-static wkb wkb_nil = { ~0, 0 };
-
-static wkb *
-wkbNULLcopy(void)
-{
-       wkb *n = GDKmalloc(sizeof(wkb_nil));
-       if (n)
-               *n = wkb_nil;
-       return n;
-}
-
 /* the first argument in the functions is the return variable */
 
 #ifdef HAVE_PROJ
@@ -4290,6 +4268,7 @@ wkbExteriorRing(wkb **exteriorRingWKB, w
        GEOSGeom geosGeometry;
        const GEOSGeometry *exteriorRingGeometry;
        str err = MAL_SUCCEED;
+    int type = -1;
 
        if (wkb_isnil(*geom)) {
                if ((*exteriorRingWKB = wkbNULLcopy()) == NULL)
@@ -4303,10 +4282,10 @@ wkbExteriorRing(wkb **exteriorRingWKB, w
                throw(MAL, "geom.ExteriorRing", "wkb2geos failed");
        }
 
-       if (GEOSGeomTypeId(geosGeometry) != GEOS_POLYGON) {
+       if ((type = GEOSGeomTypeId(geosGeometry)) != GEOS_POLYGON) {
                *exteriorRingWKB = NULL;
                GEOSGeom_destroy(geosGeometry);
-               throw(MAL, "geom.ExteriorRing", "Geometry not a Polygon");
+               throw(MAL, "geom.ExteriorRing", "Geometry is not a Polygon, it 
is a %s", geom_type2str(type,0));
 
        }
        /* get the exterior ring of the geometry */
@@ -10418,7 +10397,7 @@ DWithinXYZsubjoin_intern(bat *lres, bat 
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&stop, NULL);
     t = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 
1000;
-    fprintf(stdout, "%s first BATloop %llu ms\n", name, t);
+    fprintf(stdout, "%s first BATloop qx %d %llu ms\n", name, qx, t);
 #endif
     if ( (msg ==MAL_SUCCEED) && BATcount(bx) && (outs = (bit*) 
GDKzalloc(sizeof(bit)*BATcount(bx))) == NULL) {
         msg = createException(MAL, name, MAL_MALLOC_FAIL);
@@ -10531,7 +10510,7 @@ DWithinXYZsubjoin_intern(bat *lres, bat 
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&stop, NULL);
     t = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 
1000;
-    fprintf(stdout, "%s second BATloop %llu ms\n", name, t);
+    fprintf(stdout, "%s second BATloop ql %d %llu ms\n", name, ql, t);
 #endif
 
 #ifdef OPENMP                
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -40,7 +40,7 @@
 
 #define OPENCL_DYNAMIC 1
 #define OPENCL_THREADS 8
-//#define OPENMP  1
+#define OPENMP  1
 
 #ifdef OPENMP
 #include <omp.h>
@@ -54,6 +54,28 @@
     b->tnonil = 0;                                             \
     b->tnodense = 1;                                            
 
+static inline int
+geometryHasZ(int info)
+{
+       return (info & 0x02);
+}
+
+static inline int
+geometryHasM(int info)
+{
+       return (info & 0x01);
+}
+static wkb wkb_nil = { ~0, 0 };
+
+static wkb *
+wkbNULLcopy(void)
+{
+       wkb *n = GDKmalloc(sizeof(wkb_nil));
+       if (n)
+               *n = wkb_nil;
+       return n;
+}
+
 /* general functions */
 geom_export str geoHasZ(int* res, int* info);
 geom_export str geoHasM(int* res, int* info);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to