]> granicus.if.org Git - postgis/commitdiff
More cleanup of code comments so function descriptions are picked up by doxygen
authorRegina Obe <lr@pcorp.us>
Thu, 25 Jun 2009 03:32:43 +0000 (03:32 +0000)
committerRegina Obe <lr@pcorp.us>
Thu, 25 Jun 2009 03:32:43 +0000 (03:32 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4211 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-core.c
postgis/lwgeom_box3d.c
postgis/lwgeom_estimate.c
postgis/lwgeom_gist.c
postgis/lwgeom_rtree.c

index a28025851086812061fcd87114e3e9a03d7b879e..d79641302fdcbc6fb2286d37a6a0e63f9a3dfecf 100644 (file)
@@ -185,27 +185,29 @@ pgis_logf(const char *fmt, ... )
        va_end(ap);
 }
 
-/* liblwgeom allocator callback - install the defaults (malloc/free/stdout/stderr) */
-/* TODO hook lwnotice/lwerr up to the GUI */
+/** liblwgeom allocator callback - install the defaults (malloc/free/stdout/stderr) */
+/**
+       TODO: hook lwnotice/lwerr up to the GUI
+       */
 void lwgeom_init_allocators()
 {
        lwgeom_install_default_allocators();
 }
 
 
-/*
+/**
  * Escape input string suitable for COPY
  */
 
 char *
 escape_copy_string(char *str)
 {
-       /*
-        * Escape the following characters by adding a preceding backslash 
-        *      tab, backslash, cr, lf
-        *
+       /**
+        * Escape the following characters by adding a preceding backslash
+        *      tab, backslash, cr, lf
+        *
         * 1. find # of escaped characters
-        * 2. make new string 
+        * 2. make new string
         *
         */
 
@@ -228,8 +230,8 @@ escape_copy_string(char *str)
 
        while (*ptr)
        {
-               if ( *ptr == '\t' || *ptr == '\\' || 
-                       *ptr == '\n' || *ptr == '\r' ) 
+               if ( *ptr == '\t' || *ptr == '\\' ||
+                       *ptr == '\n' || *ptr == '\r' )
                                toescape++;
                ptr++;
        }
@@ -245,7 +247,7 @@ escape_copy_string(char *str)
        while (*ptr)
        {
                if ( *ptr == '\t' || *ptr == '\\' ||
-                       *ptr == '\n' || *ptr == '\r' ) 
+                       *ptr == '\n' || *ptr == '\r' )
                                *optr++='\\';
                                *optr++=*ptr++;
        }
@@ -260,7 +262,7 @@ escape_copy_string(char *str)
 }
 
 
-/*
+/**
  * Escape input string suitable for INSERT
  */
 
@@ -268,10 +270,10 @@ char *
 escape_insert_string(char *str)
 {
        /*
-        * Escape single quotes by adding a preceding single quote 
-        * 
+        * Escape single quotes by adding a preceding single quote
+        *
         * 1. find # of characters
-        * 2. make new string 
+        * 2. make new string
         */
 
        char    *result;
@@ -321,7 +323,7 @@ escape_insert_string(char *str)
 
 
 
-/*
+/**
  * PIP(): crossing number test for a point in a polygon
  *      input:   P = a point,
  *               V[] = vertex points of a polygon V[n+1] with V[n]=V[0]
@@ -337,7 +339,7 @@ PIP( Point P, Point* V, int n )
        for (i=0; i<n-1; i++)
        {    /* edge from V[i] to V[i+1] */
                if (((V[i].y <= P.y) && (V[i+1].y > P.y))    /* an upward crossing */
-                       || ((V[i].y > P.y) && (V[i+1].y <= P.y)))
+                               || ((V[i].y > P.y) && (V[i+1].y <= P.y)))
                { /* a downward crossing */
                        double vt = (float)(P.y - V[i].y) / (V[i+1].y - V[i].y);
                        if (P.x < V[i].x + vt * (V[i+1].x - V[i].x)) /* P.x < intersect */
@@ -405,11 +407,11 @@ Insert_attributes(DBFHandle hDBFHandle, int row)
 
                        default:
                                pgis_logf(
-                                   "Error: field %d has invalid or unknown field type (%d)",
-                                   i, types[i]);
+                                       "Error: field %d has invalid or unknown field type (%d)",
+                                       i, types[i]);
                                return 0;
                        }
-                       
+
                        if (dump_format)
                        {
                                escval = escape_copy_string(val);
@@ -443,7 +445,7 @@ Insert_attributes(DBFHandle hDBFHandle, int row)
 
 
 
-/*
+/**
  * formerly main()
  */
 int
@@ -702,12 +704,12 @@ CreateTable(void)
        if ( schema && readshape == 1 )
        {
                stringbuffer_aprintf(sb_row, "SELECT AddGeometryColumn('%s','%s','%s','%d',",
-                                    schema, table, geom, sr_id);
+                                                        schema, table, geom, sr_id);
        }
        else if (readshape == 1)
        {
                stringbuffer_aprintf(sb_row, "SELECT AddGeometryColumn('','%s','%s','%d',",
-                                    table, geom, sr_id);
+                                                        table, geom, sr_id);
        }
        if (pgtype)
        { //pgtype will only be set if we are loading geometries
@@ -754,21 +756,21 @@ LoadData(void)
                if ( schema )
                {
                        asprintf(&copysql, "COPY \"%s\".\"%s\" %s FROM stdin",
-                                schema, table, col_names);
+                                        schema, table, col_names);
                }
                else
                {
                        asprintf(&copysql, "COPY \"%s\" %s FROM stdin",
-                                table, col_names);
+                                        table, col_names);
                }
                pgis_copy_start(copysql);
                free(copysql);
        }
 
        /**************************************************************
-        * 
+        *
         *   MAIN SHAPE OBJECTS SCAN
-        * 
+        *
         **************************************************************/
        while (cur_entity <  num_entities - 1)
        {
@@ -824,12 +826,12 @@ LoadData(void)
                        if ( schema )
                        {
                                stringbuffer_aprintf(sb_row, "INSERT INTO \"%s\".\"%s\" %s VALUES (",
-                                                    schema, table, col_names);
+                                                                        schema, table, col_names);
                        }
                        else
                        {
                                stringbuffer_aprintf(sb_row, "INSERT INTO \"%s\" %s VALUES (",
-                                                    table, col_names);
+                                                                        table, col_names);
                        }
                }
                if ( ! Insert_attributes(hDBFHandle,cur_entity) ) return 0;
