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

svn at osgeo.org svn at osgeo.org
Fri Mar 12 11:54:50 EST 2010


Author: aboudreault
Date: 2010-03-12 11:54:49 -0500 (Fri, 12 Mar 2010)
New Revision: 9940

Modified:
   trunk/mapserver/MIGRATION_GUIDE.TXT
   trunk/mapserver/mapscript/php/README
   trunk/mapserver/mapscript/php/class.c
   trunk/mapserver/mapscript/php/map.c
   trunk/mapserver/mapscript/php/mapscript_i.c
   trunk/mapserver/mapscript/php/outputformat.c
   trunk/mapserver/mapscript/php/symbol.c
Log:
Added PHP/MapScript changes in MIGRATION_GUIDE.TXT

Modified: trunk/mapserver/MIGRATION_GUIDE.TXT
===================================================================
--- trunk/mapserver/MIGRATION_GUIDE.TXT	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/MIGRATION_GUIDE.TXT	2010-03-12 16:54:49 UTC (rev 9940)
@@ -7,13 +7,80 @@
 to 6.0 (i.e. backwards incompatibilities), as well as information
 on some of the new features.
 
---------------
-PHP MapScript
---------------
+---------------------
+PHP MapScript Changes
+---------------------
 
-* All deprecated class properties have been removed.
-  See mapscript/php3/README for the list.
+* PHP 5.2.0 or more recent is required.
+* PHP/MapScript now uses exceptions for error report. All errors are catchable.
+* Object properties can be set like all other php object. ie. myObj->myProperty = 10;
+  
+  NOTE: The set/setProperty methods are still available. 
 
+* All object constructors throw an exception on failure
+* Objects can be created with the php "new" operator. ie.
+  $myShape = ms_newShapeObj(MS_SHAPE_LINE); // or
+  $myShape = new shapeObj(MS_SHAPE_LINE);
+
+  NOTE: "ms_newSymbolObj()" and "new symbolObj" are different:
+        - ms_newSymbolObj() returns the id of the new/existing symbol.
+        - new symbolObj() returns the symbolObj. You don't need to 
+                          get it with getSymbolObjectById().
+
+* Class properties that have been removed
+
+  - mapObj: imagequality, interlace, scale, transparent
+  - classObj: maxscale, minscale
+  - layerObj: labelsizeitem, labelangleitem, labelmaxscale, labelminscale, 
+              maxscale, minscale, symbolscale, transparency
+  - legendObj: interlace, transparent
+  - scalebarObj: interlace, transparent
+  - symbolObj: gap, stylelength
+  - webObj: minscale, maxscale
+  - mapObj: imagetype
+  
+* Class methods that have been removed
+
+  - projectionObj: free
+  - lineObj: free
+  - pointObj: free
+  - rectObj: free
+  - shapeObj: free, union_geos
+  - symbolObj: free, getstylearray
+  - imageObj: free
+  - outputFormatObj: getformatoption, setformatoption
+  - shapefileObj: free
+  - layerObj: getFilter, getShape
+
+* referenceMapObj has new properties: marker, markername, markersize, maxboxsize, minboxsize
+* labelCacheObj has a new function: freeCache(). free() is an alias to this function.
+* shapeFileObj is automatically closed/writed on destroy. (At the end of the script or with an explicit unset())
+* layerObj->clearProcessing() method now returns void.
+* mapObj->queryByIndex(): default behavior for the addToQuery parameter was not ok, now it is.
+
+* Methods that now return MS_SUCCESS/MS_FAILURE:
+  
+  - symbolObj: setPoints, setPattern
+  - scalebarObj: setImageColor
+  - outputFormatObj: validate
+  - layerObj: setProcessing, addFeature, draw
+  - mapObj: moveLayerUp, moveLayerDown, zoomRectangle, zoomScale, setProjection,
+            setWKTProjection, setLayersDrawingOrder
+
+* Methods that now return NULL on failure:
+
+  - classObj: clone
+  - styleObj: clone  
+  - layerObj: nextShape, getExtent
+  - mapObj: clone, draw, drawQuery getLayerByName, getProjection, 
+            processTemplate, processQueryTemplate, processLegendTemplate
+
+* Methods that now return an empty array 
+
+  - symbolObj: getPatternArray
+  - layerObj: getItems, getProcessing, getGridIntersectionCoordinates
+  - mapObj: getLayersIndexByGroup, getAllGroupNames, getLayersDrawingOrder getAllLayerNames
+  
 ------------
 OUTPUTFORMAT
 ------------

Modified: trunk/mapserver/mapscript/php/README
===================================================================
--- trunk/mapserver/mapscript/php/README	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/README	2010-03-12 16:54:49 UTC (rev 9940)
@@ -1,42 +1,2 @@
 Please see the PHP MapScript documentation at: 
-http://www.mapserver.org/mapscript/php/index.html
-
---------------------------------------------------------------------
-In MapServer 6.0, the following class properties have been removed
---------------------------------------------------------------------
-
-mapObj
--------
- imagequality
- interlace
- scale
- transparent
-
-classObj
----------
- maxscale
- minscale
-
-layerObj
----------
- labelmaxscale
- labelminscale
- maxscale
- minscale
- symbolscale
- transparency
-
-legendObj
-----------
- interlace
- transparent
-
-scalebarObj
-------------
- interlace
- transparent
-
-symbolObj
-----------
- gap
- stylelength
\ No newline at end of file
+http://www.mapserver.org/mapscript/php/index.html
\ No newline at end of file

