Datum ST_GeoHash(PG_FUNCTION_ARGS);
void lwgeom_affine_ptarray(POINTARRAY *pa, double afac, double bfac, double cfac,
- double dfac, double efac, double ffac, double gfac, double hfac, double ifac, double xoff, double yoff, double zoff);
+ double dfac, double efac, double ffac, double gfac, double hfac, double ifac, double xoff, double yoff, double zoff);
void lwgeom_affine_recursive(uchar *serialized, double afac, double bfac, double cfac,
- double dfac, double efac, double ffac, double gfac, double hfac, double ifac, double xoff, double yoff, double zoff);
+ double dfac, double efac, double ffac, double gfac, double hfac, double ifac, double xoff, double yoff, double zoff);
/*------------------------------------------------------------------*/
-/*find the size of geometry */
+/** find the size of geometry */
PG_FUNCTION_INFO_V1(LWGEOM_mem_size);
Datum LWGEOM_mem_size(PG_FUNCTION_ARGS)
{
if ( size != computed_size )
{
elog(NOTICE, "varlena size (%lu) != computed size+4 (%lu)",
- (unsigned long)size,
- (unsigned long)computed_size);
+ (unsigned long)size,
+ (unsigned long)computed_size);
}
PG_FREE_IF_COPY(geom,0);
PG_RETURN_INT32(size);
}
-/* get summary info on a GEOMETRY */
+/** get summary info on a GEOMETRY */
PG_FUNCTION_INFO_V1(LWGEOM_summary);
Datum LWGEOM_summary(PG_FUNCTION_ARGS)
{
}
-/*
+/**
* Recursively count points in a SERIALIZED lwgeom
*/
int32
return npoints;
}
-/*
+/**
* Recursively count rings in a SERIALIZED lwgeom
*/
int32
return nrings;
}
-/* number of points in an object */
+/** number of points in an object */
PG_FUNCTION_INFO_V1(LWGEOM_npoints);
Datum LWGEOM_npoints(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(npoints);
}
-/* number of rings in an object */
+/** number of rings in an object */
PG_FUNCTION_INFO_V1(LWGEOM_nrings);
Datum LWGEOM_nrings(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(nrings);
}
-/*
- * Calculate the area of all the subobj in a polygon
- * area(point) = 0
- * area (line) = 0
- * area(polygon) = find its 2d area
+/**
+ * @brief Calculate the area of all the subobj in a polygon
+ * area(point) = 0
+ * area (line) = 0
+ * area(polygon) = find its 2d area
*/
PG_FUNCTION_INFO_V1(LWGEOM_area_polygon);
Datum LWGEOM_area_polygon(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(area);
}
-/*
- * find the "length of a geometry"
- * length2d(point) = 0
- * length2d(line) = length of line
- * length2d(polygon) = 0 -- could make sense to return sum(ring perimeter)
- * uses euclidian 2d length (even if input is 3d)
+/**
+ * @brief find the "length of a geometry"
+ * length2d(point) = 0
+ * length2d(line) = length of line
+ * length2d(polygon) = 0 -- could make sense to return sum(ring perimeter)
+ * uses euclidian 2d length (even if input is 3d)
*/
PG_FUNCTION_INFO_V1(LWGEOM_length2d_linestring);
Datum LWGEOM_length2d_linestring(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(dist);
}
-/*
- * find the "length of a geometry"
- * length(point) = 0
- * length(line) = length of line
- * length(polygon) = 0 -- could make sense to return sum(ring perimeter)
- * uses euclidian 3d/2d length depending on input dimensions.
+/**
+ * @brief find the "length of a geometry"
+ * length(point) = 0
+ * length(line) = length of line
+ * length(polygon) = 0 -- could make sense to return sum(ring perimeter)
+ * uses euclidian 3d/2d length depending on input dimensions.
*/
PG_FUNCTION_INFO_V1(LWGEOM_length_linestring);
Datum LWGEOM_length_linestring(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(dist);
}
-/*
- * find the "perimeter of a geometry"
- * perimeter(point) = 0
- * perimeter(line) = 0
- * perimeter(polygon) = sum of ring perimeters
- * uses euclidian 3d/2d computation depending on input dimension.
+/**
+ * @brief find the "perimeter of a geometry"
+ * perimeter(point) = 0
+ * perimeter(line) = 0
+ * perimeter(polygon) = sum of ring perimeters
+ * uses euclidian 3d/2d computation depending on input dimension.
*/
PG_FUNCTION_INFO_V1(LWGEOM_perimeter_poly);
Datum LWGEOM_perimeter_poly(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(ret);
}
-/*
- * find the "perimeter of a geometry"
- * perimeter(point) = 0
- * perimeter(line) = 0
- * perimeter(polygon) = sum of ring perimeters
- * uses euclidian 2d computation even if input is 3d
+/**
+ * @brief find the "perimeter of a geometry"
+ * perimeter(point) = 0
+ * perimeter(line) = 0
+ * perimeter(polygon) = sum of ring perimeters
+ * uses euclidian 2d computation even if input is 3d
*/
PG_FUNCTION_INFO_V1(LWGEOM_perimeter2d_poly);
Datum LWGEOM_perimeter2d_poly(PG_FUNCTION_ARGS)
}
-/*
- * Write to already allocated memory 'optr' a 2d version of
- * the given serialized form.
- * Higher dimensions in input geometry are discarded.
- * Return number bytes written in given int pointer.
+/**
+ * @brief Write to already allocated memory 'optr' a 2d version of
+ * the given serialized form.
+ * Higher dimensions in input geometry are discarded.
+ * @return number bytes written in given int pointer.
*/
void
lwgeom_force2d_recursive(uchar *serialized, uchar *optr, size_t *retsize)
TYPE_SETZM(nring->dims, 0, 0);
nring->npoints = ring->npoints;
nring->serialized_pointlist =
- lwalloc(ring->npoints*sizeof(POINT2D));
+ lwalloc(ring->npoints*sizeof(POINT2D));
loc = nring->serialized_pointlist;
for (k=0; k<ring->npoints; k++)
{
TYPE_SETZM(poly->type, 0, 0);
lwpoly_serialize_buf(poly, optr, retsize);
lwfree(poly);
- /* TODO: free nrigs[*]->serialized_pointlist */
+ /** @todo TODO: free nrigs[*]->serialized_pointlist
+ */
LWDEBUG(3, "lwgeom_force2d_recursive returning");
}
if ( type != MULTIPOINTTYPE && type != MULTIPOLYGONTYPE &&
- type != MULTILINETYPE && type != COLLECTIONTYPE &&
- type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
- type != MULTICURVETYPE && type != MULTISURFACETYPE)
+ type != MULTILINETYPE && type != COLLECTIONTYPE &&
+ type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
+ type != MULTICURVETYPE && type != MULTISURFACETYPE)
{
lwerror("lwgeom_force2d_recursive: unknown geometry: %d",
- type);
+ type);
}
/*
/* Add type */
newtypefl = lwgeom_makeType_full(0, 0, lwgeom_hasSRID(serialized[0]),
- type, lwgeom_hasBBOX(serialized[0]));
+ type, lwgeom_hasBBOX(serialized[0]));
optr[0] = newtypefl;
optr++;
totsize++;
optr += size;
LWDEBUGF(3, "lwgeom_force2d_recursive: added elem %d size: %d (tot: %d)",
- i, size, totsize);
+ i, size, totsize);
}
lwinspected_release(inspected);
if ( retsize ) *retsize = totsize;
}
-/*
- * Write to already allocated memory 'optr' a 3dz version of
- * the given serialized form.
- * Higher dimensions in input geometry are discarder.
- * If the given version is 2d Z is set to 0.
- * Return number bytes written in given int pointer.
+/**
+ * @brief Write to already allocated memory 'optr' a 3dz version of
+ * the given serialized form.
+ * Higher dimensions in input geometry are discarder.
+ * If the given version is 2d Z is set to 0.
+ * @return number bytes written in given int pointer.
*/
void
lwgeom_force3dz_recursive(uchar *serialized, uchar *optr, size_t *retsize)
TYPE_SETZM(nring->dims, 1, 0);
nring->npoints = ring->npoints;
nring->serialized_pointlist =
- lwalloc(ring->npoints*sizeof(POINT3DZ));
+ lwalloc(ring->npoints*sizeof(POINT3DZ));
loc = nring->serialized_pointlist;
for (k=0; k<ring->npoints; k++)
{
/* Add type */
*optr = lwgeom_makeType_full(1, 0, lwgeom_hasSRID(serialized[0]),
- type, lwgeom_hasBBOX(serialized[0]));
+ type, lwgeom_hasBBOX(serialized[0]));
optr++;
totsize++;
loc=serialized+1;
*retsize = totsize;
}
-/*
- * Write to already allocated memory 'optr' a 3dm version of
- * the given serialized form.
- * Higher dimensions in input geometry are discarder.
- * If the given version is 2d M is set to 0.
- * Return number bytes written in given int pointer.
+/**
+ * @brief Write to already allocated memory 'optr' a 3dm version of
+ * the given serialized form.
+ * Higher dimensions in input geometry are discarder.
+ * If the given version is 2d M is set to 0.
+ * @return number bytes written in given int pointer.
*/
void
lwgeom_force3dm_recursive(uchar *serialized, uchar *optr, size_t *retsize)
TYPE_SETZM(nring->dims, 0, 1);
nring->npoints = ring->npoints;
nring->serialized_pointlist =
- lwalloc(ring->npoints*sizeof(POINT3DM));
+ lwalloc(ring->npoints*sizeof(POINT3DM));
loc = nring->serialized_pointlist;
for (k=0; k<ring->npoints; k++)
{
TYPE_SETZM(poly->type, 0, 1);
lwpoly_serialize_buf(poly, optr, retsize);
lwfree(poly);
- /* TODO: free nrigs[*]->serialized_pointlist */
+ /** @todo TODO: free nrigs[*]->serialized_pointlist
+ */
LWDEBUG(3, "lwgeom_force3dm_recursive returning");
}
if ( type != MULTIPOINTTYPE && type != MULTIPOLYGONTYPE &&
- type != MULTILINETYPE && type != COLLECTIONTYPE &&
- type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
- type != MULTICURVETYPE && type != MULTISURFACETYPE)
+ type != MULTILINETYPE && type != COLLECTIONTYPE &&
+ type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
+ type != MULTICURVETYPE && type != MULTISURFACETYPE)
{
lwerror("lwgeom_force3dm_recursive: unknown geometry: %d",
- type);
+ type);
}
/*
/* Add type */
newtypefl = lwgeom_makeType_full(0, 1, lwgeom_hasSRID(serialized[0]),
- type, lwgeom_hasBBOX(serialized[0]));
+ type, lwgeom_hasBBOX(serialized[0]));
optr[0] = newtypefl;
optr++;
totsize++;
optr += size;
LWDEBUGF(3, "lwgeom_force3dm_recursive: added elem %d size: %d (tot: %d)",
- i, size, totsize);
+ i, size, totsize);
}
lwinspected_release(inspected);
TYPE_SETZM(nring->dims, 1, 1);
nring->npoints = ring->npoints;
nring->serialized_pointlist =
- lwalloc(ring->npoints*sizeof(POINT4D));
+ lwalloc(ring->npoints*sizeof(POINT4D));
loc = nring->serialized_pointlist;
for (k=0; k<ring->npoints; k++)
{
/* Add type */
*optr = lwgeom_makeType_full(
- 1, 1,
- lwgeom_hasSRID(serialized[0]),
- type, lwgeom_hasBBOX(serialized[0]));
+ 1, 1,
+ lwgeom_hasSRID(serialized[0]),
+ type, lwgeom_hasBBOX(serialized[0]));
optr++;
totsize++;
loc=serialized+1;
srl = lwalloc(VARSIZE(geom));
lwgeom_force2d_recursive(SERIALIZED_FORM(geom),
- srl, &size);
+ srl, &size);
result = PG_LWGEOM_construct(srl, pglwgeom_getSRID(geom),
- lwgeom_hasBBOX(geom->type));
+ lwgeom_hasBBOX(geom->type));
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_POINTER(result);
}
lwgeom_force3dz_recursive(SERIALIZED_FORM(geom),
- srl, &size);
+ srl, &size);
result = PG_LWGEOM_construct(srl, pglwgeom_getSRID(geom),
- lwgeom_hasBBOX(geom->type));
+ lwgeom_hasBBOX(geom->type));
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_POINTER(result);
}
-/* transform input geometry to 3dm if not 3dm already */
+/** transform input geometry to 3dm if not 3dm already */
PG_FUNCTION_INFO_V1(LWGEOM_force_3dm);
Datum LWGEOM_force_3dm(PG_FUNCTION_ARGS)
{
POSTGIS_DEBUGF(3, "LWGEOM_force_3dm: allocated %d bytes for result", (int)size);
lwgeom_force3dm_recursive(SERIALIZED_FORM(geom),
- srl, &size);
+ srl, &size);
POSTGIS_DEBUGF(3, "LWGEOM_force_3dm: lwgeom_force3dm_recursive returned a %d sized geom", (int)size);
result = PG_LWGEOM_construct(srl, pglwgeom_getSRID(geom),
- lwgeom_hasBBOX(geom->type));
+ lwgeom_hasBBOX(geom->type));
PG_FREE_IF_COPY(geom, 0);
srl = lwalloc(VARSIZE(geom)*2);
lwgeom_force4d_recursive(SERIALIZED_FORM(geom),
- srl, &size);
+ srl, &size);
result = PG_LWGEOM_construct(srl, pglwgeom_getSRID(geom),
- lwgeom_hasBBOX(geom->type));
+ lwgeom_hasBBOX(geom->type));
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_POINTER(result);
}
-/* transform input geometry to a collection type */
+/** transform input geometry to a collection type */
PG_FUNCTION_INFO_V1(LWGEOM_force_collection);
Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
{
* automatic bbox addition FOR_COMPLEX_GEOMS.
*/
if ( TYPE_GETTYPE(geom->type) == COLLECTIONTYPE &&
- TYPE_HASBBOX(geom->type) )
+ TYPE_HASBBOX(geom->type) )
{
PG_RETURN_POINTER(geom);
}
lwgeom->bbox = NULL;
lwgeoms[0] = lwgeom;
lwgeom = (LWGEOM *)lwcollection_construct(COLLECTIONTYPE,
- SRID, bbox, 1,
- lwgeoms);
+ SRID, bbox, 1,
+ lwgeoms);
}
result = pglwgeom_serialize(lwgeom);
PG_RETURN_POINTER(result);
}
-/* transform input geometry to a multi* type */
+/** transform input geometry to a multi* type */
PG_FUNCTION_INFO_V1(LWGEOM_force_multi);
Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
{
}
mindist = lwgeom_mindistance2d_recursive(SERIALIZED_FORM(geom1),
- SERIALIZED_FORM(geom2));
+ SERIALIZED_FORM(geom2));
PROFSTOP(PROF_QRUN);
PROFREPORT("dist",geom1, geom2, NULL);
}
mindist = lwgeom_mindistance2d_recursive_tolerance(
- SERIALIZED_FORM(geom1),
- SERIALIZED_FORM(geom2),
- tolerance
- );
+ SERIALIZED_FORM(geom1),
+ SERIALIZED_FORM(geom2),
+ tolerance
+ );
PROFSTOP(PROF_QRUN);
PROFREPORT("dist",geom1, geom2, NULL);
PG_RETURN_FLOAT8(maxdist);
}
-/*
- * Longitude shift:
- * Y remains the same
- * X is converted:
- * from -180..180 to 0..360
- * from 0..360 to -180..180
+/**
+ * @brief Longitude shift:
+ * Y remains the same
+ * X is converted:
+ * from -180..180 to 0..360
+ * from 0..360 to -180..180
*/
PG_FUNCTION_INFO_V1(LWGEOM_longitude_shift);
Datum LWGEOM_longitude_shift(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(lwgeom_pt_inside_circle(&pt, cx, cy, rr));
}
-/*
- * collect( geom, geom ) returns a geometry which contains
- * all the sub_objects from both of the argument geometries
- * returned geometry is the simplest possible, based on the types
- * of the collected objects
- * ie. if all are of either X or multiX, then a multiX is returned.
+/**
+ * @brief collect( geom, geom ) returns a geometry which contains
+ * all the sub_objects from both of the argument geometries
+ * @return geometry is the simplest possible, based on the types
+ * of the collected objects
+ * ie. if all are of either X or multiX, then a multiX is returned.
*/
PG_FUNCTION_INFO_V1(LWGEOM_collect);
Datum LWGEOM_collect(PG_FUNCTION_ARGS)
lwgeom_dropSRID(lwgeoms[1]);
outlwg = (LWGEOM *)lwcollection_construct(
- outtype, SRID,
- box, 2, lwgeoms);
+ outtype, SRID,
+ box, 2, lwgeoms);
result = pglwgeom_serialize(outlwg);
PG_RETURN_POINTER(result);
}
-/*
- * This is a geometry array constructor
- * for use as aggregates sfunc.
- * Will have as input an array of Geometry pointers and a Geometry.
- * Will DETOAST given geometry and put a pointer to it
- * in the given array. DETOASTED value is first copied
- * to a safe memory context to avoid premature deletion.
+/**
+ * @brief This is a geometry array constructor
+ * for use as aggregates sfunc.
+ * Will have as input an array of Geometry pointers and a Geometry.
+ * Will DETOAST given geometry and put a pointer to it
+ * in the given array. DETOASTED value is first copied
+ * to a safe memory context to avoid premature deletion.
*/
PG_FUNCTION_INFO_V1(LWGEOM_accum);
Datum LWGEOM_accum(PG_FUNCTION_ARGS)
nbytes = ARR_OVERHEAD_NONULLS(1)+INTALIGN(VARSIZE(geom));
POSTGIS_DEBUGF(3, "geom_accum: adding %p (nelems=%d; nbytes=%d)",
- (void*)geom, nelems, (int)nbytes);
+ (void*)geom, nelems, (int)nbytes);
result = lwalloc(nbytes);
if ( ! result )
POSTGIS_DEBUGF(3, " array start @ %p", (void*)result);
POSTGIS_DEBUGF(3, " ARR_DATA_PTR @ %p (%d)",
- ARR_DATA_PTR(result), (uchar *)ARR_DATA_PTR(result)-(uchar *)result);
+ ARR_DATA_PTR(result), (uchar *)ARR_DATA_PTR(result)-(uchar *)result);
POSTGIS_DEBUGF(3, " next element @ %p", (uchar *)result+oldsize);
SET_VARSIZE(result, nbytes);
memcpy(ARR_DIMS(result), &nelems, sizeof(int));
POSTGIS_DEBUGF(3, " writing next element starting @ %p",
- (void*)(result+oldsize));
+ (void*)(result+oldsize));
memcpy((uchar *)result+oldsize, geom, VARSIZE(geom));
}
}
-/*
- * collect_garray ( GEOMETRY[] ) returns a geometry which contains
- * all the sub_objects from all of the geometries in given array.
+/**
+ * @brief collect_garray ( GEOMETRY[] ) returns a geometry which contains
+ * all the sub_objects from all of the geometries in given array.
*
- * returned geometry is the simplest possible, based on the types
- * of the collected objects
- * ie. if all are of either X or multiX, then a multiX is returned
- * bboxonly types are treated as null geometries (no sub_objects)
+ * @return geometry is the simplest possible, based on the types
+ * of the collected objects
+ * ie. if all are of either X or multiX, then a multiX is returned
+ * bboxonly types are treated as null geometries (no sub_objects)
*/
PG_FUNCTION_INFO_V1(LWGEOM_collect_garray);
Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS)
array = DatumGetArrayTypeP(datum);
POSTGIS_DEBUGF(3, " array is %d-bytes in size, %ld w/out header",
- ARR_SIZE(array), ARR_SIZE(array)-ARR_OVERHEAD_NONULLS(ARR_NDIM(array)));
+ ARR_SIZE(array), ARR_SIZE(array)-ARR_OVERHEAD_NONULLS(ARR_NDIM(array)));
/* Get number of geometries in array */
if ( lwgeoms[i]->SRID != SRID )
{
elog(ERROR,
- "Operation on mixed SRID geometries");
+ "Operation on mixed SRID geometries");
PG_RETURN_NULL();
}
POSTGIS_DEBUGF(3, "LWGEOM_collect_garray: outtype = %d", outtype);
outlwg = (LWGEOM *)lwcollection_construct(
- outtype, SRID,
- box, nelems, lwgeoms);
+ outtype, SRID,
+ box, nelems, lwgeoms);
result = pglwgeom_serialize(outlwg);
PG_RETURN_POINTER(result);
}
-/*
+/**
* LineFromMultiPoint ( GEOMETRY ) returns a LINE formed by
- * all the points in the in given multipoint.
+ * all the points in the in given multipoint.
*/
PG_FUNCTION_INFO_V1(LWGEOM_line_from_mpoint);
Datum LWGEOM_line_from_mpoint(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(result);
}
-/*
- * makeline_garray ( GEOMETRY[] ) returns a LINE formed by
- * all the point geometries in given array.
- * array elements that are NOT points are discarded..
+/**
+ * @brief makeline_garray ( GEOMETRY[] ) returns a LINE formed by
+ * all the point geometries in given array.
+ * array elements that are NOT points are discarded..
*/
PG_FUNCTION_INFO_V1(LWGEOM_makeline_garray);
Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS)
if ( TYPE_GETTYPE(geom->type) != POINTTYPE ) continue;
lwpoints[npoints++] =
- lwpoint_deserialize(SERIALIZED_FORM(geom));
+ lwpoint_deserialize(SERIALIZED_FORM(geom));
/* Check SRID homogeneity */
if ( npoints == 1 )
if ( lwpoints[npoints-1]->SRID != SRID )
{
elog(ERROR,
- "Operation on mixed SRID geometries");
+ "Operation on mixed SRID geometries");
PG_RETURN_NULL();
}
}
POSTGIS_DEBUGF(3, "LWGEOM_makeline_garray: element %d deserialized",
- i);
+ i);
}
/* Return null on 0-points input array */
PG_RETURN_POINTER(result);
}
-/*
+/**
* makeline ( GEOMETRY, GEOMETRY ) returns a LINESTRIN segment
* formed by the given point geometries.
*/
pglwg2 = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
if ( ! TYPE_GETTYPE(pglwg1->type) == POINTTYPE ||
- ! TYPE_GETTYPE(pglwg2->type) == POINTTYPE )
+ ! TYPE_GETTYPE(pglwg2->type) == POINTTYPE )
{
elog(ERROR, "Input geometries must be points");
PG_RETURN_NULL();
PG_RETURN_POINTER(result);
}
-/*
+/**
* makepoly( GEOMETRY, GEOMETRY[] ) returns a POLYGON
- * formed by the given shell and holes geometries.
+ * formed by the given shell and holes geometries.
*/
PG_FUNCTION_INFO_V1(LWGEOM_makepoly);
Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(result);
}
-/*
+/**
* makes a polygon of the expanded features bvol - 1st point = LL 3rd=UR
* 2d only. (3d might be worth adding).
* create new geometry of type polygon, 1 ring, 5 points
PG_RETURN_POINTER(result);
}
-/* Convert geometry to BOX (internal postgres type) */
+/** Convert geometry to BOX (internal postgres type) */
PG_FUNCTION_INFO_V1(LWGEOM_to_BOX);
Datum LWGEOM_to_BOX(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-/*
+/**
* makes a polygon of the features bvol - 1st point = LL 3rd=UR
* 2d only. (3d might be worth adding).
* create new geometry of type polygon, 1 ring, 5 points
if (box.xmin == box.xmax &&
- box.ymin == box.ymax)
+ box.ymin == box.ymax)
{
/* Construct and serialize point */
LWPOINT *point = make_lwpoint2d(SRID, 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);
}
-/*
- * Returns a modified geometry so that no segment is
- * longer then the given distance (computed using 2d).
- * Every input point is kept.
- * Z and M values for added points (if needed) are set to 0.
+/**
+ * @brief Returns a modified geometry so that no segment is
+ * longer then the given distance (computed using 2d).
+ * Every input point is kept.
+ * Z and M values for added points (if needed) are set to 0.
*/
PG_FUNCTION_INFO_V1(LWGEOM_segmentize2d);
Datum LWGEOM_segmentize2d(PG_FUNCTION_ARGS)
/* Avoid deserialize/serialize steps */
if ( (TYPE_GETTYPE(ingeom->type) == POINTTYPE) ||
- (TYPE_GETTYPE(ingeom->type) == MULTIPOINTTYPE) )
+ (TYPE_GETTYPE(ingeom->type) == MULTIPOINTTYPE) )
PG_RETURN_POINTER(ingeom);
inlwgeom = lwgeom_deserialize(SERIALIZED_FORM(ingeom));
PG_RETURN_POINTER(outgeom);
}
-/* Reverse vertex order of geometry */
+/** Reverse vertex order of geometry */
PG_FUNCTION_INFO_V1(LWGEOM_reverse);
Datum LWGEOM_reverse(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(geom);
}
-/* Force polygons of the collection to obey Right-Hand-Rule */
+/** Force polygons of the collection to obey Right-Hand-Rule */
PG_FUNCTION_INFO_V1(LWGEOM_forceRHR_poly);
Datum LWGEOM_forceRHR_poly(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(outgeom);
}
-/* Test deserialize/serialize operations */
+/** Test deserialize/serialize operations */
PG_FUNCTION_INFO_V1(LWGEOM_noop);
Datum LWGEOM_noop(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(out);
}
-/*
- * Return:
+/**
+ * @return:
* 0==2d
* 1==3dm
* 2==3dz
PG_RETURN_BOOL(res);
}
-/* Return: 2,3 or 4 */
+/** Return: 2,3 or 4 */
PG_FUNCTION_INFO_V1(LWGEOM_ndims);
Datum LWGEOM_ndims(PG_FUNCTION_ARGS)
{
PG_RETURN_INT16(ret);
}
-/* lwgeom_same(lwgeom1, lwgeom2) */
+/** lwgeom_same(lwgeom1, lwgeom2) */
PG_FUNCTION_INFO_V1(LWGEOM_same);
Datum LWGEOM_same(PG_FUNCTION_ARGS)
{
else
{
elog(ERROR, "LWGEOM_makepoint: unsupported number of args: %d",
- PG_NARGS());
+ PG_NARGS());
PG_RETURN_NULL();
}
PG_RETURN_POINTER(lwgeom_result);
}
-/*
+/**
* Compute the azimuth of segment defined by the two
* given Point geometries.
- * Return NULL on exception (same point).
- * Return radians otherwise.
+ * @return NULL on exception (same point).
+ * Return radians otherwise.
*/
PG_FUNCTION_INFO_V1(LWGEOM_azimuth);
Datum LWGEOM_azimuth(PG_FUNCTION_ARGS)
g1_bvol.ymax = g1_bvol.ymax + dist;
if ( (g1_bvol.xmin > geom2->bbox->xmax) ||
- (g1_bvol.xmax < geom2->bbox->xmin) ||
- (g1_bvol.ymin > geom2->bbox->ymax) ||
- (g1_bvol.ymax < geom2->bbox->ymin)
+ (g1_bvol.xmax < geom2->bbox->xmin) ||
+ (g1_bvol.ymin > geom2->bbox->ymax) ||
+ (g1_bvol.ymax < geom2->bbox->ymin)
)
{
PG_RETURN_BOOL(FALSE); /*bbox not overlap */
PG_RETURN_BOOL(calc_dist < dist);
}
-/*
+/**
* Affine transform a pointarray.
*/
void
lwgeom_affine_ptarray(POINTARRAY *pa,
- double afac, double bfac, double cfac,
- double dfac, double efac, double ffac,
- double gfac, double hfac, double ifac,
- double xoff, double yoff, double zoff)
+ double afac, double bfac, double cfac,
+ double dfac, double efac, double ffac,
+ double gfac, double hfac, double ifac,
+ double xoff, double yoff, double zoff)
{
int i;
double x,y,z;
void
lwgeom_affine_recursive(uchar *serialized,
- double afac, double bfac, double cfac,
- double dfac, double efac, double ffac,
- double gfac, double hfac, double ifac,
- double xoff, double yoff, double zoff)
+ double afac, double bfac, double cfac,
+ double dfac, double efac, double ffac,
+ double gfac, double hfac, double ifac,
+ double xoff, double yoff, double zoff)
{
LWGEOM_INSPECTED *inspected;
int i, j;
if (point !=NULL)
{
lwgeom_affine_ptarray(point->point,
- afac, bfac, cfac,
- dfac, efac, ffac,
- gfac, hfac, ifac,
- xoff, yoff, zoff);
+ afac, bfac, cfac,
+ dfac, efac, ffac,
+ gfac, hfac, ifac,
+ xoff, yoff, zoff);
lwgeom_release((LWGEOM *)point);
continue;
}
for (j=0; j<poly->nrings; j++)
{
lwgeom_affine_ptarray(poly->rings[j],
- afac, bfac, cfac,
- dfac, efac, ffac,
- gfac, hfac, ifac,
- xoff, yoff, zoff);
+ afac, bfac, cfac,
+ dfac, efac, ffac,
+ gfac, hfac, ifac,
+ xoff, yoff, zoff);
}
lwgeom_release((LWGEOM *)poly);
continue;
if (line != NULL)
{
lwgeom_affine_ptarray(line->points,
- afac, bfac, cfac,
- dfac, efac, ffac,
- gfac, hfac, ifac,
- xoff, yoff, zoff);
+ afac, bfac, cfac,
+ dfac, efac, ffac,
+ gfac, hfac, ifac,
+ xoff, yoff, zoff);
lwgeom_release((LWGEOM *)line);
continue;
}
}
lwgeom_affine_recursive(subgeom,
- afac, bfac, cfac,
- dfac, efac, ffac,
- gfac, hfac, ifac,
- xoff, yoff, zoff);
+ afac, bfac, cfac,
+ dfac, efac, ffac,
+ gfac, hfac, ifac,
+ xoff, yoff, zoff);
}
lwinspected_release(inspected);
POSTGIS_DEBUG(2, "LWGEOM_affine called.");
lwgeom_affine_recursive(srl,
- afac, bfac, cfac,
- dfac, efac, ffac,
- gfac, hfac, ifac,
- xoff, yoff, zoff);
+ afac, bfac, cfac,
+ dfac, efac, ffac,
+ gfac, hfac, ifac,
+ xoff, yoff, zoff);
/* COMPUTE_BBOX TAINTING */
tmp = pglwgeom_deserialize(geom);
Datum ST_GeoHash(PG_FUNCTION_ARGS)
{
- PG_LWGEOM *geom = NULL;
- int precision = 0;
- int len = 0;
- char *geohash = NULL;
- char *result = NULL;
+ PG_LWGEOM *geom = NULL;
+ int precision = 0;
+ int len = 0;
+ char *geohash = NULL;
+ char *result = NULL;
- if( PG_ARGISNULL(0) )
- {
+ if( PG_ARGISNULL(0) )
+ {
PG_RETURN_NULL();
- }
+ }
- geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
+ geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
- if( ! PG_ARGISNULL(1) )
- {
- precision = PG_GETARG_INT32(1);
- }
+ if( ! PG_ARGISNULL(1) )
+ {
+ precision = PG_GETARG_INT32(1);
+ }
- geohash = lwgeom_geohash((LWGEOM*)(pglwgeom_deserialize(geom)), precision);
+ geohash = lwgeom_geohash((LWGEOM*)(pglwgeom_deserialize(geom)), precision);
- if( ! geohash )
- {
+ if( ! geohash )
+ {
elog(ERROR,"ST_GeoHash: lwgeom_geohash returned NULL.\n");
PG_RETURN_NULL();
- }
+ }
len = strlen(geohash) + VARHDRSZ;
- result = palloc(len);
+ result = palloc(len);
SET_VARSIZE(result, len);
memcpy(VARDATA(result), geohash, len-VARHDRSZ);
pfree(geohash);
PG_RETURN_POINTER(result);
-
+
}