@@ -878,7 +880,7 @@ LoadData(void)
 
                        default:
                                pgis_logf ("**** Type is NOT SUPPORTED, type id = %d ****",
-                                          obj->nSHPType);
+                                                  obj->nSHPType);
                                break;
 
                        }
@@ -1071,7 +1073,7 @@ FindPolygons(SHPObject *obj, Ring ***Out)
                        ring->list[vi-vs].m = obj->padfM[vi];
 
                        area += (obj->padfX[vi] * obj->padfY[vn]) -
-                               (obj->padfY[vi] * obj->padfX[vn]);
+                                       (obj->padfY[vi] * obj->padfX[vn]);
                }
 
                /* Close the ring with first vertex  */
@@ -1509,11 +1511,11 @@ DropTable(char *schema, char *table, char *geom)
        /*---------------Drop the table--------------------------
         * TODO: if the table has more then one geometry column
         * the DROP TABLE call will leave spurious records in
-        * geometry_columns. 
+        * geometry_columns.
         *
         * If the geometry column in the table being dropped
         * does not match 'the_geom' or the name specified with
-        * -g an error is returned by DropGeometryColumn. 
+        * -g an error is returned by DropGeometryColumn.
         *
         * The table to be dropped might not exist.
         *
@@ -1628,14 +1630,14 @@ GetFieldsSpec(void)
                 * or after pgsql reserved attribute names
                 */
                if ( name[0]=='_' ||
-                       ! strcmp(name,"gid") ||
-                       ! strcmp(name, "tableoid") ||
-                       ! strcmp(name, "cmax") ||
-                       ! strcmp(name, "xmax") ||
-                       ! strcmp(name, "cmin") ||
-                       ! strcmp(name, "primary") ||
-                       ! strcmp(name, "oid") ||
-                       ! strcmp(name, "ctid") )
+                               ! strcmp(name,"gid") ||
+                               ! strcmp(name, "tableoid") ||
+                               ! strcmp(name, "cmax") ||
+                               ! strcmp(name, "xmax") ||
+                               ! strcmp(name, "cmin") ||
+                               ! strcmp(name, "primary") ||
+                               ! strcmp(name, "oid") ||
+                               ! strcmp(name, "ctid") )
                {
                        strcpy(name2+2, name);
                        name2[0] = '_';
index e83ec41c863858dde19958fcd64b070c2bbfdb17..5eb9429b1436d0a94650ba27c13c7c535af727e6 100644 (file)
@@ -39,7 +39,7 @@ Datum BOX3D_ymax(PG_FUNCTION_ARGS);
 Datum BOX3D_zmax(PG_FUNCTION_ARGS);
 Datum BOX3D_combine(PG_FUNCTION_ARGS);
 
-/*
+/**
  *  BOX3D_in - takes a string rep of BOX3D and returns internal rep
  *
  *  example:
@@ -69,12 +69,12 @@ Datum BOX3D_in(PG_FUNCTION_ARGS)
        }
 
        nitems = sscanf(str,"BOX3D(%le %le %le ,%le %le %le)",
-                       &box->xmin, &box->ymin, &box->zmin,
-                       &box->xmax, &box->ymax, &box->zmax);
+                                       &box->xmin, &box->ymin, &box->zmin,
+                                       &box->xmax, &box->ymax, &box->zmax);
        if (nitems != 6 )
        {
                nitems = sscanf(str,"BOX3D(%le %le ,%le %le)",
-                               &box->xmin, &box->ymin, &box->xmax, &box->ymax);
+                                               &box->xmin, &box->ymin, &box->xmax, &box->ymax);
                if (nitems != 4)
                {
                        pfree(box);
@@ -105,7 +105,7 @@ Datum BOX3D_in(PG_FUNCTION_ARGS)
 }
 
 
-/*
+/**
  *  Takes an internal rep of a BOX3D and returns a string rep.
  *
  *  example:
@@ -132,13 +132,13 @@ Datum BOX3D_out(PG_FUNCTION_ARGS)
        result = (char *) palloc(size);
 
        sprintf(result, "BOX3D(%.15g %.15g %.15g,%.15g %.15g %.15g)",
-               bbox->xmin, bbox->ymin, bbox->zmin,
-               bbox->xmax,bbox->ymax,bbox->zmax);
+                       bbox->xmin, bbox->ymin, bbox->zmin,
+                       bbox->xmax,bbox->ymax,bbox->zmax);
 
        PG_RETURN_CSTRING(result);
 }
 
-/*
+/**
  *  Takes an internal rep of a BOX3D and returns a string rep.
  *  but beginning with BOX(...) and with only 2 dimensions. This
  *  is a temporary hack to allow ST_Extent() to return a result
@@ -169,8 +169,8 @@ Datum BOX3D_extent_out(PG_FUNCTION_ARGS)
        result = (char *) palloc(size);
 
        sprintf(result, "BOX(%.15g %.15g,%.15g %.15g)",
-               bbox->xmin, bbox->ymin,
-               bbox->xmax,bbox->ymax);
+                       bbox->xmin, bbox->ymin,
+                       bbox->xmax,bbox->ymax);
 
        PG_RETURN_CSTRING(result);
 }
@@ -216,7 +216,7 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS)
        uchar *ser;
 
 
-       /*
+       /**
         * Alter BOX3D cast so that a valid geometry is always
         * returned depending upon the size of the BOX3D. The
         * code makes the following assumptions:
@@ -228,14 +228,14 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS)
         */
 
        if (box->xmin == box->xmax &&
-               box->ymin == box->ymax)
+                       box->ymin == box->ymax)
        {
                /* Construct and serialize point */
                LWPOINT *point = make_lwpoint2d(-1, box->xmin, box->ymin);
                ser = lwpoint_serialize(point);
        }
        else if (box->xmin == box->xmax ||
-                box->ymin == box->ymax)
+                        box->ymin == box->ymax)
        {
                LWLINE *line;
                POINT2D *pts = palloc(sizeof(POINT2D)*2);
@@ -286,7 +286,7 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/* Expand given box of 'd' units in all directions */
+/** Expand given box of 'd' units in all directions */
 void
 expand_box3d(BOX3D *box, double d)
 {
@@ -312,7 +312,7 @@ Datum BOX3D_expand(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/*
+/**
  * convert a PG_LWGEOM to BOX3D
  *
  * NOTE: the bounding box is *always* recomputed as the cache
@@ -445,7 +445,7 @@ Datum BOX3D_construct(PG_FUNCTION_ARGS)
        maxpoint = lwgeom_deserialize(SERIALIZED_FORM(max));
 
        if ( TYPE_GETTYPE(minpoint->type) != POINTTYPE ||
-               TYPE_GETTYPE(maxpoint->type) != POINTTYPE )
+                       TYPE_GETTYPE(maxpoint->type) != POINTTYPE )
        {
                elog(ERROR, "BOX3D_construct: args must be points");
                PG_RETURN_NULL();
@@ -467,7 +467,7 @@ Datum BOX3D_construct(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/* min(a,b) */
+/** min(a,b) */
 double
 LWGEOM_Mind(double a, double b)
 {
@@ -476,7 +476,7 @@ LWGEOM_Mind(double a, double b)
        return b;
 }
 
-/* max(a,b) */
+/** max(a,b) */
 double
 LWGEOM_Maxd(double a, double b)
 {
index 8e634f2c85aed1a23005c50b9297b04f7872845e..def7d2ee0573fc8d962b9a7296fd1ea4390ddcb3 100644 (file)
@@ -33,7 +33,7 @@
 #include <errno.h>
 #include <ctype.h>
 
-/*
+/**
  *     Assign a number to the postgis statistics kind
  *
  *     tgl suggested:
@@ -86,17 +86,17 @@ static float8 estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats);
 #define SHOW_DIGS_DOUBLE 15
 #define MAX_DIGS_DOUBLE (SHOW_DIGS_DOUBLE + 6 + 1 + 3 +1)
 
-/*
+/**
  * Default geometry selectivity factor
  */
 #define DEFAULT_GEOMETRY_SEL 0.000005
 
-/*
+/**
  * Default geometry join selectivity factor
  */
 #define DEFAULT_GEOMETRY_JOINSEL 0.000005
 
-/*
+/**
  * Define this to actually DO join selectivity
  * (as contrary to just return the default JOINSEL value)
  * Note that this is only possible when compiling postgis
@@ -111,7 +111,7 @@ Datum LWGEOM_analyze(PG_FUNCTION_ARGS);
 
 
 #if ! REALLY_DO_JOINSEL
-/*
+/**
  * JOIN selectivity in the GiST && operator
  * for all PG versions
  */
@@ -119,7 +119,7 @@ PG_FUNCTION_INFO_V1(LWGEOM_gist_joinsel);
 Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
 {
        POSTGIS_DEBUGF(2, "LWGEOM_gist_joinsel called (returning %f)",
-                      DEFAULT_GEOMETRY_JOINSEL);
+                                  DEFAULT_GEOMETRY_JOINSEL);
 
        PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL);
 }
@@ -131,7 +131,7 @@ int calculate_column_intersection(BOX2DFLOAT4 *search_box, GEOM_STATS *geomstats
 int
 calculate_column_intersection(BOX2DFLOAT4 *search_box, GEOM_STATS *geomstats1, GEOM_STATS *geomstats2)
 {
-       /*
+       /**
        * Calculate the intersection of two columns from their geomstats extents - return true
        * if a valid intersection was found, false if there is no overlap
        */
@@ -154,7 +154,7 @@ calculate_column_intersection(BOX2DFLOAT4 *search_box, GEOM_STATS *geomstats1, G
        return -1;
 }
 
-/*
+/**
 * JOIN selectivity in the GiST && operator
 * for all PG versions
 */
@@ -186,7 +186,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
        BOX2DFLOAT4 search_box;
 
 
-       /*
+       /**
        * Join selectivity algorithm. To calculation the selectivity we
        * calculate the intersection of the two column sample extents,
        * sum the results, and then multiply by two since for each
@@ -238,8 +238,8 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
 
 
        if ( ! get_attstatsslot(stats1_tuple, 0, 0,
-                               STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
-                               (float4 **)gs1ptr, &geomstats1_nvalues) )
+                                                       STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
+                                                       (float4 **)gs1ptr, &geomstats1_nvalues) )
        {
                POSTGIS_DEBUG(3, " STATISTIC_KIND_GEOMETRY stats not found - returning default geometry join selectivity");
 
@@ -255,27 +255,27 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
                POSTGIS_DEBUG(3, " No statistics, returning default geometry join selectivity");
 
                free_attstatsslot(0, NULL, 0, (float *)geomstats1,
-                                 geomstats1_nvalues);
+                                                 geomstats1_nvalues);
                ReleaseSysCache(stats1_tuple);
                PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL);
        }
 
 
        if ( ! get_attstatsslot(stats2_tuple, 0, 0,
-                               STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
-                               (float4 **)gs2ptr, &geomstats2_nvalues) )
+                                                       STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
+                                                       (float4 **)gs2ptr, &geomstats2_nvalues) )
        {
                POSTGIS_DEBUG(3, " STATISTIC_KIND_GEOMETRY stats not found - returning default geometry join selectivity");
 
                free_attstatsslot(0, NULL, 0, (float *)geomstats1,
-                                 geomstats1_nvalues);
+                                                 geomstats1_nvalues);
                ReleaseSysCache(stats2_tuple);
                ReleaseSysCache(stats1_tuple);
                PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL);
        }
 
 
-       /*
+       /**
        * Setup the search box - this is the intersection of the two column
        * extents.
        */
@@ -307,7 +307,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
        * multiply out the returned selectivity by the total number of rows.
        */
        class_tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid1),
-                                    0, 0, 0);
+                                                                0, 0, 0);
 
        if (HeapTupleIsValid(class_tuple))
        {
@@ -319,7 +319,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
 
 
        class_tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid2),
-                                    0, 0, 0);
+                                                                0, 0, 0);
 
        if (HeapTupleIsValid(class_tuple))
        {
@@ -343,7 +343,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
 
        total_tuples = num1_tuples * num2_tuples;
        rows_returned = 2 * ((num1_tuples * selectivity1) +
-                            (num2_tuples * selectivity2));
+                                                (num2_tuples * selectivity2));
 
        POSTGIS_DEBUGF(3, "Rows from rel1: %f", num1_tuples * selectivity1);
        POSTGIS_DEBUGF(3, "Rows from rel2: %f", num2_tuples * selectivity2);
