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/Marker/Box.js @ 76

Revision 76, 2.7 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/**
8 * @requires OpenLayers/Marker.js
9 */
10
11/**
12 * Class: OpenLayers.Marker.Box
13 *
14 * Inherits from:
15 *  - <OpenLayers.Marker>
16 */
17OpenLayers.Marker.Box = OpenLayers.Class(OpenLayers.Marker, {
18
19    /**
20     * Property: bounds
21     * {<OpenLayers.Bounds>}
22     */
23    bounds: null,
24
25    /**
26     * Property: div
27     * {DOMElement}
28     */
29    div: null,
30   
31    /**
32     * Constructor: OpenLayers.Marker.Box
33     *
34     * Parameters:
35     * bounds - {<OpenLayers.Bounds>}
36     * borderColor - {String}
37     * borderWidth - {int}
38     */
39    initialize: function(bounds, borderColor, borderWidth) {
40        this.bounds = bounds;
41        this.div    = OpenLayers.Util.createDiv();
42        this.div.style.overflow = 'hidden';
43        this.events = new OpenLayers.Events(this, this.div, null);
44        this.setBorder(borderColor, borderWidth);
45    },
46
47    /**
48     * Method: destroy
49     */   
50    destroy: function() {
51
52        this.bounds = null;
53        this.div = null;
54
55        OpenLayers.Marker.prototype.destroy.apply(this, arguments);
56    },
57
58    /**
59     * Method: setBorder
60     * Allow the user to change the box's color and border width
61     *
62     * Parameters:
63     * color - {String} Default is "red"
64     * width - {int} Default is 2
65     */
66    setBorder: function (color, width) {
67        if (!color) {
68            color = "red";
69        }
70        if (!width) {
71            width = 2;
72        }
73        this.div.style.border = width + "px solid " + color;
74    },
75   
76    /**
77    * Method: draw
78    *
79    * Parameters:
80    * px - {<OpenLayers.Pixel>}
81    * sz - {<OpenLayers.Size>}
82    *
83    * Returns:
84    * {DOMElement} A new DOM Image with this markerŽs icon set at the
85    *         location passed-in
86    */
87    draw: function(px, sz) {
88        OpenLayers.Util.modifyDOMElement(this.div, null, px, sz);
89        return this.div;
90    }, 
91
92    /**
93     * Method: onScreen
94     *
95     * Rreturn:
96     * {Boolean} Whether or not the marker is currently visible on screen.
97     */
98    onScreen:function() {
99        var onScreen = false;
100        if (this.map) {
101            var screenBounds = this.map.getExtent();
102            onScreen = screenBounds.containsBounds(this.bounds, true, true);
103        }   
104        return onScreen;
105    },
106   
107    /**
108     * Method: display
109     * Hide or show the icon
110     *
111     * Parameters:
112     * display - {Boolean}
113     */
114    display: function(display) {
115        this.div.style.display = (display) ? "" : "none";
116    },
117
118    CLASS_NAME: "OpenLayers.Marker.Box"
119});
120
Note: See TracBrowser for help on using the repository browser.