⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attribution.js

📁 用来在地图上做操作GIS,在地图上做标记
💻 JS
字号:
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license. * See http://svn.openlayers.org/trunk/openlayers/release-license.txt  * for the full text of the license. *//** * @requires OpenLayers/Control.js *  * Class: OpenLayers.Control.Attribution * Add attribution from layers to the map display. Uses 'attribution' property * of each layer. */OpenLayers.Control.Attribution =   OpenLayers.Class(OpenLayers.Control, {        /**     * APIProperty: seperator     * {String} String used to seperate layers.     */    separator: ", ",           /**     * Constructor: OpenLayers.Control.Attribution      *      * Parameters:     * options - {Object} Options for control.     */    initialize: function(options) {        OpenLayers.Control.prototype.initialize.apply(this, arguments);    },    /**      * Method: destroy     * Destroy control.     */    destroy: function() {        this.map.events.unregister("removelayer", this, this.updateAttribution);        this.map.events.unregister("addlayer", this, this.updateAttribution);        this.map.events.unregister("changelayer", this, this.updateAttribution);        this.map.events.unregister("changebaselayer", this, this.updateAttribution);                OpenLayers.Control.prototype.destroy.apply(this, arguments);    },            /**     * Method: draw     * Initialize control.     *      * Returns:      * {DOMElement} A reference to the DIV DOMElement containing the control     */        draw: function() {        OpenLayers.Control.prototype.draw.apply(this, arguments);                this.map.events.register('changebaselayer', this, this.updateAttribution);        this.map.events.register('changelayer', this, this.updateAttribution);        this.map.events.register('addlayer', this, this.updateAttribution);        this.map.events.register('removelayer', this, this.updateAttribution);        this.updateAttribution();                return this.div;        },    /**     * Method: updateAttribution     * Update attribution string.     */    updateAttribution: function() {        var attributions = [];        if (this.map && this.map.layers) {            for(var i=0; i < this.map.layers.length; i++) {                var layer = this.map.layers[i];                if (layer.attribution && layer.getVisibility()) {                    attributions.push( layer.attribution );                }            }              this.div.innerHTML = attributions.join(this.separator);        }    },    /** @final @type String */    CLASS_NAME: "OpenLayers.Control.Attribution"});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -