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="History.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>History.js</h2>
|
72 |
|
|
|
73 |
|
|
</center>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
<h4>Summary</h4>
|
79 |
|
|
<p>
|
80 |
|
|
|
81 |
|
|
No overview generated for 'History.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="History.html">History</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 |
|
|
Author: Steven Ottens AT geodan.nl
|
113 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
114 |
|
|
$Id: History.js 2956 2007-07-09 12:17:52Z steven $
|
115 |
|
|
*/</span>
|
116 |
|
|
<span class="comment">
|
117 |
|
|
// Ensure this object's dependancies are loaded.</span>
|
118 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/tool/ToolBase.js"</span>);
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
<span class="comment">/**
|
122 |
|
|
* A tool designed to store the history of the extent during a session
|
123 |
|
|
*
|
124 |
|
|
* <span class="attrib">@constructor</span>
|
125 |
|
|
* <span class="attrib">@base</span> ToolBase
|
126 |
|
|
* <span class="attrib">@param</span> toolNode The node for this tool from the configuration document.
|
127 |
|
|
* <span class="attrib">@param</span> model The model object that contains this tool
|
128 |
|
|
*/</span>
|
129 |
|
|
<span class="reserved">function</span> History(toolNode, model) {
|
130 |
|
|
ToolBase.apply(<span class="reserved">this</span>, new Array(toolNode, model));
|
131 |
|
|
|
132 |
|
|
<span class="comment">/**
|
133 |
|
|
* Inititialising the history and setting start parameters
|
134 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
135 |
|
|
*/</span>
|
136 |
|
|
|
137 |
|
|
<span class="reserved">this</span>.init = <span class="reserved">function</span>(objRef) {
|
138 |
|
|
objRef.model.active = -1;
|
139 |
|
|
objRef.model.historyList = new Array();
|
140 |
|
|
objRef.add(objRef);
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
<span class="comment">/**
|
144 |
|
|
* This adds the current extent to the historyList
|
145 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
146 |
|
|
*/</span>
|
147 |
|
|
<span class="reserved">this</span>.add = <span class="reserved">function</span>(objRef) {
|
148 |
|
|
<span class="reserved">if</span> (objRef.model.active!=null) {
|
149 |
|
|
var place = objRef.model.active;
|
150 |
|
|
var list = objRef.model.historyList;
|
151 |
|
|
var center = objRef.targetModel.map.getExtent().getCenterLonLat();
|
152 |
|
|
<span class="comment"> // take the current scale -1, otherwise we get troubles when</span>
|
153 |
|
|
<span class="comment"> // fixed scales are defined</span>
|
154 |
|
|
var scale = objRef.targetModel.map.getScale()-1;
|
155 |
|
|
<span class="reserved">if</span> (place > -1) {
|
156 |
|
|
<span class="comment"> // check if current and previous history entry would result</span>
|
157 |
|
|
<span class="comment"> // in same center point and zoom level. If this is the case,</span>
|
158 |
|
|
<span class="comment"> // we do not want a new entry in the list</span>
|
159 |
|
|
<span class="reserved">if</span> (center.toString() == list[place].center.toString() &&
|
160 |
|
|
scale == list[place].scale) {
|
161 |
|
|
<span class="reserved">return</span>;
|
162 |
|
|
}
|
163 |
|
|
}
|
164 |
|
|
var newExtent = new Object({center:center, scale:scale});
|
165 |
|
|
|
166 |
|
|
<span class="reserved">if</span>( place==(list.length-1)) { //If we are already at the end of the list add a new item
|
167 |
|
|
list.push(newExtent);
|
168 |
|
|
place = place+1;
|
169 |
|
|
}
|
170 |
|
|
<span class="reserved">else</span> { //If we are somewhere in the middle of the list clear the rest of the list and add a new item
|
171 |
|
|
place = place+1;
|
172 |
|
|
list = list.slice(0,place);
|
173 |
|
|
list.push(newExtent);
|
174 |
|
|
}
|
175 |
|
|
objRef.model.active = place;
|
176 |
|
|
objRef.model.historyList = list;
|
177 |
|
|
}
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
<span class="comment">/**
|
181 |
|
|
* This returns the previous extent in the list
|
182 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
183 |
|
|
*/</span>
|
184 |
|
|
|
185 |
|
|
<span class="reserved">this</span>.back = <span class="reserved">function</span>(objRef){
|
186 |
|
|
var place = objRef.model.active;
|
187 |
|
|
<span class="reserved">if</span>(place<1) {
|
188 |
|
|
objRef.model.previousExtent = null;
|
189 |
|
|
alert(mbGetMessage(<span class="literal">"cantGoBack"</span>));
|
190 |
|
|
}
|
191 |
|
|
<span class="reserved">else</span> {
|
192 |
|
|
place = place -1;
|
193 |
|
|
objRef.model.active = place;
|
194 |
|
|
objRef.model.previousExtent = objRef.model.historyList[place];
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
}
|
198 |
|
|
<span class="comment">/**
|
199 |
|
|
* This returns the next extent in the list
|
200 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
201 |
|
|
*/</span>
|
202 |
|
|
<span class="reserved">this</span>.forward = <span class="reserved">function</span>(objRef) {
|
203 |
|
|
var place = objRef.model.active;
|
204 |
|
|
<span class="reserved">if</span>(place<(objRef.model.historyList.length-1)) {
|
205 |
|
|
place = place +1;
|
206 |
|
|
objRef.model.active = place;
|
207 |
|
|
objRef.model.nextExtent = objRef.model.historyList[place];
|
208 |
|
|
}
|
209 |
|
|
<span class="reserved">else</span> {
|
210 |
|
|
objRef.model.nextExtent = null;
|
211 |
|
|
alert(mbGetMessage(<span class="literal">"cantGoForward"</span>));
|
212 |
|
|
}
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
<span class="comment">/**
|
216 |
|
|
* This stops the listener, to prevent the undo/redo steps to appear in the list
|
217 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
218 |
|
|
*/</span>
|
219 |
|
|
<span class="reserved">this</span>.stop = <span class="reserved">function</span>(objRef) {
|
220 |
|
|
objRef.model.removeListener(<span class="literal">"bbox"</span>,objRef.add, objRef);
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
<span class="comment">/**
|
224 |
|
|
* This restarts the listener after undo/redo is done.
|
225 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
226 |
|
|
*/</span>
|
227 |
|
|
<span class="reserved">this</span>.start = <span class="reserved">function</span>(objRef) {
|
228 |
|
|
objRef.model.addListener(<span class="literal">"bbox"</span>,objRef.add, objRef);
|
229 |
|
|
}
|
230 |
|
|
<span class="comment">/**
|
231 |
|
|
* Set the loadModel listener in response to the init event
|
232 |
|
|
* <span class="attrib">@param</span> objRef pointer to this object.
|
233 |
|
|
*/</span>
|
234 |
|
|
<span class="reserved">this</span>.initReset = <span class="reserved">function</span>(objRef) {
|
235 |
|
|
objRef.targetModel.addListener(<span class="literal">"bbox"</span>, objRef.add, objRef);
|
236 |
|
|
objRef.targetModel.addListener(<span class="literal">"loadModel"</span>, objRef.init, objRef);
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"historyBack"</span>, <span class="reserved">this</span>.back, <span class="reserved">this</span>);
|
240 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"historyForward"</span>, <span class="reserved">this</span>.forward, <span class="reserved">this</span>);
|
241 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"historyStart"</span>, <span class="reserved">this</span>.start, <span class="reserved">this</span>);
|
242 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"historyStop"</span>, <span class="reserved">this</span>.stop, <span class="reserved">this</span>);
|
243 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"init"</span>, <span class="reserved">this</span>.initReset, <span class="reserved">this</span>);
|
244 |
|
|
}</pre>
|
245 |
|
|
<hr>
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
250 |
|
|
<a name="navbar_top"><!-- --></a>
|
251 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
252 |
|
|
<tr>
|
253 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
254 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
255 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
256 |
|
|
<tr align="center" valign="top">
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
260 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
264 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
265 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
266 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
267 |
|
|
</tr>
|
268 |
|
|
</table>
|
269 |
|
|
</td>
|
270 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
271 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
272 |
|
|
</td>
|
273 |
|
|
</tr>
|
274 |
|
|
|
275 |
|
|
<tr>
|
276 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
277 |
|
|
PREV
|
278 |
|
|
NEXT</font></td>
|
279 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
280 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
281 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
282 |
|
|
|
283 |
|
|
<script>
|
284 |
|
|
<!--
|
285 |
|
|
if(window==top) {
|
286 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
287 |
|
|
}
|
288 |
|
|
//-->
|
289 |
|
|
</script>
|
290 |
|
|
<noscript>
|
291 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
292 |
|
|
</noscript>
|
293 |
|
|
</font></td>
|
294 |
|
|
</tr>
|
295 |
|
|
</table>
|
296 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
297 |
|
|
|
298 |
|
|
<hr>
|
299 |
|
|
<font size="-1">
|
300 |
|
|
|
301 |
|
|
</font>
|
302 |
|
|
<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>
|
303 |
|
|
</body>
|
304 |
|
|
</html>
|