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. */
7 OpenLayers.Feature.WFS = Class.create();
\r
8 OpenLayers.Feature.WFS.prototype =
\r
9 Object.extend( new OpenLayers.Feature(), {
\r
14 * @param {OpenLayers.Layer} layer
\r
15 * @param {XMLNode} xmlNode
\r
17 initialize: function(layer, xmlNode) {
\r
18 var newArguments = arguments;
\r
19 if (arguments.length > 0) {
\r
20 var data = this.processXMLNode(xmlNode);
\r
21 newArguments = new Array(layer, data.lonlat, data, data.id)
\r
23 OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
\r
25 if (arguments.length > 0) {
\r
26 this.createMarker();
\r
27 this.layer.addMarker(this.marker);
\r
31 destroy: function() {
\r
32 if (this.marker != null) {
\r
33 this.layer.removeMarker(this.marker);
\r
35 OpenLayers.Feature.prototype.destroy.apply(this, arguments);
\r
39 * @param {XMLNode} xmlNode
\r
41 * @returns Data Object with 'id', 'lonlat', and private properties set
\r
44 processXMLNode: function(xmlNode) {
\r
45 //this should be overridden by subclasses
\r
46 // must return an Object with 'id' and 'lonlat' values set
\r
47 var point = xmlNode.getElementsByTagName("Point");
48 var text = point[0].textContent;
49 var floats = text.split(",");
51 return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),
52 parseFloat(floats[1])),
57 /** @final @type String */
\r
58 CLASS_NAME: "OpenLayers.Feature.WFS"
\r