src/Gisplay/Maps/Map2.js
import { BGMapWrapper } from './BGMapWrapper';
import { Aesthetic } from '../Aesthetic';
import { GisplayOptions } from './GisplayOptions';
/**
* This class contains the Map class which represents the current map.
* Each map has a group of functions available. There is only one map yet(maybe there will be two if we want to compare two).
*/
export class Map {
/**
* Map constructor
* @param {BGMapWrapper|Object} bgmap - Background map
* @param {JSON} geometry - Geometry read from the file.
* @param {Object} userOptions - The user defined options.
*/
constructor(bgmap, geometry, userOptions) {
console.log("Map constructor called -> super()");
}
/**
* This method loads user options, and for each option if it isn't provided by the user, then it uses
* the default one. 1st method to be called.
* @param {Object} userOptions - Options given by the user.
* @param {Object} bgmap - The background map provider.
*/
loadOptions(userOptions, bgmap) {
/**
* All the options available in the API.
* @type {GisplayOptions}
*/
this.gisplayOptions = new GisplayOptions(userOptions);
/**
* The background map to be used. This map will be drawn over the background map.
* @type {BGMapWrapper}
*/
this.bgMap = this.gisplayOptions.useCustomMapService ? bgmap : new BGMapWrapper(bgmap);
if (this.gisplayOptions.showLoader)
this.showLoader();
}
/**
* Calls the Background Map Wrapper to show the loader while the data is being processed.
*/
showLoader() {
this.bgMap.showLoader(); //TODO: Create showLoader at BGMapWrapper class
}
/**
* Abstract function that should be implemented by subclasses.
*/
draw() {
throw new Error("Draw method not implemented.");
}
}