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_1_0.js @ 76

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