UNPKG

@geogirafe/lib-geoportal

Version:

GeoGirafe is a flexible application to build online geoportals.

29 lines (28 loc) 903 B
import GirafeSingleton from '../../base/GirafeSingleton'; import Map from 'ol/Map'; /** The singleton containing the main OpenLayers map accessible from everywhere */ export default class MapManager extends GirafeSingleton { constructor() { super(...arguments); Object.defineProperty(this, "map", { enumerable: true, configurable: true, writable: true, value: new Map({ layers: [] }) }); } getMap() { return this.map; } /** * @returns an array of BaseLayer objects that should be printed and that are not in the layer tree. */ getLayersToPrint() { return this.map.getAllLayers().filter((layer) => layer.get('addToPrintedLayers')); } zoomToExtent(extent, minResolution) { this.map.getView().fit(extent, { minResolution: minResolution }); } }