|
|
LayerTreeThis xml file contains configurations for all layertrees of a geomajas application. Just like the maps.xml contained all maps, this one contains all layertrees. For each layertree, it is necessary to define a "layerTree"-tag with a certain id. This id is used to retrieve the widget in HTML. This means that in your geomajas page, you need to define a LayerTree with this id, like so: <div dojoType="majas.widget.LayerTree" id="someLayerTree"></div> So we have a geomajas html page in which we want to see a layertree, called 'someLayerTree'. Now we will create a configuration in the layertree.xml that refers to 'someLayerTree', and add a few buttons to it. But that is not all! A layertree is always linked to a MapWidget. This means that in the configuration of a layertree, we need a reference to a map. In the XML below, you see the LayerTree configuration for the 4th geomajas sample application. It targets the "sampleFutureMap", thus displaying the layerTree order as defined in the sampleFutureMap's configuration in maps.xml. Furthermore, it has defined 3 extra buttons to accompany it:
<?xml version="1.0" encoding="UTF-8"?> <layerTrees xmlns="http://geomajas.org/schemas/configuration/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <layerTree id="sampleFutureTree"> <targetMap>sampleFutureMap</targetMap> <toolRef>LayerVisibleTool</toolRef> <toolRef>LayerLabeledTool</toolRef> <toolRef>LayerSnappingTool</toolRef> </layerTree> </layerTrees> This will result in a layertree with looking a bit like the picture below.
Note again that this configuration consists of tools only, not the layers! The layers of a layertree were added in the map's configuration! In this case, the layer 'Lakes (editable)' is selected, and for that particular layer, the first button (LayerVisibleTool) is enabled (which means it is visible). |




