How to turn layer on?
Hi
I am working on a project that requires to turn on some layers from one of the widget (which is inheritate from GraphicSelectionBaseWidget). What i did is setVisibility to true to the layer. Here is the codes:
var essMap:Map = site.essentialsMap as Map;
var ms:MapService = essMap.mapServices.findMapServiceByID(mapServiceID) as MapService;
for each (var layerId:String in defaultLayers)
{
var id:int =Number(layerId);
var layer:com.geocortex.essentials.Layer = ms.layers.findLayerByID(layerId);
layer.setVisibility(true);
}
the result is the layer is checked on the layer list widget but the layer is not displayed on the map (map is not refreshed).
Similar codes works (layer is checked on the layer list widget andthe layer is not displayed on the map.) in another widget (which is inheritate from EssentialsBaseWidget) in a different project. The difference is the parent class (widget).
So how can i make it work?
Thanks
-
sory the last paragraph should read "Similar codes works (layer is checked on the layer list widget and the layer is displayed on the map.) in another widget (which is inheritate from EssentialsBaseWidget) in a different project. The difference is the parent class (widget)."
0 -
The question i posted is not exactly correct. After more digging, it appears that
layer.setVisibility(true)
Works for some layers, but not all.
The problem is solved now. If the layer is in a group layer, the group layer (or the parent layer), has to be setVisibility (true).
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare