Filter:   InfoImg
download overview-summary-wmsLayer.js.html
Language: NonCode
LOC: 0
Project Info
ka-map
Server: Maptools
Type: cvs
Maptools\k\ka‑map\ka‑map\docs\
   _BrowserIdent.html
   _eventManager.html
   _layer.html
   _map.html
   _overlayLayer.html
   _queueManager.html
   _wmsLayer.html
   allclasses-frame.html
   allclasses-noframe.html
   GLOBALS.html
   help-doc.html
   index-all.html
   index.html
   kaDoc.html
   kaKeymap.html
   kaLegend.html
   kaMap.html
   kaNavigator.html
   kaOverlay.html
   kaQuery.html
   kaTool.html
   kaXmlFeature.html
   kaXmlGraphicElement.html
   kaXmlIcon.html
   kaXmlLabel.html
   kaXmlLinestring.html
   kaXmlOverlay.html
   kaXmlPoint.html
   kaXmlPolygon.html
   kaXmlSymbol.html
   overview-DHTMLapi.js.html
   overview-frame.html
   overview-kaKeymap.js.html
   overview-kaLegend.js.html
   overview-kaMap.js.html
   overview-kaOverlay.js.html
   overview-kaQuery.js.html
   ...view-kaScalebar.js.html
   overview-kaTool.js.html
   ...ew-kaXmlOverlay.js.html
   overview-kaZoomer.js.html
   ...ew-overlayLayer.js.html
   overview-scalebar.js.html
   ...ummary-DHTMLapi.js.html
   ...ummary-kaKeymap.js.html
   ...ummary-kaLegend.js.html
   ...w-summary-kaMap.js.html
   ...mmary-kaOverlay.js.html
   ...summary-kaQuery.js.html
   ...mary-kaScalebar.js.html
   ...-summary-kaTool.js.html
   ...ry-kaXmlOverlay.js.html
   ...ummary-kaZoomer.js.html
   ...ry-overlayLayer.js.html
   ...ummary-scalebar.js.html
   ...ummary-wmsLayer.js.html
   ...iew-summary-xhr.js.html
   overview-summary.html
   overview-tree.html
   overview-wmsLayer.js.html
   overview-xhr.js.html
   ScaleBar.html
   stylesheet.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
ka-Map Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="wmsLayer.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>ka-Map</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>wmsLayer.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'wmsLayer.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="_wmsLayer.html">_wmsLayer</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/**********************************************************************
 *
 * $Id: overview-summary-wmsLayer.js.html,v 1.1 2006/03/15 15:56:59 pspencer Exp $
 *
 * purpose: an alternate layer type that can render directly from a
 *          WMS rather than from the tile cache
 *
 * author: Paul Spencer (pspencer<span class="attrib">@dmsolutions</span>.ca)
 *
 * TODO:
 *   - implementation is very preliminary, missing SRS at least
 *   - layers added don't show up in the legend ...
 * 
 **********************************************************************
 *
 * Copyright (c) 2005, DM Solutions Group Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 **********************************************************************/</span>

