<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>the layers's initial state (selected, frozen, ..) are used in
ClientLayers.php function createSession.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> if
(!is_null($initialMapState->layers))
{<BR> foreach
($initialMapState->layers as $initialLayerState)
{<BR>
$this->layersData[$initialLayerState->id] =
$initialLayerState;<BR>
}<BR> }</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>check if the some initialMapState have been set and if so, set
the layersData array with the values.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>replacing/modifying the existing initialMapState process
seems a bit tricky so I would suggest to insert a new piece of code just after
the $initialMapState handling but this time you would simply get the values you
want for your dynamicaly selected layers.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT
size=2>
foreach ($dynamicInitialMapStates as $dynamicInitialMapState)
{<BR>
$this->layersData[$dynamicInitialMapState->id] =
$dynamicInitialMapState;<BR>
}</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>you simply have to be sure to have the correct content in your
$dynamicInitialMapState variable</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>dynamicInitialMapState should be a array of
InitialMapState object</FONT></DIV>
<DIV><FONT size=2>InitialMapState->id</FONT></DIV>
<DIV><FONT size=2>InitialMapState->location</FONT></DIV>
<DIV><FONT size=2>InitialMapState->layers where layers is a LayerState
object</FONT></DIV>
<DIV><FONT size=2>LayerState->id</FONT></DIV>
<DIV><FONT size=2>LayerState->hidden</FONT></DIV>
<DIV><FONT size=2>LayerState->frozen</FONT></DIV>
<DIV><FONT size=2>LayerState->selected</FONT></DIV>
<DIV><FONT size=2>LayerState->unfolded</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>$dynamicInitialMapStates should be generated by you. You can
do it directly in the (extended) layers plugin or in another plugin (in which
case you have to
use $this->cartoclient->getPluginManager()->getPlugin('your_plugin_name')->dynamicInitialMapStates to
access it)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=a.muzzetta@i4es.it href="mailto:a.muzzetta@i4es.it">Alessandro
Muzzetta</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org">cartoweb-users@lists.maptools.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, January 23, 2008 1:25
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Cartoweb-users] Changing
selected layers in code</DIV>
<DIV><BR></DIV>Hello,<BR><BR>is it possible to change the layers that are
activated by default directly in code instead of having to change the
layers.ini file?<BR><BR>I have several dozen layers of which only two will be
active at any given time. Deciding which two layers will be displayed is
going to be decided by an algorithm written in php, not by the user. At
every page refresh, the algorithm, based on several parameters, will set just
two layers to selected. <BR>Is there a way to do this within Cartoweb in
php?<BR><BR>The only ugly solution I have thought of so far is to overwrite
the layers.ini file with a new one and having the pertinent layers marked as
selected. However, aside being ugly, this runs into problems with
caching. <BR><BR>Any help would be appreciated.<BR><BR>Thanks<BR
clear=all><BR>-- <BR>Alessandro Muzzetta<BR>IES Solutions Srl<BR>Catania
Office<BR>Via Vulcano 10 - I-95030 Gravina di Catania, Italy<BR>Email: <A
href="mailto:a.muzzetta@i4es.it">a.muzzetta@i4es.it</A><BR>Phone/Fax: +39
095211640<BR>Skype: alex-tecnia
<P>
<HR>
<P></P>_______________________________________________<BR>Cartoweb-users
mailing
list<BR>Cartoweb-users@lists.maptools.org<BR>http://lists.maptools.org/mailman/listinfo/cartoweb-users<BR></BLOCKQUOTE></BODY></HTML>