extern int32 lwgeom_nrings_recursive(uchar *serialized);
extern void ptarray_reverse(POINTARRAY *pa);
+extern POINTARRAY* ptarray_reverse_axis(POINTARRAY *pa);
+
extern POINTARRAY *ptarray_substring(POINTARRAY *, double, double);
extern double ptarray_locate_point(POINTARRAY *, POINT2D *);
extern void closest_point_on_segment(POINT2D *p, POINT2D *A, POINT2D *B, POINT2D *ret);
}
+
+/**
+ * Reverse X and Y axis on a given POINTARRAY
+ */
+POINTARRAY*
+ptarray_reverse_axis(POINTARRAY *pa)
+{
+ int i;
+ double d;
+ POINT4D p;
+
+ for (i=0 ; i < pa->npoints ; i++)
+ {
+ getPoint4d_p(pa, i, &p);
+ d = p.y;
+ p.y = p.x;
+ p.x = d;
+ setPoint4d(pa, i, &p);
+ }
+
+ return pa;
+}
+
+
/**
* @brief calculate the 2d bounding box of a set of points
* write result to the provided BOX2DFLOAT4
}
-/**
- * Reverse X and Y axis on a given POINTARRAY
- */
-static POINTARRAY* gml_reverse_axis_pa(POINTARRAY *pa)
-{
- int i;
- double d;
- POINT4D p;
-
- for (i=0 ; i < pa->npoints ; i++)
- {
- getPoint4d_p(pa, i, &p);
- d = p.y;
- p.y = p.x;
- p.x = d;
- setPoint4d(pa, i, &p);
- }
-
- return pa;
-}
-
-
/**
* Use Proj4 to reproject a given POINTARRAY
*/
lwerror("invalid GML representation");
srs = parse_gml_srs(xb);
- if (srs->reverse_axis) tmp_pa = gml_reverse_axis_pa(tmp_pa);
+ if (srs->reverse_axis) tmp_pa = ptarray_reverse_axis(tmp_pa);
if (!*root_srid) *root_srid = srs->srid;
else
{
if (pa->npoints != 1) lwerror("invalid GML representation");
srs = parse_gml_srs(xnode);
- if (srs->reverse_axis) pa = gml_reverse_axis_pa(pa);
+ if (srs->reverse_axis) pa = ptarray_reverse_axis(pa);
if (!*root_srid)
{
*root_srid = srs->srid;
if (pa->npoints < 2) lwerror("invalid GML representation");
srs = parse_gml_srs(xnode);
- if (srs->reverse_axis) pa = gml_reverse_axis_pa(pa);
+ if (srs->reverse_axis) pa = ptarray_reverse_axis(pa);
if (!*root_srid)
{
*root_srid = srs->srid;
}
srs = parse_gml_srs(xnode);
- if (srs->reverse_axis) pa = gml_reverse_axis_pa(pa);
+ if (srs->reverse_axis) pa = ptarray_reverse_axis(pa);
if (!*root_srid)
{
*root_srid = srs->srid;
|| (*hasz && !ptarray_isclosed3d(ppa[0])))
lwerror("invalid GML representation");
- if (srs->reverse_axis) ppa[0] = gml_reverse_axis_pa(ppa[0]);
+ if (srs->reverse_axis) ppa[0] = ptarray_reverse_axis(ppa[0]);
}
}
|| (*hasz && !ptarray_isclosed3d(ppa[ring])))
lwerror("invalid GML representation");
- if (srs->reverse_axis) ppa[ring] = gml_reverse_axis_pa(ppa[ring]);
+ if (srs->reverse_axis) ppa[ring] = ptarray_reverse_axis(ppa[ring]);
ring++;
}
}
|| (*hasz && !ptarray_isclosed3d(ppa[0])))
lwerror("invalid GML representation");
- if (srs->reverse_axis) ppa[0] = gml_reverse_axis_pa(ppa[0]);
+ if (srs->reverse_axis) ppa[0] = ptarray_reverse_axis(ppa[0]);
}
}
lwerror("invalid GML representation");
if (srs->reverse_axis)
- ppa[ring] = gml_reverse_axis_pa(ppa[ring]);
+ ppa[ring] = ptarray_reverse_axis(ppa[ring]);
ring++;
}