all files / src/olHelpers/ quickMapMulti.ts

57.14% Statements 8/14
100% Branches 0/0
50% Functions 1/2
57.14% Lines 8/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                               
/**
 * Created by gavorhes on 12/15/2015.
 */
 
import {quickMapBase, quickMapOptions} from './quickMapBase';
import provide from '../util/provide';
import MapMoveCls from './mapMoveCls';
import MapPopupCls from './mapPopupCls';
import ol = require('custom-ol');
let nm = provide('olHelpers');
 
 
/**
 * @typedef {object} quickMapMultiReturn
 * @property {ol.Map} map The X Coordinate
 * @property {MapMoveCls} mapMove The Y Coordinate
 * @property {MapPopupCls} mapPopup The Y Coordinate
 */
 
/**
 * Sets up a map with some default parameters and initializes
 * mapMove and mapPopup
 *
 * @param {object} [options={}] config options
 * @param {string} [options.divId=map] map div id
 * @param {object} [options.center={}] center config object
 * @param {number} [options.center.x=-10018378] center x, web mercator x or lon
 * @param {number} [options.center.y=5574910] center y, web mercator y or lat
 * @param {number} [options.zoom=7] zoom level
 * @param {number} [options.minZoom=undefined] min zoom
 * @param {number} [options.maxZoom=undefined] max zoom
 * @param {boolean} [options.baseSwitcher=true] if add base map switcher
 * @param {boolean} [options.fullScreen=false] if add base map switcher
 * @returns return object with map, map move, and map popup objects
 */
function quickMapMulti(options: quickMapOptions): {map: ol.Map, mapMove: MapMoveCls, mapPopup: MapPopupCls} {
    let m = quickMapBase(options);
    let mov = new MapMoveCls();
    let pop = new MapPopupCls();
    mov.init(m);
    pop.init(m);
 
    return {map: m, mapMove: mov, mapPopup: pop};
}
 
nm.quickMapMulti = quickMapMulti;
export default quickMapMulti;