[mapguide-users] RE: Turning on layer from task frame

Andy Morsell amorsell at spatialgis.com
Fri Oct 27 18:00:48 EDT 2006


I think you have to save your resource in order for the changes to be
reflected upon refresh.  Assuming you have defined an MgResourceService
called resourceService and an MgMap called map, try adding this after the
ForceRefresh():

$map->Save($resourceService); 


Andy 

-----Original Message-----
From: Jim O'Leary [mailto:joleary.public at gmail.com] 
Sent: Friday, October 27, 2006 2:08 PM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] RE: Turning on layer from task frame


I'm doing this on the server side, where $_REQUEST[layer_name] hold the
layer that the user has selected:

$trackLayer = $layers->GetItem($_REQUEST[layer_name]);
trackLayer->SetVisible(True);
$trackLayer->SetSelectable(True);
$trackLayer->SetDisplayInLegend(True);
$trackLayer->ForceRefresh();

And then on the client side, from the script frame:

parent.mapFrame.Refresh();

However, the layer does not get checked in the Layers pane, and the layer
only becomes selectable when that checkbox is checked. I don't see a
JavaScript API call for this operation. Something like 

mapFrame.checkLayer(layerName,true | false) 

would be useful.


Andy Morsell wrote:
> 
> You can use the MGLayer SetVisible method.  Note that you will also 
> have to do a client-side API refresh in order to get your map and 
> legend to update accordingly.
> 
> 
> Andy Morsell, P.E.
> Spatial Integrators, Inc.
> http://www.SpatialGIS.com
> 
> -----Original Message-----
> From: Jim O'Leary [mailto:joleary.public at gmail.com]
> Sent: Friday, October 27, 2006 12:51 PM
> To: users at mapguide.osgeo.org
> Subject: [mapguide-users] Turning on layer from task frame
> 
> 
> Is there a way to turn on a layer (that is, programmatically check the 
> layer in the Layers pane) from the Task frame?
> 
> I have a select box of layers in my task frame. When the user selects 
> a layer, I would like the same layer to be checked in the Layer pane. 
> Right now the user has to check the layer manually, or else the layer 
> is not selectable.
> 
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Turning-on-layer-from-task-frame-tf2522746.html#
> a70372
> 12
> Sent from the OSGeo MapGuide mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
> 
> 
> 

--
View this message in context:
http://www.nabble.com/Turning-on-layer-from-task-frame-tf2522746.html#a70383
56
Sent from the OSGeo MapGuide mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org







More information about the Mapguide-users mailing list