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/WMC/v1_1_0.js @ 76

Revision 76, 3.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/WMC/v1.js
8 */
9
10/**
11 * Class: OpenLayers.Format.WMC.v1_1_0
12 * Read and write WMC version 1.1.0.
13 *
14 * Differences between 1.1.0 and 1.0.0:
15 *     - 1.1.0 Layers have optional sld:MinScaleDenominator and
16 *       sld:MaxScaleDenominator
17 *
18 * Inherits from:
19 *  - <OpenLayers.Format.WMC.v1>
20 */
21OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class(
22    OpenLayers.Format.WMC.v1, {
23   
24    /**
25     * Constant: VERSION
26     * {String} 1.1.0
27     */
28    VERSION: "1.1.0",
29
30    /**
31     * Property: schemaLocation
32     * {String} http://www.opengis.net/context
33     *     http://schemas.opengis.net/context/1.1.0/context.xsd
34     */
35    schemaLocation: "http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",
36
37    /**
38     * Constructor: OpenLayers.Format.WMC.v1_1_0
39     * Instances of this class are not created directly.  Use the
40     *     <OpenLayers.Format.WMC> constructor instead.
41     *
42     * Parameters:
43     * options - {Object} An optional object whose properties will be set on
44     *     this instance.
45     */
46    initialize: function(options) {
47        OpenLayers.Format.WMC.v1.prototype.initialize.apply(
48            this, [options]
49        );
50    },
51
52    /**
53     * Method: read_sld_MinScaleDenominator
54     * Read a sld:MinScaleDenominator node.
55     *
56     * Parameters:
57     * layerContext - {Object} An object representing a layer.
58     * node - {Element} An element node.
59     */
60    read_sld_MinScaleDenominator: function(layerContext, node) {
61        var minScaleDenominator = parseFloat(this.getChildValue(node));
62        if (minScaleDenominator > 0) {
63            layerContext.maxScale = minScaleDenominator;
64        }
65    },
66
67    /**
68     * Method: read_sld_MaxScaleDenominator
69     * Read a sld:MaxScaleDenominator node.
70     *
71     * Parameters:
72     * layerContext - {Object} An object representing a layer.
73     * node - {Element} An element node.
74     */
75    read_sld_MaxScaleDenominator: function(layerContext, node) {
76        layerContext.minScale = parseFloat(this.getChildValue(node));
77    },
78
79    /**
80     * Method: write_wmc_Layer
81     * Create a Layer node given a layer context object. This method adds
82     *     elements specific to version 1.1.0.
83     *
84     * Parameters:
85     * context - {Object} A layer context object.}
86     *
87     * Returns:
88     * {Element} A WMC Layer element node.
89     */
90    write_wmc_Layer: function(context) {
91        var node = OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(
92            this, [context]
93        );
94       
95        // min/max scale denominator elements go before the 4th element in v1
96        if(context.maxScale) {
97            var minSD = this.createElementNS(
98                this.namespaces.sld, "sld:MinScaleDenominator"
99            );
100            minSD.appendChild(this.createTextNode(context.maxScale.toPrecision(16)));
101            node.appendChild(minSD);
102        }
103       
104        if(context.minScale) {
105            var maxSD = this.createElementNS(
106                this.namespaces.sld, "sld:MaxScaleDenominator"
107            );
108            maxSD.appendChild(this.createTextNode(context.minScale.toPrecision(16)));
109            node.appendChild(maxSD);
110        }
111
112        // optional FormatList element
113        node.appendChild(this.write_wmc_FormatList(context));
114
115        // optional StyleList element
116        node.appendChild(this.write_wmc_StyleList(context));
117       
118        // OpenLayers specific properties go in an Extension element
119        node.appendChild(this.write_wmc_LayerExtension(context));
120       
121        return node;
122       
123    },
124
125    CLASS_NAME: "OpenLayers.Format.WMC.v1_1_0" 
126
127});
Note: See TracBrowser for help on using the repository browser.