Skip to main content

Reference Library

Go Search
Reference Library
  
Reference Library > Wiki Pages > MapTOC and MapTOCLayerManager  

MapTOC and MapTOCLayerManager

MapTOC
Overview
 
The MapTOC and MapTOCLayerManager are controls that work together to create a "Table of Contents" that displays map layers, allows a layer to be "selected", and allows the visibility of layers to be turned on and off.  The MapTOC displays the table of contents and the MapTOCLayerManager interacts with a MapControlBridge to manage the display.  MapTOCLayerManager has no visible runtime expression.
 
These controls should be added to a page that inherits MDNAjaxPage and that also contains a MapControlBridge and a MapNavigator.  The MapControlBridge's MapTOCID and MapTOCLayerManagerID properties should be set appropriately.  The MapTOC should be bound to the MapTOCLayerManagerControl through the layer manager's MapTOCControl property.
 
MapTOC and MapTOCLayerManager are separated to allow the possibility of using a MapTOC to display information other than the current map state.  For example, one could be used to display drilldown results.  However, using a MapTOC by itself is an advanced topic outside the scope of this article.
 
Configuration
 
Properties of the MapTOCLayerManager
 
SwatchBackgroundColor, SwatchHeight, and SwatchWidth set properties of the swatch images that are generated for layer symbology.
 
ShowInScaleLayersOnly and ShowVisibleDisabledLayers affect what layers are actually displayed in the MapTOC.  A disabled layer is a layer the user cannot toggle visibility for.  (See "Layer Metadata in Map Files" below.)
 
DynamicLayersAreUnselectable should be set true if added layers that are not part of the underlying MapServer map should not be selectable on the MapTOC.
 
AllNodesStartOpen should be set true if folder nodes and value-dependent layer symbology nodes should initially be open when layer data is loaded.
 
ImageFolderURL should be the relative location of a folder within the site where swatches will be written.  It needs to be writeable by the user the page runs as. 
 
LayerCacheKey is an identifier to distinguish this layer manager's swatches from other swatches for the same layer and map service.  If not set, the class name of the page hosting the layer manager is used.  In Designer, this will read "Page".  If layer managers for several pages use the same values for SwatchBackgroundColor, SwatchHeight, and SwatchWidth, then they can use the same LayerCacheKey to facilitate reuse of swatches.
 
Properties of the MapTOC
 
MapTOC has a number of properties that affect the display of the TOC.  These include CSSClass properties for various items in the TOC, URL properties to replace the standard folder, node, and unavailable layer icons, and placement of the refresh link.  (Set ShowHeader and ShowFooter both to false to hide this link.)
 
Client events OnClientGroupToggle, OnClientLayerToggle, and OnClientRefresh are provided by the MDNAjaxPage.  Any handler you assign becomes a prehandler that can cancel the event by returning false.  OnClientLayerContentClick, OnClientLayerMouseOver, OnClientLayerMouseOut, and OnClientStateChangeNotify are all available for you to use to develop additional client-side behavior.
 
LayerSelectionMode can be set to single, multiple, or none to allow or prevent layer selection.  ShowCheckBoxes indicates whether checkboxes are displayed.  ReadOnly disables checkboxes so that you can see whether layers are visible but you can't change their state.  ReadOnly also disables selection.
 
Layer Metadata in Map Files
 
In map files, METADATA sections in LAYER sections can include instructions on how the layer is displayed by a MapTOC.  Metadata settings that are recognized are TOCHide, TOCDisable, and TOCUnselectable.  Assigning "true" to any of these causes them to be applied.  TOCHide means the layer is not displayed in the TOC.  TOCDisable means it gets no checkbox and its visibility cannot be changed.  TOCUnselectable means it cannot be selected.
 
The LAYER GROUP item is used to group layers into folders.  Although MapServer does not require it, the TOC requires that grouped layers be contiguous.  GROUP is ignored for layers that are not contiguous with the first set of layers in a given GROUP. 
 
LayerClass.SwatchImageURL
 
A final way to change the TOC display is to assign the SwatchImageURL property of a layer class (ISC.MapDotNetServer.Common.LayerClass).  The URL is used for the swatch image.  The image size is forced to the SwatchWidth and SwatchHeight values of the layer manager.

Last modified at 11/11/2008 6:11 PM  by WEB\mark