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 | default | 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 | false | Should the parent group also be turned on when a layer is turned on? |
turnOnActive | boolean | 0..1 | false | Should the associated layer be turned on when the active entity is changed? Only available since 2.5.26 |
allowExclusiveOff | boolean | 0..1 | true < 2.6.5 false >= 2.6.5 | Should it be possible to turn off the active child in an exclusive ToC group? Only available since 2.6.6 and 2.6.5.2 |
activateEntity | boolean | 0..1 | false | Should the associated entity be set active when the layer is turned on? Only available since 2.6.6 |
showFilterIcon | boolean | 0..1 | false | Should a filter icon indicator be displayed for layers that are currently filtered? Only available since 2.6.6 |
showEntitySize | boolean | 0..1 | true | Should the count of the number of selected entities be shown. |
Example ToC view will all available items
Code Block | ||
---|---|---|
| ||
<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 action="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"/> <item action="weave.toc.filterLayer"/> </contextmenu> </view> |
Toolbar and status bar Items
Code Block |
---|
weave.toc.expandAll |
Expands all the groups/folders within the ToC view.
Code Block |
---|
weave.toc.collapseAll |
Collapses all the groups/folders within the ToC view.
Code Block |
---|
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.
Code Block |
---|
weave.toc.load |
Load the previously saved ToC state.
Code Block |
---|
weave.toc.filter |
Refine the layers listed in the ToC.
Code Block |
---|
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
Code Block |
---|
weave.toc.styleLayer |
If the layer supports multiple styles then this allows the user to switch between the available styles.
Code Block |
---|
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.
Code Block |
---|
weave.toc.zoomToLayer |
Changes the current map extent to match that of the layer.
Code Block |
---|
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.
Code Block |
---|
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).
Code Block |
---|
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).
Code Block |
---|
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.
Code Block |
---|
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
.
Code Block |
---|
weave.toc.checkAll |
Allows you to check all child entries of a toc group with a single click.
Code Block |
---|
weave.toc.uncheckAll |
Allows you to uncheck all child entries of a toc group with a single click.
Code Block |
---|
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.
Code Block |
---|
weave.toc.filterLayer |
Allow the user to filter the layer, note that the filter itself must be defined separately and only layers that have an associated filter will have this entry enabled. Available from 2.6.6. See Layer Filtering for more information.
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.
add slider to all map engines
Code Block | ||
---|---|---|
| ||
<contextmenu> <item action="weave.toc.layerTransparency"/> </contextmenu> |
add slider to specified map engines
Code Block | ||
---|---|---|
| ||
<contextmenu> <item action="weave.toc.layerTransparency"> <mapEngines> <mapEngine>mapengine.raster</mapEngine> </mapEngines> </item> </contextmenu> |
add slider to specified map engines and configure individual sliders
Code Block | ||
---|---|---|
| ||
<contextmenu> <item action="weave.toc.layerTransparency"> <sliders> <slider mapengine="mapengine.vector" value="70"/> <slider mapengine="mapengine.raster" value="30"/> </sliders> </item> </contextmenu> |