Modified: trunk/mapserver/mapscript/php/class.c
===================================================================
--- trunk/mapserver/mapscript/php/class.c	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/class.c	2010-03-12 16:54:49 UTC (rev 9940)
@@ -626,7 +626,6 @@
     php_class = (php_class_object *) zend_object_store_get_object(zobj TSRMLS_CC);
     php_layer = (php_layer_object *) zend_object_store_get_object(php_class->layer TSRMLS_CC);
     
-
     if (!php_layer->map)
     {
         mapscript_throw_exception("No map object associated with this class object." TSRMLS_CC);

Modified: trunk/mapserver/mapscript/php/map.c
===================================================================
--- trunk/mapserver/mapscript/php/map.c	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/map.c	2010-03-12 16:54:49 UTC (rev 9940)
@@ -1416,9 +1416,9 @@
                               &zgeoRefExtent , mapscript_ce_rect,
                               &zmaxGeoRefExtent , mapscript_ce_rect) == FAILURE) {
         PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
-return;
+        return;
     }
-PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
+    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
     
     php_map = (php_map_object *) zend_object_store_get_object(zobj TSRMLS_CC);
     php_pixelExtent = (php_rect_object *) zend_object_store_get_object(zpixelExtent TSRMLS_CC);
@@ -2511,7 +2511,7 @@
 }
 /* }}} */
 
-/* {{{ proto int map.getLayersDrawingOrder(array_layer_index)
+/* {{{ proto int map.setLayersDrawingOrder(array_layer_index)
    Set the array used for the drawing order. 
    array_layers_index : an array containing all the layer's index ordered
                         by the drawing priority.
@@ -2521,7 +2521,7 @@
                             array[2] = 1
                             will set the darwing order to layer 2, layer 0,
                             and then layer 1.
-   Return TRUE on success or FALSE.
+   Return MS_SUCCESS on success or MS_FAILURE.
    Note : the first element in the array is the one drawn first.*/
 PHP_METHOD(mapObj, setLayersDrawingOrder)
 {

Modified: trunk/mapserver/mapscript/php/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php/mapscript_i.c	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/mapscript_i.c	2010-03-12 16:54:49 UTC (rev 9940)
@@ -1256,7 +1256,7 @@
 void shapefileObj_destroy(shapefileObj *self) {
     msShapefileClose(self);
     free(self);  
-  }
+}
 
 int shapefileObj_get(shapefileObj *self, int i, shapeObj *shape) {
     if(i<0 || i>=self->numshapes)

Modified: trunk/mapserver/mapscript/php/outputformat.c
===================================================================
--- trunk/mapserver/mapscript/php/outputformat.c	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/outputformat.c	2010-03-12 16:54:49 UTC (rev 9940)
@@ -195,10 +195,13 @@
     php_outputformat = (php_outputformat_object *) zend_object_store_get_object(zobj TSRMLS_CC);
 
     status = msOutputFormatValidate(php_outputformat->outputformat, MS_TRUE);
-    if (status != MS_SUCCESS)
+    if (status != MS_TRUE)
+    {
         mapscript_report_mapserver_error(E_WARNING TSRMLS_CC);
-        
-    RETURN_LONG(status);
+        RETURN_LONG(MS_FAILURE);
+    }
+    else
+        RETURN_LONG(MS_SUCCESS);
 }
 /* }}} */
 

Modified: trunk/mapserver/mapscript/php/symbol.c
===================================================================
--- trunk/mapserver/mapscript/php/symbol.c	2010-03-11 20:21:46 UTC (rev 9939)
+++ trunk/mapserver/mapscript/php/symbol.c	2010-03-12 16:54:49 UTC (rev 9940)
@@ -255,14 +255,15 @@
 
     php_symbol = (php_symbol_object *) zend_object_store_get_object(zobj TSRMLS_CC);
 
-    if (php_symbol->symbol->numpoints < 0)
-        RETURN_FALSE;
+    array_init(return_value);
 
-    array_init(return_value);
-    for (index=0; index < php_symbol->symbol->numpoints; index++)
+    if (php_symbol->symbol->numpoints > 0)
     {
-        add_next_index_double(return_value, php_symbol->symbol->points[index].x);
-        add_next_index_double(return_value, php_symbol->symbol->points[index].y);
+        for (index=0; index < php_symbol->symbol->numpoints; index++)
+        {
+            add_next_index_double(return_value, php_symbol->symbol->points[index].x);
+            add_next_index_double(return_value, php_symbol->symbol->points[index].y);
+        }
     }
 }
 /* }}} */
@@ -329,16 +330,17 @@
         return;
     }
     PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
-
+    
     php_symbol = (php_symbol_object *) zend_object_store_get_object(zobj TSRMLS_CC);
-
-    if (php_symbol->symbol->patternlength < 0)
-        RETURN_FALSE;
-
+    
     array_init(return_value);
-    for (index=0; index < php_symbol->symbol->patternlength; index++)
+    
+    if (php_symbol->symbol->patternlength > 0)
     {
-        add_next_index_long(return_value, php_symbol->symbol->pattern[index]);
+        for (index=0; index < php_symbol->symbol->patternlength; index++)
+        {
+            add_next_index_long(return_value, php_symbol->symbol->pattern[index]);
+        }
     }
 }
 /* }}} */



More information about the mapserver-commits mailing list