Changeset 9658
- Timestamp:
- 09/11/09 19:17:10 (12 months ago)
- Location:
- trunk/openlayers
- Files:
-
- 2 modified
-
lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js (modified) (1 diff)
-
tests/Format/WFSCapabilities/v1.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
r9219 r9658 26 26 ); 27 27 }, 28 29 /** 30 * Method: read_cap_Service 31 */ 32 read_cap_Service: function(capabilities, node) { 33 var service = {}; 34 this.runChildNodes(service, node); 35 capabilities.service = service; 36 }, 28 37 38 /** 39 * Method: read_cap_Fees 40 */ 41 read_cap_Fees: function(service, node) { 42 var fees = this.getChildValue(node); 43 if (fees && fees.toLowerCase() != "none") { 44 service.fees = fees; 45 } 46 }, 47 48 /** 49 * Method: read_cap_AccessConstraints 50 */ 51 read_cap_AccessConstraints: function(service, node) { 52 var constraints = this.getChildValue(node); 53 if (constraints && constraints.toLowerCase() != "none") { 54 service.accessConstraints = constraints; 55 } 56 }, 57 58 /** 59 * Method: read_cap_OnlineResource 60 */ 61 read_cap_OnlineResource: function(service, node) { 62 var onlineResource = this.getChildValue(node); 63 if (onlineResource && onlineResource.toLowerCase() != "none") { 64 service.onlineResource = onlineResource; 65 } 66 }, 67 68 /** 69 * Method: read_cap_Keywords 70 */ 71 read_cap_Keywords: function(service, node) { 72 var keywords = this.getChildValue(node); 73 if (keywords && keywords.toLowerCase() != "none") { 74 service.keywords = keywords.split(', '); 75 } 76 }, 77 78 /** 79 * Method: read_cap_Capability 80 */ 81 read_cap_Capability: function(capabilities, node) { 82 var capability = {}; 83 this.runChildNodes(capability, node); 84 capabilities.capability = capability; 85 }, 86 87 /** 88 * Method: read_cap_Request 89 */ 90 read_cap_Request: function(obj, node) { 91 var request = {}; 92 this.runChildNodes(request, node); 93 obj.request = request; 94 }, 95 96 /** 97 * Method: read_cap_GetFeature 98 */ 99 read_cap_GetFeature: function(request, node) { 100 var getfeature = { 101 href: {}, // DCPType 102 formats: [] // ResultFormat 103 }; 104 this.runChildNodes(getfeature, node); 105 request.getfeature = getfeature; 106 }, 107 108 /** 109 * Method: read_cap_ResultFormat 110 */ 111 read_cap_ResultFormat: function(obj, node) { 112 var children = node.childNodes; 113 var childNode; 114 for(var i=0; i<children.length; i++) { 115 childNode = children[i]; 116 if(childNode.nodeType == 1) { 117 obj.formats.push(childNode.nodeName); 118 } 119 } 120 }, 121 122 /** 123 * Method: read_cap_DCPType 124 */ 125 read_cap_DCPType: function(obj, node) { 126 this.runChildNodes(obj, node); 127 }, 128 129 /** 130 * Method: read_cap_HTTP 131 */ 132 read_cap_HTTP: function(obj, node) { 133 this.runChildNodes(obj.href, node); 134 }, 135 136 /** 137 * Method: read_cap_Get 138 */ 139 read_cap_Get: function(obj, node) { 140 obj.get = node.getAttribute("onlineResource"); 141 }, 142 143 /** 144 * Method: read_cap_Post 145 */ 146 read_cap_Post: function(obj, node) { 147 obj.post = node.getAttribute("onlineResource"); 148 }, 149 29 150 CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0" 30 151 -
trunk/openlayers/tests/Format/WFSCapabilities/v1.html
r9219 r9658 5 5 6 6 function test_read(t) { 7 t.plan( 11);7 t.plan(28); 8 8 9 9 var parser = new OpenLayers.Format.WFSCapabilities(); … … 26 26 t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct"); 27 27 t.eq(ft[0]["name"], "tiger:poly_landmarks", "name of first feature type correct"); 28 29 var service = res.service; 30 t.eq(service.name, 'WFS', "service name correct"); 31 t.eq(service.title, 'GeoServer Web Feature Service', "service title correct"); 32 t.eq(service.abstract, 'This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.', "service title correct"); 33 t.eq(service.keywords[0], 'WFS', "service keyword [0] correct"); 34 t.eq(service.keywords[2], 'GEOSERVER', "service keyword [2] correct"); 35 t.eq(service.onlineResource, 'http://localhost:80/geoserver/wfs', "service onlineresource correct"); 36 t.ok(typeof service.fees == 'undefined', "service fees correct"); 37 t.ok(typeof service.accessConstraints == 'undefined', "service accessconstraints correct"); 38 39 t.eq(res.capability.request.getfeature.href.post, "http://localhost:80/geoserver/wfs?", "getfeature request post href correct"); 40 t.eq(res.capability.request.getfeature.href.get, "http://localhost:80/geoserver/wfs?request=GetFeature", "getfeature request get href correct"); 41 42 t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); 43 t.eq(res.capability.request.getfeature.formats[4], "GML3", "getfeature response format [4] correct"); 28 44 29 45 // UMN Mapserer, v1.0.0 … … 120 136 t.eq(ft[0]["title"], "Parks", "title of first feature type correct"); 121 137 t.eq(ft[0]["name"], "park", "name of first feature type correct"); 138 139 var service = res.service; 140 t.eq(service.name, 'MapServer WFS', "service name correct"); 141 t.eq(service.title, 'GMap WMS Demo Server', "service title correct"); 142 t.eq(service.onlineResource, 'http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&', "service onlineresource correct"); 143 t.eq(res.capability.request.getfeature.href.get, "http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&", "getfeature request get href correct"); 144 t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); 122 145 } 123 146
