[postgis-commits] svn - r3268 - branches/1.3/lwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Nov 7 03:41:24 PST 2008
Author: mcayland
Date: 2008-11-07 03:41:23 -0800 (Fri, 07 Nov 2008)
New Revision: 3268
Modified:
branches/1.3/lwgeom/liblwgeom.h
branches/1.3/lwgeom/lwgeom_api.c
Log:
Add missing lwgeom_getcurve_inspected() function which is required for some of the latest GBT fixes.
Modified: branches/1.3/lwgeom/liblwgeom.h
===================================================================
--- branches/1.3/lwgeom/liblwgeom.h 2008-11-07 07:44:08 UTC (rev 3267)
+++ branches/1.3/lwgeom/liblwgeom.h 2008-11-07 11:41:23 UTC (rev 3268)
@@ -1197,6 +1197,7 @@
extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
extern void pfree_curve(LWCURVE *curve);
LWCURVE *lwcurve_clone(const LWCURVE *curve);
+LWCURVE *lwgeom_getcurve_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
/******************************************************************
* LWMULTIx and LWCOLLECTION functions
Modified: branches/1.3/lwgeom/lwgeom_api.c
===================================================================
--- branches/1.3/lwgeom/lwgeom_api.c 2008-11-07 07:44:08 UTC (rev 3267)
+++ branches/1.3/lwgeom/lwgeom_api.c 2008-11-07 11:41:23 UTC (rev 3268)
@@ -1188,8 +1188,30 @@
/*
* 1st geometry has geom_number = 0
+ * if the actual geometry isnt a CIRCULARSTRING, null is returned (see _gettype()).
* 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)
+{
+ uchar *sub_geom;
+ uchar type;
+
+ sub_geom = lwgeom_getsubgeometry_inspected(inspected, geom_number);
+
+ if (sub_geom == NULL) return NULL;
+
+ type = lwgeom_getType(sub_geom[0]);
+ if (type != CURVETYPE) return NULL;
+
+ return lwcurve_deserialize(sub_geom);
+}
+
+/*
+ * 1st geometry has geom_number = 0
+ * if there arent enough geometries, return null.
+ */
LWGEOM *lwgeom_getgeom_inspected(LWGEOM_INSPECTED *inspected, int geom_number)
{
uchar *sub_geom;
More information about the postgis-commits
mailing list