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

svn at osgeo.org svn at osgeo.org
Mon Apr 4 12:42:42 EDT 2011


Author: aboudreault
Date: 2011-04-04 09:42:42 -0700 (Mon, 04 Apr 2011)
New Revision: 11455

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapscript/php/Makefile.in
   trunk/mapserver/mapscript/php/Makefile.vc
   trunk/mapserver/mapscript/php/mapscript_i.c
   trunk/mapserver/mapscript/php/php_mapscript.c
   trunk/mapserver/mapscript/php/php_mapscript.h
   trunk/mapserver/mapserver.h
Log:
Updated PHP/MapScript for MS RFC 69: clustering. (#3700)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/HISTORY.TXT	2011-04-04 16:42:42 UTC (rev 11455)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk): 
 ---------------------------- 
 
+- Updated PHP/MapScript for MS RFC 69: clustering. (#3700)
+
 - Move allocation of cgiRequestObj paramNames/Values to msAllocCgiObj() (#1888)
 
 - Add support for simple aggregates for the cluster layer attributes (#3700)

Modified: trunk/mapserver/mapscript/php/Makefile.in
===================================================================
--- trunk/mapserver/mapscript/php/Makefile.in	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapscript/php/Makefile.in	2011-04-04 16:42:42 UTC (rev 11455)
@@ -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 result.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 cluster.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-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapscript/php/Makefile.vc	2011-04-04 16:42:42 UTC (rev 11455)
@@ -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 result.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 cluster.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/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php/mapscript_i.c	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapscript/php/mapscript_i.c	2011-04-04 16:42:42 UTC (rev 11455)
@@ -1540,3 +1540,45 @@
     return r;
 }
 
+/**********************************************************************
+ * class extensions clusterObj
+ **********************************************************************/
+
+clusterObj *clusterObj_new() {
+    clusterObj *c = (clusterObj *) msSmallMalloc(sizeof(clusterObj));
+    initCluster(c);
+    return c;
+}
+
+void clusterObj_destroy(clusterObj *self)
+{
+    freeCluster(self);
+}
+
+int clusterObj_updateFromString(clusterObj *self, char *snippet) {
+    return msUpdateClusterFromString(self, snippet);
+}
+
+int clusterObj_setGroup(clusterObj *self, char *string) {
+    if (!string || strlen(string) == 0) {
+        freeExpression(&self->group);
+        return MS_SUCCESS;
+    }
+    else return msLoadExpressionString(&self->group, string);
+}
+
+char *clusterObj_getGroupString(clusterObj *self) {
+    return msGetExpressionString(&(self->group));
+  }
+
+int clusterObj_setFilter(clusterObj *self, char *string) {
+    if (!string || strlen(string) == 0) {
+        freeExpression(&self->filter);
+        return MS_SUCCESS;
+    }
+    else return msLoadExpressionString(&self->filter, string);
+}
+
+char *clusterObj_getFilterString(clusterObj *self) {
+    return msGetExpressionString(&(self->filter));
+  }

Modified: trunk/mapserver/mapscript/php/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript.c	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapscript/php/php_mapscript.c	2011-04-04 16:42:42 UTC (rev 11455)
@@ -1221,6 +1221,7 @@
     PHP_MINIT(line)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(shape)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(shapefile)(INIT_FUNC_ARGS_PASSTHRU);
+    PHP_MINIT(cluster)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(layer)(INIT_FUNC_ARGS_PASSTHRU);
     PHP_MINIT(map)(INIT_FUNC_ARGS_PASSTHRU);
 

Modified: trunk/mapserver/mapscript/php/php_mapscript.h
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript.h	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapscript/php/php_mapscript.h	2011-04-04 16:42:42 UTC (rev 11455)
@@ -324,6 +324,13 @@
     mapObj *map;
 } php_map_object;
 
+typedef struct _php_cluster_object {
+    zend_object std;
+    parent_object parent;
+    int is_ref;
+    clusterObj *cluster;
+} php_cluster_object;
+
 /* Lifecyle functions*/
 PHP_MINIT_FUNCTION(mapscript);
 PHP_MINFO_FUNCTION(mapscript);
@@ -359,6 +366,7 @@
 PHP_MINIT_FUNCTION(shapefile);
 PHP_MINIT_FUNCTION(layer);
 PHP_MINIT_FUNCTION(map);
+PHP_MINIT_FUNCTION(cluster);
 
 /* mapscript functions */
 PHP_FUNCTION(ms_GetVersion);
@@ -423,6 +431,7 @@
 extern zend_class_entry *mapscript_ce_owsrequest;
 extern zend_class_entry *mapscript_ce_layer;
 extern zend_class_entry *mapscript_ce_map;
+extern zend_class_entry *mapscript_ce_cluster;
 
 /* PHP Object constructors */
 extern zend_object_value mapscript_object_new(zend_object *zobj, zend_class_entry *ce,
@@ -464,6 +473,7 @@
 extern void mapscript_create_shapefile(shapefileObj *shapefile, zval *return_value TSRMLS_DC);
 extern void mapscript_create_layer(layerObj *layer, parent_object parent, zval *return_value TSRMLS_DC);
 extern void mapscript_create_map(mapObj *map, zval *return_value TSRMLS_DC);
+extern void mapscript_create_cluster(clusterObj *cluster, parent_object php_parent, zval *return_value TSRMLS_DC);
 
 /* Exported functions for PHP Mapscript API */
 /* throw a MapScriptException */
@@ -763,4 +773,12 @@
 
 resultObj *resultObj_new();
 
+clusterObj* clusterObj_new();
+void clusterObj_destroy(clusterObj *self);
+int clusterObj_updateFromString(clusterObj *self, char *snippet);
+int clusterObj_setGroup(clusterObj *self, char *string);
+char *clusterObj_getGroupString(clusterObj *self);
+int clusterObj_setFilter(clusterObj *self, char *string);
+char *clusterObj_getFilterString(clusterObj *self);
+
 #endif /* PHP_MAPSCRIPT_H */

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2011-04-04 16:35:49 UTC (rev 11454)
+++ trunk/mapserver/mapserver.h	2011-04-04 16:42:42 UTC (rev 11455)
@@ -1761,6 +1761,8 @@
 MS_DLL_EXPORT int msUpdateScalebarFromString(scalebarObj *scalebar, char *string, int url_string);
 MS_DLL_EXPORT int msUpdateQueryMapFromString(queryMapObj *querymap, char *string, int url_string);
 MS_DLL_EXPORT int msUpdateLabelFromString(labelObj *label, char *string);
+MS_DLL_EXPORT void initCluster(clusterObj *cluster);
+MS_DLL_EXPORT void freeCluster(clusterObj *cluster);
 MS_DLL_EXPORT int msUpdateClusterFromString(clusterObj *cluster, char *string);
 MS_DLL_EXPORT int msUpdateReferenceMapFromString(referenceMapObj *ref, char *string, int url_string);
 MS_DLL_EXPORT int msUpdateLegendFromString(legendObj *legend, char *string, int url_string);



More information about the mapserver-commits mailing list