[postgis-commits] svn - r3663 - in spike/wktraster: . rt_core rt_pg

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Fri Feb 6 04:36:36 PST 2009


Author: strk
Date: 2009-02-06 04:36:33 -0800 (Fri, 06 Feb 2009)
New Revision: 3663

Modified:
   spike/wktraster/configure.ac
   spike/wktraster/rt_core/rt_api.c
   spike/wktraster/rt_core/rt_api.h
   spike/wktraster/rt_pg/rt_pg.c
Log:
Hush core lib to run the testsuite cleanly, and generate
the makefile in the regression testsuite.


Modified: spike/wktraster/configure.ac
===================================================================
--- spike/wktraster/configure.ac	2009-02-06 12:35:20 UTC (rev 3662)
+++ spike/wktraster/configure.ac	2009-02-06 12:36:33 UTC (rev 3663)
@@ -331,6 +331,7 @@
 dnl Find postgis sources, as we rely on liblwgeom
 dnl ===========================================================================
 
+POSTGIS_SRCDIR=""
 LIBLWGEOM_CFLAGS=""
 LIBLWGEOM_LDFLAGS=""
 AC_ARG_WITH([postgis-sources],
@@ -347,6 +348,7 @@
 
 AC_SUBST([LIBLWGEOM_CFLAGS])
 AC_SUBST([LIBLWGEOM_LDFLAGS])
+AC_SUBST([POSTGIS_SRCDIR])
 
 
 dnl ===========================================================================
@@ -504,5 +506,5 @@
 dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
 
 dnl Output the relevant files
-AC_OUTPUT([rt_core/Makefile rt_pg/Makefile])
+AC_OUTPUT([rt_core/Makefile rt_pg/Makefile rt_pg/test/Makefile])
 

Modified: spike/wktraster/rt_core/rt_api.c
===================================================================
--- spike/wktraster/rt_core/rt_api.c	2009-02-06 12:35:20 UTC (rev 3662)
+++ spike/wktraster/rt_core/rt_api.c	2009-02-06 12:36:33 UTC (rev 3663)
@@ -28,7 +28,7 @@
 
 #include "rt_api.h"
 
-#define RT_API_DEBUG
+/*#define RT_API_DEBUG*/
 #define RT_WARN_ON_TRUNCATION
 
 /*--- Utilities -------------------------------------------------*/
@@ -398,7 +398,7 @@
 	ival &= mask;
 #ifdef RT_WARN_ON_TRUNCATION
 	if ( ival != val ) {
-		printf("Pixel value for %d-bits band got truncated"
+		ctx->warn("Pixel value for %d-bits band got truncated"
 		" from %g to %hhu\n", bits, val, ival);
 	}
 #endif /* RT_WARN_ON_TRUNCATION */
@@ -1018,7 +1018,9 @@
 {
     rt_band *oldbands;
 
+#ifdef RT_API_DEBUG
     ctx->info("Adding band %p to raster %p", band, raster);
+#endif
 
     if ( band->width != raster->width )
     {
@@ -1029,13 +1031,17 @@
 
     oldbands = raster->bands;
 
+#ifdef RT_API_DEBUG
     ctx->info("Oldbands at %p", oldbands);
+#endif
 
     raster->bands = (rt_band*)ctx->realloc(raster->bands, 
         sizeof(rt_band)*(raster->numBands+1)
     );
 
+#ifdef RT_API_DEBUG
     ctx->info("realloc returned %p", raster->bands);
+#endif
 
     if ( ! raster->bands ) {
         ctx->err("Out of virtual memory "
@@ -1057,11 +1063,12 @@
     *x1 = raster->scaleX*x + raster->skewX*y + raster->ipX;
     *y1 = raster->scaleY*y + raster->skewY*x + raster->ipY;
 
+#ifdef RT_API_DEBUG
     ctx->info("rt_raster_cell_to_geopoint(%g,%g)", x, y);
     ctx->info(" ipx/y:%g/%g", raster->ipX, raster->ipY);
-
     ctx->info("cell_to_geopoint: ipX:%g, ipY:%g, %g,%g -> %g,%g",
         raster->ipX, raster->ipY, x, y, *x1, *y1);
+#endif
 }
 
 LWPOLY*
@@ -1072,7 +1079,10 @@
     LWPOLY* ret;
     POINT4D p4d;
 
-    ctx->info("rt_raster_get_envelope: raster is %dx%d", raster->width, raster->height);
+#ifdef RT_API_DEBUG
+    ctx->info("rt_raster_get_envelope: raster is %dx%d",
+        raster->width, raster->height);
+#endif
     if ( (!raster->width)  || (!raster->height) )
     {
         return 0;
@@ -1423,9 +1433,11 @@
     band->width = width;
     band->height = height;
 
+#ifdef RT_API_DEBUG
     ctx->info(" Band pixtype:%s, offline:%d",
         rt_pixtype_name(ctx, band->pixtype),
         band->offline);
+#endif
 
     /* Check there's enough bytes to read nodata value */
 
@@ -1520,8 +1532,10 @@
         }
     }
 
+#ifdef RT_API_DEBUG
     ctx->info(" Nodata value: %g, pixbytes: %d, ptr @ %p, end @ %p",
         band->nodataval, pixbytes, *ptr, end);
+#endif
 
     if ( band->offline )
     {
@@ -1549,8 +1563,10 @@
         	band->data.offline.path = ctx->alloc(sz+1);
             memcpy(band->data.offline.path, *ptr, sz);
             band->data.offline.path[sz] = '\0';
+#ifdef RT_API_DEBUG
             ctx->info("OFFDB band path is %s (size is %d)",
                 band->data.offline.path, sz);
+#endif
             *ptr += sz+1;
         }
         return band;
@@ -1866,7 +1882,9 @@
         rt_pixtype pixtype = band->pixtype;
         int pixbytes = rt_pixtype_size(ctx, pixtype);
 
+#ifdef RT_API_DEBUG
         ctx->info("Writing WKB for band %d", i);
+#endif
 
         if ( pixbytes < 1 ) {
             // ERROR !
@@ -1992,9 +2010,13 @@
     uint32_t i;
     uint32_t wkbsize;
 
+#ifdef RT_API_DEBUG
     ctx->info("rt_rater_to_hexwkb: calling rt_raster_to_wkb");
+#endif
     wkb = rt_raster_to_wkb(ctx, raster, &wkbsize);
+#ifdef RT_API_DEBUG
     ctx->info("rt_rater_to_hexwkb: rt_raster_to_wkb returned");
+#endif
 
     *hexwkbsize = wkbsize*2; /* hex is 2 times bytes */
     hexwkb = (char*)ctx->alloc( (*hexwkbsize)+1);

Modified: spike/wktraster/rt_core/rt_api.h
===================================================================
--- spike/wktraster/rt_core/rt_api.h	2009-02-06 12:35:20 UTC (rev 3662)
+++ spike/wktraster/rt_core/rt_api.h	2009-02-06 12:36:33 UTC (rev 3663)
@@ -191,7 +191,7 @@
  * @param band : the band to set nodata value to
  * @param val : the nodata value, must be in the range
  *              of values supported by this band's pixeltype
- *              or an error will be printed and non-zero
+ *              or a warning will be printed and non-zero
  *              returned.
  *
  * @return 0 on success, -1 on error (value out of valid range).
@@ -213,7 +213,7 @@
  * @param y : x ordinate
  * @param val : the pixel value, must be in the range
  *              of values supported by this band's pixeltype
- *              or an error will be printed and non-zero
+ *              or a warning will be printed and non-zero
  *              returned.
  *
  * @return 0 on success, -1 on error (value out of valid range).

Modified: spike/wktraster/rt_pg/rt_pg.c
===================================================================
--- spike/wktraster/rt_pg/rt_pg.c	2009-02-06 12:35:20 UTC (rev 3662)
+++ spike/wktraster/rt_pg/rt_pg.c	2009-02-06 12:36:33 UTC (rev 3663)
@@ -231,7 +231,7 @@
         PG_RETURN_NULL();
     }
 
-    elog(NOTICE, "rt_raster_deserialize returned %p", raster);
+    /*elog(NOTICE, "rt_raster_deserialize returned %p", raster);*/
 
     hexwkb = rt_raster_to_hexwkb(ctx, raster, &hexwkbsize);
     if ( ! hexwkb )
@@ -240,7 +240,7 @@
         PG_RETURN_NULL();
     }
 
-    elog(NOTICE, "rt_raster_to_hexwkb returned");
+    /*elog(NOTICE, "rt_raster_to_hexwkb returned");*/
 
     PG_RETURN_CSTRING(hexwkb);
 }
@@ -264,7 +264,7 @@
             PG_RETURN_NULL();
         }
 
-        elog(NOTICE, "rt_raster_deserialize returned %p", raster);
+        /*elog(NOTICE, "rt_raster_deserialize returned %p", raster);*/
 
         envelope = rt_raster_get_envelope(ctx, raster);
         if ( ! envelope ) {



More information about the postgis-commits mailing list