]> granicus.if.org Git - postgis/commitdiff
Consolidated various struct declarations from rt_api.c into rt_api.h as these structs...
authorBborie Park <bkpark at ucdavis.edu>
Sat, 13 Aug 2011 18:10:44 +0000 (18:10 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Sat, 13 Aug 2011 18:10:44 +0000 (18:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7745 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c
raster/rt_core/rt_api.h
raster/rt_pg/rt_pg.c
raster/test/core/testapi.c

index c47cfc852e9b91d7c99ebac75c2fefef304a9bf5..0c7fad69b11b568369ff195f34f1b59427c0a6fa 100644 (file)
@@ -1532,20 +1532,6 @@ rt_band_check_is_nodata(rt_band band)
     return TRUE;
 }
 
-struct rt_bandstats_t {
-       double sample;
-       uint32_t count;
-
-       double min;
-       double max;
-       double sum;
-       double mean;
-       double stddev;
-
-       double *values;
-       int sorted; /* flag indicating that values is sorted ascending by value */
-};
-
 /**
  * Compute summary statistics for a band
  *
@@ -1837,17 +1823,6 @@ rt_band_get_summary_stats(rt_band band, int exclude_nodata_value, double sample,
        return stats;
 }
 
-struct rt_histogram_t {
-       uint32_t count;
-       double percent;
-
-       double min;
-       double max;
-
-       int inc_min;
-       int inc_max;
-};
-
 /**
  * Count the distribution of data
  *
@@ -2111,11 +2086,6 @@ rt_band_get_histogram(rt_bandstats stats,
        return bins;
 }
 
-struct rt_quantile_t {
-       double quantile;
-       double value;
-};
-
 /**
  * Compute the default set of or requested quantiles for a set of data
  * the quantile formula used is same as Excel and R default method
@@ -2231,12 +2201,6 @@ rt_band_get_quantiles(rt_bandstats stats,
 /* symmetrical rounding */
 #define ROUND(x, y) (((x > 0.0) ? floor((x * pow(10, y) + 0.5)) : ceil((x * pow(10, y) - 0.5))) / pow(10, y));
 
-struct rt_valuecount_t {
-       double value;
-       uint32_t count;
-       double percent;
-};
-
 /**
  * Count the number of times provided value(s) occur in
  * the band
@@ -2495,17 +2459,6 @@ rt_band_get_value_count(rt_band band, int exclude_nodata_value,
        return vcnts;
 }
 
-struct rt_reclassexpr_t {
-       struct rt_reclassrange {
-               double min;
-               double max;
-               int inc_min; /* include min */
-               int inc_max; /* include max */
-               int exc_min; /* exceed min */
-               int exc_max; /* exceed max */
-       } src, dst;
-};
-
 /**
  * Returns new band with values reclassified
  *
@@ -2833,63 +2786,6 @@ rt_band_reclass(rt_band srcband, rt_pixtype pixtype,
 
 /*- rt_raster --------------------------------------------------------*/
 
