<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML DIR=ltr><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"></HEAD><BODY><DIV><FONT face='Arial' color=#000000 size=2>I am trying to change the order layers are rendered
in. I'm using SWIG for C#. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Code is as follows </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>// "mObj" is a mapObject. </FONT></DIV>
<DIV><FONT face=Arial size=2>// "list" is a list of "Layer" objects which aren't
layerObjs but which do reference layerObj names</FONT></DIV>
<DIV><FONT face=Arial size=2>// "list" is in the order I want, and
when this code is reached I've verified that every Layer in "list" has a
corresponding</FONT><FONT face=Arial size=2> layerObj in mObj</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>
intarray arr = new intarray( list.Count
);<BR> int arrIndex =
0;<BR> bool hasDiff =
false;</FONT></DIV><FONT face="Courier New" size=2>
<DIV><BR> foreach ( Layer reqLay in
list )<BR>
{<BR> // find
the layer object by the request layer's
ID<BR>
layerObj lObj = mObj.getLayerByName( reqLay.ID
);<BR> if (
lObj == null
)<BR>
{<BR>
throw new ApplicationException( "SetLayerOrdering must not be called until new
layers are merged into the map state."
);<BR> }</DIV>
<DIV> </DIV>
<DIV> // is
layer order different from the original order</DIV>
<DIV> if (
arrIndex != lObj.index
)<BR>
{<BR>
hasDiff =
true;<BR>
}</DIV>
<DIV> </DIV>
<DIV> // add
the index to the
intarray<BR>
arr.setitem( arrIndex++, lObj.index
);<BR> }</DIV>
<DIV> </DIV>
<DIV> // set drawing order if any
differences are found<BR> if ( hasDiff
)<BR>
{<BR>
mObj.setLayersDrawingOrder( arr.cast()
);<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>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?</FONT></DIV></BODY></HTML>