Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/OpenLayers/lib/OpenLayers/Control/Attribution.js @ 76

Revision 76, 2.8 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
2 * full list of contributors). Published under the Clear BSD license. 
3 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
4 * full text of the license. */
5
6/**
7 * @requires OpenLayers/Control.js
8 */
9
10/**
11 * Class: OpenLayers.Control.Attribution
12 * The attribution control adds attribution from layers to the map display.
13 * It uses 'attribution' property of each layer.
14 *
15 * Inherits from:
16 *  - <OpenLayers.Control>
17 */
18OpenLayers.Control.Attribution = 
19  OpenLayers.Class(OpenLayers.Control, {
20   
21    /**
22     * APIProperty: seperator
23     * {String} String used to seperate layers.
24     */
25    separator: ", ",
26   
27    /**
28     * Constructor: OpenLayers.Control.Attribution
29     *
30     * Parameters:
31     * options - {Object} Options for control.
32     */
33    initialize: function(options) {
34        OpenLayers.Control.prototype.initialize.apply(this, arguments);
35    },
36
37    /**
38     * Method: destroy
39     * Destroy control.
40     */
41    destroy: function() {
42        this.map.events.un({
43            "removelayer": this.updateAttribution,
44            "addlayer": this.updateAttribution,
45            "changelayer": this.updateAttribution,
46            "changebaselayer": this.updateAttribution,
47            scope: this
48        });
49       
50        OpenLayers.Control.prototype.destroy.apply(this, arguments);
51    },   
52   
53    /**
54     * Method: draw
55     * Initialize control.
56     *
57     * Returns:
58     * {DOMElement} A reference to the DIV DOMElement containing the control
59     */   
60    draw: function() {
61        OpenLayers.Control.prototype.draw.apply(this, arguments);
62       
63        this.map.events.on({
64            'changebaselayer': this.updateAttribution,
65            'changelayer': this.updateAttribution,
66            'addlayer': this.updateAttribution,
67            'removelayer': this.updateAttribution,
68            scope: this
69        });
70        this.updateAttribution();
71       
72        return this.div;   
73    },
74
75    /**
76     * Method: updateAttribution
77     * Update attribution string.
78     */
79    updateAttribution: function() {
80        var attributions = [];
81        if (this.map && this.map.layers) {
82            for(var i=0, len=this.map.layers.length; i<len; i++) {
83                var layer = this.map.layers[i];
84                if (layer.attribution && layer.getVisibility()) {
85                    // add attribution only if attribution text is unique
86                    if (OpenLayers.Util.indexOf(
87                                    attributions, layer.attribution) === -1) {
88                        attributions.push( layer.attribution );
89                    }
90                }
91            } 
92            this.div.innerHTML = attributions.join(this.separator);
93        }
94    },
95
96    CLASS_NAME: "OpenLayers.Control.Attribution"
97});
Note: See TracBrowser for help on using the repository browser.