ol 6.1.1-dev.1581430188339 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ImageTile.js +13 -0
- package/ImageTile.js.map +1 -1
- package/MapBrowserEventHandler.js +2 -28
- package/MapBrowserEventHandler.js.map +1 -1
- package/PluggableMap.js +37 -30
- package/PluggableMap.js.map +1 -1
- package/Tile.js +3 -2
- package/Tile.js.map +1 -1
- package/TileCache.js +7 -4
- package/TileCache.js.map +1 -1
- package/TileQueue.js +12 -2
- package/TileQueue.js.map +1 -1
- package/TileState.js +2 -1
- package/TileState.js.map +1 -1
- package/VectorRenderTile.js +43 -23
- package/VectorRenderTile.js.map +1 -1
- package/VectorTile.js +5 -3
- package/VectorTile.js.map +1 -1
- package/View.js +39 -73
- package/View.js.map +1 -1
- package/control/Attribution.js +1 -0
- package/control/Attribution.js.map +1 -1
- package/control/Control.js +1 -11
- package/control/Control.js.map +1 -1
- package/control/MousePosition.js +5 -4
- package/control/MousePosition.js.map +1 -1
- package/control/OverviewMap.js +1 -2
- package/control/OverviewMap.js.map +1 -1
- package/control/Rotate.js +3 -3
- package/control/Rotate.js.map +1 -1
- package/control/ScaleLine.js +1 -0
- package/control/ScaleLine.js.map +1 -1
- package/control/ZoomSlider.js +6 -4
- package/control/ZoomSlider.js.map +1 -1
- package/dom.js +2 -4
- package/dom.js.map +1 -1
- package/events/EventType.js +0 -1
- package/events/EventType.js.map +1 -1
- package/events/condition.js +5 -3
- package/events/condition.js.map +1 -1
- package/format/GeoJSON.js +0 -3
- package/format/GeoJSON.js.map +1 -1
- package/format/KML.js +43 -129
- package/format/KML.js.map +1 -1
- package/format/WMTSCapabilities.js +1 -4
- package/format/WMTSCapabilities.js.map +1 -1
- package/format/XMLFeature.js +2 -2
- package/format/XMLFeature.js.map +1 -1
- package/format/xsd.js +6 -6
- package/format/xsd.js.map +1 -1
- package/has.js +0 -19
- package/has.js.map +1 -1
- package/interaction/DragBox.js +16 -4
- package/interaction/DragBox.js.map +1 -1
- package/interaction/DragPan.js +2 -15
- package/interaction/DragPan.js.map +1 -1
- package/interaction/Draw.js +36 -89
- package/interaction/Draw.js.map +1 -1
- package/interaction/Modify.js +4 -5
- package/interaction/Modify.js.map +1 -1
- package/interaction/MouseWheelZoom.js +64 -29
- package/interaction/MouseWheelZoom.js.map +1 -1
- package/interaction/Pointer.js +3 -9
- package/interaction/Pointer.js.map +1 -1
- package/layer/Graticule.js +8 -21
- package/layer/Graticule.js.map +1 -1
- package/layer/Heatmap.js +1 -3
- package/layer/Heatmap.js.map +1 -1
- package/layer/Layer.js +1 -8
- package/layer/Layer.js.map +1 -1
- package/layer/VectorTile.js +2 -5
- package/layer/VectorTile.js.map +1 -1
- package/layer/VectorTileRenderType.js +1 -6
- package/layer/VectorTileRenderType.js.map +1 -1
- package/layer/WebGLPoints.js +1 -1
- package/ol.css +0 -9
- package/package.json +2 -2
- package/render/canvas/Executor.js +117 -122
- package/render/canvas/Executor.js.map +1 -1
- package/render/canvas/ExecutorGroup.js +45 -11
- package/render/canvas/ExecutorGroup.js.map +1 -1
- package/render/canvas/LabelCache.js +77 -0
- package/render/canvas/LabelCache.js.map +1 -0
- package/render/canvas/TextBuilder.js +4 -3
- package/render/canvas/TextBuilder.js.map +1 -1
- package/render/canvas/hitdetect.js +6 -9
- package/render/canvas/hitdetect.js.map +1 -1
- package/render/canvas.js +48 -41
- package/render/canvas.js.map +1 -1
- package/renderer/Composite.js +4 -5
- package/renderer/Composite.js.map +1 -1
- package/renderer/canvas/TileLayer.js +21 -0
- package/renderer/canvas/TileLayer.js.map +1 -1
- package/renderer/canvas/VectorImageLayer.js +0 -1
- package/renderer/canvas/VectorImageLayer.js.map +1 -1
- package/renderer/canvas/VectorLayer.js +43 -38
- package/renderer/canvas/VectorLayer.js.map +1 -1
- package/renderer/canvas/VectorTileLayer.js +32 -24
- package/renderer/canvas/VectorTileLayer.js.map +1 -1
- package/renderer/webgl/PointsLayer.js +6 -0
- package/renderer/webgl/PointsLayer.js.map +1 -1
- package/reproj/Tile.js +9 -0
- package/reproj/Tile.js.map +1 -1
- package/resolutionconstraint.js +8 -15
- package/resolutionconstraint.js.map +1 -1
- package/source/IIIF.js +2 -5
- package/source/IIIF.js.map +1 -1
- package/source/Tile.js +3 -0
- package/source/Tile.js.map +1 -1
- package/source/UTFGrid.js +5 -9
- package/source/UTFGrid.js.map +1 -1
- package/source/UrlTile.js +1 -1
- package/source/UrlTile.js.map +1 -1
- package/source/Vector.js +3 -0
- package/source/Vector.js.map +1 -1
- package/source/VectorTile.js +61 -79
- package/source/VectorTile.js.map +1 -1
- package/source/WMTS.js +1 -1
- package/source/Zoomify.js +20 -12
- package/source/Zoomify.js.map +1 -1
- package/sphere.js +6 -0
- package/sphere.js.map +1 -1
- package/src/ImageTile.js +14 -0
- package/src/MapBrowserEventHandler.js +2 -33
- package/src/PluggableMap.js +40 -34
- package/src/Tile.js +3 -2
- package/src/TileCache.js +11 -2
- package/src/TileQueue.js +11 -2
- package/src/TileState.js +2 -1
- package/src/VectorRenderTile.js +47 -25
- package/src/VectorTile.js +6 -3
- package/src/View.js +39 -78
- package/src/control/Attribution.js +1 -0
- package/src/control/Control.js +1 -12
- package/src/control/MousePosition.js +2 -2
- package/src/control/OverviewMap.js +1 -2
- package/src/control/Rotate.js +3 -3
- package/src/control/ScaleLine.js +1 -0
- package/src/control/ZoomSlider.js +3 -2
- package/src/dom.js +2 -4
- package/src/events/EventType.js +0 -1
- package/src/events/condition.js +6 -3
- package/src/format/GeoJSON.js +0 -2
- package/src/format/KML.js +45 -133
- package/src/format/WMTSCapabilities.js +1 -4
- package/src/format/XMLFeature.js +2 -2
- package/src/format/xsd.js +6 -6
- package/src/has.js +0 -20
- package/src/interaction/DragBox.js +19 -4
- package/src/interaction/DragPan.js +2 -17
- package/src/interaction/Draw.js +36 -92
- package/src/interaction/Modify.js +4 -5
- package/src/interaction/MouseWheelZoom.js +74 -31
- package/src/interaction/Pointer.js +3 -10
- package/src/layer/Graticule.js +9 -23
- package/src/layer/Heatmap.js +1 -3
- package/src/layer/Layer.js +1 -8
- package/src/layer/VectorTile.js +3 -6
- package/src/layer/VectorTileRenderType.js +1 -6
- package/src/layer/WebGLPoints.js +1 -1
- package/src/ol.css +0 -9
- package/src/render/canvas/Executor.js +91 -109
- package/src/render/canvas/ExecutorGroup.js +21 -1
- package/src/render/canvas/LabelCache.js +69 -0
- package/src/render/canvas/TextBuilder.js +5 -3
- package/src/render/canvas/hitdetect.js +6 -9
- package/src/render/canvas.js +58 -44
- package/src/renderer/Composite.js +4 -5
- package/src/renderer/canvas/TileLayer.js +22 -0
- package/src/renderer/canvas/VectorImageLayer.js +0 -1
- package/src/renderer/canvas/VectorLayer.js +43 -39
- package/src/renderer/canvas/VectorTileLayer.js +30 -23
- package/src/renderer/webgl/PointsLayer.js +8 -0
- package/src/reproj/Tile.js +10 -0
- package/src/resolutionconstraint.js +8 -16
- package/src/source/IIIF.js +2 -5
- package/src/source/Tile.js +3 -0
- package/src/source/UTFGrid.js +5 -8
- package/src/source/UrlTile.js +1 -1
- package/src/source/Vector.js +3 -0
- package/src/source/VectorTile.js +66 -80
- package/src/source/WMTS.js +1 -1
- package/src/source/Zoomify.js +22 -15
- package/src/sphere.js +7 -0
- package/src/structs/LRUCache.js +6 -1
- package/src/structs/RBush.js +1 -1
- package/src/style/Circle.js +2 -5
- package/src/style/Icon.js +1 -5
- package/src/style/Image.js +1 -18
- package/src/style/LiteralStyle.js +0 -1
- package/src/style/RegularShape.js +3 -7
- package/src/style/Stroke.js +1 -1
- package/src/style/expressions.js +0 -2
- package/src/tilegrid/TileGrid.js +3 -9
- package/src/tilegrid/WMTS.js +10 -5
- package/src/transform.js +0 -19
- package/src/webgl/PostProcessingPass.js +12 -12
- package/src/webgl/ShaderBuilder.js +3 -38
- package/src/xml.js +10 -49
- package/structs/LRUCache.js +26 -7
- package/structs/LRUCache.js.map +1 -1
- package/structs/RBush.js +1 -1
- package/structs/RBush.js.map +1 -1
- package/style/Circle.js +2 -5
- package/style/Circle.js.map +1 -1
- package/style/Icon.js +0 -5
- package/style/Icon.js.map +1 -1
- package/style/Image.js +1 -16
- package/style/Image.js.map +1 -1
- package/style/LiteralStyle.js +0 -1
- package/style/LiteralStyle.js.map +1 -1
- package/style/RegularShape.js +3 -7
- package/style/RegularShape.js.map +1 -1
- package/style/Stroke.js +1 -1
- package/style/expressions.js +0 -2
- package/style/expressions.js.map +1 -1
- package/tilegrid/TileGrid.js +3 -9
- package/tilegrid/TileGrid.js.map +1 -1
- package/tilegrid/WMTS.js +10 -5
- package/tilegrid/WMTS.js.map +1 -1
- package/transform.js +0 -18
- package/transform.js.map +1 -1
- package/util.js +1 -1
- package/webgl/PostProcessingPass.js +11 -12
- package/webgl/PostProcessingPass.js.map +1 -1
- package/webgl/ShaderBuilder.js +1 -20
- package/webgl/ShaderBuilder.js.map +1 -1
- package/xml.js +8 -42
- package/xml.js.map +1 -1
package/VectorRenderTile.js
CHANGED
|
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
import { getUid } from './util.js';
|
|
18
18
|
import Tile from './Tile.js';
|
|
19
19
|
import { createCanvasContext2D } from './dom.js';
|
|
20
|
+
import { unlistenByKey } from './events.js';
|
|
20
21
|
/**
|
|
21
22
|
* @typedef {Object} ReplayState
|
|
22
23
|
* @property {boolean} dirty
|
|
@@ -28,20 +29,19 @@ import { createCanvasContext2D } from './dom.js';
|
|
|
28
29
|
* @property {number} renderedTileResolution
|
|
29
30
|
* @property {number} renderedTileZ
|
|
30
31
|
*/
|
|
31
|
-
/**
|
|
32
|
-
* @type {Array<HTMLCanvasElement>}
|
|
33
|
-
*/
|
|
34
|
-
var canvasPool = [];
|
|
35
32
|
var VectorRenderTile = /** @class */ (function (_super) {
|
|
36
33
|
__extends(VectorRenderTile, _super);
|
|
37
34
|
/**
|
|
38
35
|
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
39
36
|
* @param {import("./TileState.js").default} state State.
|
|
40
37
|
* @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
|
|
38
|
+
* @param {import("./tilegrid/TileGrid.js").default} sourceTileGrid Tile grid of the source.
|
|
41
39
|
* @param {function(VectorRenderTile):Array<import("./VectorTile").default>} getSourceTiles Function
|
|
42
|
-
* to get source tiles for this tile.
|
|
40
|
+
* to get an source tiles for this tile.
|
|
41
|
+
* @param {function(VectorRenderTile):void} removeSourceTiles Function to remove this tile from its
|
|
42
|
+
* source tiles's consumer count.
|
|
43
43
|
*/
|
|
44
|
-
function VectorRenderTile(tileCoord, state, urlTileCoord, getSourceTiles) {
|
|
44
|
+
function VectorRenderTile(tileCoord, state, urlTileCoord, sourceTileGrid, getSourceTiles, removeSourceTiles) {
|
|
45
45
|
var _this = _super.call(this, tileCoord, state, { transition: 0 }) || this;
|
|
46
46
|
/**
|
|
47
47
|
* @private
|
|
@@ -64,18 +64,14 @@ var VectorRenderTile = /** @class */ (function (_super) {
|
|
|
64
64
|
*/
|
|
65
65
|
_this.errorSourceTileKeys = {};
|
|
66
66
|
/**
|
|
67
|
-
* @type {
|
|
67
|
+
* @type {ImageData}
|
|
68
68
|
*/
|
|
69
|
-
_this.hitDetectionImageData =
|
|
69
|
+
_this.hitDetectionImageData = null;
|
|
70
70
|
/**
|
|
71
71
|
* @private
|
|
72
72
|
* @type {!Object<string, ReplayState>}
|
|
73
73
|
*/
|
|
74
74
|
_this.replayState_ = {};
|
|
75
|
-
/**
|
|
76
|
-
* @type {Array<import("./VectorTile.js").default>}
|
|
77
|
-
*/
|
|
78
|
-
_this.sourceTiles = null;
|
|
79
75
|
/**
|
|
80
76
|
* @type {number}
|
|
81
77
|
*/
|
|
@@ -83,7 +79,20 @@ var VectorRenderTile = /** @class */ (function (_super) {
|
|
|
83
79
|
/**
|
|
84
80
|
* @type {!function():Array<import("./VectorTile.js").default>}
|
|
85
81
|
*/
|
|
86
|
-
_this.getSourceTiles = getSourceTiles.bind(
|
|
82
|
+
_this.getSourceTiles = getSourceTiles.bind(_this, _this);
|
|
83
|
+
/**
|
|
84
|
+
* @type {!function(import("./VectorRenderTile.js").default):void}
|
|
85
|
+
*/
|
|
86
|
+
_this.removeSourceTiles_ = removeSourceTiles;
|
|
87
|
+
/**
|
|
88
|
+
* @private
|
|
89
|
+
* @type {import("./tilegrid/TileGrid.js").default}
|
|
90
|
+
*/
|
|
91
|
+
_this.sourceTileGrid_ = sourceTileGrid;
|
|
92
|
+
/**
|
|
93
|
+
* @type {Array<import("./events.js").EventsKey>}
|
|
94
|
+
*/
|
|
95
|
+
_this.sourceTileListenerKeys = [];
|
|
87
96
|
/**
|
|
88
97
|
* z of the source tiles of the last getSourceTiles call.
|
|
89
98
|
* @type {number}
|
|
@@ -100,6 +109,26 @@ var VectorRenderTile = /** @class */ (function (_super) {
|
|
|
100
109
|
_this.wrappedTileCoord = urlTileCoord;
|
|
101
110
|
return _this;
|
|
102
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* @inheritDoc
|
|
114
|
+
*/
|
|
115
|
+
VectorRenderTile.prototype.disposeInternal = function () {
|
|
116
|
+
this.sourceTileListenerKeys.forEach(unlistenByKey);
|
|
117
|
+
this.sourceTileListenerKeys.length = 0;
|
|
118
|
+
this.removeSourceTiles_(this);
|
|
119
|
+
for (var key in this.context_) {
|
|
120
|
+
var canvas = this.context_[key].canvas;
|
|
121
|
+
canvas.width = 0;
|
|
122
|
+
canvas.height = 0;
|
|
123
|
+
}
|
|
124
|
+
for (var key in this.executorGroups) {
|
|
125
|
+
var executorGroups = this.executorGroups[key];
|
|
126
|
+
for (var i = 0, ii = executorGroups.length; i < ii; ++i) {
|
|
127
|
+
executorGroups[i].disposeInternal();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
_super.prototype.disposeInternal.call(this);
|
|
131
|
+
};
|
|
103
132
|
/**
|
|
104
133
|
* @param {import("./layer/Layer.js").default} layer Layer.
|
|
105
134
|
* @return {CanvasRenderingContext2D} The rendering context.
|
|
@@ -107,7 +136,7 @@ var VectorRenderTile = /** @class */ (function (_super) {
|
|
|
107
136
|
VectorRenderTile.prototype.getContext = function (layer) {
|
|
108
137
|
var key = getUid(layer);
|
|
109
138
|
if (!(key in this.context_)) {
|
|
110
|
-
this.context_[key] = createCanvasContext2D(
|
|
139
|
+
this.context_[key] = createCanvasContext2D();
|
|
111
140
|
}
|
|
112
141
|
return this.context_[key];
|
|
113
142
|
};
|
|
@@ -152,15 +181,6 @@ var VectorRenderTile = /** @class */ (function (_super) {
|
|
|
152
181
|
VectorRenderTile.prototype.load = function () {
|
|
153
182
|
this.getSourceTiles();
|
|
154
183
|
};
|
|
155
|
-
/**
|
|
156
|
-
* @inheritDoc
|
|
157
|
-
*/
|
|
158
|
-
VectorRenderTile.prototype.release = function () {
|
|
159
|
-
for (var key in this.context_) {
|
|
160
|
-
canvasPool.push(this.context_[key].canvas);
|
|
161
|
-
}
|
|
162
|
-
_super.prototype.release.call(this);
|
|
163
|
-
};
|
|
164
184
|
return VectorRenderTile;
|
|
165
185
|
}(Tile));
|
|
166
186
|
export default VectorRenderTile;
|
package/VectorRenderTile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorRenderTile.js","sourceRoot":"","sources":["src/VectorRenderTile.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"VectorRenderTile.js","sourceRoot":"","sources":["src/VectorRenderTile.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,qBAAqB,EAAC,MAAM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AC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,yCAAc,GAAd,UAAe,KAAK;QAClB,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG;gBACvB,KAAK,EAAE,KAAK;gBACZ,mBAAmB,EAAE,IAAI;gBACzB,kBAAkB,EAAE,GAAG;gBACvB,gBAAgB,EAAE,CAAC,CAAC;gBACpB,sBAAsB,EAAE,GAAG;gBAC3B,oBAAoB,EAAE,CAAC,CAAC;gBACxB,SAAS,EAAE,CAAC,CAAC;gBACb,aAAa,EAAE,CAAC,CAAC;aAClB,CAAC;SACH;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,+BAAI,GAAJ;QACE,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IACH,uBAAC;AAAD,CAAC,AA5KD,CAA+B,IAAI,GA4KlC;AAGD,eAAe,gBAAgB,CAAC"}
|
package/VectorTile.js
CHANGED
|
@@ -28,6 +28,10 @@ var VectorTile = /** @class */ (function (_super) {
|
|
|
28
28
|
*/
|
|
29
29
|
function VectorTile(tileCoord, state, src, format, tileLoadFunction, opt_options) {
|
|
30
30
|
var _this = _super.call(this, tileCoord, state, opt_options) || this;
|
|
31
|
+
/**
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
_this.consumers = 0;
|
|
31
35
|
/**
|
|
32
36
|
* Extent of this tile; set by the source.
|
|
33
37
|
* @type {import("./extent.js").Extent}
|
|
@@ -99,9 +103,7 @@ var VectorTile = /** @class */ (function (_super) {
|
|
|
99
103
|
if (this.state == TileState.IDLE) {
|
|
100
104
|
this.setState(TileState.LOADING);
|
|
101
105
|
this.tileLoadFunction_(this, this.url_);
|
|
102
|
-
|
|
103
|
-
this.loader_(this.extent, this.resolution, this.projection);
|
|
104
|
-
}
|
|
106
|
+
this.loader_(this.extent, this.resolution, this.projection);
|
|
105
107
|
}
|
|
106
108
|
};
|
|
107
109
|
/**
|
package/VectorTile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTile.js","sourceRoot":"","sources":["src/VectorTile.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC;IAAyB,8BAAI;IAE3B;;;;;;;OAOG;IACH,oBAAY,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW;QAAxE,YAEE,kBAAM,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"VectorTile.js","sourceRoot":"","sources":["src/VectorTile.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC;IAAyB,8BAAI;IAE3B;;;;;;;OAOG;IACH,oBAAY,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW;QAAxE,YAEE,kBAAM,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,SAuDrC;QArDC;;WAEG;QACH,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QAEnB;;;WAGG;QACH,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB;;;WAGG;QACH,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB;;;WAGG;QACH,KAAI,CAAC,OAAO,CAA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AAS,GAAT,UAAU,MAAM;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACH,iBAAC;AAAD,CAAC,AA5ID,CAAyB,IAAI,GA4I5B;AAED,eAAe,UAAU,CAAC"}
|
package/View.js
CHANGED
|
@@ -15,6 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
* @module ol/View
|
|
16
16
|
*/
|
|
17
17
|
import { DEFAULT_TILE_SIZE } from './tilegrid/common.js';
|
|
18
|
+
import { getUid } from './util.js';
|
|
18
19
|
import { VOID } from './functions.js';
|
|
19
20
|
import { createExtent, none as centerNone } from './centerconstraint.js';
|
|
20
21
|
import BaseObject from './Object.js';
|
|
@@ -134,14 +135,6 @@ import { createMinMaxResolution } from './resolutionconstraint.js';
|
|
|
134
135
|
* @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
|
|
135
136
|
* min/max values will be applied smoothly, i. e. allow the view to exceed slightly
|
|
136
137
|
* the given resolution or zoom bounds.
|
|
137
|
-
* @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to
|
|
138
|
-
* show the full configured extent. By default, when a view is configured with an
|
|
139
|
-
* extent, users will not be able to zoom out so the viewport exceeds the extent in
|
|
140
|
-
* either dimension. This means the full extent may not be visible if the viewport
|
|
141
|
-
* is taller or wider than the aspect ratio of the configured extent. If
|
|
142
|
-
* showFullExtent is true, the user will be able to zoom out so that the viewport
|
|
143
|
-
* exceeds the height or width of the configured extent, but not both, allowing the
|
|
144
|
-
* full extent to be shown.
|
|
145
138
|
* @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
|
|
146
139
|
* projection. The default is Spherical Mercator.
|
|
147
140
|
* @property {number} [resolution] The initial resolution for the view. The
|
|
@@ -292,11 +285,6 @@ var View = /** @class */ (function (_super) {
|
|
|
292
285
|
* @type {import("./proj/Projection.js").default}
|
|
293
286
|
*/
|
|
294
287
|
_this.projection_ = createProjection(options.projection, 'EPSG:3857');
|
|
295
|
-
/**
|
|
296
|
-
* @private
|
|
297
|
-
* @type {import("./size.js").Size}
|
|
298
|
-
*/
|
|
299
|
-
_this.viewportSize_ = [100, 100];
|
|
300
288
|
/**
|
|
301
289
|
* @private
|
|
302
290
|
* @type {import("./coordinate.js").Coordinate|undefined}
|
|
@@ -312,11 +300,6 @@ var View = /** @class */ (function (_super) {
|
|
|
312
300
|
* @type {number|undefined}
|
|
313
301
|
*/
|
|
314
302
|
_this.targetRotation_;
|
|
315
|
-
/**
|
|
316
|
-
* @private
|
|
317
|
-
* @type {import("./coordinate.js").Coordinate|undefined}
|
|
318
|
-
*/
|
|
319
|
-
_this.cancelAnchor_ = undefined;
|
|
320
303
|
if (options.center) {
|
|
321
304
|
options.center = fromUserCoordinate(options.center, _this.projection_);
|
|
322
305
|
}
|
|
@@ -563,19 +546,13 @@ var View = /** @class */ (function (_super) {
|
|
|
563
546
|
*/
|
|
564
547
|
View.prototype.cancelAnimations = function () {
|
|
565
548
|
this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);
|
|
566
|
-
var anchor;
|
|
567
549
|
for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
|
|
568
550
|
var series = this.animations_[i];
|
|
569
551
|
if (series[0].callback) {
|
|
570
552
|
animationCallback(series[0].callback, false);
|
|
571
553
|
}
|
|
572
|
-
anchor = anchor ||
|
|
573
|
-
series.filter(function (animation) {
|
|
574
|
-
return !animation.complete;
|
|
575
|
-
})[0].anchor;
|
|
576
554
|
}
|
|
577
555
|
this.animations_.length = 0;
|
|
578
|
-
this.cancelAnchor_ = anchor;
|
|
579
556
|
};
|
|
580
557
|
/**
|
|
581
558
|
* Update all animations.
|
|
@@ -622,7 +599,7 @@ var View = /** @class */ (function (_super) {
|
|
|
622
599
|
animation.targetResolution :
|
|
623
600
|
animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
|
|
624
601
|
if (animation.anchor) {
|
|
625
|
-
var size = this.
|
|
602
|
+
var size = this.getSizeFromViewport_(this.getRotation());
|
|
626
603
|
var constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);
|
|
627
604
|
this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);
|
|
628
605
|
}
|
|
@@ -692,33 +669,26 @@ var View = /** @class */ (function (_super) {
|
|
|
692
669
|
return center;
|
|
693
670
|
};
|
|
694
671
|
/**
|
|
695
|
-
* Returns the current viewport size.
|
|
696
672
|
* @private
|
|
697
673
|
* @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size
|
|
698
674
|
* @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
|
|
699
675
|
*/
|
|
700
|
-
View.prototype.
|
|
701
|
-
var size =
|
|
676
|
+
View.prototype.getSizeFromViewport_ = function (opt_rotation) {
|
|
677
|
+
var size = [100, 100];
|
|
678
|
+
var selector = '.ol-viewport[data-view="' + getUid(this) + '"]';
|
|
679
|
+
var element = document.querySelector(selector);
|
|
680
|
+
if (element) {
|
|
681
|
+
var metrics = getComputedStyle(element);
|
|
682
|
+
size[0] = parseInt(metrics.width, 10);
|
|
683
|
+
size[1] = parseInt(metrics.height, 10);
|
|
684
|
+
}
|
|
702
685
|
if (opt_rotation) {
|
|
703
686
|
var w = size[0];
|
|
704
687
|
var h = size[1];
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation))
|
|
708
|
-
];
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
return size;
|
|
688
|
+
size[0] = Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation));
|
|
689
|
+
size[1] = Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation));
|
|
712
690
|
}
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Stores the viewport size on the view. The viewport size is not read every time from the DOM
|
|
716
|
-
* to avoid performance hit and layout reflow.
|
|
717
|
-
* This should be done on map size change.
|
|
718
|
-
* @param {import("./size.js").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed
|
|
719
|
-
*/
|
|
720
|
-
View.prototype.setViewportSize = function (opt_size) {
|
|
721
|
-
this.viewportSize_ = Array.isArray(opt_size) ? opt_size.slice() : [100, 100];
|
|
691
|
+
return size;
|
|
722
692
|
};
|
|
723
693
|
/**
|
|
724
694
|
* Get the view center.
|
|
@@ -765,8 +735,8 @@ var View = /** @class */ (function (_super) {
|
|
|
765
735
|
* The size is the pixel dimensions of the box into which the calculated extent
|
|
766
736
|
* should fit. In most cases you want to get the extent of the entire map,
|
|
767
737
|
* that is `map.getSize()`.
|
|
768
|
-
* @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size
|
|
769
|
-
*
|
|
738
|
+
* @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size of the
|
|
739
|
+
* first map that uses this view will be used.
|
|
770
740
|
* @return {import("./extent.js").Extent} Extent.
|
|
771
741
|
* @api
|
|
772
742
|
*/
|
|
@@ -780,7 +750,7 @@ var View = /** @class */ (function (_super) {
|
|
|
780
750
|
* @return {import("./extent.js").Extent} Extent.
|
|
781
751
|
*/
|
|
782
752
|
View.prototype.calculateExtentInternal = function (opt_size) {
|
|
783
|
-
var size = opt_size || this.
|
|
753
|
+
var size = opt_size || this.getSizeFromViewport_();
|
|
784
754
|
var center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
|
|
785
755
|
assert(center, 1); // The view center is not defined
|
|
786
756
|
var resolution = /** @type {!number} */ (this.getResolution());
|
|
@@ -890,7 +860,7 @@ var View = /** @class */ (function (_super) {
|
|
|
890
860
|
* the given size.
|
|
891
861
|
*/
|
|
892
862
|
View.prototype.getResolutionForExtentInternal = function (extent, opt_size) {
|
|
893
|
-
var size = opt_size || this.
|
|
863
|
+
var size = opt_size || this.getSizeFromViewport_();
|
|
894
864
|
var xResolution = getWidth(extent) / size[0];
|
|
895
865
|
var yResolution = getHeight(extent) / size[1];
|
|
896
866
|
return Math.max(xResolution, yResolution);
|
|
@@ -903,7 +873,7 @@ var View = /** @class */ (function (_super) {
|
|
|
903
873
|
*/
|
|
904
874
|
View.prototype.getResolutionForValueFunction = function (opt_power) {
|
|
905
875
|
var power = opt_power || 2;
|
|
906
|
-
var maxResolution = this.
|
|
876
|
+
var maxResolution = this.maxResolution_;
|
|
907
877
|
var minResolution = this.minResolution_;
|
|
908
878
|
var max = Math.log(maxResolution / minResolution) / Math.log(power);
|
|
909
879
|
return (
|
|
@@ -932,17 +902,17 @@ var View = /** @class */ (function (_super) {
|
|
|
932
902
|
* @return {function(number): number} Value for resolution function.
|
|
933
903
|
*/
|
|
934
904
|
View.prototype.getValueForResolutionFunction = function (opt_power) {
|
|
935
|
-
var
|
|
936
|
-
var maxResolution = this.
|
|
905
|
+
var power = opt_power || 2;
|
|
906
|
+
var maxResolution = this.maxResolution_;
|
|
937
907
|
var minResolution = this.minResolution_;
|
|
938
|
-
var max = Math.log(maxResolution / minResolution) /
|
|
908
|
+
var max = Math.log(maxResolution / minResolution) / Math.log(power);
|
|
939
909
|
return (
|
|
940
910
|
/**
|
|
941
911
|
* @param {number} resolution Resolution.
|
|
942
912
|
* @return {number} Value.
|
|
943
913
|
*/
|
|
944
914
|
function (resolution) {
|
|
945
|
-
var value = (Math.log(maxResolution / resolution) /
|
|
915
|
+
var value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;
|
|
946
916
|
return value;
|
|
947
917
|
});
|
|
948
918
|
};
|
|
@@ -1033,7 +1003,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1033
1003
|
* @api
|
|
1034
1004
|
*/
|
|
1035
1005
|
View.prototype.fit = function (geometryOrExtent, opt_options) {
|
|
1036
|
-
var options = assign({ size: this.
|
|
1006
|
+
var options = assign({ size: this.getSizeFromViewport_() }, opt_options || {});
|
|
1037
1007
|
/** @type {import("./geom/SimpleGeometry.js").default} */
|
|
1038
1008
|
var geometry;
|
|
1039
1009
|
assert(Array.isArray(geometryOrExtent) || typeof /** @type {?} */ (geometryOrExtent).getSimplifiedGeometry === 'function', 24); // Invalid extent or geometry provided as `geometry`
|
|
@@ -1050,7 +1020,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1050
1020
|
else {
|
|
1051
1021
|
var userProjection = getUserProjection();
|
|
1052
1022
|
if (userProjection) {
|
|
1053
|
-
geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (
|
|
1023
|
+
geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry.clone().transform(userProjection, this.getProjection()));
|
|
1054
1024
|
}
|
|
1055
1025
|
else {
|
|
1056
1026
|
geometry = geometryOrExtent;
|
|
@@ -1066,7 +1036,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1066
1036
|
var options = opt_options || {};
|
|
1067
1037
|
var size = options.size;
|
|
1068
1038
|
if (!size) {
|
|
1069
|
-
size = this.
|
|
1039
|
+
size = this.getSizeFromViewport_();
|
|
1070
1040
|
}
|
|
1071
1041
|
var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
|
|
1072
1042
|
var nearest = options.nearest !== undefined ? options.nearest : false;
|
|
@@ -1201,9 +1171,9 @@ var View = /** @class */ (function (_super) {
|
|
|
1201
1171
|
*/
|
|
1202
1172
|
View.prototype.adjustResolutionInternal = function (ratio, opt_anchor) {
|
|
1203
1173
|
var isMoving = this.getAnimating() || this.getInteracting();
|
|
1204
|
-
var size = this.
|
|
1174
|
+
var size = this.getSizeFromViewport_(this.getRotation());
|
|
1205
1175
|
var newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
|
|
1206
|
-
if (opt_anchor) {
|
|
1176
|
+
if (opt_anchor !== undefined) {
|
|
1207
1177
|
this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
|
|
1208
1178
|
}
|
|
1209
1179
|
this.targetResolution_ *= ratio;
|
|
@@ -1239,7 +1209,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1239
1209
|
View.prototype.adjustRotationInternal = function (delta, opt_anchor) {
|
|
1240
1210
|
var isMoving = this.getAnimating() || this.getInteracting();
|
|
1241
1211
|
var newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
|
|
1242
|
-
if (opt_anchor) {
|
|
1212
|
+
if (opt_anchor !== undefined) {
|
|
1243
1213
|
this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
|
|
1244
1214
|
}
|
|
1245
1215
|
this.targetRotation_ += delta;
|
|
@@ -1312,7 +1282,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1312
1282
|
var isMoving = this.getAnimating() || this.getInteracting() || opt_forceMoving;
|
|
1313
1283
|
// compute rotation
|
|
1314
1284
|
var newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);
|
|
1315
|
-
var size = this.
|
|
1285
|
+
var size = this.getSizeFromViewport_(newRotation);
|
|
1316
1286
|
var newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);
|
|
1317
1287
|
var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving);
|
|
1318
1288
|
if (this.get(ViewProperty.ROTATION) !== newRotation) {
|
|
@@ -1327,7 +1297,6 @@ var View = /** @class */ (function (_super) {
|
|
|
1327
1297
|
if (this.getAnimating() && !opt_doNotCancelAnims) {
|
|
1328
1298
|
this.cancelAnimations();
|
|
1329
1299
|
}
|
|
1330
|
-
this.cancelAnchor_ = undefined;
|
|
1331
1300
|
};
|
|
1332
1301
|
/**
|
|
1333
1302
|
* If any constraints need to be applied, an animation will be triggered.
|
|
@@ -1342,18 +1311,16 @@ var View = /** @class */ (function (_super) {
|
|
|
1342
1311
|
var duration = opt_duration !== undefined ? opt_duration : 200;
|
|
1343
1312
|
var direction = opt_resolutionDirection || 0;
|
|
1344
1313
|
var newRotation = this.constraints_.rotation(this.targetRotation_);
|
|
1345
|
-
var size = this.
|
|
1314
|
+
var size = this.getSizeFromViewport_(newRotation);
|
|
1346
1315
|
var newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);
|
|
1347
1316
|
var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size);
|
|
1348
|
-
if (duration === 0
|
|
1317
|
+
if (duration === 0) {
|
|
1349
1318
|
this.targetResolution_ = newResolution;
|
|
1350
1319
|
this.targetRotation_ = newRotation;
|
|
1351
1320
|
this.targetCenter_ = newCenter;
|
|
1352
1321
|
this.applyTargetState_();
|
|
1353
1322
|
return;
|
|
1354
1323
|
}
|
|
1355
|
-
var anchor = opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined);
|
|
1356
|
-
this.cancelAnchor_ = undefined;
|
|
1357
1324
|
if (this.getResolution() !== newResolution ||
|
|
1358
1325
|
this.getRotation() !== newRotation ||
|
|
1359
1326
|
!this.getCenterInternal() ||
|
|
@@ -1367,7 +1334,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1367
1334
|
resolution: newResolution,
|
|
1368
1335
|
duration: duration,
|
|
1369
1336
|
easing: easeOut,
|
|
1370
|
-
anchor:
|
|
1337
|
+
anchor: opt_anchor
|
|
1371
1338
|
});
|
|
1372
1339
|
}
|
|
1373
1340
|
};
|
|
@@ -1412,7 +1379,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1412
1379
|
* @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
|
|
1413
1380
|
*/
|
|
1414
1381
|
View.prototype.getConstrainedCenter = function (targetCenter, opt_targetResolution) {
|
|
1415
|
-
var size = this.
|
|
1382
|
+
var size = this.getSizeFromViewport_(this.getRotation());
|
|
1416
1383
|
return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);
|
|
1417
1384
|
};
|
|
1418
1385
|
/**
|
|
@@ -1439,7 +1406,7 @@ var View = /** @class */ (function (_super) {
|
|
|
1439
1406
|
*/
|
|
1440
1407
|
View.prototype.getConstrainedResolution = function (targetResolution, opt_direction) {
|
|
1441
1408
|
var direction = opt_direction || 0;
|
|
1442
|
-
var size = this.
|
|
1409
|
+
var size = this.getSizeFromViewport_(this.getRotation());
|
|
1443
1410
|
return this.constraints_.resolution(targetResolution, direction, size);
|
|
1444
1411
|
};
|
|
1445
1412
|
return View;
|
|
@@ -1493,7 +1460,6 @@ export function createResolutionConstraint(options) {
|
|
|
1493
1460
|
var multiWorld = options.multiWorld !== undefined ?
|
|
1494
1461
|
options.multiWorld : false;
|
|
1495
1462
|
var smooth = options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;
|
|
1496
|
-
var showFullExtent = options.showFullExtent !== undefined ? options.showFullExtent : false;
|
|
1497
1463
|
var projection = createProjection(options.projection, 'EPSG:3857');
|
|
1498
1464
|
var projExtent = projection.getExtent();
|
|
1499
1465
|
var constrainOnlyCenter = options.constrainOnlyCenter;
|
|
@@ -1508,10 +1474,10 @@ export function createResolutionConstraint(options) {
|
|
|
1508
1474
|
minResolution = resolutions[maxZoom] !== undefined ?
|
|
1509
1475
|
resolutions[maxZoom] : resolutions[resolutions.length - 1];
|
|
1510
1476
|
if (options.constrainResolution) {
|
|
1511
|
-
resolutionConstraint = createSnapToResolutions(resolutions, smooth, !constrainOnlyCenter && extent
|
|
1477
|
+
resolutionConstraint = createSnapToResolutions(resolutions, smooth, !constrainOnlyCenter && extent);
|
|
1512
1478
|
}
|
|
1513
1479
|
else {
|
|
1514
|
-
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent
|
|
1480
|
+
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);
|
|
1515
1481
|
}
|
|
1516
1482
|
}
|
|
1517
1483
|
else {
|
|
@@ -1550,10 +1516,10 @@ export function createResolutionConstraint(options) {
|
|
|
1550
1516
|
maxZoom = minZoom + Math.floor(Math.log(maxResolution / minResolution) / Math.log(zoomFactor));
|
|
1551
1517
|
minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);
|
|
1552
1518
|
if (options.constrainResolution) {
|
|
1553
|
-
resolutionConstraint = createSnapToPower(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent
|
|
1519
|
+
resolutionConstraint = createSnapToPower(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);
|
|
1554
1520
|
}
|
|
1555
1521
|
else {
|
|
1556
|
-
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent
|
|
1522
|
+
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);
|
|
1557
1523
|
}
|
|
1558
1524
|
}
|
|
1559
1525
|
return { constraint: resolutionConstraint, maxResolution: maxResolution,
|