[76] | 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/Format/WFSCapabilities/v1.js |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | /** |
---|
| 11 | * Class: OpenLayers.Format.WFSCapabilities/v1_0_0 |
---|
| 12 | * Read WMS Capabilities version 1.0.0. |
---|
| 13 | * |
---|
| 14 | * Inherits from: |
---|
| 15 | * - <OpenLayers.Format.WFSCapabilities> |
---|
| 16 | */ |
---|
| 17 | OpenLayers.Format.WFSCapabilities.v1_0_0 = OpenLayers.Class( |
---|
| 18 | OpenLayers.Format.WFSCapabilities.v1, { |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * Constructor: OpenLayers.Format.WFSCapabilities.v1_0_0 |
---|
| 22 | * Create a new parser for WFS capabilities version 1.0.0. |
---|
| 23 | * |
---|
| 24 | * Parameters: |
---|
| 25 | * options - {Object} An optional object whose properties will be set on |
---|
| 26 | * this instance. |
---|
| 27 | */ |
---|
| 28 | initialize: function(options) { |
---|
| 29 | OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply( |
---|
| 30 | this, [options] |
---|
| 31 | ); |
---|
| 32 | }, |
---|
| 33 | |
---|
| 34 | /** |
---|
| 35 | * Method: read_cap_Service |
---|
| 36 | */ |
---|
| 37 | read_cap_Service: function(capabilities, node) { |
---|
| 38 | var service = {}; |
---|
| 39 | this.runChildNodes(service, node); |
---|
| 40 | capabilities.service = service; |
---|
| 41 | }, |
---|
| 42 | |
---|
| 43 | /** |
---|
| 44 | * Method: read_cap_Fees |
---|
| 45 | */ |
---|
| 46 | read_cap_Fees: function(service, node) { |
---|
| 47 | var fees = this.getChildValue(node); |
---|
| 48 | if (fees && fees.toLowerCase() != "none") { |
---|
| 49 | service.fees = fees; |
---|
| 50 | } |
---|
| 51 | }, |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * Method: read_cap_AccessConstraints |
---|
| 55 | */ |
---|
| 56 | read_cap_AccessConstraints: function(service, node) { |
---|
| 57 | var constraints = this.getChildValue(node); |
---|
| 58 | if (constraints && constraints.toLowerCase() != "none") { |
---|
| 59 | service.accessConstraints = constraints; |
---|
| 60 | } |
---|
| 61 | }, |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | * Method: read_cap_OnlineResource |
---|
| 65 | */ |
---|
| 66 | read_cap_OnlineResource: function(service, node) { |
---|
| 67 | var onlineResource = this.getChildValue(node); |
---|
| 68 | if (onlineResource && onlineResource.toLowerCase() != "none") { |
---|
| 69 | service.onlineResource = onlineResource; |
---|
| 70 | } |
---|
| 71 | }, |
---|
| 72 | |
---|
| 73 | /** |
---|
| 74 | * Method: read_cap_Keywords |
---|
| 75 | */ |
---|
| 76 | read_cap_Keywords: function(service, node) { |
---|
| 77 | var keywords = this.getChildValue(node); |
---|
| 78 | if (keywords && keywords.toLowerCase() != "none") { |
---|
| 79 | service.keywords = keywords.split(', '); |
---|
| 80 | } |
---|
| 81 | }, |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * Method: read_cap_Capability |
---|
| 85 | */ |
---|
| 86 | read_cap_Capability: function(capabilities, node) { |
---|
| 87 | var capability = {}; |
---|
| 88 | this.runChildNodes(capability, node); |
---|
| 89 | capabilities.capability = capability; |
---|
| 90 | }, |
---|
| 91 | |
---|
| 92 | /** |
---|
| 93 | * Method: read_cap_Request |
---|
| 94 | */ |
---|
| 95 | read_cap_Request: function(obj, node) { |
---|
| 96 | var request = {}; |
---|
| 97 | this.runChildNodes(request, node); |
---|
| 98 | obj.request = request; |
---|
| 99 | }, |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * Method: read_cap_GetFeature |
---|
| 103 | */ |
---|
| 104 | read_cap_GetFeature: function(request, node) { |
---|
| 105 | var getfeature = { |
---|
| 106 | href: {}, // DCPType |
---|
| 107 | formats: [] // ResultFormat |
---|
| 108 | }; |
---|
| 109 | this.runChildNodes(getfeature, node); |
---|
| 110 | request.getfeature = getfeature; |
---|
| 111 | }, |
---|
| 112 | |
---|
| 113 | /** |
---|
| 114 | * Method: read_cap_ResultFormat |
---|
| 115 | */ |
---|
| 116 | read_cap_ResultFormat: function(obj, node) { |
---|
| 117 | var children = node.childNodes; |
---|
| 118 | var childNode; |
---|
| 119 | for(var i=0; i<children.length; i++) { |
---|
| 120 | childNode = children[i]; |
---|
| 121 | if(childNode.nodeType == 1) { |
---|
| 122 | obj.formats.push(childNode.nodeName); |
---|
| 123 | } |
---|
| 124 | } |
---|
| 125 | }, |
---|
| 126 | |
---|
| 127 | /** |
---|
| 128 | * Method: read_cap_DCPType |
---|
| 129 | */ |
---|
| 130 | read_cap_DCPType: function(obj, node) { |
---|
| 131 | this.runChildNodes(obj, node); |
---|
| 132 | }, |
---|
| 133 | |
---|
| 134 | /** |
---|
| 135 | * Method: read_cap_HTTP |
---|
| 136 | */ |
---|
| 137 | read_cap_HTTP: function(obj, node) { |
---|
| 138 | this.runChildNodes(obj.href, node); |
---|
| 139 | }, |
---|
| 140 | |
---|
| 141 | /** |
---|
| 142 | * Method: read_cap_Get |
---|
| 143 | */ |
---|
| 144 | read_cap_Get: function(obj, node) { |
---|
| 145 | obj.get = node.getAttribute("onlineResource"); |
---|
| 146 | }, |
---|
| 147 | |
---|
| 148 | /** |
---|
| 149 | * Method: read_cap_Post |
---|
| 150 | */ |
---|
| 151 | read_cap_Post: function(obj, node) { |
---|
| 152 | obj.post = node.getAttribute("onlineResource"); |
---|
| 153 | }, |
---|
| 154 | |
---|
| 155 | CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0" |
---|
| 156 | |
---|
| 157 | }); |
---|