Maps SDK for Web
Class GeopolViewService
Service for store and retrieve an specific geopolitical view.
This service is used by map instances, widgets and services to store their geopolitical view configuration.
If its constructor receive a GeopolViewService instance as argument it will start listen changes in the given instance and apply the same change in its own. That behavior allows the instances of this class to be updated in cascade.
Constructor
GeopolViewService([parent])
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
parent | If is defined makes the new instance a "slave" of the given instance | No | GeopolViewService | None |
Methods
GeopolViewService.getSupportedViews(serviceType, [subType]): GeopolView[] Static
Static method that returns an array with the supported geopolitical views for the given service.
Note: If no arguments are passed to this function it will return ALL the geopolitical views available whether they are supported by a particular service or not. This was kept for backward compatibility.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
serviceType | Yes | "search" | "maps" | "reverseGeocoder" | None | |
subType | Only available for maps - Used to specify the subType of a service, for example 'maps - raster' (If you pass 'all' it returns all the geopol views for the given serviceType) | No | "raster" | "vector" | "all" | None |
Returns
getCurrentGeopolView( ): GeopolView
Returns the current geopolitical view stored in the instance.
Returns
setCurrentGeopolView([geopolView='Unified'])
Sets the current geopolitical view.
It also fires the event GEOPOL_VIEW_CHANGED.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
geopolView | view code or a GeopolView instance | No | String | GeopolView | 'Unified' |
Events
All the class events are keys of the Events static member.
To learn more about how to listen events please refer to this documentation.
GEOPOL_VIEW_CHANGED : String
Example
var geopolViewService = new GeopolViewService();
geopolViewService.on(L.GeopolViewService.Events.GEOPOL_VIEW_CHANGED, function(eventData) {
console.log(eventData);
});