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/Layer/Boxes.js @ 76

Revision 76, 2.2 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/Layer.js
9 * @requires OpenLayers/Layer/Markers.js
10 */
11
12/**
13 * Class: OpenLayers.Layer.Boxes
14 * Draw divs as 'boxes' on the layer.
15 *
16 * Inherits from:
17 *  - <OpenLayers.Layer.Markers>
18 */
19OpenLayers.Layer.Boxes = OpenLayers.Class(OpenLayers.Layer.Markers, {
20
21    /**
22     * Constructor: OpenLayers.Layer.Boxes
23     *
24     * Parameters:
25     * name - {String}
26     * options - {Object} Hashtable of extra options to tag onto the layer
27     */
28    initialize: function (name, options) {
29        OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
30    },
31   
32    /**
33     * Method: drawMarker
34     * Calculate the pixel location for the marker, create it, and
35     *    add it to the layer's div
36     *
37     * Parameters:
38     * marker - {<OpenLayers.Marker.Box>}
39     */
40    drawMarker: function(marker) {
41        var bounds   = marker.bounds;
42        var topleft  = this.map.getLayerPxFromLonLat(
43                            new OpenLayers.LonLat(bounds.left,  bounds.top));
44        var botright = this.map.getLayerPxFromLonLat(
45                             new OpenLayers.LonLat(bounds.right, bounds.bottom));
46        if (botright == null || topleft == null) {
47            marker.display(false);
48        } else {
49            var sz = new OpenLayers.Size(
50                Math.max(1, botright.x - topleft.x),
51                Math.max(1, botright.y - topleft.y));
52            var markerDiv = marker.draw(topleft, sz);
53            if (!marker.drawn) {
54                this.div.appendChild(markerDiv);
55                marker.drawn = true;
56            }
57        }
58    },
59
60
61    /**
62     * APIMethod: removeMarker
63     *
64     * Parameters:
65     * marker - {<OpenLayers.Marker.Box>}
66     */
67    removeMarker: function(marker) {
68        OpenLayers.Util.removeItem(this.markers, marker);
69        if ((marker.div != null) &&
70            (marker.div.parentNode == this.div) ) {
71            this.div.removeChild(marker.div);   
72        }
73    },
74
75    CLASS_NAME: "OpenLayers.Layer.Boxes"
76});
Note: See TracBrowser for help on using the repository browser.