@@ -374,11 +374,12 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
 /**************************** FROM POSTGIS ****************/
 
 
-/*
+/**
  * This function returns an estimate of the selectivity
  * of a search_box looking at data in the GEOM_STATS
  * structure.
- *
+ * */
+ /**
  * TODO: handle box dimension collapses (probably should be handled
  * by the statistic generator, avoiding GEOM_STATS with collapsed
  * dimensions)
@@ -403,9 +404,9 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
         * Search box completely miss histogram extent
         */
        if ( box->xmax < geomstats->xmin ||
-               box->xmin > geomstats->xmax ||
-               box->ymax < geomstats->ymin ||
-               box->ymin > geomstats->ymax )
+                       box->xmin > geomstats->xmax ||
+                       box->ymax < geomstats->ymin ||
+                       box->ymin > geomstats->ymax )
        {
                POSTGIS_DEBUG(3, " search_box does not overlaps histogram, returning 0");
 
@@ -416,9 +417,9 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
         * Search box completely contains histogram extent
         */
        if ( box->xmax >= geomstats->xmax &&
-               box->xmin <= geomstats->xmin &&
-               box->ymax >= geomstats->ymax &&
-               box->ymin <= geomstats->ymin )
+                       box->xmin <= geomstats->xmin &&
+                       box->ymax >= geomstats->ymax &&
+                       box->ymin <= geomstats->ymin )
        {
                POSTGIS_DEBUG(3, " search_box contains histogram, returning 1");
 
@@ -523,16 +524,16 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
                        gain = AOI/cell_area;
 
                        POSTGIS_DEBUGF(4, " [%d,%d] cell val %.15f",
-                                      x, y, val);
+                                                  x, y, val);
                        POSTGIS_DEBUGF(4, " [%d,%d] AOI %.15f",
-                                      x, y, AOI);
+                                                  x, y, AOI);
                        POSTGIS_DEBUGF(4, " [%d,%d] gain %.15f",
-                                      x, y, gain);
+                                                  x, y, gain);
 
                        val *= gain;
 
                        POSTGIS_DEBUGF(4, " [%d,%d] adding %.15f to value",
-                                      x, y, val);
+                                                  x, y, val);
 
                        value += val;
                }
