Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/OpenLayers/lib/OpenLayers/Format/SOSCapabilities/v1_0_0.js @ 76

Revision 76, 5.5 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
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/SOSCapabilities.js
8 * @requires OpenLayers/Format/OWSCommon/v1_1_0.js
9 * @requires OpenLayers/Format/GML/v3.js
10 */
11
12/**
13 * Class: OpenLayers.Format.SOSCapabilities.v1_0_0
14 * Read SOS Capabilities version 1.0.0.
15 *
16 * Inherits from:
17 *  - <OpenLayers.Format.SOSCapabilities>
18 */
19OpenLayers.Format.SOSCapabilities.v1_0_0 = OpenLayers.Class(
20    OpenLayers.Format.SOSCapabilities, {
21
22    /**
23     * Property: namespaces
24     * {Object} Mapping of namespace aliases to namespace URIs.
25     */
26    namespaces: {
27        ows: "http://www.opengis.net/ows/1.1",
28        sos: "http://www.opengis.net/sos/1.0",
29        gml: "http://www.opengis.net/gml",
30        xlink: "http://www.w3.org/1999/xlink"
31    },
32
33    /**
34     * Property: regExes
35     * Compiled regular expressions for manipulating strings.
36     */
37    regExes: {
38        trimSpace: (/^\s*|\s*$/g),
39        removeSpace: (/\s*/g),
40        splitSpace: (/\s+/),
41        trimComma: (/\s*,\s*/g)
42    },
43   
44    /**
45     * Constructor: OpenLayers.Format.SOSCapabilities.v1_0_0
46     * Create a new parser for SOS capabilities version 1.0.0.
47     *
48     * Parameters:
49     * options - {Object} An optional object whose properties will be set on
50     *     this instance.
51     */
52    initialize: function(options) {
53        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
54        this.options = options;
55    },
56
57    /**
58     * APIMethod: read
59     * Read capabilities data from a string, and return info about the SOS.
60     *
61     * Parameters:
62     * data - {String} or {DOMElement} data to read/parse.
63     *
64     * Returns:
65     * {Object} Information about the SOS service.
66     */
67    read: function(data) {
68        if(typeof data == "string") {
69            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
70        }
71        if(data && data.nodeType == 9) {
72            data = data.documentElement;
73        }
74        var capabilities = {};
75        this.readNode(data, capabilities);
76        return capabilities;
77    },
78
79    /**
80     * Property: readers
81     * Contains public functions, grouped by namespace prefix, that will
82     *     be applied when a namespaced node is found matching the function
83     *     name.  The function will be applied in the scope of this parser
84     *     with two arguments: the node being read and a context object passed
85     *     from the parent.
86     */
87    readers: {
88        "gml": OpenLayers.Util.applyDefaults({
89            "name": function(node, obj) {
90                obj.name = this.getChildValue(node);
91            },
92            "TimePeriod": function(node, obj) {
93                obj.timePeriod = {};
94                this.readChildNodes(node, obj.timePeriod);
95            },
96            "beginPosition": function(node, timePeriod) {
97                timePeriod.beginPosition = this.getChildValue(node);
98            },
99            "endPosition": function(node, timePeriod) {
100                timePeriod.endPosition = this.getChildValue(node);
101            }
102        }, OpenLayers.Format.GML.v3.prototype.readers["gml"]),
103        "sos": {
104            "Capabilities": function(node, obj) {
105                this.readChildNodes(node, obj);
106            },
107            "Contents": function(node, obj) {
108                obj.contents = {};
109                this.readChildNodes(node, obj.contents);
110            },
111            "ObservationOfferingList": function(node, contents) {
112                contents.offeringList = {};
113                this.readChildNodes(node, contents.offeringList);
114            },
115            "ObservationOffering": function(node, offeringList) {
116                var id = this.getAttributeNS(node, this.namespaces.gml, "id");
117                offeringList[id] = {
118                    procedures: [],
119                    observedProperties: [],
120                    featureOfInterestIds: [],
121                    responseFormats: [],
122                    resultModels: [],
123                    responseModes: []
124                };
125                this.readChildNodes(node, offeringList[id]);
126            },
127            "time": function(node, offering) {
128                offering.time = {};
129                this.readChildNodes(node, offering.time);
130            },
131            "procedure": function(node, offering) {
132                offering.procedures.push(this.getAttributeNS(node, 
133                    this.namespaces.xlink, "href"));
134            },
135            "observedProperty": function(node, offering) {
136                offering.observedProperties.push(this.getAttributeNS(node, 
137                    this.namespaces.xlink, "href"));
138            },
139            "featureOfInterest": function(node, offering) {
140                offering.featureOfInterestIds.push(this.getAttributeNS(node, 
141                    this.namespaces.xlink, "href"));
142            },
143            "responseFormat": function(node, offering) {
144                offering.responseFormats.push(this.getChildValue(node));
145            },
146            "resultModel": function(node, offering) {
147                offering.resultModels.push(this.getChildValue(node));
148            },
149            "responseMode": function(node, offering) {
150                offering.responseModes.push(this.getChildValue(node));;
151            }
152        },
153        "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
154    },   
155   
156    CLASS_NAME: "OpenLayers.Format.SOSCapabilities.v1_0_0" 
157
158});
Note: See TracBrowser for help on using the repository browser.