From: Paul Ramsey Date: Tue, 20 Nov 2012 17:50:17 +0000 (+0000) Subject: Remove conditional use of USE_STANDARD_DEVIATION, it's been working for years, that... X-Git-Tag: 2.1.0beta2~377 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e9922a842b8c9f3dc732716305847e8b31ef212;p=postgis Remove conditional use of USE_STANDARD_DEVIATION, it's been working for years, that's what we use. git-svn-id: http://svn.osgeo.org/postgis/trunk@10717 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_estimate.c b/postgis/geography_estimate.c index fcae2bb8d..0abf699ef 100644 --- a/postgis/geography_estimate.c +++ b/postgis/geography_estimate.c @@ -55,7 +55,6 @@ Datum geography_analyze(PG_FUNCTION_ARGS); * tweak the deviation factor used in computation with * SDFACTOR. */ -#define USE_STANDARD_DEVIATION 1 #define SDFACTOR 3.25 @@ -809,13 +808,11 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, double total_width = 0; int notnull_cnt = 0, examinedsamples = 0, total_count_cells=0, total_cells_coverage = 0; -#if USE_STANDARD_DEVIATION /* for standard deviation */ double avgLOWx, avgLOWy, avgLOWz, avgHIGx, avgHIGy, avgHIGz; double sumLOWx = 0, sumLOWy = 0, sumLOWz = 0, sumHIGx = 0, sumHIGy = 0, sumHIGz = 0; double sdLOWx = 0, sdLOWy = 0, sdLOWz = 0, sdHIGx = 0, sdHIGy = 0, sdHIGz = 0; GBOX *newhistobox = NULL; -#endif bool isnull; int i; @@ -849,7 +846,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, { Datum datum; GSERIALIZED *serialized; - LWGEOM *geometry; /* Fetch the datum and cast it into a geography */ datum = fetchfunc(stats, i, &isnull); @@ -858,9 +854,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, if (isnull) continue; -// serialized = (GSERIALIZED *)PG_DETOAST_DATUM(datum); -// geometry = lwgeom_from_gserialized(serialized); - /* Convert coordinates to 3D geodesic */ if ( ! gserialized_datum_get_gbox_p(datum, &gbox) ) { @@ -909,7 +902,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, /** TODO: ask if we need geom or bvol size for stawidth */ total_width += VARSIZE(serialized); -#if USE_STANDARD_DEVIATION /* * Add bvol coordinates to sum for standard deviation * computation. @@ -920,7 +912,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, sumHIGx += gbox.xmax; sumHIGy += gbox.ymax; sumHIGz += gbox.zmax; -#endif notnull_cnt++; @@ -941,8 +932,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, return; } -#if USE_STANDARD_DEVIATION - POSTGIS_DEBUG(3, "Standard deviation filter enabled"); /* @@ -1063,21 +1052,6 @@ compute_geography_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, if ( histobox.zmax > newhistobox->zmax ) histobox.zmax = newhistobox->zmax; -#else /* ! USE_STANDARD_DEVIATION */ - - /* - * Set histogram extent box - */ - histobox.xmin = sample_extent->xmin; - histobox.ymin = sample_extent->ymin; - histobox.zmin = sample_extent->zmin; - histobox.xmax = sample_extent->xmax; - histobox.ymax = sample_extent->ymax; - histobox.zmax = sample_extent->zmax; - -#endif /* USE_STANDARD_DEVIATION */ - - POSTGIS_DEBUGF(3, " histogram_extent: xmin, ymin, zmin: %f, %f, %f", histobox.xmin, histobox.ymin, histobox.zmin); POSTGIS_DEBUGF(3, " histogram_extent: xmax, ymax, zmax: %f, %f, %f", diff --git a/postgis/geometry_estimate.c b/postgis/geometry_estimate.c index 9ba5954da..e2b552f43 100644 --- a/postgis/geometry_estimate.c +++ b/postgis/geometry_estimate.c @@ -63,7 +63,6 @@ * tweak the deviation factor used in computation with * SDFACTOR. */ -#define USE_STANDARD_DEVIATION 1 #define SDFACTOR 3.25 typedef struct GEOM_STATS_T @@ -793,13 +792,13 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, double cell_area; double cell_width; double cell_height; -#if USE_STANDARD_DEVIATION + /* for standard deviation */ double avgLOWx, avgLOWy, avgHIGx, avgHIGy; double sumLOWx=0, sumLOWy=0, sumHIGx=0, sumHIGy=0; double sdLOWx=0, sdLOWy=0, sdHIGx=0, sdHIGy=0; GBOX *newhistobox=NULL; -#endif + double geow, geoh; /* width and height of histogram */ int histocells; int cols, rows; /* histogram grid size */ @@ -908,7 +907,6 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, total_width += VARSIZE(geom); total_boxes_area += (box.xmax-box.xmin)*(box.ymax-box.ymin); -#if USE_STANDARD_DEVIATION /* * Add bvol coordinates to sum for standard deviation * computation. @@ -917,7 +915,6 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, sumLOWy += box.ymin; sumHIGx += box.xmax; sumHIGy += box.ymax; -#endif notnull_cnt++; @@ -933,7 +930,6 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, return; } -#if USE_STANDARD_DEVIATION POSTGIS_DEBUGF(3, " sample_extent: xmin,ymin: %f,%f", sample_extent->xmin, sample_extent->ymin); @@ -1037,18 +1033,6 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, histobox.ymax = newhistobox->ymax; -#else /* ! USE_STANDARD_DEVIATION */ - - /* - * Set histogram extent box - */ - histobox.xmin = sample_extent->xmin; - histobox.ymin = sample_extent->ymin; - histobox.xmax = sample_extent->xmax; - histobox.ymax = sample_extent->ymax; -#endif /* USE_STANDARD_DEVIATION */ - - POSTGIS_DEBUGF(3, " histogram_extent: xmin,ymin: %f,%f", histobox.xmin, histobox.ymin); POSTGIS_DEBUGF(3, " histogram_extent: xmax,ymax: %f,%f",