@@ -561,7 +562,7 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
         * by both searc_box and feature. We should then
         * divide our value by the number of cells in the virtual
         * 'intersection' between average feature cell occupation
-        * and occupation of the search_box. This is as 
+        * and occupation of the search_box. This is as
         * fuzzy as you understand it :)
         *
         * Consistency check: whenever the number of cells is
@@ -573,7 +574,7 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
         *
         */
        overlapping_cells = (x_idx_max-x_idx_min+1) *
-                           (y_idx_max-y_idx_min+1);
+                                               (y_idx_max-y_idx_min+1);
        avg_feat_cells = geomstats->avgFeatureCells;
 
        POSTGIS_DEBUGF(3, " search_box overlaps %f cells", overlapping_cells);
@@ -600,7 +601,7 @@ estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats)
        return selectivity;
 }
 
-/*
+/**
  * This function should return an estimation of the number of
  * rows returned by a query involving an overlap check
  * ( it's the restrict function for the && operator )
@@ -674,7 +675,7 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
        /*
         * We are working on two constants..
         * TODO: check if expression is true,
-        *       returned set would be either 
+        *       returned set would be either
         *       the whole or none.
         */
        if ( ! IsA(self, Var) )
@@ -714,8 +715,8 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
 
 
        if ( ! get_attstatsslot(stats_tuple, 0, 0,
-                               STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
-                               (float4 **)gsptr, &geomstats_nvalues) )
+                                                       STATISTIC_KIND_GEOMETRY, InvalidOid, NULL, NULL,
+                                                       (float4 **)gsptr, &geomstats_nvalues) )
        {
                POSTGIS_DEBUG(3, " STATISTIC_KIND_GEOMETRY stats not found - returning default geometry selectivity");
 
@@ -726,9 +727,9 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
        POSTGIS_DEBUGF(4, " %d read from stats", geomstats_nvalues);
 
        POSTGIS_DEBUGF(4, " histo: xmin,ymin: %f,%f",
-                      geomstats->xmin, geomstats->ymin);
+                                  geomstats->xmin, geomstats->ymin);
        POSTGIS_DEBUGF(4, " histo: xmax,ymax: %f,%f",
-                      geomstats->xmax, geomstats->ymax);
+                                  geomstats->xmax, geomstats->ymax);
        POSTGIS_DEBUGF(4, " histo: cols: %f", geomstats->rows);
        POSTGIS_DEBUGF(4, " histo: rows: %f", geomstats->cols);
        POSTGIS_DEBUGF(4, " histo: avgFeatureArea: %f", geomstats->avgFeatureArea);
@@ -749,7 +750,7 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
 }
 
 
-/*
+/**
  * This function is called by the analyze function iff
  * the geometry_analyze() function give it its pointer
  * (this is always the case so far).
@@ -768,7 +769,7 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
  */
 static void
 compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
-                       int samplerows, double totalrows)
+                                          int samplerows, double totalrows)
 {
        MemoryContext old_context;
        int i;
@@ -859,9 +860,9 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                 * Skip infinite geoms
                 */
                if ( ! finite(box.xmin) ||
-                       ! finite(box.xmax) ||
-                       ! finite(box.ymin) ||
-                       ! finite(box.ymax) )
+                               ! finite(box.xmax) ||
+                               ! finite(box.ymin) ||
+                               ! finite(box.ymax) )
                {
                        POSTGIS_DEBUGF(3, " skipped infinite geometry %d", i);
 
@@ -886,22 +887,22 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                else
                {
                        sample_extent->xmax = LWGEOM_Maxf(sample_extent->xmax,
-                                                         box.xmax);
+                                                                                         box.xmax);
                        sample_extent->ymax = LWGEOM_Maxf(sample_extent->ymax,
-                                                         box.ymax);
+                                                                                         box.ymax);
                        sample_extent->xmin = LWGEOM_Minf(sample_extent->xmin,
-                                                         box.xmin);
+                                                                                         box.xmin);
                        sample_extent->ymin = LWGEOM_Minf(sample_extent->ymin,
-                                                         box.ymin);
+                                                                                         box.ymin);
                }
 
