Change POINTARRAY.dims to POINTARRAY.flags. Related to #658

git-svn-id: http://svn.osgeo.org/postgis/trunk@6205 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Olivier Courtin 2010-11-25 18:38:20 +00:00
parent df80a93181
commit 586c389dc8
24 changed files with 118 additions and 118 deletions

View file

@ -210,7 +210,7 @@ static size_t gserialized_from_lwpoint(const LWPOINT *point, uchar *buf)
assert(point);
assert(buf);
if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->dims) )
if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->flags) )
lwerror("Dimensions mismatch in lwpoint");
LWDEBUGF(2, "lwpoint_to_gserialized(%p, %p) called", point, buf);
@ -246,7 +246,7 @@ static size_t gserialized_from_lwline(const LWLINE *line, uchar *buf)
LWDEBUGF(2, "lwline_to_gserialized(%p, %p) called", line, buf);
if ( FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->dims) )
if ( FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->flags) )
lwerror("Dimensions mismatch in lwline");
ptsize = ptarray_point_size(line->points);
@ -317,7 +317,7 @@ static size_t gserialized_from_lwpoly(const LWPOLY *poly, uchar *buf)
POINTARRAY *pa = poly->rings[i];
size_t pasize;
if ( FLAGS_GET_ZM(poly->flags) != FLAGS_GET_ZM(pa->dims) )
if ( FLAGS_GET_ZM(poly->flags) != FLAGS_GET_ZM(pa->flags) )
lwerror("Dimensions mismatch in lwpoly");
pasize = pa->npoints * ptsize;
@ -339,7 +339,7 @@ static size_t gserialized_from_lwtriangle(const LWTRIANGLE *triangle, uchar *buf
LWDEBUGF(2, "lwtriangle_to_gserialized(%p, %p) called", triangle, buf);
if ( FLAGS_GET_ZM(triangle->flags) != FLAGS_GET_ZM(triangle->points->dims) )
if ( FLAGS_GET_ZM(triangle->flags) != FLAGS_GET_ZM(triangle->points->flags) )
lwerror("Dimensions mismatch in lwtriangle");
ptsize = ptarray_point_size(triangle->points);
@ -378,7 +378,7 @@ static size_t gserialized_from_lwcircstring(const LWCIRCSTRING *curve, uchar *bu
assert(curve);
assert(buf);
if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->dims))
if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
lwerror("Dimensions mismatch in lwcircstring");

View file

@ -427,8 +427,8 @@ typedef struct
/* Array of POINT 2D, 3D or 4D, possibly missaligned. */
uchar *serialized_pointlist;
/* Use TYPE_* macros to handle */
uchar dims;
/* Use FLAGS_* macros to handle */
uchar flags;
int npoints; /* how many points we are currently storing */
int maxpoints; /* how many points we have space for in serialized_pointlist */

View file

