Drop redundant getPoint2d_p_ro function

Closes #4965
This commit is contained in:
Sandro Santilli 2021-08-11 16:39:01 +02:00
parent ab07f273d3
commit b4f0beefdc
7 changed files with 8 additions and 32 deletions

View file

@ -234,7 +234,7 @@ size_t gserialized_from_lwgeom_size(const LWGEOM *geom)
/**
* Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
* that are double aligned and suitable for direct reading using getPoint2d_p_ro
* that are double aligned and suitable for direct reading using getPoint2d_cp
*/
LWGEOM* lwgeom_from_gserialized(const GSERIALIZED *g)
{

View file

@ -149,7 +149,7 @@ size_t gserialized_from_lwgeom_size(const LWGEOM *geom);
/**
* Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
* that are double aligned and suitable for direct reading using getPoint2d_p_ro
* that are double aligned and suitable for direct reading using getPoint2d_cp
*/
LWGEOM *lwgeom_from_gserialized(const GSERIALIZED *g);

View file

@ -149,7 +149,7 @@ size_t gserialized1_from_lwgeom_size(const LWGEOM *geom);
/**
* Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
* that are double aligned and suitable for direct reading using getPoint2d_p_ro
* that are double aligned and suitable for direct reading using getPoint2d_cp
*/
LWGEOM* lwgeom_from_gserialized1(const GSERIALIZED *g);
@ -160,4 +160,4 @@ const float * gserialized1_get_float_box_p(const GSERIALIZED *g, size_t *ndims);
int gserialized1_peek_gbox_p(const GSERIALIZED *g, GBOX *gbox);
int gserialized1_peek_first_point(const GSERIALIZED *g, POINT4D *out_point);
int gserialized1_peek_first_point(const GSERIALIZED *g, POINT4D *out_point);

View file

@ -161,7 +161,7 @@ size_t gserialized2_from_lwgeom_size(const LWGEOM *geom);
/**
* Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
* that are double aligned and suitable for direct reading using getPoint2d_p_ro
* that are double aligned and suitable for direct reading using getPoint2d_cp
*/
LWGEOM* lwgeom_from_gserialized2(const GSERIALIZED *g);

View file

@ -830,7 +830,7 @@ extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size);
/**
* Allocate a new #LWGEOM from a #GSERIALIZED. The resulting #LWGEOM will have coordinates
* that are double aligned and suitable for direct reading using getPoint2d_p_ro
* that are double aligned and suitable for direct reading using getPoint2d_cp
*/
extern LWGEOM* lwgeom_from_gserialized(const GSERIALIZED *g);
@ -1929,12 +1929,6 @@ extern int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox);
*/
extern int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox);
/**
* New function to read doubles directly from the double* coordinate array
* of an aligned lwgeom #POINTARRAY (built by de-serializing a #GSERIALIZED).
*/
extern int getPoint2d_p_ro(const POINTARRAY *pa, uint32_t n, POINT2D **point);
/**
* Calculate geodetic (x/y/z) box and add values to gbox. Return #LW_SUCCESS on success.
*/

View file

@ -2873,24 +2873,6 @@ int lwline_covers_lwline(const LWLINE* lwline1, const LWLINE* lwline2)
return LW_TRUE;
}
/**
* This function can only be used on LWGEOM that is built on top of
* GSERIALIZED, otherwise alignment errors will ensue.
*/
int getPoint2d_p_ro(const POINTARRAY *pa, uint32_t n, POINT2D **point)
{
uint8_t *pa_ptr = NULL;
assert(pa);
assert(n < pa->npoints);
pa_ptr = getPoint_internal(pa, n);
/* printf( "pa_ptr[0]: %g\n", *((double*)pa_ptr)); */
*point = (POINT2D*)pa_ptr;
return LW_SUCCESS;
}
int ptarray_calculate_gbox_geodetic(const POINTARRAY *pa, GBOX *gbox)
{
uint32_t i;

View file

@ -1332,14 +1332,14 @@ int
ptarray_closest_vertex_2d(const POINTARRAY *pa, const POINT2D *qp, double *dist)
{
uint32_t t, pn=0;
POINT2D *p;
const POINT2D *p;
double mindist = DBL_MAX;
/* Loop through pointarray looking for nearest segment */
for (t=0; t<pa->npoints; t++)
{
double dist_sqr;
getPoint2d_p_ro(pa, t, &p);
p = getPoint2d_cp(pa, t);
dist_sqr = distance2d_sqr_pt_pt(p, qp);
if (dist_sqr < mindist)