-               /* TODO: ask if we need geom or bvol size for stawidth */
+               /** TODO: ask if we need geom or bvol size for stawidth */
                total_width += geom->size;
                total_boxes_area += (box.xmax-box.xmin)*(box.ymax-box.ymin);
 
 #if USE_STANDARD_DEVIATION
                /*
-                * Add bvol coordinates to sum for standard deviation 
+                * Add bvol coordinates to sum for standard deviation
                 * computation.
                 */
                sumLOWx += box.xmin;
@@ -927,9 +928,9 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
 #if USE_STANDARD_DEVIATION
 
        POSTGIS_DEBUGF(3, " sample_extent: xmin,ymin: %f,%f",
-                      sample_extent->xmin, sample_extent->ymin);
+                                  sample_extent->xmin, sample_extent->ymin);
        POSTGIS_DEBUGF(3, " sample_extent: xmax,ymax: %f,%f",
-                      sample_extent->xmax, sample_extent->ymax);
+                                  sample_extent->xmax, sample_extent->ymax);
 
        /*
         * Second scan:
@@ -961,18 +962,18 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
        POSTGIS_DEBUGF(3, "  HIGy - avg:%f sd:%f", avgHIGy, sdHIGy);
 
        histobox.xmin = LW_MAX((avgLOWx - SDFACTOR * sdLOWx),
-                              sample_extent->xmin);
+                                                  sample_extent->xmin);
        histobox.ymin = LW_MAX((avgLOWy - SDFACTOR * sdLOWy),
-                              sample_extent->ymin);
+                                                  sample_extent->ymin);
        histobox.xmax = LW_MIN((avgHIGx + SDFACTOR * sdHIGx),
-                              sample_extent->xmax);
+                                                  sample_extent->xmax);
        histobox.ymax = LW_MIN((avgHIGy + SDFACTOR * sdHIGy),
-                              sample_extent->ymax);
+                                                  sample_extent->ymax);
 
        POSTGIS_DEBUGF(3, " sd_extent: xmin,ymin: %f,%f",
-                      histobox.xmin, histobox.ymin);
+                                  histobox.xmin, histobox.ymin);
        POSTGIS_DEBUGF(3, " sd_extent: xmax,ymax: %f,%f",
-                      histobox.xmin, histobox.ymax);
+                                  histobox.xmin, histobox.ymax);
 
        /*
         * Third scan:
@@ -985,9 +986,9 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                box = (BOX2DFLOAT4 *)sampleboxes[i];
 
                if ( box->xmin > histobox.xmax ||
-                       box->xmax < histobox.xmin ||
-                       box->ymin > histobox.ymax ||
-                       box->ymax < histobox.ymin )
+                               box->xmax < histobox.xmin ||
+                               box->ymin > histobox.ymax ||
+                               box->ymax < histobox.ymin )
                {
                        POSTGIS_DEBUGF(4, " feat %d is an hard deviant, skipped", i);
 
@@ -1014,7 +1015,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
 
        /*
         * Set histogram extent as the intersection between
-        * standard deviation based histogram extent 
+        * standard deviation based histogram extent
         * and computed sample extent after removal of
         * hard deviants (there might be no hard deviants).
         */
@@ -1041,9 +1042,9 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
 
 
        POSTGIS_DEBUGF(3, " histogram_extent: xmin,ymin: %f,%f",
-                      histobox.xmin, histobox.ymin);
+                                  histobox.xmin, histobox.ymin);
        POSTGIS_DEBUGF(3, " histogram_extent: xmax,ymax: %f,%f",
-                      histobox.xmax, histobox.ymax);
+                                  histobox.xmax, histobox.ymax);
 
 
        geow = histobox.xmax - histobox.xmin;
@@ -1138,8 +1139,8 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                vacuum_delay_point();
 
                POSTGIS_DEBUGF(4, " feat %d box is %f %f, %f %f",
-                              i, box->xmax, box->ymax,
-                              box->xmin, box->ymin);
+                                          i, box->xmax, box->ymax,
+                                          box->xmin, box->ymin);
 
                /* Find first overlapping column */
                x_idx_min = (box->xmin-geomstats->xmin) / geow * cols;
@@ -1162,7 +1163,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                if (y_idx_max >= rows) y_idx_max = rows-1;
 
                POSTGIS_DEBUGF(4, " feat %d overlaps columns %d-%d, rows %d-%d",
-                              i, x_idx_min, x_idx_max, y_idx_min, y_idx_max);
+                                          i, x_idx_min, x_idx_max, y_idx_min, y_idx_max);
 
                /*
                 * the {x,y}_idx_{min,max}
@@ -1179,7 +1180,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
 
                /*
                 * before adding to the total cells
-                * we could decide if we really 
+                * we could decide if we really
                 * want this feature to count
                 */
                total_boxes_cells += numcells;
@@ -1199,7 +1200,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
                return;
        }
 
-       /* what about null features (TODO) ? */
+       /** TODO: what about null features (TODO) */
        geomstats->avgFeatureCells = (float4)total_boxes_cells/examinedsamples;
 
        POSTGIS_DEBUGF(3, " histo: total_boxes_cells: %d", total_boxes_cells);
@@ -1230,7 +1231,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
 
 
        /*
-        * Write the statistics data 
+        * Write the statistics data
         */
        stats->stakind[0] = STATISTIC_KIND_GEOMETRY;
        stats->staop[0] = InvalidOid;
@@ -1242,7 +1243,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
        stats->stadistinct = -1.0;
 
        POSTGIS_DEBUGF(3, " out: slot 0: kind %d (STATISTIC_KIND_GEOMETRY)",
-                      stats->stakind[0]);
+                                  stats->stakind[0]);
        POSTGIS_DEBUGF(3, " out: slot 0: op %d (InvalidOid)", stats->staop[0]);
        POSTGIS_DEBUGF(3, " out: slot 0: numnumbers %d", stats->numnumbers[0]);
        POSTGIS_DEBUGF(3, " out: null fraction: %d/%d=%g", null_cnt, samplerows, stats->stanullfrac);
@@ -1252,7 +1253,7 @@ compute_geometry_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
        stats->stats_valid = true;
 }
 
