1 |
4307
|
leinfelder
|
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
2 |
|
|
<html>
|
3 |
|
|
<head>
|
4 |
|
|
<title>
|
5 |
|
|
<a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008 Overview
|
6 |
|
|
</title>
|
7 |
|
|
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
8 |
|
|
<script>
|
9 |
|
|
function asd() {
|
10 |
|
|
|
11 |
|
|
parent.document.title="LayerControl.js Overview";
|
12 |
|
|
|
13 |
|
|
}
|
14 |
|
|
</script>
|
15 |
|
|
</head>
|
16 |
|
|
<body bgcolor="white" onload="asd();">
|
17 |
|
|
|
18 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
19 |
|
|
<a name="navbar_top"><!-- --></a>
|
20 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
21 |
|
|
<tr>
|
22 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
23 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
24 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
25 |
|
|
<tr align="center" valign="top">
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
29 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
33 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
34 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
35 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
36 |
|
|
</tr>
|
37 |
|
|
</table>
|
38 |
|
|
</td>
|
39 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top">
|
40 |
|
|
<em>
|
41 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
42 |
|
|
</td>
|
43 |
|
|
</tr>
|
44 |
|
|
|
45 |
|
|
<tr>
|
46 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
47 |
|
|
PREV
|
48 |
|
|
NEXT</font></td>
|
49 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
50 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
51 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
52 |
|
|
|
53 |
|
|
<script>
|
54 |
|
|
<!--
|
55 |
|
|
if(window==top) {
|
56 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
57 |
|
|
}
|
58 |
|
|
//-->
|
59 |
|
|
</script>
|
60 |
|
|
<noscript>
|
61 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
62 |
|
|
</noscript>
|
63 |
|
|
</font></td>
|
64 |
|
|
</tr>
|
65 |
|
|
</table>
|
66 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
67 |
|
|
|
68 |
|
|
<hr>
|
69 |
|
|
<center>
|
70 |
|
|
|
71 |
|
|
<h2>LayerControl.js</h2>
|
72 |
|
|
|
73 |
|
|
</center>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
<h4>Summary</h4>
|
79 |
|
|
<p>
|
80 |
|
|
|
81 |
|
|
No overview generated for 'LayerControl.js'<BR/><BR/>
|
82 |
|
|
|
83 |
|
|
</p>
|
84 |
|
|
|
85 |
|
|
<hr>
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
89 |
|
|
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
|
90 |
|
|
<td colspan=2><font size="+2">
|
91 |
|
|
|
92 |
|
|
<b>Class Summary</b>
|
93 |
|
|
|
94 |
|
|
</font></td>
|
95 |
|
|
</tr>
|
96 |
|
|
|
97 |
|
|
<tr bgcolor="white" class="TableRowColor">
|
98 |
|
|
<td width="15%"><b><a href="LayerControl.html">LayerControl</a></b></td>
|
99 |
|
|
<td> </td>
|
100 |
|
|
</tr>
|
101 |
|
|
|
102 |
|
|
</table>
|
103 |
|
|
<hr/>
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
107 |
|
|
|
108 |
|
|
<!-- ========== END METHOD SUMMARY =========== -->
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
<pre class="sourceview"><span class="comment">/*
|
112 |
|
|
License: GPL as per: http://www.gnu.org/copyleft/gpl.html
|
113 |
|
|
$Id: LayerControl.js 3607 2007-11-16 05:06:51Z rdewit $
|
114 |
|
|
*/</span>
|
115 |
|
|
<span class="comment">
|
116 |
|
|
// Ensure this object's dependancies are loaded.</span>
|
117 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/widget/WidgetBaseXSL.js"</span>);
|
118 |
|
|
|
119 |
|
|
<span class="comment">/**
|
120 |
|
|
* Widget to allow control of layer odering, visibility, deletion
|
121 |
|
|
* <span class="attrib">@constructor</span>
|
122 |
|
|
* <span class="attrib">@base</span> WidgetBaseXSL
|
123 |
|
|
* <span class="attrib">@author</span> adair
|
124 |
|
|
* <span class="attrib">@param</span> widgetNode The widget's XML object node from the configuration document.
|
125 |
|
|
* <span class="attrib">@param</span> model The model object that this widget belongs to.
|
126 |
|
|
*/</span>
|
127 |
|
|
<span class="reserved">function</span> LayerControl(widgetNode, model) {
|
128 |
|
|
WidgetBaseXSL.apply(<span class="reserved">this</span>,new Array(widgetNode, model));
|
129 |
|
|
|
130 |
|
|
<span class="comment">/**
|
131 |
|
|
* Override of widget prepaint to set some stylesheet parameters including
|
132 |
|
|
* featureName (for OWS Context) and hidden attribute.
|
133 |
|
|
* <span class="attrib">@param</span> objRef Pointer to this object.
|
134 |
|
|
*/</span>
|
135 |
|
|
<span class="reserved">this</span>.prePaint = <span class="reserved">function</span>(objRef) {
|
136 |
|
|
<span class="reserved">if</span> (objRef.model.featureName) {
|
137 |
|
|
|
138 |
|
|
objRef.stylesheet.setParameter(<span class="literal">"featureName"</span>, objRef.model.featureName );
|
139 |
|
|
objRef.stylesheet.setParameter(<span class="literal">"hidden"</span>, objRef.model.getHidden(objRef.model.featureName).toString() );
|
140 |
|
|
}
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
<span class="comment">/**
|
144 |
|
|
* Displays a layer in a preview pane when mouse is over the table row
|
145 |
|
|
* <span class="attrib">@param</span> layerId the name of the layer to highlight
|
146 |
|
|
*/</span>
|
147 |
|
|
<span class="reserved">this</span>.highlightLayer = <span class="reserved">function</span>(layerId) {
|
148 |
|
|
var layer = <span class="reserved">this</span>.model.map.mbMapPane.oLlayers[layerId].div;
|
149 |
|
|
var previewImage = document.getElementById(<span class="literal">"previewImage"</span>);
|
150 |
|
|
try {
|
151 |
|
|
<span class="reserved">if</span> (previewImage && layer) previewImage.src = layer.firstChild.firstChild.src;
|
152 |
|
|
} catch(e) {}
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
<span class="comment">/**
|
156 |
|
|
* Listener method to paint this widget
|
157 |
|
|
* <span class="attrib">@param</span> layerName the name of the layer to highlight
|
158 |
|
|
*/</span>
|
159 |
|
|
<span class="reserved">this</span>.refresh = <span class="reserved">function</span>(objRef, layerName) {
|
160 |
|
|
objRef.paint(objRef, objRef.id);
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
<span class="reserved">this</span>.foldUnfoldGroup = <span class="reserved">function</span>(groupName,id) {
|
164 |
|
|
<span class="comment"> // context config stuff to maintain group folding over refresh</span>
|
165 |
|
|
var xpathExpression = <span class="literal">"//wmc:General/wmc:Extension/wmc:GroupList/wmc:Group[@name='"</span> + groupName + <span class="literal">"']"</span>;
|
166 |
|
|
<span class="comment"> //var thisGroupsLayerNodes = model.doc.selectNodes(xpathExpression);</span>
|
167 |
|
|
var thisGroupsNode = model.doc.selectSingleNode(xpathExpression);
|
168 |
|
|
var thisGroupsFoldedState = thisGroupsNode.getAttribute(<span class="literal">'folded'</span>);
|
169 |
|
|
var e =document.getElementById(id);
|
170 |
|
|
<span class="reserved">if</span>(thisGroupsFoldedState == <span class="literal">"1"</span>) {
|
171 |
|
|
thisGroupsNode.setAttribute(<span class="literal">"folded"</span>, <span class="literal">"0"</span>);
|
172 |
|
|
e.value=<span class="literal">"-"</span>;
|
173 |
|
|
|
174 |
|
|
} <span class="reserved">else</span> {
|
175 |
|
|
thisGroupsNode.setAttribute(<span class="literal">"folded"</span>, <span class="literal">"1"</span>);
|
176 |
|
|
e.value=<span class="literal">"+"</span>;
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
<span class="comment">/**
|
182 |
|
|
* not working yet
|
183 |
|
|
* <span class="attrib">@param</span> layerId the name of the layer to highlight
|
184 |
|
|
*/</span>
|
185 |
|
|
<span class="reserved">this</span>.showLayerMetadata = <span class="reserved">function</span>(layerId) {
|
186 |
|
|
var metadataWidget = config.objects.layerMetadata;
|
187 |
|
|
<span class="reserved">if</span> (metadataWidget) {
|
188 |
|
|
metadataWidget.stylesheet.setParameter(<span class="literal">"featureName"</span>,layerId);
|
189 |
|
|
metadataWidget.node = document.getElementById(metadataWidget.htmlTagId);
|
190 |
|
|
metadataWidget.paint(metadataWidget);
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
<span class="comment">/**
|
195 |
|
|
* Change image source from imageA to imageB
|
196 |
|
|
* <span class="attrib">@param</span> id id of image tag where we want to change the source
|
197 |
|
|
* <span class="attrib">@param</span> imageA url of imageA
|
198 |
|
|
* <span class="attrib">@param</span> imageB url of imageB
|
199 |
|
|
*/</span>
|
200 |
|
|
<span class="reserved">this</span>.ChangeImage= <span class="reserved">function</span> (id, imageA, imageB) {
|
201 |
|
|
var indexA=document.getElementById(id).src.indexOf(imageA);
|
202 |
|
|
var indexB=document.getElementById(id).src.indexOf(imageB);
|
203 |
|
|
<span class="reserved">if</span> (document.getElementById(id) != null) {
|
204 |
|
|
<span class="reserved">if</span> (indexA != -1) { <span class="comment">/* HACK for IE. */</span>
|
205 |
|
|
document.getElementById(id).src=document.getElementById(id).src.substring(0,indexA)+imageB;
|
206 |
|
|
} <span class="reserved">else</span> {
|
207 |
|
|
document.getElementById(id).src=document.getElementById(id).src.substring(0,indexB)+imageA;
|
208 |
|
|
}
|
209 |
|
|
}
|
210 |
|
|
<span class="reserved">return</span>;
|
211 |
|
|
}
|
212 |
|
|
|
213 |
|
|
<span class="comment">/**
|
214 |
|
|
* Display or fold the layer's legend
|
215 |
|
|
* <span class="attrib">@param</span> id id of legend div
|
216 |
|
|
*/</span>
|
217 |
|
|
<span class="reserved">this</span>.switchVisibilityById = <span class="reserved">function</span> (id) {
|
218 |
|
|
e =document.getElementById(id);
|
219 |
|
|
|
220 |
|
|
<span class="reserved">if</span> (e.style.display==<span class="literal">"none"</span>) {
|
221 |
|
|
e.style.display = <span class="literal">"block"</span>;
|
222 |
|
|
} <span class="reserved">else</span> {
|
223 |
|
|
e.style.display = <span class="literal">"none"</span>;
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
}
|
228 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"deleteLayer"</span>,<span class="reserved">this</span>.refresh, <span class="reserved">this</span>);
|
229 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"moveLayerUp"</span>,<span class="reserved">this</span>.refresh, <span class="reserved">this</span>);
|
230 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"moveLayerDown"</span>,<span class="reserved">this</span>.refresh, <span class="reserved">this</span>);
|
231 |
|
|
<span class="reserved">if</span> (<span class="reserved">this</span>.autoRefresh) <span class="reserved">this</span>.model.addListener(<span class="literal">"addLayer"</span>,<span class="reserved">this</span>.refresh, <span class="reserved">this</span>);
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
</pre>
|
235 |
|
|
<hr>
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
240 |
|
|
<a name="navbar_top"><!-- --></a>
|
241 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
242 |
|
|
<tr>
|
243 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
244 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
245 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
246 |
|
|
<tr align="center" valign="top">
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
250 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
254 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
255 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
256 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
257 |
|
|
</tr>
|
258 |
|
|
</table>
|
259 |
|
|
</td>
|
260 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
261 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
262 |
|
|
</td>
|
263 |
|
|
</tr>
|
264 |
|
|
|
265 |
|
|
<tr>
|
266 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
267 |
|
|
PREV
|
268 |
|
|
NEXT</font></td>
|
269 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
270 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
271 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
272 |
|
|
|
273 |
|
|
<script>
|
274 |
|
|
<!--
|
275 |
|
|
if(window==top) {
|
276 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
277 |
|
|
}
|
278 |
|
|
//-->
|
279 |
|
|
</script>
|
280 |
|
|
<noscript>
|
281 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
282 |
|
|
</noscript>
|
283 |
|
|
</font></td>
|
284 |
|
|
</tr>
|
285 |
|
|
</table>
|
286 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
287 |
|
|
|
288 |
|
|
<hr>
|
289 |
|
|
<font size="-1">
|
290 |
|
|
|
291 |
|
|
</font>
|
292 |
|
|
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Apr 27 20:30:54 2008</div>
|
293 |
|
|
</body>
|
294 |
|
|
</html>
|