@ -57,8 +57,8 @@ lwcircstring_construct(int srid, GBOX *bbox, POINTARRAY *points)
result->type = CIRCSTRINGTYPE;
result->flags = 0;
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->dims));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->dims));
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->flags));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->flags));
FLAGS_SET_BBOX(result->flags, bbox?1:0);
result->srid = srid;
@ -207,7 +207,7 @@ void lwcircstring_serialize_buf(LWCIRCSTRING *curve, uchar *buf, size_t *retsize
return;
}
if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->dims))
if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
{
lwerror("Dimensions mismatch in lwcircstring");
return;

View file

@ -482,7 +482,7 @@ getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *op)
/* Get a pointer to nth point offset and zmflag */
ptr=getPoint_internal(pa, n);
zmflag=FLAGS_GET_ZM(pa->dims);
zmflag=FLAGS_GET_ZM(pa->flags);
LWDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
@ -567,7 +567,7 @@ getPoint3dz_p(const POINTARRAY *pa, int n, POINT3DZ *op)
#endif
LWDEBUGF(2, "getPoint3dz_p called on array of %d-dimensions / %u pts",
FLAGS_NDIMS(pa->dims), pa->npoints);
FLAGS_NDIMS(pa->flags), pa->npoints);
/* Get a pointer to nth point offset */
ptr=getPoint_internal(pa, n);
@ -576,7 +576,7 @@ getPoint3dz_p(const POINTARRAY *pa, int n, POINT3DZ *op)
* if input POINTARRAY has the Z, it is always
* at third position so make a single copy
*/
if ( FLAGS_GET_Z(pa->dims) )
if ( FLAGS_GET_Z(pa->flags) )
{
memcpy(op, ptr, sizeof(POINT3DZ));
}
@ -618,12 +618,12 @@ getPoint3dm_p(const POINTARRAY *pa, int n, POINT3DM *op)
#endif
LWDEBUGF(2, "getPoint3dm_p(%d) called on array of %d-dimensions / %u pts",
n, FLAGS_NDIMS(pa->dims), pa->npoints);
n, FLAGS_NDIMS(pa->flags), pa->npoints);
/* Get a pointer to nth point offset and zmflag */
ptr=getPoint_internal(pa, n);
zmflag=FLAGS_GET_ZM(pa->dims);
zmflag=FLAGS_GET_ZM(pa->flags);
/*
* if input POINTARRAY has the M and NO Z,
@ -709,7 +709,7 @@ void
ptarray_set_point4d(POINTARRAY *pa, int n, POINT4D *p4d)
{
uchar *ptr=getPoint_internal(pa, n);
switch ( FLAGS_GET_ZM(pa->dims) )
switch ( FLAGS_GET_ZM(pa->flags) )
{
case 3:
memcpy(ptr, p4d, sizeof(POINT4D));
@ -774,9 +774,9 @@ getPoint_internal(const POINTARRAY *pa, int n)
int
ptarray_point_size(const POINTARRAY *pa)
{
LWDEBUGF(2, "ptarray_point_size: FLAGS_NDIMS(pa->dims)=%x",FLAGS_NDIMS(pa->dims));
LWDEBUGF(2, "ptarray_point_size: FLAGS_NDIMS(pa->flags)=%x",FLAGS_NDIMS(pa->flags));
return sizeof(double)*FLAGS_NDIMS(pa->dims);
return sizeof(double)*FLAGS_NDIMS(pa->flags);
}
@ -1810,26 +1810,26 @@ void printPA(POINTARRAY *pa)
char *mflag;
if ( FLAGS_GET_M(pa->dims) ) mflag = "M";
if ( FLAGS_GET_M(pa->flags) ) mflag = "M";
else mflag = "";
lwnotice(" POINTARRAY%s{", mflag);
lwnotice(" ndims=%i, ptsize=%i",
FLAGS_NDIMS(pa->dims), ptarray_point_size(pa));
FLAGS_NDIMS(pa->flags), ptarray_point_size(pa));
lwnotice(" npoints = %i", pa->npoints);
for (t =0; t<pa->npoints; t++)
{
getPoint4d_p(pa, t, &pt);
if (FLAGS_NDIMS(pa->dims) == 2)
if (FLAGS_NDIMS(pa->flags) == 2)
{
lwnotice(" %i : %lf,%lf",t,pt.x,pt.y);
}
if (FLAGS_NDIMS(pa->dims) == 3)
if (FLAGS_NDIMS(pa->flags) == 3)
{
lwnotice(" %i : %lf,%lf,%lf",t,pt.x,pt.y,pt.z);
}
if (FLAGS_NDIMS(pa->dims) == 4)
if (FLAGS_NDIMS(pa->flags) == 4)
{
lwnotice(" %i : %lf,%lf,%lf,%lf",t,pt.x,pt.y,pt.z,pt.m);
}

View file

@ -81,8 +81,8 @@ static int wkt_parser_set_dims(LWGEOM *geom, uchar flags)
if( geom->type == POINTTYPE )
{
LWPOINT *pt = (LWPOINT*)geom;
FLAGS_SET_Z(pt->point->dims, hasz);
FLAGS_SET_M(pt->point->dims, hasm);
FLAGS_SET_Z(pt->point->flags, hasz);
FLAGS_SET_M(pt->point->flags, hasm);
return LW_TRUE;
}
else if ( geom->type == TRIANGLETYPE ||
@ -90,8 +90,8 @@ static int wkt_parser_set_dims(LWGEOM *geom, uchar flags)
geom->type == LINETYPE )
{
LWLINE *ln = (LWLINE*)geom;
FLAGS_SET_Z(ln->points->dims, hasz);
FLAGS_SET_M(ln->points->dims, hasm);
FLAGS_SET_Z(ln->points->flags, hasz);
FLAGS_SET_M(ln->points->flags, hasm);
return LW_TRUE;
}
else if ( geom->type == POLYGONTYPE )
@ -99,8 +99,8 @@ static int wkt_parser_set_dims(LWGEOM *geom, uchar flags)
LWPOLY *poly = (LWPOLY*)geom;
for ( i = 0; i < poly->nrings; i++ )
{
FLAGS_SET_Z(poly->rings[i]->dims, hasz);
FLAGS_SET_M(poly->rings[i]->dims, hasm);
FLAGS_SET_Z(poly->rings[i]->flags, hasz);
FLAGS_SET_M(poly->rings[i]->flags, hasm);
}
return LW_TRUE;
}
@ -143,7 +143,7 @@ static int wkt_pointarray_dimensionality(POINTARRAY *pa, uchar flags)
return LW_TRUE;
LWDEBUGF(5,"dimensionality ndims == %d", ndims);
LWDEBUGF(5,"FLAGS_NDIMS(pa->dims) == %d", FLAGS_NDIMS(pa->dims));
LWDEBUGF(5,"FLAGS_NDIMS(pa->flags) == %d", FLAGS_NDIMS(pa->flags));
/*
* ndims > 2 implies that the flags have something useful to add,
@ -152,13 +152,13 @@ static int wkt_pointarray_dimensionality(POINTARRAY *pa, uchar flags)
if( ndims > 2 )
{
/* Mismatch implies a problem */
if ( FLAGS_NDIMS(pa->dims) != ndims )
if ( FLAGS_NDIMS(pa->flags) != ndims )
return LW_FALSE;
/* Match means use the explicit dimensionality */
else
{
FLAGS_SET_Z(pa->dims, hasz);
FLAGS_SET_M(pa->dims, hasm);
FLAGS_SET_Z(pa->flags, hasz);
FLAGS_SET_M(pa->flags, hasm);
}
}
@ -227,7 +227,7 @@ POINTARRAY* wkt_parser_ptarray_add_coord(POINTARRAY *pa, POINT p)
}
/* Check that the coordinate has the same dimesionality as the array */
if( FLAGS_NDIMS(p.flags) != FLAGS_NDIMS(pa->dims) )
if( FLAGS_NDIMS(p.flags) != FLAGS_NDIMS(pa->flags) )
{
global_parser_result.message = parser_error_messages[PARSER_ERROR_MIXDIMS];
global_parser_result.errcode = PARSER_ERROR_MIXDIMS;
@ -237,12 +237,12 @@ POINTARRAY* wkt_parser_ptarray_add_coord(POINTARRAY *pa, POINT p)
/* While parsing the point arrays, XYM and XMZ points are both treated as XYZ */
pt.x = p.x;
pt.y = p.y;
if( FLAGS_GET_Z(pa->dims) )
if( FLAGS_GET_Z(pa->flags) )
pt.z = p.z;
if( FLAGS_GET_M(pa->dims) )
if( FLAGS_GET_M(pa->flags) )
pt.m = p.m;
/* If the destination is XYM, we'll write the third coordinate to m */
if( FLAGS_GET_M(pa->dims) && ! FLAGS_GET_Z(pa->dims) )
if( FLAGS_GET_M(pa->flags) && ! FLAGS_GET_Z(pa->flags) )
pt.m = p.z;
ptarray_append_point(pa, &pt, REPEATED_POINTS_OK); /* Allow duplicate points in array */
@ -411,7 +411,7 @@ LWGEOM* wkt_parser_polygon_new(POINTARRAY *pa)
return NULL;
}
poly = lwpoly_construct_empty(SRID_UNKNOWN, FLAGS_GET_Z(pa->dims), FLAGS_GET_M(pa->dims));
poly = lwpoly_construct_empty(SRID_UNKNOWN, FLAGS_GET_Z(pa->flags), FLAGS_GET_M(pa->flags));
/* Error out if we can't build this polygon. */
if( ! poly )
@ -436,7 +436,7 @@ LWGEOM* wkt_parser_polygon_add_ring(LWGEOM *poly, POINTARRAY *pa)
}
/* Rings must agree on dimensionality */
if( FLAGS_NDIMS(poly->flags) != FLAGS_NDIMS(pa->dims) )
if( FLAGS_NDIMS(poly->flags) != FLAGS_NDIMS(pa->flags) )
{
SET_PARSER_ERROR(PARSER_ERROR_MIXDIMS);
return NULL;

View file

@ -34,8 +34,8 @@ lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
result->type = LINETYPE;
result->flags = 0;
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->dims));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->dims));
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->flags));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->flags));
FLAGS_SET_BBOX(result->flags, bbox?1:0);
LWDEBUGF(3, "lwline_construct type=%d", result->type);
@ -177,7 +177,7 @@ lwline_serialize_buf(LWLINE *line, uchar *buf, size_t *retsize)
if (line == NULL)
lwerror("lwline_serialize:: given null line");
if ( FLAGS_GET_ZM(line->flags) != FLAGS_GET_ZM(line->points->dims) )
if ( FLAGS_GET_ZM(line->flags) != FLAGS_GET_ZM(line->points->flags) )
lwerror("Dimensions mismatch in lwline");
ptsize = ptarray_point_size(line->points);

