1
|
<!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="AoiBoxOL.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>AoiBoxOL.js</h2>
|
72
|
|
73
|
</center>
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
<h4>Summary</h4>
|
79
|
<p>
|
80
|
|
81
|
No overview generated for 'AoiBoxOL.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="AoiBoxOL.html">AoiBoxOL</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: Mike Adair mike.adairATccrs.nrcan.gc.ca
|
113
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
114
|
|
115
|
$Id: AoiBoxDHTML.js,v 1.2 2008/03/18 09:59:16 terral Exp $
|
116
|
*/</span>
|
117
|
<span class="comment">
|
118
|
// Ensure this object's dependancies are loaded.</span>
|
119
|
mapbuilder.loadScript(baseDir+<span class="literal">"/widget/WidgetBase.js"</span>);
|
120
|
|
121
|
<span class="comment">/**
|
122
|
* Widget to draw an Area Of Interest box of a model. The box can be drawn with
|
123
|
* the paint() method and is registered as a listener of the context AOI property.
|
124
|
* This object works entirely in pixel/line coordinate space and knows nothing
|
125
|
* about geography. This widget uses DHTML methods to draw the box. Since it
|
126
|
* does not support a targetModel property, it has to be defined as a child widget
|
127
|
* of the context of the map that the box should be drawn into.
|
128
|
* WARNING: This widget cannot be used in maps that use button controls.
|
129
|
* Button controls take care of aoi handling themselves.
|
130
|
* It is designed for use in locator map setups only.
|
131
|
* See also MAP-312
|
132
|
* <span class="attrib">@deprecated</span>
|
133
|
* <span class="attrib">@constructor</span>
|
134
|
* <span class="attrib">@base</span> WidgetBase
|
135
|
* <span class="attrib">@param</span> widgetNode The node for this object from the Config file.
|
136
|
* <span class="attrib">@param</span> model The model that contains this object.
|
137
|
*/</span>
|
138
|
<span class="reserved">function</span> AoiBoxOL(widgetNode, model) {
|
139
|
WidgetBase.apply(<span class="reserved">this</span>,new Array(widgetNode, model));
|
140
|
|
141
|
<span class="reserved">this</span>.cursor = <span class="literal">'crosshair'</span>;
|
142
|
|
143
|
<span class="comment">/**
|
144
|
* Interactive ZoomOut control.
|
145
|
* <span class="attrib">@param</span> objRef reference to this object.
|
146
|
* <span class="attrib">@return</span> {OpenLayers.Control} class of the OL control.
|
147
|
*/</span>
|
148
|
<span class="reserved">this</span>.createControl = <span class="reserved">function</span>(objRef) {
|
149
|
var Control = OpenLayers.Class( OpenLayers.Control, {
|
150
|
CLASS_NAME: <span class="literal">'mbControl.AoiBoxOL'</span>,
|
151
|
type: OpenLayers.Control.TYPE_TOOL,
|
152
|
|
153
|
draw: <span class="reserved">function</span>() {
|
154
|
<span class="reserved">this</span>.handler = new OpenLayers.Handler.Box( <span class="reserved">this</span>,
|
155
|
{done: <span class="reserved">this</span>.aoiBox}, {keyMask: <span class="reserved">this</span>.keyMask} );
|
156
|
|
157
|
},
|
158
|
|
159
|
aoiBox: <span class="reserved">function</span> (position) {
|
160
|
<span class="reserved">if</span> (position instanceof OpenLayers.Bounds) {
|
161
|
var minXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
162
|
new OpenLayers.Pixel(position.left, position.bottom));
|
163
|
var maxXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
164
|
new OpenLayers.Pixel(position.right, position.top));
|
165
|
var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
|
166
|
maxXY.lon, maxXY.lat);
|
167
|
}
|
168
|
<span class="reserved">else</span>{
|
169
|
var XY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
170
|
new OpenLayers.Pixel(position.x, position.y));
|
171
|
var bounds = new OpenLayers.Bounds(XY.lon, XY.lat,
|
172
|
XY.lon,XY.lat);
|
173
|
}
|
174
|
var bboxOL = bounds.toBBOX().split(<span class="literal">','</span>);
|
175
|
var ul = new Array(bboxOL[0],bboxOL[3]);
|
176
|
var lr = new Array(bboxOL[2],bboxOL[1]);
|
177
|
objRef.model.setParam(<span class="literal">"aoi"</span>, new Array(ul, lr));
|
178
|
}
|
179
|
});
|
180
|
|
181
|
<span class="reserved">return</span> Control;
|
182
|
}
|
183
|
|
184
|
<span class="reserved">this</span>.init = <span class="reserved">function</span>(objRef) {
|
185
|
var Control = objRef.createControl(objRef);
|
186
|
var ct=new Control();
|
187
|
objRef.model.map.addControl(ct);
|
188
|
ct.activate();
|
189
|
}
|
190
|
|
191
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"loadModel"</span>,<span class="reserved">this</span>.init, <span class="reserved">this</span>);
|
192
|
<span class="comment">/**
|
193
|
* Draws a bounding box around the current AOI.
|
194
|
* <span class="attrib">@param</span> objRef reference to this widget
|
195
|
*/</span>
|
196
|
<span class="reserved">this</span>.drawAoiBox = <span class="reserved">function</span>(objRef) {
|
197
|
<span class="reserved">if</span>(objRef.model.map){
|
198
|
var ext = objRef.model.getParam(<span class="literal">'aoi'</span>);
|
199
|
var bounds = new OpenLayers.Bounds(ext[0][0], ext[1][1], ext[1][0], ext[0][1]);
|
200
|
objRef.model.aoiBoxLayer = new OpenLayers.Layer.Boxes(<span class="literal">'Boxes'</span>);
|
201
|
objRef.model.map.addLayer(objRef.model.aoiBoxLayer);
|
202
|
var box = new OpenLayers.Marker.Box(bounds);
|
203
|
objRef.model.aoiBoxLayer.addMarker(box);
|
204
|
}
|
205
|
}
|
206
|
<span class="comment">/**
|
207
|
* Clears the AOI box.
|
208
|
* <span class="attrib">@param</span> objRef reference to this widget
|
209
|
*/</span>
|
210
|
<span class="reserved">this</span>.clearAoiBox = <span class="reserved">function</span>(objRef) {
|
211
|
<span class="reserved">if</span> (objRef.model.aoiBoxLayer) {
|
212
|
objRef.model.aoiBoxLayer.destroy();
|
213
|
}
|
214
|
}
|
215
|
<span class="comment">
|
216
|
// adds a listener to the context to clear the AOI box when AOI changes</span>
|
217
|
<span class="reserved">this</span>.model.addListener(<span class="literal">'aoi'</span>, <span class="reserved">this</span>.clearAoiBox, <span class="reserved">this</span>);
|
218
|
<span class="reserved">this</span>.model.addListener(<span class="literal">'aoi'</span>, <span class="reserved">this</span>.drawAoiBox, <span class="reserved">this</span>);
|
219
|
}</pre>
|
220
|
<hr>
|
221
|
|
222
|
|
223
|
|
224
|
<!-- ========== START OF NAVBAR ========== -->
|
225
|
<a name="navbar_top"><!-- --></a>
|
226
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
227
|
<tr>
|
228
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
229
|
<a name="navbar_top_firstrow"><!-- --></a>
|
230
|
<table border="0" cellpadding="0" cellspacing="3">
|
231
|
<tr align="center" valign="top">
|
232
|
|
233
|
|
234
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
235
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
236
|
|
237
|
|
238
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
239
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
240
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
241
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
242
|
</tr>
|
243
|
</table>
|
244
|
</td>
|
245
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
246
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
247
|
</td>
|
248
|
</tr>
|
249
|
|
250
|
<tr>
|
251
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
252
|
PREV
|
253
|
NEXT</font></td>
|
254
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
255
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
256
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
257
|
|
258
|
<script>
|
259
|
<!--
|
260
|
if(window==top) {
|
261
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
262
|
}
|
263
|
//-->
|
264
|
</script>
|
265
|
<noscript>
|
266
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
267
|
</noscript>
|
268
|
</font></td>
|
269
|
</tr>
|
270
|
</table>
|
271
|
<!-- =========== END OF NAVBAR =========== -->
|
272
|
|
273
|
<hr>
|
274
|
<font size="-1">
|
275
|
|
276
|
</font>
|
277
|
<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>
|
278
|
</body>
|
279
|
</html>
|