Base source switcher

Base source switcher is a group of buttons that enables the user to switch between different predefined services (BaseSources), e. g. background maps. For every sourceset a button will be displayed in the client. Only one sourceset is active at the same time. Moreover, it is possible to define groups. All sourcesets of the same group will be listed in a dropdown list with the group name as the title.

../../../_images/basesourceswitcher1.png

Hint

Base source switcher can also be added into the sidepane. The definition of groups is not possible in the sidepane.

../../../_images/basesourceswitcher_sidepane1.png

Configuration

Preparation: In order to be able to configure the Base source switcher, you have to define service instances as BaseSource (checkbox “Basesource”). You can define the layer as a BaseSource in the Layerset tab in the Backend of the application. You have to edit the service and set a check mark at “BaseSource”.

../../../_images/basesourceswitcher_basesource1.png

Note

On application start, all sourcesets with an activated root layer will be active.

Configuration with selected root layer - sourceset is active on start:

../../../_images/basesourceswitcher_instance_active1.png

Configuration with selected root layer - sourceset is not active on start:

../../../_images/basesourceswitcher_instance_not_active1.png

The configuration of the element itself occurs in two steps:

  1. Create a Base source switcher element with Title, Tooltip (and, if configured in Map area: Position)

  2. Add sourceset(s) with one or more sources and definition of a group (optional)

  • Title: Title of the element.

  • Tooltip: The text entered as a tooltip will be indicated by hovering over the element with the cursor.

  • Instancesets: One or more instancesets can be defined. Select one or more instances and assign a title and group (optional).

../../../_images/basesourceswitcher_configuration.png

In the configuration example either one, none or several entries per instanceset can be selected. You can create groups, which are then grouped together in the dropdown list. Further Instancesets can be added via the mapbender-button-add button. It is possible to move an instanceset in the configuration window via drag and drop.

  • Title: Title of the BaseSource.

  • Group: Optional group name.

  • Position: Position (only when used in Map area). Options: ‘left-top’, ‘right-top’, ‘left-bottom’, ‘right-bottom’

  • Instances: Sources for the BaseSource.

YAML-Definition

This template can be used to insert the element into a YAML application.

title: 'BaseSourceSwitcher'                         # title
tooltip: 'BaseSourceSwitcher'                       # text to use as tooltip
target: map                                         # Id of Map element
anchor: 'right-bottom'                              # Position (only when used in Map area). Options: 'left-top', 'right-top', 'left-bottom', 'right-bottom'
sourcesets:                                         # List of sourcesets
    - { title: sourcesetname, group: groupname,
        sources: [sourceId]}                        # sourceset: title,
                                                    # group: (optional) group name to group of sourcesets by "group name"
                                                    # sources list of sources
  sourcesets:
    - { title: sourcesetname, group: groupname,
        sources: [sourceId]}