[postgis-commits] svn - r3275 - trunk/liblwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Nov 7 06:05:53 PST 2008
Author: mcayland
Date: 2008-11-07 06:05:53 -0800 (Fri, 07 Nov 2008)
New Revision: 3275
Modified:
trunk/liblwgeom/liblwgeom.h
trunk/liblwgeom/lwgeom_api.c
Log:
Add missing lwgeom_getcurve_inspected() function which is required for some of the latest GBT fixes.
Modified: trunk/liblwgeom/liblwgeom.h
===================================================================
--- trunk/liblwgeom/liblwgeom.h 2008-11-07 13:54:21 UTC (rev 3274)
+++ trunk/liblwgeom/liblwgeom.h 2008-11-07 14:05:53 UTC (rev 3275)
@@ -1281,6 +1281,7 @@
extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
extern void pfree_curve(LWCURVE *curve);
LWCURVE *lwcurve_clone(const LWCURVE *curve);
+extern LWCURVE *lwgeom_getcurve_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
/******************************************************************
* LWMULTIx and LWCOLLECTION functions
Modified: trunk/liblwgeom/lwgeom_api.c
===================================================================
--- trunk/liblwgeom/lwgeom_api.c 2008-11-07 13:54:21 UTC (rev 3274)
+++ trunk/liblwgeom/lwgeom_api.c 2008-11-07 14:05:53 UTC (rev 3275)
@@ -1153,8 +1153,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