View file

@ -730,7 +730,7 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
ptr = output;
if (!FLAGS_GET_Z(pa->dims))
if (!FLAGS_GET_Z(pa->flags))
{
for (i=0; i<pa->npoints; i++)
{
@ -794,7 +794,7 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
static size_t
pointArray_geojson_size(POINTARRAY *pa, int precision)
{
if (FLAGS_NDIMS(pa->dims) == 2)
if (FLAGS_NDIMS(pa->flags) == 2)
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(","))
* 2 * pa->npoints + sizeof(",[]");

View file

@ -518,7 +518,7 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
ptr = output;
if ( ! FLAGS_GET_Z(pa->dims) )
if ( ! FLAGS_GET_Z(pa->flags) )
{
for (i=0; i<pa->npoints; i++)
{
@ -1265,7 +1265,7 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int is_deegree)
ptr = output;
if ( ! FLAGS_GET_Z(pa->dims) )
if ( ! FLAGS_GET_Z(pa->flags) )
{
for (i=0; i<pa->npoints; i++)
{
@ -1335,7 +1335,7 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int is_deegree)
static size_t
pointArray_GMLsize(POINTARRAY *pa, int precision)
{
if (FLAGS_NDIMS(pa->dims) == 2)
if (FLAGS_NDIMS(pa->flags) == 2)
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", "))
* 2 * pa->npoints;

View file

@ -345,7 +345,7 @@ pointArray_toKML2(POINTARRAY *pa, char *output, int precision)
ptr = output;
if ( ! FLAGS_GET_Z(pa->dims) )
if ( ! FLAGS_GET_Z(pa->flags) )
{
for (i=0; i<pa->npoints; i++)
{
@ -413,7 +413,7 @@ pointArray_toKML2(POINTARRAY *pa, char *output, int precision)
static size_t
pointArray_KMLsize(POINTARRAY *pa, int precision)
{
if (FLAGS_NDIMS(pa->dims) == 2)
if (FLAGS_NDIMS(pa->flags) == 2)
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", "))
* 2 * pa->npoints;

View file

@ -294,7 +294,7 @@ static size_t ptarray_to_wkb_size(const POINTARRAY *pa, uchar variant)
if ( pa->npoints < 1 )
return 0;
if ( variant & (WKB_ISO | WKB_EXTENDED) )
dims = FLAGS_NDIMS(pa->dims);
dims = FLAGS_NDIMS(pa->flags);
/* Include the npoints if it's not a POINT type) */
if ( ! ( variant & WKB_NO_NPOINTS ) )
@ -321,7 +321,7 @@ static char* ptarray_to_wkb_buf(const POINTARRAY *pa, char *buf, uchar variant)
/* SFSQL is always 2-d. Extended and ISO use all available dimensions */
if ( (variant & WKB_ISO) || (variant & WKB_EXTENDED) )
dims = FLAGS_NDIMS(pa->dims);
dims = FLAGS_NDIMS(pa->flags);
/* Set the number of points (if it's not a POINT type) */
if ( ! ( variant & WKB_NO_NPOINTS ) )

View file

@ -68,7 +68,7 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
/* ISO and extended formats include all dimensions */
if ( variant & ( WKT_ISO | WKT_EXTENDED ) )
dimensions = FLAGS_NDIMS(ptarray->dims);
dimensions = FLAGS_NDIMS(ptarray->flags);
/* Opening paren? */
if ( ! (variant & WKT_NO_PARENS) )

View file

@ -52,7 +52,7 @@ lwpoint_serialize_buf(LWPOINT *point, uchar *buf, size_t *retsize)
uchar *loc;
int ptsize = ptarray_point_size(point->point);
if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->dims) )
if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->flags) )
lwerror("Dimensions mismatch in lwpoint");
LWDEBUGF(2, "lwpoint_serialize_buf(%p, %p) called", point, buf);
@ -175,8 +175,8 @@ lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
result = lwalloc(sizeof(LWPOINT));
result->type = POINTTYPE;
FLAGS_SET_Z(flags, FLAGS_GET_Z(point->dims));
FLAGS_SET_M(flags, FLAGS_GET_M(point->dims));
FLAGS_SET_Z(flags, FLAGS_GET_Z(point->flags));
FLAGS_SET_M(flags, FLAGS_GET_M(point->flags));
FLAGS_SET_BBOX(flags, bbox?1:0);
result->flags = flags;
result->srid = srid;