<span class="comment">/******************************************************************************
 * _wmsLayer - a special type of layer object that represents a WMS layer.  It 
 *             is special because this layer renders directly from the WMS
 *             server rather than through a tile caching service.
 *
 * To use _wmsLayer:
 * 
 * 1) add a script tag to your page:
 * 
 * &lt;script type="text/javascript" src="wmsLayer.js"&gt;&lt;/script&gt;
 *
 * 2) create a new instance of _wmsLayer
 *
 * var l = new _wmsLayer( szName, bVisible, opacity, imageformat, bQueryable, 
 *                   server, version, layers, srs);
 *
 * 3) add it to the map
 *
 * myKaMap.addMapLayer( l );
 *
 * For instance, assuming you have a form to input the parameters required:
 *
 * function addWMSLayer()
 * {
 *     var f = document.forms.wms;
 *     var szName = f.wmsName.value;
 *     var bVisible = true;
 *     var opacity = 100;
 *     var imageformat = "image/png";
 *     var bQueryable = true;
 *     var server = f.wmsServer.value;
 *     var version = "1.1.1";
 *     var layers = f.wmsLayers.value;
 *     var srs = f.wmsSRS.value;
 *     var l = new _wmsLayer( szName, bVisible, opacity, imageformat, bQueryable, 
 *                      server, version, layers, srs);
 *     myKaMap.addMapLayer( l );
 * }
 *
 *****************************************************************************/</span>
 
 <span class="reserved">function</span> _wmsLayer( szName, bVisible, opacity, imageformat, bQueryable, 
                     server, version, layers, srs) {
    _layer.apply(<span class="reserved">this</span>,[szName,bVisible,opacity,imageformat,bQueryable]);
    <span class="reserved">this</span>.server = server;
    <span class="reserved">this</span>.version = (version &amp;&amp; version != <span class="literal">''</span>) ? version : <span class="literal">'1.1.1'</span>;
    <span class="reserved">this</span>.layers = layers;
    <span class="reserved">this</span>.srs = srs;
    <span class="reserved">this</span>.bWidthHeight = false; <span class="comment">//track adding width/height</span>
    
    <span class="reserved">this</span>.baseURL = <span class="reserved">this</span>.server;
    <span class="comment">/* 
     * make sure the server url is terminated with a ? or not a &amp; so we can
     * append the rest of the request without having to worry about a
     * correctly formatted url
     */</span>
    <span class="reserved">if</span> (<span class="reserved">this</span>.baseURL.indexOf(<span class="literal">'?'</span>) == -1) {
        <span class="reserved">this</span>.baseURL = <span class="reserved">this</span>.baseURL + <span class="literal">'?'</span>;
    } <span class="reserved">else</span> {
        <span class="reserved">if</span> (<span class="reserved">this</span>.baseURL.charAt( <span class="reserved">this</span>.baseURL.length - 1 ) == <span class="literal">'&amp;'</span>)
            <span class="reserved">this</span>.baseURL = <span class="reserved">this</span>.baseURL.slice( 0, -1 );
    }

    <span class="comment">/*
     * required components of WMS 1.1.1 are:
     * VERSION set to version or 1.1.1 if version is empty
     * REQUEST - set to GetMap if not in the server URL
     * LAYERS - set to layers if not in the server URL
     * STYLES - not supported in this code, add to server URL yourself
     * SRS - set to srs if not in the server URL
     * BBOX - set dynamically by setTile()
     * WIDTH - set to tile height if not in the server URL
     * HEIGHT - set to tile width if not in the server URL
     * FORMAT - set to imageformat if not in the server URL
     *
     * Optional components are:
     *
     * TRANSPARENT - set to ON if not in the server URL
     * BGCOLOR - do not add this, it will interfer with transparency
     * EXCEPTIONS - set to in image if not in the server URL
     * TIME - not supported in this code, add to server URL yourself
     * ELEVATION - not supported in this code, add to server URL yourself
     * SLD (SLD only) - not supported in this code, add to server URL yourself
     * WFS (SLD only) - not supported in this code, add to server URL yourself
     */</span>
     
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'service'</span>, <span class="literal">"&amp;service=WMS"</span> );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'request'</span>, <span class="literal">"&amp;request=GetMap"</span> );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'version'</span>, <span class="literal">"&amp;version="</span>+<span class="reserved">this</span>.version );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'layers'</span>, <span class="literal">"&amp;layers="</span> + escape(<span class="reserved">this</span>.layers) );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'srs'</span>, <span class="literal">"&amp;srs="</span> + <span class="reserved">this</span>.srs );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'styles'</span>, <span class="literal">"&amp;styles="</span> );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'format'</span>, <span class="literal">"&amp;format="</span> + <span class="reserved">this</span>.imageformat );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'transparent'</span>, <span class="literal">'&amp;transparent=true'</span> );
    <span class="reserved">this</span>.addRequestParameter( <span class="literal">'exceptions'</span>, <span class="literal">'&amp;exceptions=application/vnd.ogc.se-inimage'</span> );
    
    <span class="reserved">for</span> (var p in _layer.<span class="reserved">prototype</span>) {
        <span class="reserved">if</span> (!_wmsLayer.<span class="reserved">prototype</span>[p])
            _wmsLayer.<span class="reserved">prototype</span>[p]= _layer.<span class="reserved">prototype</span>[p];
    }
};
 
<span class="comment">/**
 * wmsLayer.addRequestParameter( name, parameter )
 *
 * add a parameter to the baseURL safely by checking to see if the parameter
 * exists already.  This is an internal function not intended to be used
 * by other code.
 */</span>
_wmsLayer.<span class="reserved">prototype</span>.addRequestParameter = <span class="reserved">function</span>( name, parameter ) {
    <span class="reserved">if</span> (<span class="reserved">this</span>.baseURL.indexOf( name ) == -1) {
        <span class="reserved">this</span>.baseURL = <span class="reserved">this</span>.baseURL + parameter;
    }
};

_wmsLayer.<span class="reserved">prototype</span>.setTile = <span class="reserved">function</span>(img) {
    var url = <span class="reserved">this</span>.baseURL;
    var km = <span class="reserved">this</span>._map.kaMap;
    
    <span class="comment">//only do this once - we don't have _map when the layer is initialized</span>
    <span class="reserved">if</span> (!<span class="reserved">this</span>.bWidthHeight) {
        <span class="reserved">this</span>.addRequestParameter( <span class="literal">'width'</span>, <span class="literal">'&amp;width='</span>+km.tileWidth );
        <span class="reserved">this</span>.addRequestParameter( <span class="literal">'height'</span>, <span class="literal">'&amp;height='</span>+km.tileHeight );
    }
    
    var l = km.cellSize * (safeParseInt(img.style.left) + km.xOrigin);
    var t = -1*km.cellSize * (safeParseInt(img.style.top) + km.yOrigin);
    var r = l + km.cellSize * km.tileWidth;
    var b = t - km.cellSize * km.tileHeight;
    
    url = url + <span class="literal">"&amp;BBOX="</span> + l + <span class="literal">","</span> + b + <span class="literal">","</span> + r + <span class="literal">","</span> + t;
    
    <span class="reserved">if</span> (img.src != url) {
        img.style.visibility = <span class="literal">'hidden'</span>;
        img.src = url;
     }
};</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>ka-Map</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Wed Mar 15 10:50:59 2006</div>
</body>
</html>