[Mapserver-dev] New msCloneLayerObj() function

Daniel Morissette morissette at dmsolutions.ca
Mon Feb 17 13:54:45 EST 2003


We are thinking of adding a new function to mapfile.c (and MapScript) to
initialize a new layer by creating a clone of an existing layer.  This
would allow us to easily make copies of layers inside a single mapObj,
or to copy layers from one mapObj to another.

The C function prototype would be:

  int msCloneLayerObj(mapObj *target_map, layerObj *src_layer);

which would create a new layer inside target_map which is a copy of

In PHP MapScript, the function ms_newMapObj() would be extended to take
an optional second argument that would be the layer to clone:

 layerObj ms_newLayerObj(mapObj target_map [,layerObj layer_to_clone])

I don't think SWIG allows for optional arguments like we use in PHP, so
we would have to expose a separate function for msCloneLayerObj() in the
SWIG'd MapScript.

Is that OK with you?  Any suggestions, comments?

 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/

More information about the mapserver-dev mailing list