lwmline.o \
lwmpoly.o \
lwcollection.o \
- lwcurve.o \
+ lwcircstring.o \
lwcompound.o \
lwcurvepoly.o \
lwmcurve.o \
extern size_t lwgeom_size(const uchar *serialized_form);
extern size_t lwgeom_size_subgeom(const uchar *serialized_form, int geom_number);
extern size_t lwgeom_size_line(const uchar *serialized_line);
-extern size_t lwgeom_size_curve(const uchar *serialized_curve);
+extern size_t lwgeom_size_circstring(const uchar *serialized_curve);
extern size_t lwgeom_size_point(const uchar *serialized_point);
extern size_t lwgeom_size_poly(const uchar *serialized_line);
void errorIfSRIDMismatch(int srid1, int srid2);
-/* CURVETYPE */
+/* CIRCSTRINGTYPE */
typedef struct
{
- uchar type; /* CURVETYPE */
+ uchar type; /* CIRCSTRINGTYPE */
BOX2DFLOAT4 *bbox;
uint32 SRID;
POINTARRAY *points; /* array of POINT(3D/3DM) */
-} LWCURVE; /* "light-weight arcline" */
+} LWCIRCSTRING; /* "light-weight circularstring" */
/* COMPOUNDTYPE */
typedef struct
LWGEOM **geoms;
} LWMSURFACE;
-#define CURVETYPE 8
+#define CIRCSTRINGTYPE 8
#define COMPOUNDTYPE 9
#define CURVEPOLYTYPE 13
#define MULTICURVETYPE 14
#define MULTISURFACETYPE 15
/******************************************************************
- * LWCURVE functions
+ * LWCIRCSTRING functions
******************************************************************/
/* Casts LWGEOM->LW* (return NULL if cast is illegal) */
-extern LWCURVE *lwgeom_as_lwcurve(LWGEOM *lwgeom);
+extern LWCIRCSTRING *lwgeom_as_lwcircstring(LWGEOM *lwgeom);
-LWCURVE *lwcurve_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points);
+LWCIRCSTRING *lwcircstring_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points);
/*
* given the LWGEOM serialized form (or a pointer into a muli* one)
- * construct a proper LWCURVE.
+ * construct a proper LWCIRCSTRING.
* serialized_form should point to the 8bit type format (with type = 2)
* See SERIALIZED_FORM doc
*/
-extern LWCURVE *lwcurve_deserialize(uchar *serialized_form);
+extern LWCIRCSTRING *lwcircstring_deserialize(uchar *serialized_form);
/* find the size this curve would get when serialized */
-extern size_t lwcurve_serialize_size(LWCURVE *curve);
+extern size_t lwcircstring_serialize_size(LWCIRCSTRING *curve);
/*
- * convert this curve into its serialize form
+ * convert this circularstring into its serialize form
* result's first char will be the 8bit type. See serialized form doc
* copies data.
*/
-extern uchar *lwcurve_serialize(LWCURVE *curve);
+extern uchar *lwcircstring_serialize(LWCIRCSTRING *curve);
/* same as above, writes to buf */
-extern void lwcurve_serialize_buf(LWCURVE *curve, uchar *buf, size_t *size);
+extern void lwcircstring_serialize_buf(LWCIRCSTRING *curve, uchar *buf, size_t *size);
/*
* find bounding box (standard one) zmin=zmax=0 if 2d (might change to NaN)
*/
-extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
+extern BOX3D *lwcircstring_compute_box3d(LWCIRCSTRING *curve);
-LWGEOM *lwcurve_add(const LWCURVE *to, uint32 where, const LWGEOM *what);
-extern int lwcurve_compute_box2d_p(LWCURVE *curve, BOX2DFLOAT4 *box);
-extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
-LWCURVE *lwcurve_clone(const LWCURVE *curve);
-extern LWCURVE *lwgeom_getcurve_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
-extern void lwfree_curve(LWCURVE *curve);
+LWGEOM *lwcircstring_add(const LWCIRCSTRING *to, uint32 where, const LWGEOM *what);
+extern int lwcircstring_compute_box2d_p(LWCIRCSTRING *curve, BOX2DFLOAT4 *box);
+extern BOX3D *lwcircstring_compute_box3d(LWCIRCSTRING *curve);
+LWCIRCSTRING *lwcircstring_clone(const LWCIRCSTRING *curve);
+extern LWCIRCSTRING *lwgeom_getcircstring_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
+extern void lwfree_circstring(LWCIRCSTRING *curve);
/******************************************************************
* LWMULTIx and LWCOLLECTION functions
*
**********************************************************************/
-/* basic LWCURVE functions */
+/* basic LWCIRCSTRING functions */
#include <stdio.h>
#include <stdlib.h>
#include "liblwgeom.h"
BOX3D *lwcircle_compute_box3d(POINT4D *p1, POINT4D *p2, POINT4D *p3);
-void printLWCURVE(LWCURVE *curve);
-void lwcurve_reverse(LWCURVE *curve);
-LWCURVE *lwcurve_segmentize2d(LWCURVE *curve, double dist);
-char lwcurve_same(const LWCURVE *me, const LWCURVE *you);
-LWCURVE *lwcurve_from_lwpointarray(int SRID, unsigned int npoints, LWPOINT **points);
-LWCURVE *lwcurve_from_lwmpoint(int SRID, LWMPOINT *mpoint);
-LWCURVE *lwcurve_addpoint(LWCURVE *curve, LWPOINT *point, unsigned int where);
-LWCURVE *lwcurve_removepoint(LWCURVE *curve, unsigned int index);
-void lwcurve_setPoint4d(LWCURVE *curve, unsigned int index, POINT4D *newpoint);
+void printLWCIRCSTRING(LWCIRCSTRING *curve);
+void lwcircstring_reverse(LWCIRCSTRING *curve);
+LWCIRCSTRING *lwcircstring_segmentize2d(LWCIRCSTRING *curve, double dist);
+char lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you);
+LWCIRCSTRING *lwcircstring_from_lwpointarray(int SRID, unsigned int npoints, LWPOINT **points);
+LWCIRCSTRING *lwcircstring_from_lwmpoint(int SRID, LWMPOINT *mpoint);
+LWCIRCSTRING *lwcircstring_addpoint(LWCIRCSTRING *curve, LWPOINT *point, unsigned int where);
+LWCIRCSTRING *lwcircstring_removepoint(LWCIRCSTRING *curve, unsigned int index);
+void lwcircstring_setPoint4d(LWCIRCSTRING *curve, unsigned int index, POINT4D *newpoint);
#endif
/*
- * Construct a new LWCURVE. points will *NOT* be copied
+ * Construct a new LWCIRCSTRING. points will *NOT* be copied
* use SRID=-1 for unknown SRID (will have 8bit type's S = 0)
*/
-LWCURVE *
-lwcurve_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points)
+LWCIRCSTRING *
+lwcircstring_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points)
{
- LWCURVE *result;
+ LWCIRCSTRING *result;
/*
* The first arc requires three points. Each additional
*/
if(points->npoints % 2 != 1 || points->npoints < 3)
{
- lwerror("lwcurve_construct: invalid point count %d", points->npoints);
+ lwerror("lwcircstring_construct: invalid point count %d", points->npoints);
return NULL;
}
- result = (LWCURVE*) lwalloc(sizeof(LWCURVE));
+ result = (LWCIRCSTRING*) lwalloc(sizeof(LWCIRCSTRING));
result->type = lwgeom_makeType_full(
TYPE_HASZ(points->dims),
TYPE_HASM(points->dims),
- (SRID!=-1), CURVETYPE, 0);
+ (SRID!=-1), CIRCSTRINGTYPE, 0);
result->SRID = SRID;
result->points = points;
result->bbox = bbox;
/*
* given the LWGEOM serialized form (or a point into a multi* one)
- * construct a propert LWCURVE.
+ * construct a proper LWCIRCSTRING.
* serialized_form should point to the 8bit type format (with type = 8)
* See serialized form doc
*/
-LWCURVE *
-lwcurve_deserialize(uchar *serialized_form)
+LWCIRCSTRING *
+lwcircstring_deserialize(uchar *serialized_form)
{
uchar type;
- LWCURVE *result;
+ LWCIRCSTRING *result;
uchar *loc=NULL;
uint32 npoints;
POINTARRAY *pa;
type = (uchar)serialized_form[0];
- if(lwgeom_getType(type) != CURVETYPE)
+ if(lwgeom_getType(type) != CIRCSTRINGTYPE)
{
- lwerror("lwcurve_deserialize: attempt to deserialize a curve which is really a %s", lwgeom_typename(type));
+ lwerror("lwcircstring_deserialize: attempt to deserialize a circularstring which is really a %s", lwgeom_typename(type));
return NULL;
}
- result = (LWCURVE*) lwalloc(sizeof(LWCURVE));
+ result = (LWCIRCSTRING*) lwalloc(sizeof(LWCIRCSTRING));
result->type = type;
loc = serialized_form + 1;
if(lwgeom_hasBBOX(type))
{
- LWDEBUG(3, "lwcurve_deserialize: input has bbox");
+ LWDEBUG(3, "lwcircstring_deserialize: input has bbox");
result->bbox = lwalloc(sizeof(BOX2DFLOAT4));
memcpy(result->bbox, loc, sizeof(BOX2DFLOAT4));
}
else
{
- LWDEBUG(3, "lwcurve_deserialize: input lacks bbox");
+ LWDEBUG(3, "lwcircstring_deserialize: input lacks bbox");
result->bbox = NULL;
}
if(lwgeom_hasSRID(type))
{
- LWDEBUG(3, "lwcurve_deserialize: input has srid");
+ LWDEBUG(3, "lwcircstring_deserialize: input has srid");
result->SRID = lw_get_int32(loc);
loc += 4; /* type + SRID */
}
else
{
- LWDEBUG(3, "lwcurve_deserialize: input lacks srid");
+ LWDEBUG(3, "lwcircstring_deserialize: input lacks srid");
result->SRID = -1;
}
npoints = lw_get_uint32(loc);
- LWDEBUGF(3, "curve npoints = %d", npoints);
+ LWDEBUGF(3, "circstring npoints = %d", npoints);
loc += 4;
pa = pointArray_construct(loc, TYPE_HASZ(type), TYPE_HASM(type), npoints);
}
/*
- * convert this curve into its serialized form
+ * convert this circularstring into its serialized form
* result's first char will be the 8bit type. See serialized form doc
*/
uchar *
-lwcurve_serialize(LWCURVE *curve)
+lwcircstring_serialize(LWCIRCSTRING *curve)
{
size_t size, retsize;
uchar * result;
if(curve == NULL) {
- lwerror("lwcurve_serialize:: given null curve");
+ lwerror("lwcircstring_serialize:: given null curve");
return NULL;
}
- size = lwcurve_serialize_size(curve);
+ size = lwcircstring_serialize_size(curve);
result = lwalloc(size);
- lwcurve_serialize_buf(curve, result, &retsize);
+ lwcircstring_serialize_buf(curve, result, &retsize);
if(retsize != size)
- lwerror("lwcurve_serialize_size returned %d, ..selialize_buf returned %d", size, retsize);
+ lwerror("lwcircstring_serialize_size returned %d, ..serialize_buf returned %d", size, retsize);
return result;
}
/*
- * convert this curve into its serialized form writing it into
+ * convert this circularstring into its serialized form writing it into
* the given buffer, and returning number of bytes written into
* the given int pointer.
* result's first char will be the 8bit type. See serialized form doc
*/
-void lwcurve_serialize_buf(LWCURVE *curve, uchar *buf, size_t *retsize)
+void lwcircstring_serialize_buf(LWCIRCSTRING *curve, uchar *buf, size_t *retsize)
{
char hasSRID;
uchar *loc;
int ptsize;
size_t size;
- LWDEBUGF(2, "lwcurve_serialize_buf(%p, %p, %p) called",
+ LWDEBUGF(2, "lwcircstring_serialize_buf(%p, %p, %p) called",
curve, buf, retsize);
if(curve == NULL)
{
- lwerror("lwcurve_serialize:: given null curve");
+ lwerror("lwcircstring_serialize:: given null curve");
return;
}
if(TYPE_GETZM(curve->type) != TYPE_GETZM(curve->points->dims))
{
- lwerror("Dimensions mismatch in lwcurve");
+ lwerror("Dimensions mismatch in lwcircstring");
return;
}
buf[0] = (uchar)lwgeom_makeType_full(
TYPE_HASZ(curve->type), TYPE_HASM(curve->type),
- hasSRID, CURVETYPE, curve->bbox ? 1 : 0);
+ hasSRID, CIRCSTRINGTYPE, curve->bbox ? 1 : 0);
loc = buf+1;
- LWDEBUGF(3, "lwcurve_serialize_buf added type (%d)", curve->type);
+ LWDEBUGF(3, "lwcircstring_serialize_buf added type (%d)", curve->type);
if(curve->bbox)
{
memcpy(loc, curve->bbox, sizeof(BOX2DFLOAT4));
loc += sizeof(BOX2DFLOAT4);
- LWDEBUG(3, "lwcurve_serialize_buf added BBOX");
+ LWDEBUG(3, "lwcircstring_serialize_buf added BBOX");
}
if(hasSRID)
memcpy(loc, &curve->SRID, sizeof(int32));
loc += sizeof(int32);
- LWDEBUG(3, "lwcurve_serialize_buf added SRID");
+ LWDEBUG(3, "lwcircstring_serialize_buf added SRID");
}
memcpy(loc, &curve->points->npoints, sizeof(uint32));
loc += sizeof(uint32);
- LWDEBUGF(3, "lwcurve_serialize_buf added npoints (%d)",
+ LWDEBUGF(3, "lwcircstring_serialize_buf added npoints (%d)",
curve->points->npoints);
/* copy in points */
memcpy(loc, getPoint_internal(curve->points, 0), size);
loc += size;
- LWDEBUGF(3, "lwcurve_serialize_buf copied serialized_pointlist (%d bytes)",
+ LWDEBUGF(3, "lwcircstring_serialize_buf copied serialized_pointlist (%d bytes)",
ptsize * curve->points->npoints);
if(retsize) *retsize = loc-buf;
- LWDEBUGF(3, "lwcurve_serialize_buf returning (loc: %p, size: %d)",
+ LWDEBUGF(3, "lwcircstring_serialize_buf returning (loc: %p, size: %d)",
loc, loc-buf);
}
-/* find length of this deserialized curve */
+/* find length of this deserialized circularstring */
size_t
-lwcurve_serialize_size(LWCURVE *curve)
+lwcircstring_serialize_size(LWCIRCSTRING *curve)
{
size_t size = 1; /* type */
- LWDEBUG(2, "lwcurve_serialize_size called");
+ LWDEBUG(2, "lwcircstring_serialize_size called");
if(curve->SRID != -1) size += 4; /* SRID */
if(curve->bbox) size += sizeof(BOX2DFLOAT4);
size += 4; /* npoints */
size += pointArray_ptsize(curve->points) * curve->points->npoints;
- LWDEBUGF(3, "lwcurve_serialize_size returning %d", size);
+ LWDEBUGF(3, "lwcircstring_serialize_size returning %d", size);
return size;
}
* TODO: This ignores curvature, which should be taken into account.
*/
BOX3D *
-lwcurve_compute_box3d(LWCURVE *curve)
+lwcircstring_compute_box3d(LWCIRCSTRING *curve)
{
BOX3D *box, *tmp;
int i;
POINT4D *p2 = lwalloc(sizeof(POINT4D));
POINT4D *p3 = lwalloc(sizeof(POINT4D));
- LWDEBUG(2, "lwcurve_compute_box3d called.");
+ LWDEBUG(2, "lwcircstring_compute_box3d called.");
/* initialize box values */
box = lwalloc(sizeof(BOX3D));
box->zmin = (box->zmin < tmp->zmin) ? box->zmin : tmp->zmin;
box->zmax = (box->zmax > tmp->zmax) ? box->zmax : tmp->zmax;
- LWDEBUGF(4, "curve %d x=(%.16f,%.16f) y=(%.16f,%.16f) z=(%.16f,%.16f)", i/2, box->xmin, box->xmax, box->ymin, box->ymax, box->zmin, box->zmax);
+ LWDEBUGF(4, "circularstring %d x=(%.16f,%.16f) y=(%.16f,%.16f) z=(%.16f,%.16f)", i/2, box->xmin, box->xmax, box->ymin, box->ymax, box->zmin, box->zmax);
}
}
int
-lwcurve_compute_box2d_p(LWCURVE *curve, BOX2DFLOAT4 *result)
+lwcircstring_compute_box2d_p(LWCIRCSTRING *curve, BOX2DFLOAT4 *result)
{
- BOX3D *box = lwcurve_compute_box3d(curve);
- LWDEBUG(2, "lwcurve_compute_box2d_p called.");
+ BOX3D *box = lwcircstring_compute_box3d(curve);
+ LWDEBUG(2, "lwcircstring_compute_box2d_p called.");
if(box == NULL) return 0;
box3d_to_box2df_p(box, result);
return 1;
}
-void lwfree_curve(LWCURVE *curve)
+void lwfree_circstring(LWCIRCSTRING *curve)
{
lwfree(curve->points);
lwfree(curve);
/* find length of this serialized curve */
size_t
-lwgeom_size_curve(const uchar *serialized_curve)
+lwgeom_size_circstring(const uchar *serialized_curve)
{
int type = (uchar)serialized_curve[0];
uint32 result = 1; /* type */
const uchar *loc;
uint32 npoints;
- LWDEBUG(2, "lwgeom_size_curve called");
+ LWDEBUG(2, "lwgeom_size_circstring called");
- if(lwgeom_getType(type) != CURVETYPE)
- lwerror("lwgeom_size_curve::attempt to find the length of a non-curve");
+ if(lwgeom_getType(type) != CIRCSTRINGTYPE)
+ lwerror("lwgeom_size_circstring::attempt to find the length of a non-circularstring");
loc = serialized_curve + 1;
if(lwgeom_hasBBOX(type))
result += TYPE_NDIMS(type) * sizeof(double) * npoints;
- LWDEBUGF(3, "lwgeom_size_curve returning %d", result);
+ LWDEBUGF(3, "lwgeom_size_circstring returning %d", result);
return result;
}
-void printLWCURVE(LWCURVE *curve)
+void printLWCIRCSTRING(LWCIRCSTRING *curve)
{
- lwnotice("LWCURVE {");
+ lwnotice("LWCIRCSTRING {");
lwnotice(" ndims = %i", (int)TYPE_NDIMS(curve->type));
lwnotice(" SRID = %i", (int)curve->SRID);
printPA(curve->points);
lwnotice("}");
}
-/* Clone LWCURVE object. POINTARRAY is not copied. */
-LWCURVE *
-lwcurve_clone(const LWCURVE *g)
+/* Clone LWCIRCSTRING object. POINTARRAY is not copied. */
+LWCIRCSTRING *
+lwcircstring_clone(const LWCIRCSTRING *g)
{
- LWCURVE *ret = lwalloc(sizeof(LWCURVE));
- memcpy(ret, g, sizeof(LWCURVE));
+ LWCIRCSTRING *ret = lwalloc(sizeof(LWCIRCSTRING));
+ memcpy(ret, g, sizeof(LWCIRCSTRING));
if(g->bbox) ret->bbox = box2d_clone(g->bbox);
return ret;
}
* Returns a MULTICURVE or a GEOMETRYCOLLECTION
*/
LWGEOM *
-lwcurve_add(const LWCURVE *to, uint32 where, const LWGEOM *what)
+lwcircstring_add(const LWCIRCSTRING *to, uint32 where, const LWGEOM *what)
{
LWCOLLECTION *col;
LWGEOM **geoms;
TYPE_SETHASBBOX(geoms[1]->type, 0);
/* Find appropriate geom type */
- if(TYPE_GETTYPE(what->type) == CURVETYPE || TYPE_GETTYPE(what->type) == LINETYPE) newtype = MULTICURVETYPE;
+ if(TYPE_GETTYPE(what->type) == CIRCSTRINGTYPE || TYPE_GETTYPE(what->type) == LINETYPE) newtype = MULTICURVETYPE;
else newtype = COLLECTIONTYPE;
col = lwcollection_construct(newtype,
return (LWGEOM *)col;
}
-void lwcurve_reverse(LWCURVE *curve)
+void lwcircstring_reverse(LWCIRCSTRING *curve)
{
ptarray_reverse(curve->points);
}
/*
* TODO: Invalid segmentization. This should accomodate the curvature.
*/
-LWCURVE *
-lwcurve_segmentize2d(LWCURVE *curve, double dist)
+LWCIRCSTRING *
+lwcircstring_segmentize2d(LWCIRCSTRING *curve, double dist)
{
- return lwcurve_construct(curve->SRID, NULL,
+ return lwcircstring_construct(curve->SRID, NULL,
ptarray_segmentize2d(curve->points, dist));
}
/* check coordinate equality */
char
-lwcurve_same(const LWCURVE *me, const LWCURVE *you)
+lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you)
{
return ptarray_same(me->points, you->points);
}
/*
- * Construct a LWCURVE from an array of LWPOINTs
- * LWCURVE dimensions are large enough to host all input dimensions.
+ * Construct a LWCIRCSTRING from an array of LWPOINTs
+ * LWCIRCSTRING dimensions are large enough to host all input dimensions.
*/
-LWCURVE *
-lwcurve_from_lwpointarray(int SRID, unsigned int npoints, LWPOINT **points)
+LWCIRCSTRING *
+lwcircstring_from_lwpointarray(int SRID, unsigned int npoints, LWPOINT **points)
{
int zmflag=0;
unsigned int i;
}
pa = pointArray_construct(newpoints, zmflag&2, zmflag&1, npoints);
- return lwcurve_construct(SRID, NULL, pa);
+ return lwcircstring_construct(SRID, NULL, pa);
}
/*
- * Construct a LWCURVE from a LWMPOINT
+ * Construct a LWCIRCSTRING from a LWMPOINT
*/
-LWCURVE *
-lwcurve_from_lwmpoint(int SRID, LWMPOINT *mpoint)
+LWCIRCSTRING *
+lwcircstring_from_lwmpoint(int SRID, LWMPOINT *mpoint)
{
unsigned int i;
POINTARRAY *pa;
LWDEBUGF(3, "lwcurve_from_lwmpoint: constructed pointarray for %d points, %d zmflag", mpoint->ngeoms, zmflag);
- return lwcurve_construct(SRID, NULL, pa);
+ return lwcircstring_construct(SRID, NULL, pa);
}
-LWCURVE *
-lwcurve_addpoint(LWCURVE *curve, LWPOINT *point, unsigned int where)
+LWCIRCSTRING *
+lwcircstring_addpoint(LWCIRCSTRING *curve, LWPOINT *point, unsigned int where)
{
POINTARRAY *newpa;
- LWCURVE *ret;
+ LWCIRCSTRING *ret;
newpa = ptarray_addPoint(curve->points,
getPoint_internal(point->point, 0),
TYPE_NDIMS(point->type), where);
- ret = lwcurve_construct(curve->SRID, NULL, newpa);
+ ret = lwcircstring_construct(curve->SRID, NULL, newpa);
return ret;
}
-LWCURVE *
-lwcurve_removepoint(LWCURVE *curve, unsigned int index)
+LWCIRCSTRING *
+lwcircstring_removepoint(LWCIRCSTRING *curve, unsigned int index)
{
POINTARRAY *newpa;
- LWCURVE *ret;
+ LWCIRCSTRING *ret;
newpa = ptarray_removePoint(curve->points, index);
- ret = lwcurve_construct(curve->SRID, NULL, newpa);
+ ret = lwcircstring_construct(curve->SRID, NULL, newpa);
return ret;
}
* Note: input will be changed, make sure you have permissions for this.
* */
void
-lwcurve_setPoint4d(LWCURVE *curve, unsigned int index, POINT4D *newpoint)
+lwcircstring_setPoint4d(LWCIRCSTRING *curve, unsigned int index, POINT4D *newpoint)
{
setPoint4d(curve->points, index, newpoint);
}
switch(TYPE_GETTYPE(col->geoms[i]->type)) {
case POINTTYPE:
case LINETYPE:
- case CURVETYPE:
+ case CIRCSTRINGTYPE:
case POLYGONTYPE:
ngeoms += 1;
break;
if(lwgeom_getType(insp->sub_geoms[i][0]) == LINETYPE)
result->geoms[i] = (LWGEOM *)lwline_deserialize(insp->sub_geoms[i]);
else
- result->geoms[i] = (LWGEOM *)lwcurve_deserialize(insp->sub_geoms[i]);
+ result->geoms[i] = (LWGEOM *)lwcircstring_deserialize(insp->sub_geoms[i]);
if(TYPE_NDIMS(result->geoms[i]->type) != TYPE_NDIMS(result->type))
{
- lwerror("Mixed dimensions (compound:%d, line/curve%d:%d)",
+ lwerror("Mixed dimensions (compound: %d, line/circularstring %d:%d)",
TYPE_NDIMS(result->type), i,
TYPE_NDIMS(result->geoms[i]->type)
);
TYPE_SETHASBBOX(geoms[1]->type, 0);
/* Find appropriate geom type */
- if(TYPE_GETTYPE(what->type) == LINETYPE || TYPE_GETTYPE(what->type) == CURVETYPE) newtype = COMPOUNDTYPE;
+ if(TYPE_GETTYPE(what->type) == LINETYPE || TYPE_GETTYPE(what->type) == CIRCSTRINGTYPE) newtype = COMPOUNDTYPE;
else newtype = COLLECTIONTYPE;
col = lwcollection_construct(newtype,
for(i = 0; i < insp->ngeometries; i++)
{
result->rings[i] = lwgeom_deserialize(insp->sub_geoms[i]);
- if(lwgeom_getType(result->rings[i]->type) != CURVETYPE
+ if(lwgeom_getType(result->rings[i]->type) != CIRCSTRINGTYPE
&& lwgeom_getType(result->rings[i]->type) != LINETYPE)
{
- lwerror("Only Circular curves and Linestrings are currently supported as rings, not %s (%d)", lwgeom_typename(result->rings[i]->type), result->rings[i]->type);
+ lwerror("Only Circularstrings and Linestrings are currently supported as rings, not %s (%d)", lwgeom_typename(result->rings[i]->type), result->rings[i]->type);
lwfree(result);
lwfree(insp);
return NULL;
return (LWGEOM *)lwpoint_deserialize(srl);
case LINETYPE:
return (LWGEOM *)lwline_deserialize(srl);
- case CURVETYPE:
- return (LWGEOM *)lwcurve_deserialize(srl);
+ case CIRCSTRINGTYPE:
+ return (LWGEOM *)lwcircstring_deserialize(srl);
case POLYGONTYPE:
return (LWGEOM *)lwpoly_deserialize(srl);
case MULTIPOINTTYPE:
return lwline_serialize_size((LWLINE *)lwgeom);
case POLYGONTYPE:
return lwpoly_serialize_size((LWPOLY *)lwgeom);
- case CURVETYPE:
- return lwcurve_serialize_size((LWCURVE *)lwgeom);
+ case CIRCSTRINGTYPE:
+ return lwcircstring_serialize_size((LWCIRCSTRING *)lwgeom);
case CURVEPOLYTYPE:
case COMPOUNDTYPE:
case MULTIPOINTTYPE:
case POLYGONTYPE:
lwpoly_serialize_buf((LWPOLY *)lwgeom, buf, retsize);
break;
- case CURVETYPE:
- lwcurve_serialize_buf((LWCURVE *)lwgeom, buf, retsize);
+ case CIRCSTRINGTYPE:
+ lwcircstring_serialize_buf((LWCIRCSTRING *)lwgeom, buf, retsize);
break;
case CURVEPOLYTYPE:
case COMPOUNDTYPE:
return lwpoint_compute_box2d_p((LWPOINT *)lwgeom, buf);
case LINETYPE:
return lwline_compute_box2d_p((LWLINE *)lwgeom, buf);
- case CURVETYPE:
- return lwcurve_compute_box2d_p((LWCURVE *)lwgeom, buf);
+ case CIRCSTRINGTYPE:
+ return lwcircstring_compute_box2d_p((LWCIRCSTRING *)lwgeom, buf);
case POLYGONTYPE:
return lwpoly_compute_box2d_p((LWPOLY *)lwgeom, buf);
case COMPOUNDTYPE:
else return NULL;
}
-LWCURVE *
-lwgeom_as_lwcurve(LWGEOM *lwgeom)
+LWCIRCSTRING *
+lwgeom_as_lwcircstring(LWGEOM *lwgeom)
{
- if( TYPE_GETTYPE(lwgeom->type) == CURVETYPE )
- return (LWCURVE *)lwgeom;
+ if( TYPE_GETTYPE(lwgeom->type) == CIRCSTRINGTYPE )
+ return (LWCIRCSTRING *)lwgeom;
else return NULL;
}
return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
case LINETYPE:
return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
- case CURVETYPE:
- return (LWGEOM *)lwcurve_clone((LWCURVE *)lwgeom);
+ case CIRCSTRINGTYPE:
+ return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
case POLYGONTYPE:
return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
case COMPOUNDTYPE:
case LINETYPE:
return (LWGEOM *)lwline_add((const LWLINE *)to, where, what);
- case CURVETYPE:
- return (LWGEOM *)lwcurve_add((const LWCURVE *)to, where, what);
+ case CIRCSTRINGTYPE:
+ return (LWGEOM *)lwcircstring_add((const LWCIRCSTRING *)to, where, what);
case POLYGONTYPE:
return (LWGEOM *)lwpoly_add((const LWPOLY *)to, where, what);
loc += 4;
}
- if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) || (type == CURVETYPE))
+ if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) || (type == CIRCSTRINGTYPE))
{
- /* simple geometry (point/line/polygon)-- not multi! */
+ /* simple geometry (point/line/polygon/circstring)-- not multi! */
result->ngeometries = 1;
sub_geoms = (uchar**) lwalloc(sizeof(char*));
sub_geoms[0] = (uchar *)serialized_form;
* if there arent enough geometries, return null.
* this is fine to call on a circularstring
*/
-LWCURVE *
-lwgeom_getcurve_inspected(LWGEOM_INSPECTED *inspected, int geom_number)
+LWCIRCSTRING *
+lwgeom_getcircstring_inspected(LWGEOM_INSPECTED *inspected, int geom_number)
{
uchar *sub_geom;
uchar type;
if (sub_geom == NULL) return NULL;
type = lwgeom_getType(sub_geom[0]);
- if (type != CURVETYPE) return NULL;
+ if (type != CIRCSTRINGTYPE) return NULL;
- return lwcurve_deserialize(sub_geom);
+ return lwcircstring_deserialize(sub_geom);
}
/*
uchar *loc;
if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) ||
- (type==CURVETYPE) || (type==COMPOUNDTYPE) || (type==CURVEPOLYTYPE) )
+ (type==CIRCSTRINGTYPE) || (type==COMPOUNDTYPE) || (type==CURVEPOLYTYPE) )
{
return 1;
}
return lwgeom_size_line(serialized_form);
}
- else if(type == CURVETYPE)
+ else if(type == CIRCSTRINGTYPE)
{
- LWDEBUG(3, "lwgeom_size: is a curve");
+ LWDEBUG(3, "lwgeom_size: is a circularstring");
- return lwgeom_size_curve(serialized_form);
+ return lwgeom_size_circstring(serialized_form);
}
else if (type == POLYGONTYPE)
{
return result;
}
- else if (type == CURVETYPE)
+ else if (type == CIRCSTRINGTYPE)
{
- LWCURVE *curve = lwcurve_deserialize(srl);
- result = lwcurve_compute_box3d(curve);
- lwfree_curve(curve);
+ LWCIRCSTRING *curve = lwcircstring_deserialize(srl);
+ result = lwcircstring_compute_box3d(curve);
+ lwfree_circstring(curve);
return result;
}
else if (type == POLYGONTYPE)
void read_wkb_point(const char **b);
void read_wkb_polygon(const char **b);
void read_wkb_linestring(const char **b);
-void read_wkb_curve(const char **b);
+void read_wkb_circstring(const char **b);
void read_wkb_ordinate_array(const char **b);
void read_collection(const char **b, read_col_func f);
void parse_wkb(const char **b);
{
LWDEBUG(2, "alloc_circularstring");
- alloc_stack_tuple(CURVETYPE,write_type,1);
+ alloc_stack_tuple(CIRCSTRINGTYPE,write_type,1);
minpoints=3;
checkclosed=0;
isodd=1;
void
-read_wkb_curve(const char **b)
+read_wkb_circstring(const char **b)
{
- /* Things to check for CURVE ORDINATE_ARRAYs */
+ /* Things to check for CIRCULARSTRING ORDINATE_ARRAYs */
minpoints=3;
checkclosed=0;
isodd=-1;
read_wkb_linestring(b);
break;
- case CURVETYPE:
- read_wkb_curve(b);
+ case CIRCSTRINGTYPE:
+ read_wkb_circstring(b);
break;
case POLYGONTYPE:
uchar* output_line_collection(uchar* geom,outfunc func,int supress);
uchar* output_polygon_collection(uchar* geom,int suppress);
uchar* output_polygon_ring_collection(uchar* geom,outfunc func,int supress);
-uchar* output_curve_collection(uchar* geom,outfunc func,int supress);
+uchar* output_circstring_collection(uchar* geom,outfunc func,int supress);
uchar* output_multipoint(uchar* geom,int suppress);
uchar* output_compound(uchar* geom, int suppress);
uchar* output_multisurface(uchar* geom, int suppress);
uchar* output_wkb_polygon_collection(uchar* geom);
uchar* output_wkb_polygon_ring_collection(uchar* geom,outwkbfunc func);
uchar* output_wkb_line_collection(uchar* geom,outwkbfunc func);
-uchar* output_wkb_curve_collection(uchar* geom,outwkbfunc func);
+uchar* output_wkb_circstring_collection(uchar* geom,outwkbfunc func);
uchar* output_wkb_point(uchar* geom);
uchar* output_wkb(uchar* geom);
/* Ouput the points from a CIRCULARSTRING */
uchar *
-output_curve_collection(uchar* geom,outfunc func,int supress)
+output_circstring_collection(uchar* geom,outfunc func,int supress)
{
int cnt = read_int(&geom);
int orig_cnt = cnt;
case LINETYPE:
geom = output_wkt(geom,2);
break;
- case CURVETYPE:
+ case CIRCSTRINGTYPE:
geom = output_wkt(geom,1);
break;
}
}
geom = output_line_collection(geom,output_point,0);
break;
- case CURVETYPE:
+ case CIRCSTRINGTYPE:
if ( supress < 2 )
{
if(writeM) write_str("CIRCULARSTRINGM");
else write_str("CIRCULARSTRING");
}
- geom = output_curve_collection(geom,output_point,0);
+ geom = output_circstring_collection(geom,output_point,0);
break;
case POLYGONTYPE:
if ( supress < 2 )
/* Ouput the points from a CIRCULARSTRING */
uchar *
-output_wkb_curve_collection(uchar* geom,outwkbfunc func)
+output_wkb_circstring_collection(uchar* geom,outwkbfunc func)
{
int cnt = read_int(&geom);
int orig_cnt = cnt;
case LINETYPE:
geom=output_wkb_line_collection(geom,output_wkb_point);
break;
- case CURVETYPE:
- geom=output_wkb_curve_collection(geom,output_wkb_point);
+ case CIRCSTRINGTYPE:
+ geom=output_wkb_circstring_collection(geom,output_wkb_point);
break;
case POLYGONTYPE:
geom=output_wkb_collection(geom,output_wkb_polygon_collection);
result->type = insp->type;
result->SRID = insp->SRID;
result->ngeoms = insp->ngeometries;
- result->geoms = lwalloc(sizeof(LWCURVE *)*insp->ngeometries);
+ result->geoms = lwalloc(sizeof(LWGEOM *)*insp->ngeometries);
if(lwgeom_hasBBOX(srl[0]))
{
for(i = 0; i < insp->ngeometries; i++)
{
stype = lwgeom_getType(insp->sub_geoms[i][0]);
- if(stype == CURVETYPE)
+ if(stype == CIRCSTRINGTYPE)
{
- result->geoms[i] = (LWGEOM *)lwcurve_deserialize(insp->sub_geoms[i]);
+ result->geoms[i] = (LWGEOM *)lwcircstring_deserialize(insp->sub_geoms[i]);
}
else if(stype == LINETYPE)
{
geoms[i+1] = lwgeom_clone((LWGEOM *)to->geoms[i]);
}
- if(TYPE_GETTYPE(what->type) == CURVETYPE) newtype = MULTICURVETYPE;
+ if(TYPE_GETTYPE(what->type) == CIRCSTRINGTYPE) newtype = MULTICURVETYPE;
else newtype = COLLECTIONTYPE;
col = lwcollection_construct(newtype,
double interpolate_arc(double angle, double zm1, double a1, double zm2, double a2);
POINTARRAY *lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32 perQuad);
-LWLINE *lwcurve_segmentize(LWCURVE *icurve, uint32 perQuad);
+LWLINE *lwcurve_segmentize(LWCIRCSTRING *icurve, uint32 perQuad);
LWLINE *lwcompound_segmentize(LWCOMPOUND *icompound, uint32 perQuad);
LWPOLY *lwcurvepoly_segmentize(LWCURVEPOLY *curvepoly, uint32 perQuad);
LWMLINE *lwmcurve_segmentize(LWMCURVE *mcurve, uint32 perQuad);
case MULTILINETYPE:
case MULTIPOLYGONTYPE:
return 0;
- case CURVETYPE:
+ case CIRCSTRINGTYPE:
return 1;
/* It's a collection that MAY contain an arc */
default:
}
LWLINE *
-lwcurve_segmentize(LWCURVE *icurve, uint32 perQuad)
+lwcurve_segmentize(LWCIRCSTRING *icurve, uint32 perQuad)
{
LWLINE *oline;
DYNPTARRAY *ptarray;
for(i = 0; i < icompound->ngeoms; i++)
{
geom = icompound->geoms[i];
- if(lwgeom_getType(geom->type) == CURVETYPE)
+ if(lwgeom_getType(geom->type) == CIRCSTRINGTYPE)
{
- tmp = lwcurve_segmentize((LWCURVE *)geom, perQuad);
+ tmp = lwcurve_segmentize((LWCIRCSTRING *)geom, perQuad);
for(j = 0; j < tmp->points->npoints; j++)
{
getPoint4d_p(tmp->points, j, p);
for(i = 0; i < curvepoly->nrings; i++)
{
tmp = curvepoly->rings[i];
- if(lwgeom_getType(tmp->type) == CURVETYPE)
+ if(lwgeom_getType(tmp->type) == CIRCSTRINGTYPE)
{
- line = lwcurve_segmentize((LWCURVE *)tmp, perQuad);
+ line = lwcurve_segmentize((LWCIRCSTRING *)tmp, perQuad);
ptarray[i] = ptarray_clone(line->points);
lwfree(line);
}
for(i = 0; i < mcurve->ngeoms; i++)
{
tmp = mcurve->geoms[i];
- if(lwgeom_getType(tmp->type) == CURVETYPE)
+ if(lwgeom_getType(tmp->type) == CIRCSTRINGTYPE)
{
- lines[i] = (LWGEOM *)lwcurve_segmentize((LWCURVE *)tmp, perQuad);
+ lines[i] = (LWGEOM *)lwcurve_segmentize((LWCIRCSTRING *)tmp, perQuad);
}
else if(lwgeom_getType(tmp->type) == LINETYPE)
{
{
tmp = collection->geoms[i];
switch(lwgeom_getType(tmp->type)) {
- case CURVETYPE:
- geoms[i] = (LWGEOM *)lwcurve_segmentize((LWCURVE *)tmp, perQuad);
+ case CIRCSTRINGTYPE:
+ geoms[i] = (LWGEOM *)lwcurve_segmentize((LWCIRCSTRING *)tmp, perQuad);
break;
case COMPOUNDTYPE:
geoms[i] = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad);
{
LWGEOM * ogeom = NULL;
switch(lwgeom_getType(geom->type)) {
- case CURVETYPE:
- ogeom = (LWGEOM *)lwcurve_segmentize((LWCURVE *)geom, perQuad);
+ case CIRCSTRINGTYPE:
+ ogeom = (LWGEOM *)lwcurve_segmentize((LWCIRCSTRING *)geom, perQuad);
break;
case COMPOUNDTYPE:
ogeom = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)geom, perQuad);
return (LWGEOM *)lwline_construct(SRID, NULL, pts);
}
- else if(type == CURVETYPE)
+ else if(type == CIRCSTRINGTYPE)
{
#if POSTGIS_DEBUG_LEVEL >= 4
POINT4D tmp;
LWDEBUGF(4, "new point: (%.16f,%.16f)",tmp.x,tmp.y);
}
#endif
- return (LWGEOM *)lwcurve_construct(SRID, NULL, pts);
+ return (LWGEOM *)lwcircstring_construct(SRID, NULL, pts);
}
else
{
lwgeom_release(geom);
return result;
}
- else if(currentType == CURVETYPE && type == CURVETYPE)
+ else if(currentType == CIRCSTRINGTYPE && type == CIRCSTRINGTYPE)
{
POINTARRAY *newPoints;
POINT4D pt;
- LWCURVE *curve = (LWCURVE *)geom;
+ LWCIRCSTRING *curve = (LWCIRCSTRING *)geom;
- LWDEBUG(3, "append_segment: curve to curve");
+ LWDEBUG(3, "append_segment: circularstring to circularstring");
newPoints = ptarray_construct(TYPE_HASZ(pts->dims), TYPE_HASM(pts->dims), pts->npoints + curve->points->npoints - 1);
setPoint4d(newPoints, i + curve->points->npoints - 1, &pt);
}
- result = (LWGEOM *)lwcurve_construct(SRID, NULL, newPoints);
+ result = (LWGEOM *)lwcircstring_construct(SRID, NULL, newPoints);
lwgeom_release(geom);
return result;
}
- else if(currentType == CURVETYPE && type == LINETYPE)
+ else if(currentType == CIRCSTRINGTYPE && type == LINETYPE)
{
LWLINE *line;
LWGEOM **geomArray;
lwgeom_release(geom);
return result;
}
- else if(currentType == LINETYPE && type == CURVETYPE)
+ else if(currentType == LINETYPE && type == CIRCSTRINGTYPE)
{
- LWCURVE *curve;
+ LWCIRCSTRING *curve;
LWGEOM **geomArray;
- LWDEBUG(3, "append_segment: curve to line");
+ LWDEBUG(3, "append_segment: circularstring to line");
geomArray = lwalloc(sizeof(LWGEOM *)*2);
geomArray[0] = lwgeom_clone(geom);
- curve = lwcurve_construct(SRID, NULL, pts);
+ curve = lwcircstring_construct(SRID, NULL, pts);
geomArray[1] = lwgeom_clone((LWGEOM *)curve);
result = (LWGEOM *)lwcollection_construct(COMPOUNDTYPE, SRID, NULL, 2, geomArray);
newGeom = (LWGEOM *)lwline_construct(SRID, NULL, pts);
}
- else if(type == CURVETYPE)
+ else if(type == CIRCSTRINGTYPE)
{
- LWDEBUG(3, "append_segment: curve to compound");
+ LWDEBUG(3, "append_segment: circularstring to compound");
- newGeom = (LWGEOM *)lwcurve_construct(SRID, NULL, pts);
+ newGeom = (LWGEOM *)lwcircstring_construct(SRID, NULL, pts);
}
else
{
if(isline > 0)
{
}
- /* We were tracking a curve, commit it and start line*/
+ /* We were tracking a circularstring, commit it and start line*/
else if(isline == 0)
{
- LWDEBUGF(3, "Building curve, %d - %d", commit, i);
+ LWDEBUGF(3, "Building circularstring, %d - %d", commit, i);
count = i - commit;
pts = ptarray_construct(
setPoint4d(pts, 2, &tmp);
commit = i-1;
- geom = append_segment(geom, pts, CURVETYPE, SRID);
+ geom = append_segment(geom, pts, CIRCSTRINGTYPE, SRID);
isline = -1;
/*
isline = 1;
}
}
- /* Found a curve segment */
+ /* Found a circularstring segment */
else
{
- /* We were tracking a curve, commit it and start line */
+ /* We were tracking a circularstring, commit it and start line */
if(isline > 0)
{
LWDEBUGF(3, "Building line, %d - %d", commit, i-2);
geom = append_segment(geom, pts, LINETYPE, SRID);
isline = -1;
}
- /* We are tracking a curve, keep going */
+ /* We are tracking a circularstring, keep going */
else if(isline == 0)
{
;
/* We didn't know what we were tracking, now we do */
else
{
- LWDEBUG(3, "It's a curve");
+ LWDEBUG(3, "It's a circularstring");
isline = 0;
}
}
count = i - commit;
if(isline == 0 && count > 2)
{
- LWDEBUGF(3, "Finishing curve %d,%d.", commit, i);
+ LWDEBUGF(3, "Finishing circularstring %d,%d.", commit, i);
pts = ptarray_construct(
TYPE_HASZ(type),
getPoint4d_p(points, i - 1, &tmp);
setPoint4d(pts, 2, &tmp);
- geom = append_segment(geom, pts, CURVETYPE, SRID);
+ geom = append_segment(geom, pts, CIRCSTRINGTYPE, SRID);
}
else
{
for(i=0; i<poly->nrings; i++)
{
geoms[i] = pta_desegmentize(poly->rings[i], poly->type, poly->SRID);
- if(lwgeom_getType(geoms[i]->type) == CURVETYPE ||
+ if(lwgeom_getType(geoms[i]->type) == CIRCSTRINGTYPE ||
lwgeom_getType(geoms[i]->type) == COMPOUNDTYPE)
{
hascurve = 1;
for(i=0; i<mline->ngeoms; i++)
{
geoms[i] = lwline_desegmentize((LWLINE *)mline->geoms[i]);
- if(lwgeom_getType(geoms[i]->type) == CURVETYPE ||
+ if(lwgeom_getType(geoms[i]->type) == CIRCSTRINGTYPE ||
lwgeom_getType(geoms[i]->type) == COMPOUNDTYPE)
{
hascurve = 1;
#define LINETYPEI 11
#define POLYGONTYPEI 12
-#define CURVETYPE 8
+#define CIRCSTRINGTYPE 8
#define COMPOUNDTYPE 9
#define CURVEPOLYTYPE 13
#define MULTICURVETYPE 14
LWLINE *line=NULL;
LWPOINT *point=NULL;
LWPOLY *poly=NULL;
- LWCURVE *curve=NULL;
+ LWCIRCSTRING *curve=NULL;
uchar *subgeom=NULL;
point = lwgeom_getpoint_inspected(inspected, i);
continue;
}
- curve = lwgeom_getcurve_inspected(inspected, i);
+ curve = lwgeom_getcircstring_inspected(inspected, i);
if (curve != NULL)
{
npoints += curve->points->npoints;
uchar newtypefl;
LWPOINT *point = NULL;
LWLINE *line = NULL;
- LWCURVE *curve = NULL;
+ LWCIRCSTRING *curve = NULL;
LWPOLY *poly = NULL;
POINTARRAY newpts;
POINTARRAY **nrings;
return;
}
- if ( type == CURVETYPE )
+ if ( type == CIRCSTRINGTYPE )
{
- curve = lwcurve_deserialize(serialized);
+ curve = lwcircstring_deserialize(serialized);
- LWDEBUGF(3, "lwgeom_force2d_recursize: it's a curve with %d points", curve->points->npoints);
+ LWDEBUGF(3, "lwgeom_force2d_recursize: it's a circularstring with %d points", curve->points->npoints);
TYPE_SETZM(newpts.dims, 0, 0);
newpts.npoints = curve->points->npoints;
}
curve->points = &newpts;
TYPE_SETZM(curve->type, 0, 0);
- lwcurve_serialize_buf(curve, optr, retsize);
+ lwcircstring_serialize_buf(curve, optr, retsize);
lwfree(newpts.serialized_pointlist);
lwfree(curve);
return;
int type;
LWPOINT *point = NULL;
LWLINE *line = NULL;
- LWCURVE *curve = NULL;
+ LWCIRCSTRING *curve = NULL;
LWPOLY *poly = NULL;
POINTARRAY newpts;
POINTARRAY **nrings;
return;
}
- if ( type == CURVETYPE )
+ if ( type == CIRCSTRINGTYPE )
{
- curve = lwcurve_deserialize(serialized);
+ curve = lwcircstring_deserialize(serialized);
- LWDEBUG(3, "lwgeom_force3dz_recursize: it's a curve");
+ LWDEBUG(3, "lwgeom_force3dz_recursize: it's a circularstring");
TYPE_SETZM(newpts.dims, 1, 0);
newpts.npoints = curve->points->npoints;
}
curve->points = &newpts;
TYPE_SETZM(curve->type, 1, 0);
- lwcurve_serialize_buf(curve, optr, retsize);
+ lwcircstring_serialize_buf(curve, optr, retsize);
- LWDEBUGF(3, "lwgeom_force3dz_recursive: it's a curve, size:%d", *retsize);
+ LWDEBUGF(3, "lwgeom_force3dz_recursive: it's a circularstring, size:%d", *retsize);
return;
}
uchar newtypefl;
LWPOINT *point = NULL;
LWLINE *line = NULL;
- LWCURVE *curve = NULL;
+ LWCIRCSTRING *curve = NULL;
LWPOLY *poly = NULL;
POINTARRAY newpts;
POINTARRAY **nrings;
return;
}
- if ( type == CURVETYPE )
+ if ( type == CIRCSTRINGTYPE )
{
- curve = lwcurve_deserialize(serialized);
+ curve = lwcircstring_deserialize(serialized);
- LWDEBUGF(3, "lwgeom_force3dm_recursize: it's a curve with %d points", curve->points->npoints);
+ LWDEBUGF(3, "lwgeom_force3dm_recursize: it's a circularstring with %d points", curve->points->npoints);
TYPE_SETZM(newpts.dims, 0, 1);
newpts.npoints = curve->points->npoints;
}
curve->points = &newpts;
TYPE_SETZM(curve->type, 0, 1);
- lwcurve_serialize_buf(curve, optr, retsize);
+ lwcircstring_serialize_buf(curve, optr, retsize);
lwfree(newpts.serialized_pointlist);
lwfree(curve);
return;
int type;
LWPOINT *point = NULL;
LWLINE *line = NULL;
- LWCURVE *curve = NULL;
+ LWCIRCSTRING *curve = NULL;
LWPOLY *poly = NULL;
POINTARRAY newpts;
POINTARRAY **nrings;
return;
}
- if ( type == CURVETYPE )
+ if ( type == CIRCSTRINGTYPE )
{
- curve = lwcurve_deserialize(serialized);
+ curve = lwcircstring_deserialize(serialized);
TYPE_SETZM(newpts.dims, 1, 1);
newpts.npoints = curve->points->npoints;
newpts.serialized_pointlist = lwalloc(sizeof(POINT4D)*curve->points->npoints);
}
curve->points = &newpts;
TYPE_SETZM(curve->type, 1, 1);
- lwcurve_serialize_buf(curve, optr, retsize);
+ lwcircstring_serialize_buf(curve, optr, retsize);
- LWDEBUGF(3, "lwgeom_force4d_recursive: it's a curve, size:%d", *retsize);
+ LWDEBUGF(3, "lwgeom_force4d_recursive: it's a circularstring, size:%d", *retsize);
return;
}
LWLINE *line=NULL;
LWPOINT *point=NULL;
LWPOLY *poly=NULL;
- LWCURVE *curve=NULL;
+ LWCIRCSTRING *curve=NULL;
uchar *subgeom=NULL;
point = lwgeom_getpoint_inspected(inspected, i);
continue;
}
- curve = lwgeom_getcurve_inspected(inspected, i);
+ curve = lwgeom_getcircstring_inspected(inspected, i);
if (curve != NULL)
{
lwgeom_affine_ptarray(curve->points,
static int32 lwgeom_numpoints_linestring_recursive(const uchar *serialized);
static int32 lwgeom_dimension_recursive(const uchar *serialized);
char line_is_closed(LWLINE *line);
-char curve_is_closed(LWCURVE *curve);
+char circstring_is_closed(LWCIRCSTRING *curve);
char compound_is_closed(LWCOMPOUND *compound);
/*------------------------------------------------------------------*/
strcpy(result,"MULTIPOINT");
else if (type == LINETYPE)
strcpy(result,"LINESTRING");
- else if (type == CURVETYPE)
+ else if (type == CIRCSTRINGTYPE)
strcpy(result,"CIRCULARSTRING");
else if (type == COMPOUNDTYPE)
strcpy(result, "COMPOUNDCURVE");
/* elog(NOTICE, "GeometryN called"); */
/* call is valid on multi* geoms only */
- if (type==POINTTYPE || type==LINETYPE || type==CURVETYPE ||
+ if (type==POINTTYPE || type==LINETYPE || type==CIRCSTRINGTYPE ||
type==COMPOUNDTYPE || type==POLYGONTYPE || type==CURVEPOLYTYPE)
{
/* elog(NOTICE, "geometryn: geom is of type %d, requires >=4", type); */
if ( type == POINTTYPE ) dims = 0;
else if ( type == MULTIPOINTTYPE ) dims=0;
else if ( type == LINETYPE ) dims=1;
- else if ( type == CURVETYPE ) dims=1;
+ else if ( type == CIRCSTRINGTYPE ) dims=1;
else if ( type == COMPOUNDTYPE ) dims=1;
else if ( type == MULTILINETYPE ) dims=1;
else if ( type == MULTICURVETYPE ) dims=1;
int32 wanted_index;
LWGEOM_INSPECTED *inspected;
LWLINE *line = NULL;
- LWCURVE *curve = NULL;
+ LWCIRCSTRING *curve = NULL;
LWGEOM *tmp = NULL;
POINTARRAY *pts;
LWPOINT *point;
{
tmp = lwgeom_getgeom_inspected(inspected, i);
if (lwgeom_getType(tmp->type) == LINETYPE ||
- lwgeom_getType(tmp->type) == CURVETYPE)
+ lwgeom_getType(tmp->type) == CIRCSTRINGTYPE)
break;
}
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_NULL();
}
- if(lwgeom_getType(tmp->type) == CURVETYPE)
+ if(lwgeom_getType(tmp->type) == CIRCSTRINGTYPE)
{
- curve = (LWCURVE *)tmp;
+ curve = (LWCIRCSTRING *)tmp;
if(wanted_index > curve->points->npoints)
{
lwinspected_release(inspected);
return 1;
}
-char curve_is_closed(LWCURVE *curve)
+char circstring_is_closed(LWCIRCSTRING *curve)
{
POINT3DZ sp, ep;
- LWDEBUG(2, "curve_is_closed called.");
+ LWDEBUG(2, "circstring_is_closed called.");
getPoint3dz_p(curve->points, 0, &sp);
getPoint3dz_p(curve->points, curve->points->npoints-1, &ep);
}
else
{
- getPoint3dz_p(((LWCURVE *)tmp)->points, 0, &sp);
+ getPoint3dz_p(((LWCIRCSTRING *)tmp)->points, 0, &sp);
}
tmp = compound->geoms[compound->ngeoms - 1];
}
else
{
- getPoint3dz_p(((LWCURVE *)tmp)->points, ((LWCURVE *)tmp)->points->npoints - 1, &ep);
+ getPoint3dz_p(((LWCIRCSTRING *)tmp)->points, ((LWCIRCSTRING *)tmp)->points->npoints - 1, &ep);
}
if(sp.x != ep.x) return 0;
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_BOOL(FALSE);
}
- else if(lwgeom_getType(sub->type) == CURVETYPE &&
- !curve_is_closed((LWCURVE *)sub))
+ else if(lwgeom_getType(sub->type) == CIRCSTRINGTYPE &&
+ !circstring_is_closed((LWCIRCSTRING *)sub))
{
lwgeom_release(sub);
lwinspected_release(inspected);
LWLINE *line=NULL;
LWPOINT *point=NULL;
LWPOLY *poly=NULL;
- LWCURVE *curve=NULL;
+ LWCIRCSTRING *curve=NULL;
POINT4D p;
uchar *subgeom=NULL;
continue;
}
- curve = lwgeom_getcurve_inspected(inspected, j);
+ curve = lwgeom_getcircstring_inspected(inspected, j);
if (curve != NULL)
{
POINTARRAY *pts = curve->points;