Project

General

Profile

1 3032 perry
<?xml version="1.0" encoding="ISO-8859-1"?>
2
3
<!--
4
5
Description: transforms a WMS Layer node into an XML structure that contains
6
7
             the URL for the GetMap request for both context docs and WMS caps.
8
9
Author:      adair
10
11
Licence:     LGPL as specified in http://www.gnu.org/copyleft/lesser.html .
12
13
14
15
$Id$
16
17
$Name$
18
19
-->
20
21
22
23
<xsl:stylesheet version="1.0"
24
25
    xmlns:wmc="http://www.opengis.net/context"
26
27
    xmlns:mb="http://mapbuilder.sourceforge.net/mapbuilder"
28
29
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
30
31
    xmlns:xlink="http://www.w3.org/1999/xlink">
32
33
34
35
  <xsl:output method="xml"/>
36
37
  <xsl:strip-space elements="*"/>
38
39
  <!--
40
41
  <xsl:include href="ogcMapImgObjects.xsl" />
42
43
  -->
44
45
46
47
  <xsl:param name="bbox"/>
48
49
  <xsl:param name="width"/>
50
51
  <xsl:param name="height"/>
52
53
  <xsl:param name="srs"/>
54
55
  <xsl:param name="version"/>
56
57
  <xsl:param name="format">image/gif</xsl:param>
58
59
60
61
  <xsl:template match="Layer">
62
63
    <xsl:variable name="styleParam"/>
64
65
    <xsl:variable name="visibility"/>
66
67
    <xsl:variable name="mapRequest">
68
69
      <xsl:choose>
70
71
        <xsl:when test="starts-with($version, '1.0')">
72
73
            WMTVER=<xsl:value-of select="$version"/>&amp;REQUEST=map
74
75
        </xsl:when>
76
77
        <xsl:otherwise>
78
79
            VERSION=<xsl:value-of select="$version"/>&amp;REQUEST=GetMap
80
81
        </xsl:otherwise>
82
83
      </xsl:choose>
84
85
    </xsl:variable>
86
87
88
89
    <GetMap>
90
91
      <mb:QueryString>
92
93
        <xsl:variable name="src">
94
95
            <xsl:value-of select="$mapRequest"/>
96
97
   &amp;SRS=<xsl:value-of select="$srs"/>
98
99
  &amp;BBOX=<xsl:value-of select="translate($bbox,' ',',')"/>
100
101
 &amp;WIDTH=<xsl:value-of select="$width"/>
102
103
&amp;HEIGHT=<xsl:value-of select="$height"/>
104
105
&amp;LAYERS=<xsl:value-of select="Name"/>
106
107
&amp;FORMAT=<xsl:value-of select="$format"/>
108
109
       &amp;<xsl:value-of select="$styleParam"/>
110
111
&amp;TRANSPARENT=TRUE
112
113
<!--
114
115
  //TBD: these still to be properly handled
116
117
  //also sld support
118
119
  if (this.transparent) src += '&' + 'TRANSPARENT=' + this.transparent;
120
121
	if (this.bgcolor) src += '&' + 'BGCOLOR=' + this.bgcolor;
122
123
	//if (this.exceptions) src += '&' + 'EXCEPTIONS=' + this.exceptions;
124
125
	if (this.vendorstr) src += '&' + this.vendorstr;
126
127
  // -->
128
129
        </xsl:variable>
130
131
        <xsl:value-of select="translate(normalize-space($src),' ', '' )" disable-output-escaping="no"/>
132
133
      </mb:QueryString>
134
135
    </GetMap>
136
137
  </xsl:template>
138
139
140
141
  <xsl:template match="wmc:Layer">
142
143
    <xsl:param name="version">
144
145
        <xsl:value-of select="wmc:Server/@version"/>
146
147
    </xsl:param>
148
149
    <xsl:variable name="format">
150
151
      <xsl:choose>
152
153
        <xsl:when test="wmc:FormatList"><xsl:value-of select="wmc:FormatList/wmc:Format[@current='1']"/></xsl:when>
154
155
        <xsl:otherwise>image/gif</xsl:otherwise>
156
157
      </xsl:choose>
158
159
    </xsl:variable>
160
161
    <xsl:variable name="styleParam">
162
163
      <xsl:choose>
164
165
        <xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD">
166
167
          SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:OnlineResource/@xlink:href"/>
168
169
        </xsl:when>
170
171
        <xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:StyeLayerDescriptor">
172
173
          SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:StyeLayerDescriptor"/>
174
175
        </xsl:when>
176
177
        <xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:FeatureTypeStyle">
178
179
          SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:FeatureTypeStyle"/>
180
181
        </xsl:when>
182
183
        <xsl:otherwise>
184
185
          STYLES=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:Name"/>
186
187
        </xsl:otherwise>
188
189
      </xsl:choose>
190
191
    </xsl:variable>
192
193
    <xsl:variable name="visibility">
194
195
      <xsl:choose>
196
197
        <xsl:when test="@hidden='1'">hidden</xsl:when>
198
199
        <xsl:otherwise>visible</xsl:otherwise>
200
201
      </xsl:choose>
202
203
    </xsl:variable>
204
205
    <xsl:variable name="mapRequest">
206
207
      <xsl:choose>
208
209
        <xsl:when test="starts-with($version, '1.0')">
210
211
            WMTVER=<xsl:value-of select="$version"/>&amp;REQUEST=map
212
213
        </xsl:when>
214
215
        <xsl:otherwise>
216
217
            VERSION=<xsl:value-of select="$version"/>&amp;REQUEST=GetMap
218
219
        </xsl:otherwise>
220
221
      </xsl:choose>
222
223
    </xsl:variable>
224
225
226
227
    <GetMap>
228
229
      <mb:QueryString>
230
231
        <xsl:variable name="src">
232
233
            <xsl:value-of select="$mapRequest"/>
234
235
   &amp;SRS=<xsl:value-of select="$srs"/>
236
237
  &amp;BBOX=<xsl:value-of select="$bbox"/>
238
239
 &amp;WIDTH=<xsl:value-of select="$width"/>
240
241
&amp;HEIGHT=<xsl:value-of select="$height"/>
242
243
&amp;LAYERS=<xsl:value-of select="wmc:Name"/>
244
245
&amp;FORMAT=<xsl:value-of select="$format"/>
246
247
       &amp;<xsl:value-of select="$styleParam"/>
248
249
&amp;TRANSPARENT=true
250
251
<!--
252
253
  //TBD: these still to be properly handled
254
255
  //also sld support
256
257
  if (this.transparent) src += '&' + 'TRANSPARENT=' + this.transparent;
258
259
	if (this.bgcolor) src += '&' + 'BGCOLOR=' + this.bgcolor;
260
261
	//if (this.exceptions) src += '&' + 'EXCEPTIONS=' + this.exceptions;
262
263
	if (this.vendorstr) src += '&' + this.vendorstr;
264
265
  // -->
266
267
        </xsl:variable>
268
269
        <xsl:value-of select="translate(normalize-space($src),' ', '' )" disable-output-escaping="no"/>
270
271
      </mb:QueryString>
272
273
    </GetMap>
274
275
  </xsl:template>
276
277
278
279
</xsl:stylesheet>