[mapserver-commits] r8390 - in trunk/mapserver: . mapscript/php3

svn at osgeo.org svn at osgeo.org
Tue Jan 6 11:50:51 EST 2009


Author: aboudreault
Date: 2009-01-06 11:50:51 -0500 (Tue, 06 Jan 2009)
New Revision: 8390

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapscript/php3/php_mapscript.c
Log:
Expose Map/Layer's Projection objects in PHP/MapScript (#2845)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-01-06 15:27:12 UTC (rev 8389)
+++ trunk/mapserver/HISTORY.TXT	2009-01-06 16:50:51 UTC (rev 8390)
@@ -12,6 +12,8 @@
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
 
+- Expose Map/Layer's Projection objects in PHP/MapScript (#2845)
+
 - Added getUnits() methods to projectionObj in Mapscript (#2798)
 
 - Improved Tag parsing in template code. (#2781)

Modified: trunk/mapserver/mapscript/php3/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.c	2009-01-06 15:27:12 UTC (rev 8389)
+++ trunk/mapserver/mapscript/php3/php_mapscript.c	2009-01-06 16:50:51 UTC (rev 8390)
@@ -1603,6 +1603,11 @@
     _phpms_add_property_object(return_value, "latlon", new_obj_ptr, E_ERROR TSRMLS_CC);
 
     MAKE_STD_ZVAL(new_obj_ptr);  /* Alloc and Init a ZVAL for new object */
+    _phpms_build_projection_object(&(pMap->projection), PHPMS_GLOBAL(le_msprojection_ref),
+                                   list,  new_obj_ptr TSRMLS_CC);
+    _phpms_add_property_object(return_value, "projection", new_obj_ptr, E_ERROR TSRMLS_CC);
+
+    MAKE_STD_ZVAL(new_obj_ptr);  /* Alloc and Init a ZVAL for new object */
     _phpms_build_outputformat_object(pMap->outputformat, list, new_obj_ptr TSRMLS_CC);
     _phpms_add_property_object(return_value, "outputformat", new_obj_ptr, E_ERROR TSRMLS_CC);
 
@@ -1993,7 +1998,8 @@
     rectObj             sRect;
     int                 bSetNewExtents = 0; 
     int                 bSetUnitsAndExtents = 0;
-    pval                **pExtent;
+    pval                **pExtent, *new_obj_ptr;
+    HashTable           *list=NULL;
     
 
     convert_to_string(pProjString);
@@ -2029,7 +2035,16 @@
 
     if (nStatus == -1)
         _phpms_report_mapserver_error(E_ERROR);
-
+    else
+    { /* update the php projection object */
+       zend_hash_del(Z_OBJPROP_P(pThis), "projection", 
+                      sizeof("projection"));
+      
+       MAKE_STD_ZVAL(new_obj_ptr);  /* Alloc and Init a ZVAL for new object */
+       _phpms_build_projection_object(&(self->projection), PHPMS_GLOBAL(le_msprojection_ref),
+                                      list,  new_obj_ptr TSRMLS_CC);
+                                      _phpms_add_property_object(pThis, "projection", new_obj_ptr, E_ERROR TSRMLS_CC);
+    }
     
     nUnits = GetMapserverUnitUsingProj(&(self->projection));
     if (nUnits != -1 && bSetUnitsAndExtents)
@@ -6632,6 +6647,11 @@
     PHPMS_ADD_PROP_STR(return_value,  "requires",   player->requires);
     PHPMS_ADD_PROP_STR(return_value,  "labelrequires", player->labelrequires);
 
+    MAKE_STD_ZVAL(new_obj_ptr); 
+    _phpms_build_projection_object(&(player->projection), PHPMS_GLOBAL(le_msprojection_ref),
+                                   list,  new_obj_ptr TSRMLS_CC);
+    _phpms_add_property_object(return_value, "projection", new_obj_ptr, E_ERROR TSRMLS_CC);
+
     MAKE_STD_ZVAL(new_obj_ptr);
     _phpms_build_color_object(&(player->offsite),list, new_obj_ptr TSRMLS_CC);
     _phpms_add_property_object(return_value, "offsite", new_obj_ptr, E_ERROR TSRMLS_CC);
@@ -7342,19 +7362,11 @@
 {
     layerObj *self;
     pval   *pProjString;
-    pval   *pThis;
+    pval   *pThis, *new_obj_ptr;
     int     nStatus = 0;
-
-
-#ifdef PHP4
     HashTable   *list=NULL;
-#endif
 
-#ifdef PHP4
     pThis = getThis();
-#else
-    getThis(&pThis);
-#endif
 
     if (pThis == NULL ||
         getParameters(ht, 1, &pProjString) != SUCCESS)
@@ -7376,6 +7388,16 @@
                                           pProjString->value.str.val)) == -1)
         _phpms_report_mapserver_error(E_ERROR);
 
+    /* update the php projection object */
+    zend_hash_del(Z_OBJPROP_P(pThis), "projection", 
+                  sizeof("projection"));
+    
+    MAKE_STD_ZVAL(new_obj_ptr);  /* Alloc and Init a ZVAL for new object */
+    _phpms_build_projection_object(&(self->projection), PHPMS_GLOBAL(le_msprojection_ref),
+                                   list,  new_obj_ptr TSRMLS_CC);
+    _phpms_add_property_object(pThis, "projection", new_obj_ptr, E_ERROR TSRMLS_CC);
+    
+
     RETURN_LONG(nStatus);
 }
 /* }}} */
@@ -7392,18 +7414,11 @@
 {
     layerObj *self;
     pval   *pProjString;
-    pval   *pThis;
+    pval   *pThis, *new_obj_ptr;
     int     nStatus = 0;
-
-#ifdef PHP4
     HashTable   *list=NULL;
-#endif
 
-#ifdef PHP4
     pThis = getThis();
-#else
-    getThis(&pThis);
-#endif
 
     if (pThis == NULL ||
         getParameters(ht, 1, &pProjString) != SUCCESS)
@@ -7425,6 +7440,15 @@
                                           pProjString->value.str.val)) == -1)
         _phpms_report_mapserver_error(E_ERROR);
 
+    /* update the php projection object */
+    zend_hash_del(Z_OBJPROP_P(pThis), "projection", 
+                  sizeof("projection"));
+    
+    MAKE_STD_ZVAL(new_obj_ptr);  /* Alloc and Init a ZVAL for new object */
+    _phpms_build_projection_object(&(self->projection), PHPMS_GLOBAL(le_msprojection_ref),
+                                   list,  new_obj_ptr TSRMLS_CC);
+    _phpms_add_property_object(pThis, "projection", new_obj_ptr, E_ERROR TSRMLS_CC);
+
     RETURN_LONG(nStatus);
 }
 /* }}} */



More information about the mapserver-commits mailing list