Provides a means of displaying the current layer and gives the user the ability to turn on/off the layer visibility.
The ToC view provides a placeholder to display the layers that are available on the map, but it doesn't actually describe the layers that are available, to do that you need to set up a toc model.
ID
com.cohga.html.client.main.tocView
weave.toc
Sub-tags
Name | type | cardinality | description |
label | String | 0..1 | Label to display in tab |
location | String | 1..1 | Which region to add the view to |
toolbar | toolbar | 0..1 | A toolbar of items to appear at the top of the view |
statusbar | statusbar | 0..1 | A toolbar of items to appear at the bottom of the view |
contextmenu | contextmenu | 0..1 | a right-click context menu |
checkParentOnVisible | boolean | 0..1 | Should the parent group also be turned on when a layer is turned on, the default is false |
turnOnActive | boolean | 0..1 | Should the associated layer be turned on when the active entity is changed, the default is false. Only available since 2.5.26. |
<view id="com.cohga.html.client.map.tocView"> <label>Layers</label> <location>west</location> <toolbar> <item action="weave.toc.expandAll"/> <item action="weave.toc.collapseAll"/> <item action="weave.toc.save"/> <item action="weave.toc.load"/> <item>-></item> <item component="weave.toc.favourites"/> <item component="weave.toc.filter"/> </toolbar> <contextmenu> <item action="weave.toc.styleLayer"/> <item action="weave.toc.selectLayer"/> <item action="weave.toc.zoomToLayer"/> <item action="weave.toc.zoomSelection"/> <item action="weave.toc.zoomToMinScale"/> <item action="weave.toc.zoomToMaxScale"/> <item action="weave.toc.clearSelection"/> <item action="weave.toc.lockLayer"/> <item action="weave.toc.favourite"/> <item action="weave.toc.checkAll"/> <item action="weave.toc.uncheckAll"/> </contextmenu> </view>
Toolbar and statusbar Items
weave.toc.expandAll
Expands all the groups/folders within the ToC view.
weave.toc.collapseAll
Collapses all the groups/folders within the ToC view.
weave.toc.save
Saves the current ToC state so it can later be restored, note that only a single ToC state can be saved at once, using the save button will replace the currently saved ToC state.
weave.toc.load
Load the previously saved ToC state.
weave.toc.filter
Refine the layers listed in the ToC.
weave.toc.favourites
Toggle the display of just the favourite layers, i.e. those that have been marked as favourites using the weave.toc.favourite
action list below. Available from 2.6.5.
Context Menu Items
weave.toc.styleLayer
If the layer supports multiple styles then this allows the user to switch between the available styles.
weave.toc.selectLayer
If the layer is associated with an entity this allows the user to change the active entity. Requires that the entity
attribute is specified for the layer in the toc model.
weave.toc.zoomToLayer
Changes the current map extent to match that of the layer.
weave.toc.zoomSelection
If the layer is associated with an entity this allows the user to change the map view based on the extent of the current selection for that entity. Requires that the entity
attribute is specified for the layer in the toc model.
weave.toc.zoomToMinScale
Change the current map extent to match the minimum scale range for the layer (if a minimum scale for the layer can be determined by Weave).
weave.toc.zoomToMaxScale
Change the current map extent to match the maximum scale range for the layer (if a maximum scale for the layer can be determined by Weave).
weave.toc.clearSelection
If the layer is associated with an entity this allows the user to clear the selection for the entity. Requires that the entity
attribute is specified for the layer in the toc model.
weave.toc.lockLayer
If the layer is lockable this allows the user to toggle the state of the locking for the layer. A lockable layer is a layer that has the ability to disable the scale ranges that are applied to a layer's display, allowing a user to view the layer outside of its normal scale ranges. To create a lockable layer you need to duplicate the layer in the underlying map engine, rename the new layer to include UNLOCKED
as a prefix and remove any scale ranges that are attached to the symbology for the new layer. Then when Weave attempts to display the layer in an unlocked state it will display the unlocked version of the layer rather than the original.
Note:
- You should not include the unlocked version of the layer in the ToC model.
- If the underlying layer name contains a colon (which some WMS map engines do) the
UNLOCKED
prefix should be after the colon, e.g.topp:property
should usetopp:UNLOCKEDproperty
.
weave.toc.checkAll
Allows you to check all child entries of a toc group with a single click.
weave.toc.uncheckAll
Allows you to uncheck all child entries of a toc group with a single click.
weave.toc.favourite
Mark a layer as a favourite, which would then be displayed if the user selects the weave.toc.favourites
action listed above. Available from 2.6.5.
Layer Transparency Slider
The weave.toc.layerTransparency
context menu item was added at 2.5.21, this item adds a new slider to the context menu allowing you to directly change the transparency of the underlying map engine. Note that the slider is attached to individual layers in the ToC panel but it changes the transparency for the entire map engine that the layer belongs to and not just the layer associated with the ToC entry.
You can either specify the mapEngine
and slider
settings within a mapEngines
and sliders
section, as in the example or specify them directly under the item.
You can also specify width
and interval
, either at the action level or the slider level, to specify the width of the slider and the movement interval of the slider.
Note that the tool currently only works on a layer entry in a ToC, and will not be available for a group, even if that group is set as not expandable. This has been resolved and will be available from 2.5.23.
<contextmenu> <item action="weave.toc.layerTransparency"/> </contextmenu>
<contextmenu> <item action="weave.toc.layerTransparency"> <mapEngines> <mapEngine>mapengine.raster</mapEngine> </mapEngines> </item> </contextmenu>
<contextmenu> <item action="weave.toc.layerTransparency"> <sliders> <slider mapengine="mapengine.vector" value="70"/> <slider mapengine="mapengine.raster" value="30"/> </sliders> </item> </contextmenu>