<commit_before>/**
 * @class Oskari.mapping.mapmodule.AbstractMapModule
 *
 * Provides map functionality/Wraps actual map implementation (Openlayers).
 * Currently hardcoded at 13 zoomlevels (0-12) and SRS projection code 'EPSG:3067'.
 * There are plans to make these more configurable in the future.
 *
 * See http://www.oskari.org/trac/wiki/DocumentationBundleMapmodule
 */
Oskari.AbstractFunc = function () {
    var name = arguments[0];
    return function () {
        throw "AbstractFuncCalled: " + name;
    };
};

Oskari.clazz.define('Oskari.mapping.mapmodule.AbstractMapModule',
    /**
 * @method create called automatically on construction
 * @static
 *
 * @param {String} id
 *      Unigue ID for this map
 * @param {String} imageUrl
 *      base url for marker etc images
 * @param {Array} map options, example data:
 *  {
 *      resolutions : [2000, 1000, 500, 200, 100, 50, 20, 10, 4, 2, 1, 0.5, 0.25],
 *      maxExtent : {
 *          left : 0,
 *          bottom : 10000000,
 *          right : 10000000,
 *          top : 0
 *      },
 srsName : "EPSG:3067"
 *  }
 */

    function (id, imageUrl, options) {

        this._id = id;
        this._imageUrl = imageUrl;
        this._options = options;

        this._controls = {};
        this._layerPlugins = {};

        /** @static @property {String} _projectionCode SRS projection code, defaults
         * to 'EPSG:3067' */
        this._projection = null;
        this._projectionCode = options.srsName;
        this._supportedFormats = {};

        this._map = null;

        // _mapScales are calculated in _calculateScalesImpl based on resolutions in options
        this._mapScales = [];
        this._mapResolutions = options.resolutions;
        // arr
        this._maxExtent = options.maxExtent;
        // props: left,bottom,right, top
        this._extent = [this._maxExtent.left, this._maxExtent.bottom, this._maxExtent.right, this._maxExtent.top];
        // arr

        this._sandbox = null;
        this._stealth = false;

        this._pluginInstances = {};

        // mapcontrols assumes this to be present before init or start
        this._localization = null;

        /* array of { id: <id>, name: <name>, layer: layer, impl: layerImpl } */
        this.layerDefs = [];
        this.layerDefsById = {};
    }, {
        /**
         * @method getImageUrl
         * Returns a base url for plugins to show. Can be set in constructor and
         * defaults to "/Oskari/resources" if not set.
         * @return {String}
         */
        getImageUrl: function () {
            if (!this._imageUrl) {
                // default if not set
                return "/Oskari/resources";
            }
            return this._imageUrl;
        },
        /**
         * @method getControls
         * Returns map controls - storage for controls by id. See getMapControl for getting single control.
         * @return {Object} contains control names as keys and control
         *      objects as values
         */
        getControls: function () {
            return this._controls;
        },
        /**
         * @method getMapControl
         * Returns a single map control that matches the given id/name.
         *  See getControls for getting all controls.
         * @param {String} id name of the map control
         * @return {OpenLayers.Control} control matching the id or undefined if not found
         */
        getMapControl: function (id) {
            return this._controls[id];
        },
        /**
         * @method addMapControl
         * Adds a control to the map and saves a reference so the control
         * can be accessed with getControls/getMapControl.
         * @param {String} id control id/name
         * @param {OpenLayers.Control} ctl
         */
        addMapControl: function (id, ctl) {
            this._controls[id] = ctl;
            this._addMapControlImpl(ctl);
        },
        /**
         * @method removeMapControl
         * Removes a control from the map matching the given id/name and
         * also removes it from references gotten by getControls()
         * @param {String} id control id/name
         */
        removeMapControl: function (id) {
            this._removeMapControlImpl(ctl);
            delete this._controls[id];
        },
        /**
         * @method setLayerPlugin
         * Adds a plugin to the map that is responsible for rendering maplayers on the map. Other types of
         * plugins doesn't need to be registered like this.
         * Saves a reference so the plugin so it can be accessed with getLayerPlugins/getLayerPlugin.
         *
         * The plugin handling rendering a layer is responsible for calling this method and registering
         * itself as a layersplugin.
         *
         * @param {String} id plugin id/name
         * @param {Oskari.mapframework.ui.module.common.mapmodule.Plugin} plug
         */
        setLayerPlugin: function (id, plug) {
            this._layerPlugins[id] = plug;
        },<commit_msg>Fixed the 'removeMapControl' function in AbstractMapModule.js<commit_after>/**
 * @class Oskari.mapping.mapmodule.AbstractMapModule
 *
 * Provides map functionality/Wraps actual map implementation (Openlayers).
 * Currently hardcoded at 13 zoomlevels (0-12) and SRS projection code 'EPSG:3067'.
 * There are plans to make these more configurable in the future.
 *
 * See http://www.oskari.org/trac/wiki/DocumentationBundleMapmodule
 */
Oskari.AbstractFunc = function () {
    var name = arguments[0];
    return function () {
        throw "AbstractFuncCalled: " + name;
    };
};

Oskari.clazz.define('Oskari.mapping.mapmodule.AbstractMapModule',
    /**
 * @method create called automatically on construction
 * @static
 *
 * @param {String} id
 *      Unigue ID for this map
 * @param {String} imageUrl
 *      base url for marker etc images
 * @param {Array} map options, example data:
 *  {
 *      resolutions : [2000, 1000, 500, 200, 100, 50, 20, 10, 4, 2, 1, 0.5, 0.25],
 *      maxExtent : {
 *          left : 0,
 *          bottom : 10000000,
 *          right : 10000000,
 *          top : 0
 *      },
 srsName : "EPSG:3067"
 *  }
 */

    function (id, imageUrl, options) {

        this._id = id;
        this._imageUrl = imageUrl;
        this._options = options;

        this._controls = {};
        this._layerPlugins = {};

        /** @static @property {String} _projectionCode SRS projection code, defaults
         * to 'EPSG:3067' */
        this._projection = null;
        this._projectionCode = options.srsName;
        this._supportedFormats = {};

        this._map = null;

        // _mapScales are calculated in _calculateScalesImpl based on resolutions in options
        this._mapScales = [];
        this._mapResolutions = options.resolutions;
        // arr
        this._maxExtent = options.maxExtent;
        // props: left,bottom,right, top
        this._extent = [this._maxExtent.left, this._maxExtent.bottom, this._maxExtent.right, this._maxExtent.top];
        // arr

        this._sandbox = null;
        this._stealth = false;

        this._pluginInstances = {};

        // mapcontrols assumes this to be present before init or start
        this._localization = null;

        /* array of { id: <id>, name: <name>, layer: layer, impl: layerImpl } */
        this.layerDefs = [];
        this.layerDefsById = {};
    }, {
        /**
         * @method getImageUrl
         * Returns a base url for plugins to show. Can be set in constructor and
         * defaults to "/Oskari/resources" if not set.
         * @return {String}
         */
        getImageUrl: function () {
            if (!this._imageUrl) {
                // default if not set
                return "/Oskari/resources";
            }
            return this._imageUrl;
        },
        /**
         * @method getControls
         * Returns map controls - storage for controls by id. See getMapControl for getting single control.
         * @return {Object} contains control names as keys and control
         *      objects as values
         */
        getControls: function () {
            return this._controls;
        },
        /**
         * @method getMapControl
         * Returns a single map control that matches the given id/name.
         *  See getControls for getting all controls.
         * @param {String} id name of the map control
         * @return {OpenLayers.Control} control matching the id or undefined if not found
         */
        getMapControl: function (id) {
            return this._controls[id];
        },
        /**
         * @method addMapControl
         * Adds a control to the map and saves a reference so the control
         * can be accessed with getControls/getMapControl.
         * @param {String} id control id/name
         * @param {OpenLayers.Control} ctl
         */
        addMapControl: function (id, ctl) {
            this._controls[id] = ctl;
            this._addMapControlImpl(ctl);
        },
        /**
         * @method removeMapControl
         * Removes a control from the map matching the given id/name and
         * also removes it from references gotten by getControls()
         * @param {String} id control id/name
         */
        removeMapControl: function (id) {
            var ctl = this._controls[id];
            this._removeMapControlImpl(ctl);
            delete this._controls[id];
        },
        /**
         * @method setLayerPlugin
         * Adds a plugin to the map that is responsible for rendering maplayers on the map. Other types of
         * plugins doesn't need to be registered like this.
         * Saves a reference so the plugin so it can be accessed with getLayerPlugins/getLayerPlugin.
         *
         * The plugin handling rendering a layer is responsible for calling this method and registering
         * itself as a layersplugin.
         *
         * @param {String} id plugin id/name
         * @param {Oskari.mapframework.ui.module.common.mapmodule.Plugin} plug
         */
        setLayerPlugin: function (id, plug) {
            this._layerPlugins[id] = plug;
        },
{'fraction_non_alphanumeric': 0.09720031545741326, 'fraction_numerical': 0.013209779179810725, 'mean_word_length': 1.956002331002331, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813164', 'n_tokens_mistral': 2870, 'n_tokens_neox': 2727, 'n_words': 874}