-struct rt_raster_serialized_t {
-    /*---[ 8 byte boundary ]---{ */
-    uint32_t size; /* required by postgresql: 4 bytes */
-    uint16_t version; /* format version (this is version 0): 2 bytes */
-    uint16_t numBands; /* Number of bands: 2 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double scaleX; /* pixel width: 8 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double scaleY; /* pixel height: 8 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double ipX; /* insertion point X: 8 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double ipY; /* insertion point Y: 8 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double skewX; /* skew about the X axis: 8 bytes */
-
-    /* }---[ 8 byte boundary ]---{ */
-    double skewY; /* skew about the Y axis: 8 bytes */
-
-    /* }---[ 8 byte boundary ]--- */
-    int32_t srid; /* Spatial reference id: 4 bytes */
-    uint16_t width; /* pixel columns: 2 bytes */
-    uint16_t height; /* pixel rows: 2 bytes */
-};
-
-/* NOTE: the initial part of this structure matches the layout
- *       of data in the serialized form version 0, starting
- *       from the numBands element
- */
-struct rt_raster_t {
-    uint32_t size;
-    uint16_t version;
-
-    /* Number of bands, all share the same dimension
-     * and georeference */
-    uint16_t numBands;
-
-    /* Georeference (in projection units) */
-    double scaleX; /* pixel width */
-    double scaleY; /* pixel height */
-    double ipX; /* geo x ordinate of the corner of upper-left pixel */
-    double ipY; /* geo y ordinate of the corner of bottom-right pixel */
-    double skewX; /* skew about the X axis*/
-    double skewY; /* skew about the Y axis */
-
-    int32_t srid; /* spatial reference id */
-    uint16_t width; /* pixel columns - max 65535 */
-    uint16_t height; /* pixel rows - max 65535 */
-    rt_band *bands; /* actual bands */
-
-};
-
 rt_raster
 rt_raster_new(uint16_t width, uint16_t height) {
     rt_raster ret = NULL;
@@ -3333,14 +3229,6 @@ rt_raster_cell_to_geopoint(rt_raster raster,
 
 }
 
-/* WKT string representing each polygon in WKT format acompagned by its
-correspoding value */
-struct rt_geomval_t {
-    int srid;
-    double val;
-    char * geom;
-};
-
 rt_geomval
 rt_raster_dump_as_wktpolygons(rt_raster raster, int nband, int * pnElements)
 {
@@ -5323,13 +5211,6 @@ rt_raster_to_gdal(rt_raster raster, const char *srs,
        return rtn;
 }
 
-struct rt_gdaldriver_t {
-    int idx;
-    char *short_name;
-    char *long_name;
-               char *create_options;
-};
-
 /**
  * Returns a set of available GDAL drivers
  *
index 0a92d3746bde4dc64effde3973507a0b6e159fac..e9c8bf70543385a80b521ef4c95ba688a7c44625 100644 (file)
  *
  **/
 
-
 /**
  * Types definitions
  */
 typedef struct rt_raster_t* rt_raster;
 typedef struct rt_band_t* rt_band;
 typedef struct rt_geomval_t* rt_geomval;
+typedef struct rt_bandstats_t* rt_bandstats;
+typedef struct rt_histogram_t* rt_histogram;
+typedef struct rt_quantile_t* rt_quantile;
+typedef struct rt_valuecount_t* rt_valuecount;
+typedef struct rt_gdaldriver_t* rt_gdaldriver;
+typedef struct rt_reclassexpr_t* rt_reclassexpr;
+
+
+/**
+ * Struct definitions
+ *
+ * These structs are defined here as they are needed elsewhere
+ * including rt_pg/rt_pg.c and reduce duplicative declarations
+ *
+ */
+struct rt_raster_serialized_t {
+    /*---[ 8 byte boundary ]---{ */
+    uint32_t size; /* required by postgresql: 4 bytes */
+    uint16_t version; /* format version (this is version 0): 2 bytes */
+    uint16_t numBands; /* Number of bands: 2 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double scaleX; /* pixel width: 8 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double scaleY; /* pixel height: 8 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double ipX; /* insertion point X: 8 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double ipY; /* insertion point Y: 8 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double skewX; /* skew about the X axis: 8 bytes */
+
+    /* }---[ 8 byte boundary ]---{ */
+    double skewY; /* skew about the Y axis: 8 bytes */
+
+    /* }---[ 8 byte boundary ]--- */
+    int32_t srid; /* Spatial reference id: 4 bytes */
+    uint16_t width; /* pixel columns: 2 bytes */
+    uint16_t height; /* pixel rows: 2 bytes */
+};
+
+/* NOTE: the initial part of this structure matches the layout
+ *       of data in the serialized form version 0, starting
+ *       from the numBands element
+ */
+struct rt_raster_t {
+    uint32_t size;
+    uint16_t version;
+
+    /* Number of bands, all share the same dimension
+     * and georeference */
+    uint16_t numBands;
+
+    /* Georeference (in projection units) */
+    double scaleX; /* pixel width */
+    double scaleY; /* pixel height */
+    double ipX; /* geo x ordinate of the corner of upper-left pixel */
+    double ipY; /* geo y ordinate of the corner of bottom-right pixel */
+    double skewX; /* skew about the X axis*/
+    double skewY; /* skew about the Y axis */
+
+    int32_t srid; /* spatial reference id */
+    uint16_t width; /* pixel columns - max 65535 */
+    uint16_t height; /* pixel rows - max 65535 */
+    rt_band *bands; /* actual bands */
+
+};
+
+/* WKT string representing each polygon in WKT format acompagned by its
+correspoding value */
+struct rt_geomval_t {
+    int srid;
+    double val;
+    char * geom;
+};
+
+/* summary stats of specified band */
+struct rt_bandstats_t {
+       double sample;
+       uint32_t count;
+
+       double min;
+       double max;
+       double sum;
+       double mean;
+       double stddev;
+
+       double *values;
+       int sorted; /* flag indicating that values is sorted ascending by value */
+};
+
+/* histogram bin(s) of specified band */
+struct rt_histogram_t {
+       uint32_t count;
+       double percent;
+
+       double min;
+       double max;
+
+       int inc_min;
+       int inc_max;
+};
+
+/* quantile(s) of the specified band */
+struct rt_quantile_t {
+       double quantile;
+       double value;
+};
+
+/* number of times a value occurs */
+struct rt_valuecount_t {
+       double value;
+       uint32_t count;
+       double percent;
+};
+
+/* reclassification expression */
+struct rt_reclassexpr_t {
+       struct rt_reclassrange {
+               double min;
+               double max;
+               int inc_min; /* include min */
+               int inc_max; /* include max */
+               int exc_min; /* exceed min */
+               int exc_max; /* exceed max */
+       } src, dst;
+};
+
+/* gdal driver information */
+struct rt_gdaldriver_t {
+    int idx;
+    char *short_name;
+    char *long_name;
+               char *create_options;
+};
 
 /**
 * Global functions for memory/logging handlers.
@@ -461,7 +599,6 @@ int rt_band_check_is_nodata(rt_band band);
  *
  * @return the summary statistics for a band
  */
-typedef struct rt_bandstats_t* rt_bandstats;
 rt_bandstats rt_band_get_summary_stats(rt_band band, int exclude_nodata_value,
        double sample, int inc_vals, uint64_t *cK, double *cM, double *cQ);
        
@@ -483,7 +620,6 @@ rt_bandstats rt_band_get_summary_stats(rt_band band, int exclude_nodata_value,
  *
  * @return the histogram of the data
  */
-typedef struct rt_histogram_t* rt_histogram;
 rt_histogram rt_band_get_histogram(rt_bandstats stats,
        int bin_count, double *bin_widths, int bin_widths_count,
        int right, double min, double max, int *rtn_count);
@@ -499,7 +635,6 @@ rt_histogram rt_band_get_histogram(rt_bandstats stats,
  *
  * @return the default set of or requested quantiles for a band
  */
-typedef struct rt_quantile_t* rt_quantile;
 rt_quantile rt_band_get_quantiles(rt_bandstats stats,
        double *quantiles, int quantiles_count, int *rtn_count);
 
@@ -516,7 +651,6 @@ rt_quantile rt_band_get_quantiles(rt_bandstats stats,
  *
  * @return the default set of or requested quantiles for a band
  */
-typedef struct rt_valuecount_t* rt_valuecount;
 rt_valuecount rt_band_get_value_count(rt_band band, int exclude_nodata_value,
        double *search_values, uint32_t search_values_count,
        double roundto, int *rtn_count);
@@ -533,7 +667,6 @@ rt_valuecount rt_band_get_value_count(rt_band band, int exclude_nodata_value,
  *
  * @return a new rt_band or 0 on error
  */
-typedef struct rt_reclassexpr_t* rt_reclassexpr;
 rt_band rt_band_reclass(rt_band srcband, rt_pixtype pixtype,
        uint32_t hasnodata, double nodataval,
        rt_reclassexpr *exprset, int exprcount);
@@ -899,7 +1032,6 @@ uint8_t *rt_raster_to_gdal(rt_raster raster, const char *srs,
  *
  * @return set of "gdaldriver" values of available GDAL drivers
  */
-typedef struct rt_gdaldriver_t* rt_gdaldriver;
 rt_gdaldriver rt_raster_gdal_drivers(uint32_t *drv_count);
 
 /**
index 66a0c15cb43008055473348e546df0904aea90b9..919d669138c4ddbeb9f0f4cc3d251e12037134c0 100644 (file)
 #define MAX_DBL_CHARLEN (3 + DBL_MANT_DIG - DBL_MIN_EXP)
 #define MAX_INT_CHARLEN 32
 
-/* size of rt_raster_serialized_t */
-struct rt_raster_serialized_t {
-    uint32_t size;
-    uint16_t version;
-    uint16_t numBands;
-    double scaleX;
-    double scaleY;
-    double ipX;
-    double ipY;
-    double skewX;
-    double skewY;
-    int32_t srid;
-    uint16_t width;
-    uint16_t height;
-};
-
-#define RT_RASTER_SERIALIZED_T_LEN sizeof(struct rt_raster_serialized_t)
-
 /*
  * This is required for builds against pgsql 8.2
  */
@@ -708,7 +690,7 @@ Datum RASTER_convex_hull(PG_FUNCTION_ARGS)
     uchar* pglwgeom;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     {
         raster = rt_raster_deserialize(pgraster, TRUE);
@@ -750,16 +732,6 @@ Datum RASTER_convex_hull(PG_FUNCTION_ARGS)
 }
 
 
-/**
- * Needed for sizeof
- */
-struct rt_geomval_t {
-    int srid;
-    double val;
-    char * geom;
-};
-
-
 PG_FUNCTION_INFO_V1(RASTER_dumpAsWKTPolygons);
 Datum RASTER_dumpAsWKTPolygons(PG_FUNCTION_ARGS)
 {
@@ -998,7 +970,7 @@ Datum RASTER_getSRID(PG_FUNCTION_ARGS)
     int32_t srid;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1055,7 +1027,7 @@ Datum RASTER_getWidth(PG_FUNCTION_ARGS)
     uint16_t width;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1082,7 +1054,7 @@ Datum RASTER_getHeight(PG_FUNCTION_ARGS)
     uint16_t height;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1109,7 +1081,7 @@ Datum RASTER_getNumBands(PG_FUNCTION_ARGS)
     int32_t num_bands;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1136,7 +1108,7 @@ Datum RASTER_getXScale(PG_FUNCTION_ARGS)
     double xsize;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1163,7 +1135,7 @@ Datum RASTER_getYScale(PG_FUNCTION_ARGS)
     double ysize;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1252,7 +1224,7 @@ Datum RASTER_getXSkew(PG_FUNCTION_ARGS)
     double xskew;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1280,7 +1252,7 @@ Datum RASTER_getYSkew(PG_FUNCTION_ARGS)
     double yskew;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1369,7 +1341,7 @@ Datum RASTER_getXUpperLeft(PG_FUNCTION_ARGS)
     double xul;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -1396,7 +1368,7 @@ Datum RASTER_getYUpperLeft(PG_FUNCTION_ARGS)
     double yul;
 
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster ) {
@@ -2237,7 +2209,7 @@ Datum RASTER_isEmpty(PG_FUNCTION_ARGS)
 
     /* Deserialize raster */
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster )
@@ -2269,7 +2241,7 @@ Datum RASTER_hasNoBand(PG_FUNCTION_ARGS)
 
     /* Deserialize raster */
                if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+               pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
     raster = rt_raster_deserialize(pgraster, TRUE);
     if ( ! raster )
@@ -3023,20 +2995,6 @@ Datum RASTER_band(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(pgraster);
 }
 
-struct rt_bandstats_t {
-       double sample;
-       uint32_t count;
-
-       double min;
-       double max;
-       double sum;
-       double mean;
-       double stddev;
-
-       double *values;
-       int sorted;
-};
-
 /**
  * Get summary stats of a band
  */
@@ -3447,18 +3405,6 @@ Datum RASTER_summaryStatsCoverage(PG_FUNCTION_ARGS)
        PG_RETURN_DATUM(result);
 }
 
-/* get histogram */
-struct rt_histogram_t {
-       uint32_t count;
-       double percent;
-
-       double min;
-       double max;
-
-       int inc_min;
-       int inc_max;
-};
-
 /**
  * Returns histogram for a band
  */
@@ -4235,12 +4181,6 @@ Datum RASTER_histogramCoverage(PG_FUNCTION_ARGS)
        }
 }
 
-/* get quantiles */
-struct rt_quantile_t {
-       double quantile;
-       double value;
-};
-
 /**
  * Returns quantiles for a band
  */
@@ -4481,12 +4421,6 @@ Datum RASTER_quantile(PG_FUNCTION_ARGS)
        }
 }
 
-struct rt_valuecount_t {
-       double value;
-       uint32_t count;
-       double percent;
-};
-
 /* get counts of values */
 PG_FUNCTION_INFO_V1(RASTER_valueCount);
 Datum RASTER_valueCount(PG_FUNCTION_ARGS) {
@@ -4698,17 +4632,6 @@ Datum RASTER_valueCount(PG_FUNCTION_ARGS) {
        }
 }
 
-struct rt_reclassexpr_t {
-       struct rt_reclassrange {
-               double min;
-               double max;
-               int inc_min;
-               int inc_max;
-               int exc_min;
-               int exc_max;
-       } src, dst;
-};
-
 /**
  * Reclassify the specified bands of the raster
  */
@@ -5351,16 +5274,6 @@ Datum RASTER_asGDALRaster(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/**
- * Needed for sizeof
- */
-struct rt_gdaldriver_t {
-    int idx;
-    char *short_name;
-    char *long_name;
-               char *create_options;
-};
-
 /**
  * Returns available GDAL drivers
  */
@@ -6281,7 +6194,7 @@ Datum RASTER_metadata(PG_FUNCTION_ARGS)
 
        /* pgraster is null, return null */
        if (PG_ARGISNULL(0)) PG_RETURN_NULL();
-       pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, RT_RASTER_SERIALIZED_T_LEN);
+       pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
 
        /* raster */
        raster = rt_raster_deserialize(pgraster, TRUE);
index 448e97bfc3dd43a3e1926e61036cabc61f495d6f..40708444756fd8f98f91b9d4c778629657423b8f 100644 (file)
@@ -988,33 +988,6 @@ static void testRasterFromBand(rt_raster raster) {
        rt_raster_destroy(rast);
 }
 
-struct rt_bandstats_t {
-       double sample;
-       uint32_t count;
-
-       double min;
-       double max;
-       double sum;
-       double mean;
-       double stddev;
-
-       double *values;
-       int sorted;
-};
-struct rt_histogram_t {
-       uint32_t count;
-       double percent;
-
-       double min;
-       double max;
-
-       int inc_min;
-       int inc_max;
-};
-struct rt_quantile_t {
-       double quantile;
-       double value;
-};
 static void testBandStats() {
        rt_bandstats stats = NULL;
        rt_histogram histogram = NULL;
@@ -1165,16 +1138,6 @@ static void testRasterReplaceBand() {
        if (mem) rtdealloc(mem);
 }
 
-struct rt_reclassexpr_t {
-       struct rt_reclassrange {
-               double min;
-               double max;
-               int inc_min; /* include min */
-               int inc_max; /* include max */
-               int exc_min; /* exceed min */
-               int exc_max; /* exceed max */
-       } src, dst;
-};
 static void testBandReclass() {
        rt_reclassexpr *exprset;
 
@@ -1265,12 +1228,6 @@ static void testBandReclass() {
        rt_band_destroy(newband);
 }
 
-struct rt_gdaldriver_t {
-       int idx;
-       char *short_name;
-       char *long_name;
-       char *create_options;
-};
 static void testGDALDrivers() {
        int i;
        uint32_t size;
@@ -1336,11 +1293,6 @@ static void testRasterToGDAL() {
        deepRelease(raster);
 }
 
-struct rt_valuecount_t {
-       double value;
-       uint32_t count;
-       double percent;
-};
 static void testValueCount() {
        rt_valuecount vcnts = NULL;
 
@@ -1711,16 +1663,6 @@ main()
                /* We can check rt_raster_has_no_band here too */
                CHECK(!rt_raster_has_no_band(rt, 1));
 
-        /**
-         * Need to define again, to access the struct fields
-         **/
-        struct rt_geomval_t {
-            int srid;
-            double val;
-            char * geom;
-        };
-
-        typedef struct rt_geomval_t* rt_geomval;
         int nPols = 0;
 
         rt_geomval gv = (rt_geomval) rt_raster_dump_as_wktpolygons(rt, 1, &nPols);