LiteMap

ol-ishare/litemap~ LiteMap

import { LiteMap } from 'ol-ishare/litemap';

Wrapper for an OpenLayers Map which loads configuration for a named profile from iShareUrl.

Events:

  • load
    • Dispatched when the configuration has been loaded and OpenLayers map and layers have been created. At this point controls can be created and added to the map, if suitable keys are available in the lang UI text lookup these will be used when the controls are created.
  • load:lang
    • Dispatched when the language lookup has loaded, available via the LiteMap instance property lang. Within a listener it's possible to update the lang object to override values, for a specific application for example.

Constructor

new LiteMap(options)

Parameters:
Name Type Description
options module:ol-ishare/litemap~MapOptions

LiteMap options

Members

lang

Properties:
Name Type Description
lang object

Object with key/value pairs to allow looking up UI text, available once the load:lang event is dispatched, supported by iShare version 6.0.9 and above

map

Properties:
Name Type Description
map ol/Map~Map

OpenLayers Map instance

profile

Properties:
Name Type Description
profile module:ol-ishare/profile~Profile

Current profile instance

Methods

loadProfile(profile, options)

Load a given profile Object, once loaded dispatch a profileload event.

Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile as provided by module:ol-ishare/profile~getProfile

options Object

Options that affect how the profile is loaded

Properties
Name Type Description
createOnlyVisibleLayers Boolean

When true only create groups and layers that are initiallyVisible (defaults to true)

getAddressSearch(optionsopt) → {module:ol-ishare/search~AddressSearch}

Get an address search instance compatible with Gazetteer control pre-configured with setting relevant to the current profile.

Parameters:
Name Type Attributes Description
options Object <optional>

Options

Properties
Name Type Attributes Description
pageSize Number <optional>

Number of addresses to return, see AddressSearch for default and max values

Returns:

Address search instance

Type
module:ol-ishare/search~AddressSearch

resetView() → {ol/extent~Extent}

(Re)sets the view to that set in the current profile

Returns:

Actual extent of updated map view (after accounting for fixed zoom levels)

Type
ol/extent~Extent

zoomToFeatures(features, options) → {ol/extent~Extent}

Change the view of the map to centre on the supplied features at a resolution that shows them all in context

Parameters:
Name Type Description
features Array.<ol/Feature~Feature>

Features around which the map should be redrawn

options ol/View~FitOptions

Options passed to ol/View~View#fit, by default the padding property is set to [25, 25, 25, 25]

Returns:

Actual extent of updated map view (after accounting for fixed zoom levels)

Type
ol/extent~Extent

zoomToProfile() → {ol/extent~Extent}

Change the view of the map to show the full extent of the profile

Returns:

Actual extent of updated map view (after accounting for fixed zoom levels)

Type
ol/extent~Extent

(static) defaultInteractions(opt_optionsopt) → {ol/Collection.<ol/interaction/Interaction>}

Get the interactions included in maps by default. Specific interactions can be excluded by setting the appropriate option to false in the constructor options, but the order of the interactions is fixed. If you want to specify a different order for interactions, you will need to create your own ol/interaction/Interaction instances and insert them into a ol/Collection in the order you want before creating your ol/Map~Map instance. The default set of interactions are the OpenLayers default (see http://openlayers.org/en/latest/apidoc/module-ol_interaction.html) minus: ol/interaction/DragRotate~DragRotate and ol/interaction/PinchRotate~PinchRotate plus: module:ol-ishare/interaction/infopopup~InfoPopup.

Parameters:
Name Type Attributes Description
opt_options ol/interaction/Interaction~DefaultsOptions <optional>

Default options.

Returns:

A collection of interactions to be used with the ol/Map~Map constructor's interactions option.

Type
ol/Collection.<ol/interaction/Interaction>

(static) defaultControls(opt_optionsopt, langopt) → {ol/Collection.<ol/control/Control>}

Get the controls and their settings included in maps by default. Specific controls can be excluded by setting the appropriate option to false in the constructor options, but the order of the controls is fixed. If you want to specify a different order for controls, you will need to create your own ol/control/Control instances and insert them into a ol/Collection in the order you want before creating your ol/Map~Map instance. The default set of controls are the OpenLayers default (see https://openlayers.org/en/latest/apidoc/module-ol_control.html). Changes to default configuration: attributionOptions: { collapsible: false }

Parameters:
Name Type Attributes Description
opt_options ol/control/Control~DefaultsOptions <optional>

Control options.

lang Object <optional>

Language string lookup used to configure UI text of controls.

Returns:

A Collection of controls to be used with the ol/Map~Map constructor's control option (see the map.controls property of ol-ishare/litemap~MapOptions).

Type
ol/Collection.<ol/control/Control>