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/WFST/v1_0_0.js @ 76

Revision 76, 5.8 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/WFST/v1.js
8 * @requires OpenLayers/Format/Filter/v1_0_0.js
9 */
10
11/**
12 * Class: OpenLayers.Format.WFST.v1_0_0
13 * A format for creating WFS v1.0.0 transactions.  Create a new instance with the
14 *     <OpenLayers.Format.WFST.v1_0_0> constructor.
15 *
16 * Inherits from:
17 *  - <OpenLayers.Format.Filter.v1_0_0>
18 *  - <OpenLayers.Format.WFST.v1>
19 */
20OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
21    OpenLayers.Format.Filter.v1_0_0, OpenLayers.Format.WFST.v1, {
22   
23    /**
24     * Property: version
25     * {String} WFS version number.
26     */
27    version: "1.0.0",
28
29    /**
30     * APIProperty: srsNameInQuery
31     * {Boolean} If true the reference system is passed in Query requests
32     *     via the "srsName" attribute to the "wfs:Query" element, this
33     *     property defaults to false as it isn't WFS 1.0.0 compliant.
34     */
35    srsNameInQuery: false,
36   
37    /**
38     * Property: schemaLocations
39     * {Object} Properties are namespace aliases, values are schema locations.
40     */
41    schemaLocations: {
42        "wfs": "http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
43    },
44
45    /**
46     * Constructor: OpenLayers.Format.WFST.v1_0_0
47     * A class for parsing and generating WFS v1.0.0 transactions.
48     *
49     * Parameters:
50     * options - {Object} Optional object whose properties will be set on the
51     *     instance.
52     *
53     * Valid options properties:
54     * featureType - {String} Local (without prefix) feature typeName (required).
55     * featureNS - {String} Feature namespace (optional).
56     * featurePrefix - {String} Feature namespace alias (optional - only used
57     *     if featureNS is provided).  Default is 'feature'.
58     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'.
59     */
60    initialize: function(options) {
61        OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this, [options]);
62        OpenLayers.Format.WFST.v1.prototype.initialize.apply(this, [options]);
63    },
64   
65    /**
66     * Property: readers
67     * Contains public functions, grouped by namespace prefix, that will
68     *     be applied when a namespaced node is found matching the function
69     *     name.  The function will be applied in the scope of this parser
70     *     with two arguments: the node being read and a context object passed
71     *     from the parent.
72     */
73    readers: {
74        "wfs": OpenLayers.Util.applyDefaults({
75            "WFS_TransactionResponse": function(node, obj) {
76                obj.insertIds = [];
77                obj.success = false;
78                this.readChildNodes(node, obj);
79            },
80            "InsertResult": function(node, container) {
81                var obj = {fids: []};
82                this.readChildNodes(node, obj);
83                container.insertIds.push(obj.fids[0]);
84            },
85            "TransactionResult": function(node, obj) {
86                this.readChildNodes(node, obj);
87            },
88            "Status": function(node, obj) {
89                this.readChildNodes(node, obj);
90            },
91            "SUCCESS": function(node, obj) {
92                obj.success = true;
93            }
94        }, OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),
95        "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
96        "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"],
97        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]
98    },
99
100    /**
101     * Property: writers
102     * As a compliment to the readers property, this structure contains public
103     *     writing functions grouped by namespace alias and named like the
104     *     node names they produce.
105     */
106    writers: {
107        "wfs": OpenLayers.Util.applyDefaults({
108            "Query": function(options) {
109                options = OpenLayers.Util.extend({
110                    featureNS: this.featureNS,
111                    featurePrefix: this.featurePrefix,
112                    featureType: this.featureType,
113                    srsName: this.srsName,
114                    srsNameInQuery: this.srsNameInQuery
115                }, options);
116                var node = this.createElementNSPlus("wfs:Query", {
117                    attributes: {
118                        typeName: (options.featureNS ? options.featurePrefix + ":" : "") +
119                            options.featureType
120                    }
121                });
122                if(options.srsNameInQuery && options.srsName) {
123                    node.setAttribute("srsName", options.srsName);
124                }
125                if(options.featureNS) {
126                    node.setAttribute("xmlns:" + options.featurePrefix, options.featureNS);
127                }
128                if(options.propertyNames) {
129                    for(var i=0,len = options.propertyNames.length; i<len; i++) {
130                        this.writeNode(
131                            "ogc:PropertyName", 
132                            {property: options.propertyNames[i]},
133                            node
134                        );
135                    }
136                }
137                if(options.filter) {
138                    this.setFilterProperty(options.filter);
139                    this.writeNode("ogc:Filter", options.filter, node);
140                }
141                return node;
142            }
143        }, OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),
144        "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
145        "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"],
146        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]
147    },
148   
149    CLASS_NAME: "OpenLayers.Format.WFST.v1_0_0" 
150});
Note: See TracBrowser for help on using the repository browser.