[ms4w-users] Problem with layer ordering

Russell H. DeGrove russell at goisc.com
Mon Sep 25 16:39:41 EDT 2006

I am trying to change the order layers are rendered in.  I'm using SWIG for C#. 
Code is as follows 
// "mObj" is a mapObject. 
// "list" is a list of "Layer" objects which aren't layerObjs but which do reference layerObj names
// "list" is in the order I want, and when this code is reached I've verified that every Layer in "list" has a corresponding layerObj in mObj
        intarray arr = new intarray( list.Count );
        int arrIndex = 0;
        bool hasDiff = false;

        foreach ( Layer reqLay in list )
            // find the layer object by the request layer's ID
            layerObj lObj = mObj.getLayerByName( reqLay.ID );
            if ( lObj == null )
                throw new ApplicationException( "SetLayerOrdering must not be called until new layers are merged into the map state." );
            // is layer order different from the original order
            if ( arrIndex != lObj.index )
                hasDiff = true;
            // add the index to the intarray
            arr.setitem( arrIndex++, lObj.index );
        // set drawing order if any differences are found
        if ( hasDiff )
            mObj.setLayersDrawingOrder( arr.cast() );
I can step through the code and see that  mObj.setLayersDrawingOrder gets called when there are changes but the subsequent map rendering does not reflect the change in ordering.  Can anyone suggest what I might be doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ms4w-users/attachments/20060925/8ec01035/attachment.html

More information about the ms4w-users mailing list