View file

@ -35,14 +35,14 @@ lwpoly_construct(int srid, GBOX *bbox, uint32 nrings, POINTARRAY **points)
if ( nrings < 1 ) lwerror("lwpoly_construct: need at least 1 ring");
hasz = FLAGS_GET_Z(points[0]->dims);
hasm = FLAGS_GET_M(points[0]->dims);
hasz = FLAGS_GET_Z(points[0]->flags);
hasm = FLAGS_GET_M(points[0]->flags);
#ifdef CHECK_POLY_RINGS_ZM
zm = FLAGS_GET_ZM(points[0]->dims);
zm = FLAGS_GET_ZM(points[0]->flags);
for (i=1; i<nrings; i++)
{
if ( zm != FLAGS_GET_ZM(points[i]->dims) )
if ( zm != FLAGS_GET_ZM(points[i]->flags) )
lwerror("lwpoly_construct: mixed dimensioned rings");
}
#endif
@ -254,9 +254,9 @@ lwpoly_serialize_buf(LWPOLY *poly, uchar *buf, size_t *retsize)
uint32 npoints;
LWDEBUGF(4, "FLAGS_GET_ZM(poly->type) == %d", FLAGS_GET_ZM(poly->flags));
LWDEBUGF(4, "FLAGS_GET_ZM(pa->dims) == %d", FLAGS_GET_ZM(pa->dims));
LWDEBUGF(4, "FLAGS_GET_ZM(pa->flags) == %d", FLAGS_GET_ZM(pa->flags));
if ( FLAGS_GET_ZM(poly->flags) != FLAGS_GET_ZM(pa->dims) )
if ( FLAGS_GET_ZM(poly->flags) != FLAGS_GET_ZM(pa->flags) )
lwerror("Dimensions mismatch in lwpoly");
npoints = pa->npoints;

