Project

General

Profile

Download (3.85 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/WPSCapabilities.js
8
 * @requires OpenLayers/Format/OWSCommon/v1_1_0.js
9
 */
10

    
11
/**
12
 * Class: OpenLayers.Format.WPSCapabilities.v1_0_0
13
 * Read WPS Capabilities version 1.0.0.
14
 * 
15
 * Inherits from:
16
 *  - <OpenLayers.Format.XML>
17
 */
18
OpenLayers.Format.WPSCapabilities.v1_0_0 = OpenLayers.Class(
19
    OpenLayers.Format.XML, {
20

    
21
    /**
22
     * Property: namespaces
23
     * {Object} Mapping of namespace aliases to namespace URIs.
24
     */
25
    namespaces: {
26
        ows: "http://www.opengis.net/ows/1.1",
27
        wps: "http://www.opengis.net/wps/1.0.0",
28
        xlink: "http://www.w3.org/1999/xlink"
29
    },
30

    
31
    /**
32
     * Property: regExes
33
     * Compiled regular expressions for manipulating strings.
34
     */
35
    regExes: {
36
        trimSpace: (/^\s*|\s*$/g),
37
        removeSpace: (/\s*/g),
38
        splitSpace: (/\s+/),
39
        trimComma: (/\s*,\s*/g)
40
    },
41
    
42
    /**
43
     * Constructor: OpenLayers.Format.WPSCapabilities.v1_0_0
44
     * Create a new parser for WPS capabilities version 1.0.0. 
45
     *
46
     * Parameters:
47
     * options - {Object} An optional object whose properties will be set on
48
     *     this instance.
49
     */
50
    initialize: function(options) {
51
        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
52
    },
53

    
54
    /**
55
     * APIMethod: read
56
     * Read capabilities data from a string, and return info about the WPS.
57
     * 
58
     * Parameters: 
59
     * data - {String} or {DOMElement} data to read/parse.
60
     *
61
     * Returns:
62
     * {Object} Information about the WPS service.
63
     */
64
    read: function(data) {
65
        if(typeof data == "string") {
66
            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
67
        }
68
        if(data && data.nodeType == 9) {
69
            data = data.documentElement;
70
        }
71
        var capabilities = {};
72
        this.readNode(data, capabilities);
73
        return capabilities;
74
    },
75

    
76
    /**
77
     * Property: readers
78
     * Contains public functions, grouped by namespace prefix, that will
79
     *     be applied when a namespaced node is found matching the function
80
     *     name.  The function will be applied in the scope of this parser
81
     *     with two arguments: the node being read and a context object passed
82
     *     from the parent.
83
     */
84
    readers: {
85
        "wps": {
86
            "Capabilities": function(node, obj) {
87
                this.readChildNodes(node, obj);
88
            },
89
            "ProcessOfferings": function(node, obj) {
90
                obj.processOfferings = {};
91
                this.readChildNodes(node, obj.processOfferings);
92
            },
93
            "Process": function(node, processOfferings) {
94
                var processVersion = this.getAttributeNS(node, this.namespaces.wps, "processVersion");
95
                var process = {processVersion: processVersion};
96
                this.readChildNodes(node, process);
97
                processOfferings[process.identifier] = process;
98
            },
99
            "Languages": function(node, obj) {
100
                obj.languages = [];
101
                this.readChildNodes(node, obj.languages);
102
            },
103
            "Default": function(node, languages) {
104
                var language = {isDefault: true};
105
                this.readChildNodes(node, language);
106
                languages.push(language);
107
            },
108
            "Supported": function(node, languages) {
109
                var language = {};
110
                this.readChildNodes(node, language);     
111
                languages.push(language);
112
            }
113
        },
114
        "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
115
    },    
116
    
117
    CLASS_NAME: "OpenLayers.Format.WPSCapabilities.v1_0_0" 
118

    
119
});
    (1-1/1)