[postgis-commits] svn - r3270 - branches/1.3/lwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Nov 7 04:25:32 PST 2008
Author: mcayland
Date: 2008-11-07 04:25:30 -0800 (Fri, 07 Nov 2008)
New Revision: 3270
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 11:47:12 UTC (rev 3269)
+++ branches/1.3/lwgeom/liblwgeom.h 2008-11-07 12:25:30 UTC (rev 3270)
@@ -1198,6 +1198,7 @@
extern void pfree_curve(LWCURVE *curve);
LWCURVE *lwcurve_clone(const LWCURVE *curve);
LWCURVE *lwgeom_getcurve_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
+LWCURVEPOLY *lwgeom_getcurvepoly_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 11:47:12 UTC (rev 3269)
+++ branches/1.3/lwgeom/lwgeom_api.c 2008-11-07 12:25:30 UTC (rev 3270)
@@ -1210,8 +1210,30 @@
/*
* 1st geometry has geom_number = 0
+ * if the actual geometry isnt a CURVEPOLYGON, null is returned (see _gettype()).
* if there arent enough geometries, return null.
+ * this is fine to call on a curvepolygon
*/
+LWCURVEPOLY *
+lwgeom_getcurvepoly_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 != CURVEPOLYTYPE) return NULL;
+
+ return lwcurvepoly_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