[mapserver-commits] r7574 - trunk/mapserver/mapscript/php3
svn at osgeo.org
svn at osgeo.org
Mon May 12 09:59:02 EDT 2008
Author: Assefa
Date: 2008-05-12 09:59:02 -0400 (Mon, 12 May 2008)
New Revision: 7574
Modified:
trunk/mapserver/mapscript/php3/README
trunk/mapserver/mapscript/php3/mapscript_i.c
trunk/mapserver/mapscript/php3/php_mapscript.c
trunk/mapserver/mapscript/php3/php_mapscript.h
Log:
Add insertLayer function (#762)
Modified: trunk/mapserver/mapscript/php3/README
===================================================================
--- trunk/mapserver/mapscript/php3/README 2008-05-09 13:33:55 UTC (rev 7573)
+++ trunk/mapserver/mapscript/php3/README 2008-05-12 13:59:02 UTC (rev 7574)
@@ -576,6 +576,10 @@
using the msIO services (ie. ms_ioinstallstdouttobuffer() and
ms_iogetstdoutbufferstring())
+ int insertLayer( layerObj layer [, int nIndex=-1 ] )
+ Insert a copy of *layer* into the Map at index *nIndex*. The default
+ value of *nIndex* is -1, which means the last possible index. Returns
+ the index of the new Layer, or -1 in the case of a failure.
LayerObj Class:
---------------
@@ -885,6 +889,7 @@
Returns MS_TRUE/MS_FALSE depending on whether the layer is
currently visible in the map (i.e. turned on, in scale, etc.).
+
ClassObj Class:
---------------
Modified: trunk/mapserver/mapscript/php3/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php3/mapscript_i.c 2008-05-09 13:33:55 UTC (rev 7573)
+++ trunk/mapserver/mapscript/php3/mapscript_i.c 2008-05-12 13:59:02 UTC (rev 7574)
@@ -335,6 +335,14 @@
return msOWSDispatch( self, req, TRUE);
}
+int mapObj_insertLayer(mapObj *self, layerObj *layer, int index)
+{
+ if (self && layer)
+ return msInsertLayer(self, layer, index);
+
+ return -1;
+}
+
/**********************************************************************
* class extensions for layerObj, always within the context of a map
**********************************************************************/
Modified: trunk/mapserver/mapscript/php3/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.c 2008-05-09 13:33:55 UTC (rev 7573)
+++ trunk/mapserver/mapscript/php3/php_mapscript.c 2008-05-12 13:59:02 UTC (rev 7574)
@@ -168,6 +168,8 @@
DLEXPORT void php3_ms_map_loadOWSParameters(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_map_OWSDispatch(INTERNAL_FUNCTION_PARAMETERS);
+DLEXPORT void php3_ms_map_insertLayer(INTERNAL_FUNCTION_PARAMETERS);
+
DLEXPORT void php3_ms_img_saveImage(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_img_saveWebImage(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_img_pasteImage(INTERNAL_FUNCTION_PARAMETERS);
@@ -696,6 +698,7 @@
{"applyconfigoptions", php3_ms_map_applyConfigOptions, NULL},
{"loadowsparameters", php3_ms_map_loadOWSParameters, NULL},
{"owsdispatch", php3_ms_map_OWSDispatch, NULL},
+ {"insertlayer", php3_ms_map_insertLayer, NULL},
{NULL, NULL, NULL}
};
@@ -5986,10 +5989,75 @@
}
+
+
+/**********************************************************************
+ * map->insertLayer(layerobj)
+ *
+ **********************************************************************/
+
+/* {{{ proto int map.insertLayer(layerObj layer, index)
+ Returns the index where the layer had been inserted*/
+
+DLEXPORT void php3_ms_map_insertLayer(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *pLyrIndex, *pLyr, *pThis;
+ mapObj *self=NULL;
+ layerObj *poLayer=NULL;
+ int nLyrIndex = -1, iReturn=-1;
+ int nArgs;
+
+#ifdef PHP4
+ HashTable *list=NULL;
+#endif
+ nArgs = ARG_COUNT(ht);
+
+#ifdef PHP4
+ pThis = getThis();
+#else
+ getThis(&pThis);
+#endif
+
+ if (pThis == NULL ||
+ (nArgs != 1 && nArgs != 2) ||
+ getParameters(ht, nArgs, &pLyr, &pLyrIndex) == FAILURE)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+
+ if (nArgs == 2)
+ {
+ convert_to_long(pLyrIndex);
+ nLyrIndex = pLyrIndex->value.lval;
+ }
+
+ self = (mapObj *)_phpms_fetch_handle(pThis, PHPMS_GLOBAL(le_msmap),
+ list TSRMLS_CC);
+ poLayer = (layerObj *)_phpms_fetch_handle(pLyr,
+ PHPMS_GLOBAL(le_mslayer),
+ list TSRMLS_CC);
+
+ if (self == NULL || poLayer == NULL ||
+ (iReturn = mapObj_insertLayer(self, poLayer, nLyrIndex) ) < 0)
+ {
+ _phpms_report_mapserver_error(E_ERROR);
+ }
+
+ /* Update mapObj members */
+ _phpms_set_property_long(pThis, "numlayers",
+ self->numlayers, E_ERROR TSRMLS_CC);
+
+
+ /* Return layer object */
+ RETURN_LONG(iReturn);
+}
/* }}} */
+/* }}} */
+
/*=====================================================================
* PHP function wrappers - image class
*====================================================================*/
Modified: trunk/mapserver/mapscript/php3/php_mapscript.h
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.h 2008-05-09 13:33:55 UTC (rev 7573)
+++ trunk/mapserver/mapscript/php3/php_mapscript.h 2008-05-12 13:59:02 UTC (rev 7574)
@@ -126,6 +126,7 @@
int mapObj_loadOWSParameters(mapObj *self, cgiRequestObj *request,
char *wmtver_string);
int mapObj_OWSDispatch(mapObj *self, cgiRequestObj *req );
+int mapObj_insertLayer(mapObj *self, layerObj *layer, int index);
layerObj *layerObj_new(mapObj *map);
void layerObj_destroy(layerObj* self);
More information about the mapserver-commits
mailing list