[prev in list] [next in list] [prev in thread] [next in thread]
List: geos-commits
Subject: [geos-commits] r3051 - in trunk/php: . test
From: svn_geos () osgeo ! org
Date: 2010-06-21 1:39:50
Message-ID: 20100621013950.291E93906E0 () trac ! osgeo ! org
[Download RAW message or body]
Author: strk
Date: 2010-06-21 01:39:50 +0000 (Mon, 21 Jun 2010)
New Revision: 3051
Modified:
trunk/php/geos.c
trunk/php/test/test.php
Log:
exteriorRing
Modified: trunk/php/geos.c
===================================================================
--- trunk/php/geos.c 2010-06-21 01:36:53 UTC (rev 3050)
+++ trunk/php/geos.c 2010-06-21 01:39:50 UTC (rev 3051)
@@ -211,6 +211,7 @@
PHP_METHOD(Geometry, getX);
PHP_METHOD(Geometry, getY);
PHP_METHOD(Geometry, interiorRingN);
+PHP_METHOD(Geometry, exteriorRing);
static function_entry Geometry_methods[] = {
PHP_ME(Geometry, __construct, NULL, 0)
@@ -256,6 +257,7 @@
PHP_ME(Geometry, getX, NULL, 0)
PHP_ME(Geometry, getY, NULL, 0)
PHP_ME(Geometry, interiorRingN, NULL, 0)
+ PHP_ME(Geometry, exteriorRing, NULL, 0)
{NULL, NULL, NULL}
};
@@ -1687,8 +1689,28 @@
setRelay(return_value, cc);
}
+/**
+ * GEOSGeometry GEOSGeometry::exteriorRing()
+ */
+PHP_METHOD(Geometry, exteriorRing)
+{
+ GEOSGeometry *geom;
+ const GEOSGeometry *c;
+ GEOSGeometry *cc;
+ geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
+ c = GEOSGetExteriorRing(geom);
+ if ( ! c ) RETURN_NULL(); /* should get an exception first */
+ cc = GEOSGeom_clone(c);
+ if ( ! cc ) RETURN_NULL(); /* should get an exception first */
+
+ object_init_ex(return_value, Geometry_ce_ptr);
+ setRelay(return_value, cc);
+}
+
+
+
/* ------ Initialization / Deinitialization / Meta ------------------ */
/* per-module initialization */
Modified: trunk/php/test/test.php
===================================================================
--- trunk/php/test/test.php 2010-06-21 01:36:53 UTC (rev 3050)
+++ trunk/php/test/test.php 2010-06-21 01:39:50 UTC (rev 3051)
@@ -1465,4 +1465,27 @@
}
+ public function testGeometry_exteriorRing()
+ {
+ $reader = new GEOSWKTReader();
+ $writer = new GEOSWKTWriter();
+ $writer->setRoundingPrecision(0);
+
+ $g = $reader->read('POLYGON (
+ (10 10, 10 14, 14 14, 14 10, 10 10),
+ (11 11, 11 12, 12 12, 12 11, 11 11))');
+ $r = $g->exteriorRing();
+ $this->assertEquals('LINEARRING (10 10, 10 14, 14 14, 14 10, 10 10)',
+ $writer->write($r) );
+
+ $g = $reader->read('POINT (0 0)');
+ try {
+ $g->exteriorRing(0);
+ $this->assertTrue( FALSE );
+ } catch (Exception $e) {
+ $this->assertContains( 'Polygon', $e->getMessage() );
+ }
+
+ }
+
}
_______________________________________________
geos-commits mailing list
geos-commits@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic