[mapserver-commits] r10964 - trunk/mapserver/mapscript/php

svn at osgeo.org svn at osgeo.org
Mon Feb 7 12:26:59 EST 2011


Author: aboudreault
Date: 2011-02-07 09:26:59 -0800 (Mon, 07 Feb 2011)
New Revision: 10964

Modified:
   trunk/mapserver/mapscript/php/Makefile.in
   trunk/mapserver/mapscript/php/Makefile.vc
   trunk/mapserver/mapscript/php/layer.c
   trunk/mapserver/mapscript/php/map.c
   trunk/mapserver/mapscript/php/mapscript_i.c
   trunk/mapserver/mapscript/php/php_mapscript.c
   trunk/mapserver/mapscript/php/php_mapscript.h
   trunk/mapserver/mapscript/php/php_mapscript_util.c
Log:
Fixed PHP/MapScript for RFC 65 changes (#3647)

Modified: trunk/mapserver/mapscript/php/Makefile.in
===================================================================
--- trunk/mapserver/mapscript/php/Makefile.in	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/Makefile.in	2011-02-07 17:26:59 UTC (rev 10964)
@@ -79,7 +79,7 @@
 
 all: php_mapscript.so
 
-PHPMS_CLASS_OBJS =  mapscript_error.o color.o rect.o hashtable.o web.o grid.o error.o referencemap.o querymap.o outputformat.o scalebar.o label.o legend.o symbol.o style.o image.o class.o projection.o line.o shape.o shapefile.o point.o labelcache.o labelcachemember.o resultcachemember.o owsrequest.o layer.o map.o
+PHPMS_CLASS_OBJS =  mapscript_error.o color.o rect.o hashtable.o web.o grid.o error.o referencemap.o querymap.o outputformat.o scalebar.o label.o legend.o symbol.o style.o image.o class.o projection.o line.o shape.o shapefile.o point.o labelcache.o labelcachemember.o result.o owsrequest.o layer.o map.o
 PHPMS_OBJS =  php_mapscript_util.o $(PHPMS_CLASS_OBJS) php_mapscript.o mapscript_i.o $(PHP_REGEX_OBJ)
 
 PHPPROJ_OBJS = php_mapscript_util.o php_proj.o $(PHP_REGEX_OBJ)

Modified: trunk/mapserver/mapscript/php/Makefile.vc
===================================================================
--- trunk/mapserver/mapscript/php/Makefile.vc	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/Makefile.vc	2011-02-07 17:26:59 UTC (rev 10964)
@@ -52,7 +52,7 @@
 # The rest of the file should not have to be edited...
 #
 
-PHPMS_CLASS_OBJS =  mapscript_error.obj color.obj rect.obj hashtable.obj web.obj grid.obj error.obj referencemap.obj querymap.obj outputformat.obj scalebar.obj label.obj legend.obj symbol.obj style.obj image.obj class.obj projection.obj line.obj shape.obj shapefile.obj point.obj labelcache.obj labelcachemember.obj resultcachemember.obj owsrequest.obj layer.obj map.obj
+PHPMS_CLASS_OBJS =  mapscript_error.obj color.obj rect.obj hashtable.obj web.obj grid.obj error.obj referencemap.obj querymap.obj outputformat.obj scalebar.obj label.obj legend.obj symbol.obj style.obj image.obj class.obj projection.obj line.obj shape.obj shapefile.obj point.obj labelcache.obj labelcachemember.obj result.obj owsrequest.obj layer.obj map.obj
 
 PHPMS_OBJS =  php_mapscript_util.obj $(PHPMS_CLASS_OBJS) php_mapscript.obj mapscript_i.obj
 

Modified: trunk/mapserver/mapscript/php/layer.c
===================================================================
--- trunk/mapserver/mapscript/php/layer.c	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/layer.c	2011-02-07 17:26:59 UTC (rev 10964)
@@ -174,9 +174,8 @@
   ZEND_ARG_INFO(0, mode)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(layer_resultsGetShape_args, 0, 0, 1)
-  ZEND_ARG_INFO(0, shapeindex)
-  ZEND_ARG_INFO(0, tileindex)
+ZEND_BEGIN_ARG_INFO_EX(layer_getShape_args, 0, 0, 1)
+  ZEND_ARG_OBJ_INFO(0, record, resultObj, 0)
 ZEND_END_ARG_INFO()
 
 /* {{{ proto void __construct(mapObj map [, layerObj layer]) 
@@ -935,12 +934,12 @@
 /* }}} */
 
 /* {{{ proto int layer.getResult(int i)
-   Returns a resultCacheMemberObj by index from a layer object.*/  
+   Returns a resultObj by index from a layer object.*/  
 PHP_METHOD(layerObj, getResult)
 {
     zval *zobj = getThis();
     long index;
-    resultCacheMemberObj *resultcachemember = NULL;
+    resultObj *result = NULL;
     php_layer_object *php_layer;
 
     PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
@@ -953,16 +952,16 @@
     
     php_layer = (php_layer_object *) zend_object_store_get_object(zobj TSRMLS_CC);
 
-    if ((resultcachemember = layerObj_getResult(php_layer->layer, index)) == NULL)
+    if ((result = layerObj_getResult(php_layer->layer, index)) == NULL)
     {
         mapscript_throw_exception("Invalid result index." TSRMLS_CC);
         return;
     }
 
-    /* Return resultcachemember object */
+    /* Return result object */
     MAPSCRIPT_MAKE_PARENT(zobj, NULL);
-    mapscript_create_resultcachemember(&(php_layer->layer->resultcache->results[index]), 
-                                       parent, return_value TSRMLS_CC);
+    mapscript_create_result(&(php_layer->layer->resultcache->results[index]), 
+                            parent, return_value TSRMLS_CC);
 }
 /* }}} */
 
@@ -1868,26 +1867,27 @@
 }
 /* }}} */
 
-/* {{{ proto shapeObj layer.resultsGetShape(shapeindex, [tileindex])
+/* {{{ proto shapeObj layer.getShape(record)
    Retrieve shapeObj from a resultset by index. */
-PHP_METHOD(layerObj, resultsGetShape)
+PHP_METHOD(layerObj, getShape)
 {
     zval *zobj = getThis();
-    long shapeindex, tileindex = -1;
+    zval *zresult;
     shapeObj *shape = NULL;
+    php_result_object *php_result;
     php_layer_object *php_layer;
 
     PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
-    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
-                              &shapeindex, &tileindex) == FAILURE) {
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O",
+                              &zresult, mapscript_ce_result) == 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);
+    php_result = (php_result_object *) zend_object_store_get_object(zresult TSRMLS_CC);
 
-
     /* Create a new shapeObj to hold the result 
      * Note that the type used to create the shape (MS_NULL) does not matter
      * at this point since it will be set by SHPReadShape().
@@ -1898,7 +1898,7 @@
         return;
     }
 
-    if (msLayerResultsGetShape(php_layer->layer, shape, tileindex, shapeindex) != MS_SUCCESS)
+    if (msLayerGetShape(php_layer->layer, shape, php_result->result) != MS_SUCCESS)
     {
         shapeObj_destroy(shape);
         mapscript_throw_mapserver_exception("" TSRMLS_CC);
@@ -1983,7 +1983,7 @@
     PHP_ME(layerObj, isVisible, NULL, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, setConnectionType, layer_setConnectionType_args, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, getGridIntersectionCoordinates, NULL, ZEND_ACC_PUBLIC)
-    PHP_ME(layerObj, resultsGetShape, layer_resultsGetShape_args, ZEND_ACC_PUBLIC)
+    PHP_ME(layerObj, getShape, layer_getShape_args, ZEND_ACC_PUBLIC)
     PHP_ME(layerObj, free, NULL, ZEND_ACC_PUBLIC)
     {NULL, NULL, NULL}
 };

Modified: trunk/mapserver/mapscript/php/map.c
===================================================================
--- trunk/mapserver/mapscript/php/map.c	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/map.c	2011-02-07 17:26:59 UTC (rev 10964)
@@ -317,7 +317,7 @@
     PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
 
     php_map = (php_map_object *)zend_object_store_get_object(zobj TSRMLS_CC);
-    
+
     map = mapObj_new(filename, path);
 
     if (map == NULL)

Modified: trunk/mapserver/mapscript/php/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php/mapscript_i.c	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/mapscript_i.c	2011-02-07 17:26:59 UTC (rev 10964)
@@ -46,9 +46,9 @@
  **********************************************************************/
 mapObj *mapObj_new(char *filename, char *new_path) {
     if(filename && strlen(filename))
-      return msLoadMap(filename, new_path);
+        return msLoadMap(filename, new_path);
     else { /* create an empty map, no layers etc... */
-      return msNewMapObj();
+        return msNewMapObj();
     } 
 }
 
@@ -482,12 +482,7 @@
     msLayerClose(self);
   }
 
