~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
 
2
 * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
 
3
 * full text of the license. */
 
4
 
 
5
/**
 
6
 * @requires OpenLayers/Format/WMC/v1.js
 
7
 */
 
8
 
 
9
/**
 
10
 * Class: OpenLayers.Format.WMC.v1_1_0
 
11
 * Read and write WMC version 1.1.0.
 
12
 *
 
13
 * Differences between 1.1.0 and 1.0.0:
 
14
 *     - 1.1.0 Layers have optional sld:MinScaleDenominator and
 
15
 *       sld:MaxScaleDenominator
 
16
 * 
 
17
 * Inherits from:
 
18
 *  - <OpenLayers.Format.WMC.v1>
 
19
 */
 
20
OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class(
 
21
    OpenLayers.Format.WMC.v1, {
 
22
    
 
23
    /**
 
24
     * Constant: VERSION
 
25
     * {String} 1.1.0
 
26
     */
 
27
    VERSION: "1.1.0",
 
28
 
 
29
    /**
 
30
     * Property: schemaLocation
 
31
     * {String} http://www.opengis.net/context
 
32
     *     http://schemas.opengis.net/context/1.1.0/context.xsd
 
33
     */
 
34
    schemaLocation: "http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",
 
35
 
 
36
    /**
 
37
     * Constructor: OpenLayers.Format.WMC.v1_1_0
 
38
     * Instances of this class are not created directly.  Use the
 
39
     *     <OpenLayers.Format.WMC> constructor instead.
 
40
     *
 
41
     * Parameters:
 
42
     * options - {Object} An optional object whose properties will be set on
 
43
     *     this instance.
 
44
     */
 
45
    initialize: function(options) {
 
46
        OpenLayers.Format.WMC.v1.prototype.initialize.apply(
 
47
            this, [options]
 
48
        );
 
49
    },
 
50
 
 
51
    /**
 
52
     * Method: read_sld_MinScaleDenominator
 
53
     * Read a sld:MinScaleDenominator node.
 
54
     *
 
55
     * Parameters:
 
56
     * layerInfo - {Object} An object representing a layer.
 
57
     * node - {Element} An element node.
 
58
     */
 
59
    read_sld_MinScaleDenominator: function(layerInfo, node) {
 
60
        layerInfo.options.maxScale = this.getChildValue(node);
 
61
    },
 
62
 
 
63
    /**
 
64
     * Method: read_sld_MaxScaleDenominator
 
65
     * Read a sld:MaxScaleDenominator node.
 
66
     *
 
67
     * Parameters:
 
68
     * layerInfo - {Object} An object representing a layer.
 
69
     * node - {Element} An element node.
 
70
     */
 
71
    read_sld_MaxScaleDenominator: function(layerInfo, node) {
 
72
        layerInfo.options.minScale = this.getChildValue(node);
 
73
    },
 
74
 
 
75
    /**
 
76
     * Method: write_wmc_Layer
 
77
     * Create a Layer node given a layer object.  This method adds elements
 
78
     *     specific to version 1.1.0.
 
79
     *
 
80
     * Parameters:
 
81
     * layer - {<OpenLayers.Layer.WMS>} Layer object.
 
82
     *
 
83
     * Returns:
 
84
     * {Element} A WMC Layer element node.
 
85
     */
 
86
    write_wmc_Layer: function(layer) {
 
87
        var node = OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(
 
88
            this, [layer]
 
89
        );
 
90
        
 
91
        // min/max scale denominator elements go before the 4th element in v1
 
92
        if(layer.options.resolutions || layer.options.scales ||
 
93
           layer.options.minResolution || layer.options.maxScale) {
 
94
            var minSD = this.createElementNS(
 
95
                this.namespaces.sld, "sld:MinScaleDenominator"
 
96
            );
 
97
            minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10)));
 
98
            node.insertBefore(minSD, node.childNodes[3]);
 
99
        }
 
100
        
 
101
        if(layer.options.resolutions || layer.options.scales ||
 
102
           layer.options.maxResolution || layer.options.minScale) {
 
103
            var maxSD = this.createElementNS(
 
104
                this.namespaces.sld, "sld:MaxScaleDenominator"
 
105
            );
 
106
            maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10)));
 
107
            node.insertBefore(maxSD, node.childNodes[4]);
 
108
        }
 
109
        
 
110
        return node;
 
111
        
 
112
    },
 
113
 
 
114
    CLASS_NAME: "OpenLayers.Format.WMC.v1_1_0" 
 
115
 
 
116
});
 
 
b'\\ No newline at end of file'