View file

@ -294,9 +294,9 @@ lwcurve_segmentize(LWCIRCSTRING *icurve, uint32 perQuad)
uint32 i, j;
POINT4D p1, p2, p3, p4;
LWDEBUGF(2, "lwcurve_segmentize called., dim = %d", icurve->points->dims);
LWDEBUGF(2, "lwcurve_segmentize called., dim = %d", icurve->points->flags);
ptarray = ptarray_construct_empty(FLAGS_GET_Z(icurve->points->dims), FLAGS_GET_M(icurve->points->dims), 64);
ptarray = ptarray_construct_empty(FLAGS_GET_Z(icurve->points->flags), FLAGS_GET_M(icurve->points->flags), 64);
if (!getPoint4d_p(icurve->points, 0, &p4))
{
lwerror("lwcurve_segmentize: Cannot extract point.");
@ -615,7 +615,7 @@ append_segment(LWGEOM *geom, POINTARRAY *pts, int type, int srid)
LWDEBUG(3, "append_segment: line to line");
newPoints = ptarray_construct(TYPE_HASZ(pts->dims), TYPE_HASM(pts->dims), pts->npoints + line->points->npoints - 1);
newPoints = ptarray_construct(TYPE_HASZ(pts->flags), TYPE_HASM(pts->flags), pts->npoints + line->points->npoints - 1);
for (i=0; i<line->points->npoints; i++)
{
getPoint4d_p(line->points, i, &pt);
@ -639,7 +639,7 @@ append_segment(LWGEOM *geom, POINTARRAY *pts, int type, int srid)
LWDEBUG(3, "append_segment: circularstring to circularstring");
newPoints = ptarray_construct(FLAGS_GET_Z(pts->dims), FLAGS_GET_M(pts->dims), pts->npoints + curve->points->npoints - 1);
newPoints = ptarray_construct(FLAGS_GET_Z(pts->flags), FLAGS_GET_M(pts->flags), pts->npoints + curve->points->npoints - 1);
LWDEBUGF(3, "New array length: %d", pts->npoints + curve->points->npoints - 1);
@ -814,8 +814,8 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
count = i - commit;
pts = ptarray_construct(
FLAGS_GET_Z(points->dims),
FLAGS_GET_M(points->dims),
FLAGS_GET_Z(points->flags),
FLAGS_GET_M(points->flags),
3);
getPoint4d_p(points, commit, &tmp);
ptarray_set_point4d(pts, 0, &tmp);
@ -890,8 +890,8 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
count = i - commit - 2;
pts = ptarray_construct(
FLAGS_GET_Z(points->dims),
FLAGS_GET_M(points->dims),
FLAGS_GET_Z(points->flags),
FLAGS_GET_M(points->flags),
count);
for (j=commit; j<i-2; j++)
{
@ -922,8 +922,8 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
LWDEBUGF(3, "Finishing circularstring %d,%d.", commit, i);
pts = ptarray_construct(
FLAGS_GET_Z(points->dims),
FLAGS_GET_M(points->dims),
FLAGS_GET_Z(points->flags),
FLAGS_GET_M(points->flags),
3);
getPoint4d_p(points, commit, &tmp);
ptarray_set_point4d(pts, 0, &tmp);
@ -939,8 +939,8 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
LWDEBUGF(3, "Finishing line %d,%d.", commit, i);
pts = ptarray_construct(
FLAGS_GET_Z(points->dims),
FLAGS_GET_M(points->dims),
FLAGS_GET_Z(points->flags),
FLAGS_GET_M(points->flags),
count);
for (j=commit; j<i; j++)
{

View file

@ -31,8 +31,8 @@ lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points)
result->type = TRIANGLETYPE;
result->flags = 0;
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->dims));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->dims));
FLAGS_SET_Z(result->flags, FLAGS_GET_Z(points->flags));
FLAGS_SET_M(result->flags, FLAGS_GET_M(points->flags));
FLAGS_SET_BBOX(result->flags, bbox?1:0);
result->srid = srid;
@ -180,7 +180,7 @@ lwtriangle_serialize_buf(LWTRIANGLE *triangle, uchar *buf, size_t *retsize)
if (triangle == NULL)
lwerror("lwtriangle_serialize:: given null triangle");
if ( FLAGS_GET_ZM(triangle->flags) != FLAGS_GET_ZM(triangle->points->dims) )
if ( FLAGS_GET_ZM(triangle->flags) != FLAGS_GET_ZM(triangle->points->flags) )
lwerror("Dimensions mismatch in lwtriangle");
ptsize = ptarray_point_size(triangle->points);

