[mapserver-commits] r7717 - trunk/mapserver/mapscript/php3

svn at osgeo.org svn at osgeo.org
Thu Jun 19 22:42:51 EDT 2008


Author: Assefa
Date: 2008-06-19 22:42:51 -0400 (Thu, 19 Jun 2008)
New Revision: 7717

Modified:
   trunk/mapserver/mapscript/php3/README
   trunk/mapserver/mapscript/php3/php_mapscript.c
Log:
Add setbounds function on a shape object #2501

Modified: trunk/mapserver/mapscript/php3/README
===================================================================
--- trunk/mapserver/mapscript/php3/README	2008-06-20 02:31:17 UTC (rev 7716)
+++ trunk/mapserver/mapscript/php3/README	2008-06-20 02:42:51 UTC (rev 7717)
@@ -1430,6 +1430,12 @@
    string toWkt()
         Returns WKT representation of the shape's geometry.
 
+   int setBounds()    
+    Updates the bounds property of the shape.
+    Must be called to calculate new bounding box after new parts have been
+    added.   Returns true if successful. Else return false.
+
+  
  RectObj Class:
  --------------
 

Modified: trunk/mapserver/mapscript/php3/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.c	2008-06-20 02:31:17 UTC (rev 7716)
+++ trunk/mapserver/mapscript/php3/php_mapscript.c	2008-06-20 02:42:51 UTC (rev 7717)
@@ -276,6 +276,7 @@
 DLEXPORT void php3_ms_shape_getvalue(INTERNAL_FUNCTION_PARAMETERS);
 DLEXPORT void php3_ms_shape_getpointusingmeasure(INTERNAL_FUNCTION_PARAMETERS);
 DLEXPORT void php3_ms_shape_getmeasureusingpoint(INTERNAL_FUNCTION_PARAMETERS);
+DLEXPORT void php3_ms_shape_setbounds(INTERNAL_FUNCTION_PARAMETERS);
 
 /*geos related functions*/
 DLEXPORT void php3_ms_shape_buffer(INTERNAL_FUNCTION_PARAMETERS);
@@ -869,6 +870,7 @@
     {"towkt",           php3_ms_shape_towkt,            NULL},
     {"free",            php3_ms_shape_free,             NULL},
     {"getlabelpoint",   php3_ms_shape_getlabelpoint,    NULL},
+    {"setbounds",       php3_ms_shape_setbounds,    NULL},
     {NULL, NULL, NULL}
 };
 
@@ -12048,7 +12050,55 @@
 }
 /* }}} */
 
+/**********************************************************************
+ *                        shape->setbounds()
+ **********************************************************************/
 
+/* {{{ proto int shape.project(projectionObj in, projectionObj out)
+   calculate new bounding . Returns MS_SUCCESS/MS_FAILURE*/
+
+DLEXPORT void php3_ms_shape_setbounds(INTERNAL_FUNCTION_PARAMETERS)
+{
+  pval                *pThis;
+    shapeObj            *self;
+    int                 status=MS_FAILURE;
+
+    HashTable   *list=NULL;
+    pval   **pBounds;
+
+
+    pThis = getThis();
+
+    if (pThis == NULL)
+      RETURN_FALSE;
+
+    self = (shapeObj *)_phpms_fetch_handle2(pThis, 
+                                            PHPMS_GLOBAL(le_msshape_ref),
+                                            PHPMS_GLOBAL(le_msshape_new),
+                                            list TSRMLS_CC);
+    if (self == NULL)
+      RETURN_FALSE;
+
+    shapeObj_setBounds(self);
+   
+
+    if (zend_hash_find(Z_OBJPROP_P(pThis), "bounds", 
+                       sizeof("bounds"), (void *)&pBounds) == SUCCESS)
+    {
+        _phpms_set_property_double((*pBounds),"minx", self->bounds.minx, 
+                                   E_ERROR TSRMLS_CC);
+        _phpms_set_property_double((*pBounds),"miny", self->bounds.miny, 
+                                   E_ERROR TSRMLS_CC);
+        _phpms_set_property_double((*pBounds),"maxx", self->bounds.maxx, 
+                                   E_ERROR TSRMLS_CC);
+        _phpms_set_property_double((*pBounds),"maxy", self->bounds.maxy, 
+                                   E_ERROR TSRMLS_CC);
+    }
+    
+    RETURN_TRUE;
+}
+/* }}} */
+
 /*=====================================================================
  *                 PHP function wrappers - webObj class
  *====================================================================*/



More information about the mapserver-commits mailing list