[mapserver-commits] r11643 - in trunk/mapserver: . mapscript/php

svn at osgeo.org svn at osgeo.org
Wed May 4 12:17:09 EDT 2011


Author: aboudreault
Date: 2011-05-04 09:17:09 -0700 (Wed, 04 May 2011)
New Revision: 11643

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapscript/php/layer.c
Log:
PHP/Mapscript: Added getResultsBounds in layer object (#2967)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-05-03 21:27:29 UTC (rev 11642)
+++ trunk/mapserver/HISTORY.TXT	2011-05-04 16:17:09 UTC (rev 11643)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk): 
 ---------------------------- 
 
+- PHP/Mapscript: Added getResultsBounds() method in layer object (#2967)
+
 - Fix SLD containing a PropertyIsLike filter (#3855)
 
 - Fixed msUnionLayerNextShape to return correct values (#3859)  

Modified: trunk/mapserver/mapscript/php/layer.c
===================================================================
--- trunk/mapserver/mapscript/php/layer.c	2011-05-03 21:27:29 UTC (rev 11642)
+++ trunk/mapserver/mapscript/php/layer.c	2011-05-04 16:17:09 UTC (rev 11643)
@@ -944,6 +944,33 @@
 }
 /* }}} */
 
+/* {{{ proto int layer.getResultsBounds()
+   Returns the bounds of results from this layer in the last query. */
+PHP_METHOD(layerObj, getResultsBounds)
+{
+    zval *zobj = getThis();
+    php_layer_object *php_layer;
+    parent_object parent;
+
+    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
+    if (zend_parse_parameters_none() == FAILURE) {
+        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
+        return;
+    }
+    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
+    
+    php_layer = (php_layer_object *) zend_object_store_get_object(zobj TSRMLS_CC);
+
+    if (!php_layer->layer->resultcache)
+        RETURN_NULL();
+
+    /* Return result object */
+    MAPSCRIPT_MAKE_PARENT(zobj, NULL);
+    mapscript_create_rect(&(php_layer->layer->resultcache->bounds), 
+                          parent, return_value TSRMLS_CC);
+}
+/* }}} */
+
 /* {{{ proto int layer.getResult(int i)
    Returns a resultObj by index from a layer object.*/  
 PHP_METHOD(layerObj, getResult)
@@ -1925,6 +1952,7 @@
     PHP_ME(layerObj, getProjection, NULL, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, setWKTProjection, layer_setWKTProjection_args, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, getNumResults, NULL, ZEND_ACC_PUBLIC)
+    PHP_ME(layerObj, getResultsBounds, NULL, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, getResult, layer_getResult_args, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, open, NULL, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, whichShapes, layer_whichShapes_args, ZEND_ACC_PUBLIC)



More information about the mapserver-commits mailing list