-
Notifications
You must be signed in to change notification settings - Fork 0
/
tx_dlf_ol3-3e6cda8.js
136 lines (125 loc) · 3.27 KB
/
tx_dlf_ol3-3e6cda8.js
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
/**
* (c) Kitodo. Key to digital objects e.V. <[email protected]>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
/**
* @return {number|undefined}
*/
ol.Map.prototype.getZoom = function(){
return this.getView().getZoom();
};
/**
* Returns an array containing the min and max zoom level [minZoom, maxZoom]
* @return {Array.<number>}
*/
ol.Map.prototype.getZoomRange = function() {
var maxZoom = window.OL3_MAX_ZOOM !== undefined && !isNaN(window.OL3_MAX_ZOOM) ? window.OL3_MAX_ZOOM : 18;
return [0, maxZoom];
};
/**
* Zooms to given zoomLevel
*
* @param {number} zoomLevel
*/
ol.Map.prototype.zoom = function(zoomLevel) {
var view = this.getView(),
resolution = view.getResolution();
this.beforeRender(ol.animation.zoom({
'resolution': resolution,
'duration': 500
}));
view.setZoom(zoomLevel);
};
/**
* Zooms in the map. Uses ol.animation for smooth zooming
*/
ol.Map.prototype.zoomIn = function() {
var view = this.getView(),
zoomLevel = view.getZoom() + 1,
resolution = view.getResolution();
this.beforeRender(ol.animation.zoom({
'resolution': resolution,
'duration': 500
}));
view.setZoom(zoomLevel);
};
/**
* Zooms out the map
*/
ol.Map.prototype.zoomOut = function() {
var view = this.getView(),
zoomLevel = view.getZoom() - 1,
resolution = view.getResolution();
this.beforeRender(ol.animation.zoom({
'resolution': resolution,
'duration': 500
}));
view.setZoom(zoomLevel);
};
/**
* Zooms to given point
* @param {Array.<number>} center
* @param {number} zoomLevel
* @param {number=} opt_duration
*/
ol.Map.prototype.zoomTo = function(center, zoomLevel, opt_duration) {
var view = this.getView(),
resolution = view.getResolution(),
duration = opt_duration !== undefined ? opt_duration : 500;
this.beforeRender(ol.animation.zoom({
'resolution': resolution,
'duration': duration
}));
view.setCenter(center);
view.setZoom(zoomLevel);
};
/**
* Rotate the map
* @param {number} rotation
*/
ol.Map.prototype.rotate = function(rotation) {
var view = this.getView(),
rotate = view.getRotation() + (rotation * Math.PI/180),
center = view.getCenter();
this.beforeRender(ol.animation.rotate({
'rotation':view.getRotation(),
'anchor':center,
'duration':200
}));
view.rotate(rotate, center);
if (this.ov_view != null) {
this.ov_view.rotate(rotate);
}
};
/**
* Rotate the map in the left direction
*/
ol.Map.prototype.rotateLeft = function() {
this.rotate(-5);
if (this.ov_view != null) {
this.ov_view.rotate(-5);
}
};
/**
* Rotate the map in the right direction
*/
ol.Map.prototype.rotateRight = function() {
this.rotate(5);
if (this.ov_view != null) {
this.ov_view.rotate(5);
}
};
/**
* Resets the rotation of the map
*/
ol.Map.prototype.resetRotation = function() {
this.getView().rotate(0, this.getView().getCenter());
if (this.ov_view != null) {
this.ov_view.rotate(0);
}
};