View file

@ -1513,7 +1513,7 @@ lwgeom_pointarray_length(const POINTARRAY *pts)
if ( pts->npoints < 2 ) return 0.0;
/* compute 2d length if 3d is not available */
if ( ! FLAGS_GET_Z(pts->dims) ) return lwgeom_pointarray_length2d(pts);
if ( ! FLAGS_GET_Z(pts->flags) ) return lwgeom_pointarray_length2d(pts);
for (i=0; i<pts->npoints-1; i++)
{

View file

@ -33,7 +33,7 @@ ptarray_construct(char hasz, char hasm, uint32 npoints)
ptlist = NULL;
pa = lwalloc(sizeof(POINTARRAY));
pa->dims = dims;
pa->flags = dims;
pa->serialized_pointlist = ptlist;
pa->npoints = npoints;
pa->maxpoints = npoints;
@ -52,7 +52,7 @@ ptarray_construct_empty(char hasz, char hasm, int maxpoints)
/* Set our dimsionality info on the bitmap */
FLAGS_SET_Z(dims, hasz?1:0);
FLAGS_SET_M(dims, hasm?1:0);
pa->dims = dims;
pa->flags = dims;
/* We will be allocating a bit of room */
pa->npoints = 0;
@ -139,8 +139,8 @@ ptarray_append_point(POINTARRAY *pa, POINT4D *pt, int repeated_points)
/* Return LW_SUCCESS and do nothing else if previous point in list is equal to this one */
if ( (pt->x == tmp.x) && (pt->y == tmp.y) &&
(TYPE_HASZ(pa->dims) ? pt->z == tmp.z : 1) &&
(TYPE_HASM(pa->dims) ? pt->m == tmp.m : 1) )
(TYPE_HASZ(pa->flags) ? pt->z == tmp.z : 1) &&
(TYPE_HASM(pa->flags) ? pt->m == tmp.m : 1) )
{
return LW_SUCCESS;
}
@ -161,7 +161,7 @@ ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, int splice_ends)
return LW_FAILURE;
}
if( pa1->dims != pa2->dims )
if( pa1->flags != pa2->flags )
{
lwerror("ptarray_append_ptarray: appending mixed dimensionality is not allowed");
return LW_FAILURE;
@ -229,8 +229,8 @@ POINTARRAY* ptarray_construct_reference_data(char hasz, char hasm, uint32 npoint
{
POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
LWDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
FLAGS_SET_Z(pa->dims, hasz?1:0);
FLAGS_SET_M(pa->dims, hasm?1:0);
FLAGS_SET_Z(pa->flags, hasz?1:0);
FLAGS_SET_M(pa->flags, hasm?1:0);
pa->npoints = npoints;
pa->maxpoints = npoints;
pa->serialized_pointlist = ptlist;
@ -243,8 +243,8 @@ ptarray_construct_copy_data(char hasz, char hasm, uint32 npoints, const uchar *p
{
POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
FLAGS_SET_Z(pa->dims, hasz?1:0);
FLAGS_SET_M(pa->dims, hasm?1:0);
FLAGS_SET_Z(pa->flags, hasz?1:0);
FLAGS_SET_M(pa->flags, hasm?1:0);
pa->npoints = npoints;
pa->maxpoints = npoints;
@ -391,8 +391,8 @@ ptarray_segmentize2d(const POINTARRAY *ipa, double dist)
POINT4D pbuf;
POINTARRAY *opa;
int ipoff=0; /* input point offset */
int hasz = FLAGS_GET_Z(ipa->dims);
int hasm = FLAGS_GET_M(ipa->dims);
int hasz = FLAGS_GET_Z(ipa->flags);
int hasm = FLAGS_GET_M(ipa->flags);
pbuf.x = pbuf.y = pbuf.z = pbuf.m = 0;
@ -451,7 +451,7 @@ ptarray_same(const POINTARRAY *pa1, const POINTARRAY *pa2)
uint32 i;
size_t ptsize;
if ( FLAGS_GET_ZM(pa1->dims) != FLAGS_GET_ZM(pa2->dims) ) return LW_FALSE;
if ( FLAGS_GET_ZM(pa1->flags) != FLAGS_GET_ZM(pa2->flags) ) return LW_FALSE;
LWDEBUG(5,"dimensions are the same");
if ( pa1->npoints != pa2->npoints ) return LW_FALSE;
@ -514,8 +514,8 @@ ptarray_addPoint(const POINTARRAY *pa, uchar *p, size_t pdims, uint32 where)
LWDEBUG(3, "initialized point buffer");
ret = ptarray_construct(FLAGS_GET_Z(pa->dims),
FLAGS_GET_M(pa->dims), pa->npoints+1);
ret = ptarray_construct(FLAGS_GET_Z(pa->flags),
FLAGS_GET_M(pa->flags), pa->npoints+1);
if ( where == -1 ) where = pa->npoints;
@ -564,8 +564,8 @@ ptarray_removePoint(POINTARRAY *pa, uint32 which)
}
#endif
ret = ptarray_construct(FLAGS_GET_Z(pa->dims),
FLAGS_GET_M(pa->dims), pa->npoints-1);
ret = ptarray_construct(FLAGS_GET_Z(pa->flags),
FLAGS_GET_M(pa->flags), pa->npoints-1);
/* copy initial part */
if ( which )
@ -596,11 +596,11 @@ ptarray_merge(POINTARRAY *pa1, POINTARRAY *pa2)
POINTARRAY *pa;
size_t ptsize = ptarray_point_size(pa1);
if (FLAGS_GET_ZM(pa1->dims) != FLAGS_GET_ZM(pa2->dims))
if (FLAGS_GET_ZM(pa1->flags) != FLAGS_GET_ZM(pa2->flags))
lwerror("ptarray_cat: Mixed dimension");
pa = ptarray_construct( FLAGS_GET_Z(pa1->dims),
FLAGS_GET_M(pa1->dims),
pa = ptarray_construct( FLAGS_GET_Z(pa1->flags),
FLAGS_GET_M(pa1->flags),
pa1->npoints + pa2->npoints);
memcpy( getPoint_internal(pa, 0),
@ -629,7 +629,7 @@ ptarray_clone(const POINTARRAY *in)
LWDEBUG(3, "ptarray_clone called.");
out->dims = in->dims;
out->flags = in->flags;
out->npoints = in->npoints;
out->maxpoints = in->maxpoints;
@ -647,7 +647,7 @@ ptarray_clone(const POINTARRAY *in)
int
ptarray_isclosed(const POINTARRAY *in)
{
int ndims = FLAGS_NDIMS(in->dims);
int ndims = FLAGS_NDIMS(in->flags);
if ( memcmp(getPoint_internal(in, 0), getPoint_internal(in, in->npoints-1), ndims*sizeof(double)) ) return 0;
return 1;
}
@ -673,8 +673,8 @@ ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
{
/* TODO handle zero-length point arrays */
int i;
int in_hasz = FLAGS_GET_Z(pa->dims);
int in_hasm = FLAGS_GET_M(pa->dims);
int in_hasz = FLAGS_GET_Z(pa->flags);
int in_hasm = FLAGS_GET_M(pa->flags);
POINT4D pt;
POINTARRAY *pa_out = ptarray_construct_empty(hasz, hasm, pa->npoints);
@ -735,7 +735,7 @@ ptarray_compute_box3d_p(const POINTARRAY *pa, BOX3D *result)
result->ymin = pt.y;
result->ymax = pt.y;
if ( FLAGS_GET_Z(pa->dims) )
if ( FLAGS_GET_Z(pa->flags) )
{
result->zmin = pt.z;
result->zmax = pt.z;
@ -756,7 +756,7 @@ ptarray_compute_box3d_p(const POINTARRAY *pa, BOX3D *result)
if (pt.x > result->xmax) result->xmax = pt.x;
if (pt.y > result->ymax) result->ymax = pt.y;
if ( FLAGS_GET_Z(pa->dims) )
if ( FLAGS_GET_Z(pa->flags) )
{
if (pt.z > result->zmax) result->zmax = pt.z;
if (pt.z < result->zmin) result->zmin = pt.z;
@ -784,7 +784,7 @@ ptarray_substring(POINTARRAY *ipa, double from, double to)
* Create a dynamic pointarray with an initial capacity
* equal to full copy of input points
*/
dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->dims), FLAGS_GET_M(ipa->dims), ipa->npoints);
dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->flags), FLAGS_GET_M(ipa->flags), ipa->npoints);
/* Compute total line length */
length = lwgeom_pointarray_length2d(ipa);
@ -1129,8 +1129,8 @@ ptarray_remove_repeated_points(POINTARRAY *in)
LWDEBUGF(3, "ptsize: %d", ptsize);
/* Allocate enough space for all points */
out = ptarray_construct(FLAGS_GET_Z(in->dims),
FLAGS_GET_M(in->dims), in->npoints);
out = ptarray_construct(FLAGS_GET_Z(in->flags),
FLAGS_GET_M(in->flags), in->npoints);
/* Now fill up the actual points (NOTE: could be optimized) */
@ -1220,10 +1220,10 @@ ptarray_simplify(POINTARRAY *inpts, double epsilon)
p1 = 0;
stack[++sp] = inpts->npoints-1;
LWDEBUGF(2, "Input has %d pts and %d dims", inpts->npoints, inpts->dims);
LWDEBUGF(2, "Input has %d pts and %d dims", inpts->npoints, inpts->flags);
/* Allocate output POINTARRAY, and add first point. */
outpts = ptarray_construct_empty(FLAGS_GET_Z(inpts->dims), FLAGS_GET_M(inpts->dims), inpts->npoints);
outpts = ptarray_construct_empty(FLAGS_GET_Z(inpts->flags), FLAGS_GET_M(inpts->flags), inpts->npoints);
getPoint4d_p(inpts, 0, &pt);
ptarray_append_point(outpts, &pt, REPEATED_POINTS_NOT_OK);

View file

@ -250,7 +250,7 @@ Datum CHIP_to_LWGEOM(PG_FUNCTION_ARGS)
/* Construct point array */
pa[0] = palloc(sizeof(POINTARRAY));
pa[0]->serialized_pointlist = (uchar *)pts;
TYPE_SETZM(pa[0]->dims, 0, 0);
TYPE_SETZM(pa[0]->flags, 0, 0);
pa[0]->npoints = 5;
/* Construct polygon */

View file

@ -295,7 +295,7 @@ ptarray_grid(POINTARRAY *pa, gridspec *grid)
LWDEBUGF(2, "ptarray_grid called on %p", pa);
dpa = ptarray_construct_empty(FLAGS_GET_Z(pa->dims),FLAGS_GET_M(pa->dims), pa->npoints);
dpa = ptarray_construct_empty(FLAGS_GET_Z(pa->flags),FLAGS_GET_M(pa->flags), pa->npoints);
for (ipn=0, opn=0; ipn<pa->npoints; ++ipn)
{
@ -310,11 +310,11 @@ ptarray_grid(POINTARRAY *pa, gridspec *grid)
pbuf.y = rint((pbuf.y - grid->ipy)/grid->ysize) *
grid->ysize + grid->ipy;
if ( FLAGS_GET_Z(pa->dims) && grid->zsize )
if ( FLAGS_GET_Z(pa->flags) && grid->zsize )
pbuf.z = rint((pbuf.z - grid->ipz)/grid->zsize) *
grid->zsize + grid->ipz;
if ( FLAGS_GET_M(pa->dims) && grid->msize )
if ( FLAGS_GET_M(pa->flags) && grid->msize )
pbuf.m = rint((pbuf.m - grid->ipm)/grid->msize) *
grid->msize + grid->ipm;

View file

@ -2734,7 +2734,7 @@ lwgeom_affine_ptarray(POINTARRAY *pa,
LWDEBUG(2, "lwgeom_affine_ptarray start");
if ( FLAGS_GET_Z(pa->dims) )
if ( FLAGS_GET_Z(pa->flags) )
{
LWDEBUG(3, " has z");

View file

@ -244,7 +244,7 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
{
LWDEBUGF(3, " 1 creating new POINTARRAY with first point %g,%g,%g,%g", p1.x, p1.y, p1.z, p1.m);
dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->dims), FLAGS_GET_M(ipa->dims), ipa->npoints-i);
dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->flags), FLAGS_GET_M(ipa->flags), ipa->npoints-i);
ptarray_append_point(dpa, &p1, REPEATED_POINTS_OK);
}

View file

@ -3465,7 +3465,7 @@ ptarray_to_GEOSCoordSeq(POINTARRAY *pa)
POINT3DZ p;
GEOSCoordSeq sq;
if ( FLAGS_GET_Z(pa->dims) ) dims = 3;
if ( FLAGS_GET_Z(pa->flags) ) dims = 3;
size = pa->npoints;
sq = GEOSCoordSeq_create(size, dims);

View file

@ -190,7 +190,7 @@ ptarray_close2d(POINTARRAY* ring)
/* close it up */
newring = ptarray_addPoint(ring,
getPoint_internal(ring, 0),
FLAGS_NDIMS(ring->dims),
FLAGS_NDIMS(ring->flags),
ring->npoints);
ring = newring;
}
@ -219,7 +219,7 @@ ring_make_geos_friendly(POINTARRAY* ring)
/* let's add another... */
ring = ptarray_addPoint(ring,
getPoint_internal(ring, 0),
FLAGS_NDIMS(ring->dims),
FLAGS_NDIMS(ring->flags),
ring->npoints);
}
@ -285,7 +285,7 @@ lwline_make_geos_friendly(LWLINE *line)
/* Duplicate point */
line->points = ptarray_addPoint(line->points,
getPoint_internal(line->points, 0),
FLAGS_NDIMS(line->points->dims),
FLAGS_NDIMS(line->points->flags),
line->points->npoints);
ret = (LWGEOM*)line;
#else

View file

@ -325,7 +325,7 @@ double lwgeom_pointarray_length_ellipse(POINTARRAY *pts, SPHEROID *sphere)
if ( pts->npoints < 2 ) return 0.0;
/* compute 2d length if 3d is not available */
if ( TYPE_NDIMS(pts->dims) < 3 )
if ( TYPE_NDIMS(pts->flags) < 3 )
{
return lwgeom_pointarray_length2d_ellipse(pts, sphere);
}