[geos-commits] r4004 - in trunk: . php php/test
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Sep 15 09:09:56 PDT 2014
Author: strk
Date: 2014-09-15 09:09:56 -0700 (Mon, 15 Sep 2014)
New Revision: 4004
Modified:
trunk/NEWS
trunk/php/geos.c
trunk/php/test/test.php
Log:
Expose Geometry->normalize() method in PHP binding
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2014-09-15 14:29:02 UTC (rev 4003)
+++ trunk/NEWS 2014-09-15 16:09:56 UTC (rev 4004)
@@ -3,6 +3,7 @@
- New things:
- Voronoi API (#627)
+ - PHP: Geometry->normalize method
- GEOS_USE_ONLY_R_API macro support (#695)
...
Modified: trunk/php/geos.c
===================================================================
--- trunk/php/geos.c 2014-09-15 14:29:02 UTC (rev 4003)
+++ trunk/php/geos.c 2014-09-15 16:09:56 UTC (rev 4004)
@@ -198,6 +198,7 @@
PHP_METHOD(Geometry, relate);
PHP_METHOD(Geometry, relateBoundaryNodeRule);
PHP_METHOD(Geometry, simplify); /* also does topology-preserving */
+PHP_METHOD(Geometry, normalize);
PHP_METHOD(Geometry, extractUniquePoints);
PHP_METHOD(Geometry, disjoint);
PHP_METHOD(Geometry, touches);
@@ -262,6 +263,7 @@
PHP_ME(Geometry, relate, NULL, 0)
PHP_ME(Geometry, relateBoundaryNodeRule, NULL, 0)
PHP_ME(Geometry, simplify, NULL, 0)
+ PHP_ME(Geometry, normalize, NULL, 0)
PHP_ME(Geometry, extractUniquePoints, NULL, 0)
PHP_ME(Geometry, disjoint, NULL, 0)
PHP_ME(Geometry, touches, NULL, 0)
@@ -1008,6 +1010,27 @@
}
/**
+ * GEOSGeometry GEOSGeometry::normalize()
+ */
+PHP_METHOD(Geometry, normalize)
+{
+ GEOSGeometry *this;
+ GEOSGeometry *ret;
+
+ this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
+
+ ret = GEOSGeom_clone(this);
+
+ if ( ! ret ) RETURN_NULL();
+
+ GEOSNormalize(ret); /* exception should be gotten automatically */
+
+ /* return_value is a zval */
+ object_init_ex(return_value, Geometry_ce_ptr);
+ setRelay(return_value, ret);
+}
+
+/**
* GEOSGeometry GEOSGeometry::extractUniquePoints()
*/
PHP_METHOD(Geometry, extractUniquePoints)
Modified: trunk/php/test/test.php
===================================================================
--- trunk/php/test/test.php 2014-09-15 14:29:02 UTC (rev 4003)
+++ trunk/php/test/test.php 2014-09-15 16:09:56 UTC (rev 4004)
@@ -2047,8 +2047,8 @@
$b = $g->voronoiDiagram();
$this->assertEquals(
-'GEOMETRYCOLLECTION (POLYGON ((50 200, 200 200, 200 50, 50 50, 50 200)), POLYGON ((-100 50, -100 200, 50 200, 50 50, -100 50)), POLYGON ((50 -100, -100 -100, -100 50, 50 50, 50 -100)), POLYGON ((200 50, 200 -100, 50 -100, 50 50, 200 50)))'
- , $writer->write($b));
+'GEOMETRYCOLLECTION (POLYGON ((50 50, 50 200, 200 200, 200 50, 50 50)), POLYGON ((50 -100, 50 50, 200 50, 200 -100, 50 -100)), POLYGON ((-100 50, -100 200, 50 200, 50 50, -100 50)), POLYGON ((-100 -100, -100 50, 50 50, 50 -100, -100 -100)))'
+ , $writer->write($b->normalize()));
$b = $g->voronoiDiagram(0, 1);
$this->assertEquals(
More information about the geos-commits
mailing list