Project

General

Profile

Download (4.26 KB) Statistics
| Branch: | Tag: | Revision:
1
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
2
 * full list of contributors). Published under the 2-clause BSD license.
3
 * See license.txt in the OpenLayers distribution or repository 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 WFS Capabilities version 1.0.0.
13
 * 
14
 * Inherits from:
15
 *  - <OpenLayers.Format.WFSCapabilities.v1>
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

    
29
    /**
30
     * Property: readers
31
     * Contains public functions, grouped by namespace prefix, that will
32
     *     be applied when a namespaced node is found matching the function
33
     *     name.  The function will be applied in the scope of this parser
34
     *     with two arguments: the node being read and a context object passed
35
     *     from the parent.
36
     */
37
    readers: {
38
        "wfs": OpenLayers.Util.applyDefaults({
39
            "Service": function(node, capabilities) {
40
                capabilities.service = {};
41
                this.readChildNodes(node, capabilities.service);
42
            },
43
            "Fees": function(node, service) {
44
                var fees = this.getChildValue(node);
45
                if (fees && fees.toLowerCase() != "none") {
46
                    service.fees = fees;
47
                }
48
            },
49
            "AccessConstraints": function(node, service) {
50
                var constraints = this.getChildValue(node);
51
                if (constraints && constraints.toLowerCase() != "none") {
52
                    service.accessConstraints = constraints;
53
                }
54
            },
55
            "OnlineResource": function(node, service) {
56
                var onlineResource = this.getChildValue(node);
57
                if (onlineResource && onlineResource.toLowerCase() != "none") {
58
                    service.onlineResource = onlineResource;
59
                }
60
            },
61
            "Keywords": function(node, service) {
62
                var keywords = this.getChildValue(node);
63
                if (keywords && keywords.toLowerCase() != "none") {
64
                    service.keywords = keywords.split(', ');
65
                }
66
            },
67
            "Capability": function(node, capabilities) {
68
                capabilities.capability = {};
69
                this.readChildNodes(node, capabilities.capability);
70
            },
71
            "Request": function(node, obj) {
72
                obj.request = {};
73
                this.readChildNodes(node, obj.request);
74
            },
75
            "GetFeature": function(node, request) {
76
                request.getfeature = {
77
                    href: {}, // DCPType
78
                    formats: [] // ResultFormat
79
                };
80
                this.readChildNodes(node, request.getfeature);
81
            },
82
            "ResultFormat": function(node, obj) {
83
                var children = node.childNodes;
84
                var childNode;
85
                for(var i=0; i<children.length; i++) {
86
                    childNode = children[i];
87
                    if(childNode.nodeType == 1) {
88
                        obj.formats.push(childNode.nodeName);
89
                    }
90
                }
91
            },
92
            "DCPType": function(node, obj) {
93
                this.readChildNodes(node, obj);
94
            },
95
            "HTTP": function(node, obj) {
96
                this.readChildNodes(node, obj.href);
97
            },
98
            "Get": function(node, obj) {
99
                obj.get = node.getAttribute("onlineResource");
100
            },
101
            "Post": function(node, obj) {
102
                obj.post = node.getAttribute("onlineResource");
103
            },
104
            "SRS": function(node, obj) {
105
                var srs = this.getChildValue(node);
106
                if (srs) {
107
                    obj.srs = srs;
108
                }
109
            }
110
        }, OpenLayers.Format.WFSCapabilities.v1.prototype.readers["wfs"])
111
    },
112
    
113
    CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0" 
114

    
115
});
(2-2/3)