-/*
+/**
  * This function will be called when the ANALYZE command is run
  * on a column of the "geometry" type.
  *
@@ -1313,7 +1314,7 @@ Datum LWGEOM_analyze(PG_FUNCTION_ARGS)
        PG_RETURN_BOOL(true);
 }
 
-/*
+/**
  * Return the estimated extent of the table
  * looking at gathered statistics (or NULL if
  * no statistics have been gathered).
@@ -1394,7 +1395,7 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS)
        else
        {
                POSTGIS_DEBUGF(3, " schema:current_schema() table:%s column:%s",
-                              tbl, col);
+                                          tbl, col);
        }
 #endif
 
@@ -1497,7 +1498,7 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS)
        memcpy(box, ARR_DATA_PTR(array), sizeof(BOX2DFLOAT4));
 
        POSTGIS_DEBUGF(3, " histogram extent = %g %g, %g %g", box->xmin,
-                      box->ymin, box->xmax, box->ymax);
+                                  box->ymin, box->xmax, box->ymax);
 
        SPIcode = SPI_finish();
        if (SPIcode != SPI_OK_FINISH )
index 879022b5745f7dce31f08018bcb4b81d133e1d99..be6c376cbc2435169cb5ffecb76ac2b85e011d37 100644 (file)
@@ -21,8 +21,8 @@
 #include <errno.h>
 
 
-/*
- * implementation GiST support and basic LWGEOM operations (like &&)
+/**
+ * @file implementation GiST support and basic LWGEOM operations (like &&)
  */
 
 
@@ -60,7 +60,7 @@ static int counter_leaf = 0;
 static int counter_intern = 0;
 
 
-/* GiST strategies (modified from src/include/access/rtree.h) */
+/** GiST strategies (modified from src/include/access/rtree.h) */
 #define RTLeftStrategyNumber                   1
 #define RTOverLeftStrategyNumber               2
 #define RTOverlapStrategyNumber                        3
@@ -75,7 +75,7 @@ static int counter_intern = 0;
 #define RTOverAboveStrategyNumber              12
 
 
-/*
+/**
  * all the lwgeom_<same,overlpa,overleft,left,right,overright,overbelow,below,above,overabove,contained,contain>
  *  work the same.
  *  1. get lwgeom1
@@ -114,16 +114,16 @@ Datum LWGEOM_overlap(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_overlap,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
 
        POSTGIS_DEBUGF(3, "GIST: lwgeom_overlap:\n(%f %f, %f %f) (%f %f %f %f) = %i",
-                      box1.xmin, box1.ymax, box1.xmax, box1.ymax,
-                      box2.xmin, box2.ymax, box2.xmax, box2.ymax,
-                      result
-                     );
+                                  box1.xmin, box1.ymax, box1.xmax, box1.ymax,
+                                  box2.xmin, box2.ymax, box2.xmax, box2.ymax,
+                                  result
+                                 );
 
        PG_RETURN_BOOL(result);
 }
@@ -157,7 +157,7 @@ Datum LWGEOM_overleft(PG_FUNCTION_ARGS)
 
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_overleft,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -186,7 +186,7 @@ Datum LWGEOM_left(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_left,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -216,7 +216,7 @@ Datum LWGEOM_right(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_right,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -246,7 +246,7 @@ Datum LWGEOM_overright(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_overright,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -277,7 +277,7 @@ Datum LWGEOM_overbelow(PG_FUNCTION_ARGS)
 
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_overbelow,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -306,7 +306,7 @@ Datum LWGEOM_below(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_below,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -336,7 +336,7 @@ Datum LWGEOM_above(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_above,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -366,7 +366,7 @@ Datum LWGEOM_overabove(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_overabove,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -396,7 +396,7 @@ Datum LWGEOM_contained(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_contained,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -426,7 +426,7 @@ Datum LWGEOM_contain(PG_FUNCTION_ARGS)
        }
 
        result = DatumGetBool(DirectFunctionCall2(BOX2D_contain,
-                             PointerGetDatum(&box1), PointerGetDatum(&box2)));
+                                                 PointerGetDatum(&box1), PointerGetDatum(&box2)));
 
        PG_FREE_IF_COPY(lwgeom1, 0);
        PG_FREE_IF_COPY(lwgeom2, 1);
@@ -482,10 +482,10 @@ Datum LWGEOM_gist_compress(PG_FUNCTION_ARGS)
                        rr = (BOX2DFLOAT4*) palloc(sizeof(BOX2DFLOAT4));
 
                        if (    ! getbox2d_p(SERIALIZED_FORM(in), rr) ||
-                               ! finite(rr->xmin) ||
-                               ! finite(rr->ymin) ||
-                               ! finite(rr->xmax) ||
-                               ! finite(rr->ymax) )
+                                       ! finite(rr->xmin) ||
+                                       ! finite(rr->ymin) ||
+                                       ! finite(rr->xmax) ||
+                                       ! finite(rr->ymax) )
                        {
 
                                POSTGIS_DEBUG(4, "found empty or infinite geometry");
@@ -505,14 +505,14 @@ Datum LWGEOM_gist_compress(PG_FUNCTION_ARGS)
 
 #if POSTGIS_PGSQL_VERSION >= 82
                        gistentryinit(*retval, PointerGetDatum(rr),
-                                     entry->rel, entry->page,
-                                     entry->offset,
-                                     FALSE);
+                                                 entry->rel, entry->page,
+                                                 entry->offset,
+                                                 FALSE);
 #else
                        gistentryinit(*retval, PointerGetDatum(rr),
-                                     entry->rel, entry->page,
-                                     entry->offset, sizeof(BOX2DFLOAT4),
-                                     FALSE);
+                                                 entry->rel, entry->page,
+                                                 entry->offset, sizeof(BOX2DFLOAT4),
+                                                 FALSE);
 #endif
 
 
@@ -523,10 +523,10 @@ Datum LWGEOM_gist_compress(PG_FUNCTION_ARGS)
 
 #if POSTGIS_PGSQL_VERSION >= 82
                        gistentryinit(*retval, (Datum) 0, entry->rel,
-                                     entry->page, entry->offset, FALSE);
+                                                 entry->page, entry->offset, FALSE);
 #else
                        gistentryinit(*retval, (Datum) 0, entry->rel,
-                                     entry->page, entry->offset, 0, FALSE);
+                                                 entry->page, entry->offset, 0, FALSE);
 #endif
 
                }
@@ -573,7 +573,7 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
        }
 
        /*
-       ** First pull only a small amount of the tuple, enough to 
+       ** First pull only a small amount of the tuple, enough to
        ** get the bounding box, if one exists.
        ** size = header + type + box2df4?
        */