-int layerObj_getShape(layerObj *self, shapeObj *shape, 
-                      int tileindex, int shapeindex) {
-    return msLayerGetShape(self, shape, tileindex, shapeindex);
-  }
-
-resultCacheMemberObj *layerObj_getResult(layerObj *self, int i) {
+resultObj *layerObj_getResult(layerObj *self, int i) {
     if(!self->resultcache) return NULL;
 
     if(i >= 0 && i < self->resultcache->numresults)

Modified: trunk/mapserver/mapscript/php/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript.c	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/php_mapscript.c	2011-02-07 17:26:59 UTC (rev 10964)
@@ -1208,7 +1208,7 @@
     PHP_MINIT(projection)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(labelcachemember)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(labelcache)(INIT_FUNC_ARGS_PASSTHRU);
-    PHP_MINIT(resultcachemember)(INIT_FUNC_ARGS_PASSTHRU);
+    PHP_MINIT(result)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(scalebar)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(owsrequest)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(point)(INIT_FUNC_ARGS_PASSTHRU);

Modified: trunk/mapserver/mapscript/php/php_mapscript.h
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript.h	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/php_mapscript.h	2011-02-07 17:26:59 UTC (rev 10964)
@@ -275,11 +275,11 @@
     labelCacheMemberObj *labelcachemember;
 } php_labelcachemember_object;
 
-typedef struct _php_resultcachemember_object {
+typedef struct _php_result_object {
     zend_object std;
     parent_object parent;
-    resultCacheMemberObj *resultcachemember;
-} php_resultcachemember_object;
+    resultObj *result;
+} php_result_object;
 
 typedef struct _php_scalebar_object {
     zend_object std;
@@ -348,7 +348,7 @@
 PHP_MINIT_FUNCTION(projection);
 PHP_MINIT_FUNCTION(labelcachemember);
 PHP_MINIT_FUNCTION(labelcache);
-PHP_MINIT_FUNCTION(resultcachemember);
+PHP_MINIT_FUNCTION(result);
 PHP_MINIT_FUNCTION(scalebar);
 PHP_MINIT_FUNCTION(owsrequest);
 PHP_MINIT_FUNCTION(point);
@@ -418,7 +418,7 @@
 extern zend_class_entry *mapscript_ce_shapefile;
 extern zend_class_entry *mapscript_ce_labelcachemember;
 extern zend_class_entry *mapscript_ce_labelcache;
-extern zend_class_entry *mapscript_ce_resultcachemember;
+extern zend_class_entry *mapscript_ce_result;
 extern zend_class_entry *mapscript_ce_scalebar;
 extern zend_class_entry *mapscript_ce_owsrequest;
 extern zend_class_entry *mapscript_ce_layer;
@@ -444,8 +444,8 @@
                                               parent_object parent, zval *return_value TSRMLS_DC);
 extern void mapscript_create_labelcache(labelCacheObj *labelcache, 
                                               parent_object parent, zval *return_value TSRMLS_DC);
-extern void mapscript_create_resultcachemember(resultCacheMemberObj *resultcachemember, 
-                                               parent_object parent, zval *return_value TSRMLS_DC);
+extern void mapscript_create_result(resultObj *result, 
+                                    parent_object parent, zval *return_value TSRMLS_DC);
 extern void mapscript_create_scalebar(scalebarObj *scalebar, parent_object parent, zval *return_value TSRMLS_DC);
 extern void mapscript_create_owsrequest(cgiRequestObj *cgirequest, zval *return_value TSRMLS_DC);
 extern void mapscript_create_image(imageObj *image, zval *return_value TSRMLS_DC);
@@ -506,7 +506,7 @@
 int              mapObj_queryByIndex(mapObj *self, int qlayer, 
                                      int tileindex, int shapeindex,
                                      int bAddToQuery);
-int             mapObj_saveQuery(mapObj *self, char *filename);
+int             mapObj_saveQuery(mapObj *self, char *filename, int results);
 int             mapObj_loadQuery(mapObj *self, char *filename);
 
 int             mapObj_setWKTProjection(mapObj *self, char *string);
@@ -563,7 +563,7 @@
 void            layerObj_close(layerObj *self);
 int             layerObj_getShape(layerObj *self, shapeObj *shape,
                                   int tileindex, int shapeindex);
-resultCacheMemberObj *layerObj_getResult(layerObj *self, int i);
+resultObj *layerObj_getResult(layerObj *self, int i);
 classObj       *layerObj_getClass(layerObj *self, int i);
 int             layerObj_getClassIndex(layerObj *self, shapeObj *shape, double scaledenom, int *classgroup, int numclasses);
 int             layerObj_draw(layerObj *self, mapObj *map, imageObj *img);

Modified: trunk/mapserver/mapscript/php/php_mapscript_util.c
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript_util.c	2011-02-07 17:05:57 UTC (rev 10963)
+++ trunk/mapserver/mapscript/php/php_mapscript_util.c	2011-02-07 17:26:59 UTC (rev 10964)
@@ -124,8 +124,8 @@
         mapscript_create_labelcachemember((labelCacheMemberObj*)internal_object, p, *php_object_storage TSRMLS_CC);
     else if (ce == mapscript_ce_labelcache)
         mapscript_create_labelcache((labelCacheObj*)internal_object, p, *php_object_storage TSRMLS_CC);
-    else if (ce == mapscript_ce_resultcachemember)
-        mapscript_create_resultcachemember((resultCacheMemberObj*)internal_object, p, *php_object_storage TSRMLS_CC);
+    else if (ce == mapscript_ce_result)
+        mapscript_create_result((resultObj*)internal_object, p, *php_object_storage TSRMLS_CC);
     else if (ce == mapscript_ce_scalebar)
         mapscript_create_scalebar((scalebarObj*)internal_object, p, *php_object_storage TSRMLS_CC);
     else if (ce == mapscript_ce_web)



More information about the mapserver-commits mailing list