[geos-commits] r3054 - in trunk/php: . test
svn_geos at osgeo.org
svn_geos at osgeo.org
Sun Jun 20 21:49:22 EDT 2010
Author: strk
Date: 2010-06-21 01:49:22 +0000 (Mon, 21 Jun 2010)
New Revision: 3054
Modified:
trunk/php/geos.c
trunk/php/test/test.php
Log:
coordinateDimension()
Modified: trunk/php/geos.c
===================================================================
--- trunk/php/geos.c 2010-06-21 01:46:52 UTC (rev 3053)
+++ trunk/php/geos.c 2010-06-21 01:49:22 UTC (rev 3054)
@@ -214,6 +214,7 @@
PHP_METHOD(Geometry, exteriorRing);
PHP_METHOD(Geometry, numCoordinates);
PHP_METHOD(Geometry, dimension);
+PHP_METHOD(Geometry, coordinateDimension);
static function_entry Geometry_methods[] = {
PHP_ME(Geometry, __construct, NULL, 0)
@@ -262,6 +263,7 @@
PHP_ME(Geometry, exteriorRing, NULL, 0)
PHP_ME(Geometry, numCoordinates, NULL, 0)
PHP_ME(Geometry, dimension, NULL, 0)
+ PHP_ME(Geometry, coordinateDimension, NULL, 0)
{NULL, NULL, NULL}
};
@@ -1746,7 +1748,23 @@
RETURN_LONG(ret);
}
+/**
+ * long GEOSGeometry::coordinateDimension()
+ */
+PHP_METHOD(Geometry, coordinateDimension)
+{
+ GEOSGeometry *geom;
+ long int ret;
+ geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
+
+ ret = GEOSGeom_getCoordinateDimension(geom);
+ if ( ret == -1 ) RETURN_NULL(); /* should get an exception first */
+
+ RETURN_LONG(ret);
+}
+
+
/* ------ Initialization / Deinitialization / Meta ------------------ */
/* per-module initialization */
Modified: trunk/php/test/test.php
===================================================================
--- trunk/php/test/test.php 2010-06-21 01:46:52 UTC (rev 3053)
+++ trunk/php/test/test.php 2010-06-21 01:49:22 UTC (rev 3054)
@@ -1566,4 +1566,16 @@
$this->assertEquals(2, $g->dimension());
}
+ public function testGeometry_coordinateDimension()
+ {
+ $reader = new GEOSWKTReader();
+
+ $g = $reader->read('POINT(0 0)');
+ $this->assertEquals(2, $g->coordinateDimension());
+
+ $g = $reader->read('POINT(0 0 0)');
+ $this->assertEquals(3, $g->coordinateDimension());
+
+ }
+
}
More information about the geos-commits
mailing list