@@ -588,7 +588,7 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
 
        /*
        ** If the bounding box exists, copy it into the working variable.
-       ** If not, pull the full toasted data out, and call the standard box 
+       ** If not, pull the full toasted data out, and call the standard box
        ** retrieval function, which will calculate the box from scratch.
        */
        serialized_lwgeom = SERIALIZED_FORM(query);
@@ -608,11 +608,11 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
 
        if (GIST_LEAF(entry))
                result = lwgeom_rtree_leaf_consistent((BOX2DFLOAT4 *)
-                                                     DatumGetPointer(entry->key), &box, strategy );
+                                                                                         DatumGetPointer(entry->key), &box, strategy );
        else
                result = lwgeom_rtree_internal_consistent(
-                            (BOX2DFLOAT4 *) DatumGetPointer(entry->key),
-                            &box, strategy );
+                                        (BOX2DFLOAT4 *) DatumGetPointer(entry->key),
+                                        &box, strategy );
 
        PG_FREE_IF_COPY(query, 1);
        PG_RETURN_BOOL(result);
@@ -621,7 +621,7 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
 
 static bool
 lwgeom_rtree_internal_consistent(BOX2DFLOAT4 *key, BOX2DFLOAT4 *query,
-                                 StrategyNumber strategy)
+                                                                StrategyNumber strategy)
 {
        bool retval;
 
@@ -638,14 +638,14 @@ lwgeom_rtree_internal_consistent(BOX2DFLOAT4 *key, BOX2DFLOAT4 *query,
        case RTOverlapStrategyNumber:  /*optimized for speed */
 
                retval = (((key->xmax>= query->xmax) &&
-                          (key->xmin <= query->xmax)) ||
-                         ((query->xmax>= key->xmax) &&
-                          (query->xmin<= key->xmax)))
-                        &&
-                        (((key->ymax>= query->ymax) &&
-                          (key->ymin<= query->ymax)) ||
-                         ((query->ymax>= key->ymax) &&
-                          (query->ymin<= key->ymax)));
+                                  (key->xmin <= query->xmax)) ||
+                                 ((query->xmax>= key->xmax) &&
+                                  (query->xmin<= key->xmax)))
+                                &&
+                                (((key->ymax>= query->ymax) &&
+                                  (key->ymin<= query->ymax)) ||
+                                 ((query->ymax>= key->ymax) &&
+                                  (query->ymin<= key->ymax)));
 
 
 #if POSTGIS_DEBUG_LEVEL >=4
@@ -653,13 +653,13 @@ lwgeom_rtree_internal_consistent(BOX2DFLOAT4 *key, BOX2DFLOAT4 *query,
                if (counter_intern == 0)
                {
                        POSTGIS_DEBUGF(4, "search bounding box is: <%.16g %.16g,%.16g %.16g> - size box2d= %ld",
-                                      query->xmin,query->ymin,query->xmax,query->ymax,sizeof(BOX2DFLOAT4));
+                                                  query->xmin,query->ymin,query->xmax,query->ymax,sizeof(BOX2DFLOAT4));
 
                }
 
 
                POSTGIS_DEBUGF(4, "%i:(int)<%.8g %.8g,%.8g %.8g>&&<%.8g %.8g,%.8g %.8g> %i",counter_intern,key->xmin,key->ymin,key->xmax,key->ymax,
-                              query->xmin,query->ymin,query->xmax,query->ymax,   (int) retval);
+                                          query->xmin,query->ymin,query->xmax,query->ymax,   (int) retval);
 
                counter_intern++;
 #endif
@@ -701,7 +701,7 @@ lwgeom_rtree_internal_consistent(BOX2DFLOAT4 *key, BOX2DFLOAT4 *query,
 
 static bool
 lwgeom_rtree_leaf_consistent(BOX2DFLOAT4 *key,
-                             BOX2DFLOAT4 *query, StrategyNumber strategy)
+                                                        BOX2DFLOAT4 *query, StrategyNumber strategy)
 {
        bool retval;
 
@@ -717,20 +717,20 @@ lwgeom_rtree_leaf_consistent(BOX2DFLOAT4 *key,
                break;
        case RTOverlapStrategyNumber: /*optimized for speed */
                retval = (((key->xmax>= query->xmax) &&
-                          (key->xmin <= query->xmax)) ||
-                         ((query->xmax>= key->xmax) &&
-                          (query->xmin<= key->xmax)))
-                        &&
-                        (((key->ymax>= query->ymax) &&
-                          (key->ymin<= query->ymax)) ||
-                         ((query->ymax>= key->ymax) &&
-                          (query->ymin<= key->ymax)));
+                                  (key->xmin <= query->xmax)) ||
+                                 ((query->xmax>= key->xmax) &&
+                                  (query->xmin<= key->xmax)))
+                                &&
+                                (((key->ymax>= query->ymax) &&
+                                  (key->ymin<= query->ymax)) ||
+                                 ((query->ymax>= key->ymax) &&
+                                  (query->ymin<= key->ymax)));
 
 #if POSTGIS_DEBUG_LEVEL >= 4
                /*keep track and report info about how many times this is called */
                POSTGIS_DEBUGF(4, "%i:gist test (leaf) <%.6g %.6g,%.6g %.6g> &&  <%.6g %.6g,%.6g %.6g> --> %i",
-                              counter_leaf,key->xmin,key->ymin,key->xmax,key->ymax,
-                              query->xmin,query->ymin,query->xmax,query->ymax,   (int) retval);
+                                          counter_leaf,key->xmin,key->ymin,key->xmax,key->ymax,
+                                          query->xmin,query->ymin,query->xmax,query->ymax,   (int) retval);
                counter_leaf++;
 #endif
                return(retval);
@@ -785,7 +785,7 @@ Datum LWGEOM_gist_decompress(PG_FUNCTION_ARGS)
 
 
 
-/*
+/**
  * The GiST Union method for boxes
  * returns the minimal bounding box that encloses all the entries in entryvec
  */
@@ -833,7 +833,7 @@ Datum LWGEOM_gist_union(PG_FUNCTION_ARGS)
 }
 
 
