]> git.openstreetmap.org Git - rails.git/blob - public/lib/OpenLayers/Layer/WFS.js
back out the registration of the gpx mime type, as it didn't seem work
[rails.git] / public / lib / OpenLayers / Layer / WFS.js
1 /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
2  * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
3  * text of the license. */
4 // @require: OpenLayers/Layer/Grid.js
5 // @require: OpenLayers/Layer/Markers.js
6 /**
7 * @class
8 */
9 OpenLayers.Layer.WFS = Class.create();
10 OpenLayers.Layer.WFS.prototype = 
11   Object.extend(new OpenLayers.Layer.Grid(),
12     Object.extend(new OpenLayers.Layer.Markers(), {
13
14     /** @type Object */
15     featureClass: OpenLayers.Feature.WFS,
16
17     /** @final @type hash */
18     DEFAULT_PARAMS: { service: "WFS",
19                       version: "1.0.0",
20                       request: "GetFeature",
21                       typename: "docpoint"
22                     },
23
24     /**
25     * @constructor
26     *
27     * @param {str} name
28     * @param {str} url
29     * @param {hash} params
30     * @param {Object} featureClass
31     */
32     initialize: function(name, url, params, featureClass) {
33         if (featureClass != null) this.featureClass = featureClass;
34         
35         var newArguments = new Array();
36         if (arguments.length > 0) {
37             //uppercase params
38             params = OpenLayers.Util.upperCaseObject(params);
39             newArguments.push(name, url, params);
40         }
41         OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
42         OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
43     
44         if (arguments.length > 0) {
45             OpenLayers.Util.applyDefaults(
46                            this.params, 
47                            OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
48                            );
49         }
50     },    
51     
52
53     /**
54      * 
55      */
56     destroy: function() {
57         OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
58         OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
59     },
60     
61     /** 
62     * @param {OpenLayers.Bounds} bounds
63     * @param {Boolean} zoomChanged
64     */
65     moveTo: function(bounds, zoomChanged) {
66         OpenLayers.Layer.Grid.prototype.moveTo.apply(this, arguments);
67         OpenLayers.Layer.Markers.prototype.moveTo.apply(this, arguments);
68     },
69     
70     /** WFS layer is never a base class. 
71      * @type Boolean
72      */
73     isBaseLayer: function() {
74         return false;
75     },
76     
77     /**
78     * @param {String} name
79     * @param {hash} params
80     *
81     * @returns A clone of this OpenLayers.Layer.WMS, with the passed-in
82     *          parameters merged in.
83     * @type OpenLayers.Layer.WMS
84     */
85     clone: function (name, params) {
86         var mergedParams = {}
87         Object.extend(mergedParams, this.params);
88         Object.extend(mergedParams, params);
89         var obj = new OpenLayers.Layer.WFS(name, this.url, mergedParams);
90         obj.setTileSize(this.tileSize);
91         return obj;
92     },
93
94     /**
95     * addTile creates a tile, initializes it (via 'draw' in this case), and 
96     * adds it to the layer div. 
97     *
98     * @param {OpenLayers.Bounds} bounds
99     *
100     * @returns The added OpenLayers.Tile.WFS
101     * @type OpenLayers.Tile.WFS
102     */
103     addTile:function(bounds, position) {
104         url = this.getFullRequestString(
105                      { BBOX:bounds.toBBOX() });
106
107         return new OpenLayers.Tile.WFS(this, position, bounds, 
108                                            url, this.tileSize);
109     },
110
111
112     /** @final @type String */
113     CLASS_NAME: "OpenLayers.Layer.WFS"
114 }
115 )
116 );