1
|
/*
|
2
|
Author: Steven Ottens AT geodan.nl
|
3
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
4
|
$Id: Back.js 3587 2007-11-12 12:24:58Z ahocevar $
|
5
|
*/
|
6
|
|
7
|
// Ensure this object's dependancies are loaded.
|
8
|
mapbuilder.loadScript(baseDir+"/widget/ButtonBase.js");
|
9
|
|
10
|
/**
|
11
|
* When this button is pressed the map will reload with it's original extent
|
12
|
* @constructor
|
13
|
* @base ButtonBase
|
14
|
* @author Steven Ottens AT geodan.nl
|
15
|
* @param widgetNode The widget node from the Config XML file.
|
16
|
* @param model The model for this widget
|
17
|
*/
|
18
|
function Back(widgetNode, model) {
|
19
|
|
20
|
ButtonBase.apply(this, new Array(widgetNode, model));
|
21
|
|
22
|
/**
|
23
|
* Interactive ZoomOut control.
|
24
|
* @param objRef reference to this object.
|
25
|
* @return {OpenLayers.Control} instance of the OL control.
|
26
|
*/
|
27
|
this.createControl = function(objRef) {
|
28
|
var Control = OpenLayers.Class( OpenLayers.Control, {
|
29
|
type: OpenLayers.Control.TYPE_BUTTON,
|
30
|
|
31
|
trigger: function() {
|
32
|
var objRef = this.objRef;
|
33
|
objRef.targetModel.setParam("historyBack");
|
34
|
var previousExtent = objRef.targetModel.previousExtent;
|
35
|
if(previousExtent){
|
36
|
objRef.targetModel.setParam("historyStop");
|
37
|
this.map.setCenter(previousExtent.center);
|
38
|
this.map.zoomToScale(previousExtent.scale);
|
39
|
objRef.targetModel.setParam("historyStart");
|
40
|
}
|
41
|
},
|
42
|
|
43
|
CLASS_NAME: 'mbControl.Back'
|
44
|
});
|
45
|
return Control;
|
46
|
}
|
47
|
}
|
48
|
|
49
|
|