-/*
+/**
  * size of a box is width*height
  * we do this in double precision because width and height can be very very small
  * and it gives screwy results
@@ -865,7 +865,7 @@ size_box2d(Datum box2d)
        return result;
 }
 
-/*
+/**
  * size of a box is width*height
  * we do this in double precision because width and height can be very very small
  * and it gives screwy results
@@ -903,7 +903,7 @@ static double size_box2d_double(Datum box2d)
 
 
 
-/*
+/**
 ** The GiST Penalty method for boxes
 ** As in the R-tree paper, we use change in area as our penalty metric
 */
@@ -959,7 +959,7 @@ compare_KB(const void* a, const void* b)
        return ( sa>sb ) ? 1 : -1;
 }
 
-/*
+/**
 ** Equality method
 */
 PG_FUNCTION_INFO_V1(LWGEOM_gist_same);
@@ -980,7 +980,7 @@ Datum LWGEOM_gist_same(PG_FUNCTION_ARGS)
 
 
 
-/*
+/**
 ** The GiST PickSplit method
 ** New linear algorithm, see 'New Linear Node Splitting Algorithm for R-tree',
 ** C.H.Ang and T.C.Tan
@@ -1020,11 +1020,11 @@ Datum LWGEOM_gist_picksplit(PG_FUNCTION_ARGS)
                cur = (BOX2DFLOAT4 *) DatumGetPointer(entryvec->vector[i].key);
 
                if ( allisequal == true &&  (
-                           pageunion.xmax != cur->xmax ||
-                           pageunion.ymax != cur->ymax ||
-                           pageunion.xmin != cur->xmin ||
-                           pageunion.ymin != cur->ymin
-                       ) )
+                                       pageunion.xmax != cur->xmax ||
+                                       pageunion.ymax != cur->ymax ||
+                                       pageunion.xmin != cur->xmin ||
+                                       pageunion.ymin != cur->ymin
+                               ) )
                        allisequal = false;
 
                if (pageunion.xmax < cur->xmax)
@@ -1169,12 +1169,12 @@ Datum LWGEOM_gist_picksplit(PG_FUNCTION_ARGS)
        else
        {
                Datum interLR = DirectFunctionCall2(BOX2D_intersects,
-                                                   PointerGetDatum(unionL), PointerGetDatum(unionR));
+                                                                                       PointerGetDatum(unionL), PointerGetDatum(unionR));
                Datum interBT = DirectFunctionCall2(BOX2D_intersects,
-                                                   PointerGetDatum(unionB), PointerGetDatum(unionT));
+                                                                                       PointerGetDatum(unionB), PointerGetDatum(unionT));
                float sizeLR, sizeBT;
 
-               /*elog(NOTICE,"direction is abigeous"); */
+               /*elog(NOTICE,"direction is ambiguous"); */
 
                sizeLR = size_box2d(interLR);
                sizeBT = size_box2d(interBT);
@@ -1278,7 +1278,7 @@ Datum LWGEOM_gist_picksplit(PG_FUNCTION_ARGS)
 }
 
 
-/* debug function */
+/** debug function */
 Datum report_lwgeom_gist_activity(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(report_lwgeom_gist_activity);
 Datum report_lwgeom_gist_activity(PG_FUNCTION_ARGS)
index 00e7bb7f19e03335079ca4a134de6416b9171639..3b954d6c62ebffd4663aa8d97ce35a691abff4d7 100644 (file)
@@ -18,7 +18,7 @@
 Datum LWGEOM_polygon_index(PG_FUNCTION_ARGS);
 
 
-/*
+/**
  * Creates an rtree given a pointer to the point array.
  * Must copy the point array.
  */
@@ -81,7 +81,7 @@ RTREE_NODE *createTree(POINTARRAY *pointArray)
        return root;
 }
 
-/*
+/**
  * Creates an interior node given the children.
  */
 RTREE_NODE *createInteriorNode(RTREE_NODE *left, RTREE_NODE *right)
@@ -101,7 +101,7 @@ RTREE_NODE *createInteriorNode(RTREE_NODE *left, RTREE_NODE *right)
        return parent;
 }
 
-/*
+/**
  * Creates a leaf node given the pointer to the start point of the segment.
  */
 RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint)
@@ -154,7 +154,7 @@ RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint)
        return parent;
 }
 
-/*
+/**
  * Creates an interval with the total extents of the two given intervals.
  */
 INTERVAL *mergeIntervals(INTERVAL *inter1, INTERVAL *inter2)
@@ -172,7 +172,7 @@ INTERVAL *mergeIntervals(INTERVAL *inter1, INTERVAL *inter2)
        return interval;
 }
 
-/*
+/**
  * Creates an interval given the min and max values, in arbitrary order.
  */
 INTERVAL *createInterval(double value1, double value2)
@@ -190,7 +190,7 @@ INTERVAL *createInterval(double value1, double value2)
        return interval;
 }
 
-/*
+/**
  * Recursively frees the child nodes, the interval and the line before
  * freeing the root node.
  */
@@ -213,7 +213,7 @@ void freeTree(RTREE_NODE *root)
 }
 
 
-/*
+/**
  * Free the cache object and all the sub-objects properly.
  */
 void clearCache(RTREE_POLY_CACHE *cache)
@@ -233,7 +233,7 @@ void clearCache(RTREE_POLY_CACHE *cache)
 }
 
 
-/*
+/**
  * Retrieves a collection of line segments given the root and crossing value.
  * The collection is a multilinestring consisting of two point lines
  * representing the segments of the ring that may be crossed by the
@@ -305,7 +305,7 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
        return result;
 }
 
-/* Merges two multilinestrings into a single multilinestring. */
+/** Merges two multilinestrings into a single multilinestring. */
 LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2)
 {
        LWGEOM **geoms;
@@ -333,7 +333,7 @@ LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2)
        return (LWMLINE *)col;
 }
 
-/*
+/**
  * Returns 1 if min < value <= max, 0 otherwise. */
 uint32 isContained(INTERVAL *interval, double value)
 {
@@ -478,7 +478,7 @@ void populateCache(RTREE_POLY_CACHE *currentCache, LWGEOM *lwgeom, uchar *serial
        LWDEBUGF(3, "populateCache returning %p", currentCache);
 }
 
-/*
+/**
  * Creates a new cachable index if needed, or returns the current cache if
  * it is applicable to the current polygon.
  * The memory context must be changed to function scope before calling this