ol 10.3.0 → 10.3.1-dev.1733000076141
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/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/source/DataTile.d.ts +2 -3
- package/source/DataTile.d.ts.map +1 -1
- package/source/DataTile.js +1 -2
- package/source/TileDebug.d.ts +9 -0
- package/source/TileDebug.d.ts.map +1 -1
- package/source/TileDebug.js +74 -12
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
package/package.json
CHANGED
package/source/DataTile.d.ts
CHANGED
|
@@ -203,10 +203,9 @@ declare class DataTileSource<TileType extends import("../Tile.js").default = Dat
|
|
|
203
203
|
*/
|
|
204
204
|
private crossOrigin_;
|
|
205
205
|
/**
|
|
206
|
-
* @
|
|
207
|
-
* @type {import("../transform.js").Transform}
|
|
206
|
+
* @type {import("../transform.js").Transform|null}
|
|
208
207
|
*/
|
|
209
|
-
|
|
208
|
+
transformMatrix: import("../transform.js").Transform | null;
|
|
210
209
|
/**
|
|
211
210
|
* Set the source tile sizes. The length of the array is expected to match the number of
|
|
212
211
|
* levels in the tile grid.
|
package/source/DataTile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["DataTile.js"],"names":[],"mappings":";mCAoBa,WAAW,GAAC,iBAAiB;;;;;YAK5B,WAAW;;;;;;;;;;;;;;;qBASZ,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAa,EAAb,aAAa,KAAI,CAAC,OAAO,gBAAgB,EAAE,IAAI,GAAC,OAAO,CAAC,OAAO,gBAAgB,EAAE,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBvH,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;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AAO,iBAAiB,EAAE,SAAS,GAAC,IAAI,CAEvB;IAG7B;;;;;OAKG;IACH,kCAFW,KAAK,CAAC,OAAO,YAAY,EAAE,IAAI,CAAC,QAI1C;IAED;;;;;;OAMG;IACH,yBAHW,MAAM,GACL,OAAO,YAAY,EAAE,IAAI,CAWpC;IAmBD;;;OAGG;IACH,4BAHW,MAAM,QAKhB;IAED;;;;;;;OAOG;IACH,kBAPW,MAAM,KACN,MAAM,KACN,MAAM,cACN,OAAO,uBAAuB,EAAE,OAAO,cACvC,OAAO,uBAAuB,EAAE,OAAO,GACrC,QAAQ,CA6CpB;IAED;;;;;;;;OAQG;IACH,oBARW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,eACN,OAAO,uBAAuB,EAAE,OAAO,GACtC,QAAQ,GAAC,IAAI,CAiExB;IAmDD;;;;;;;;;;;OAWG;IACH,qCAJW,OAAO,YAAY,EAAE,cAAc,YACnC,OAAO,yBAAyB,EAAE,OAAO,QAWnD;CACF;qBA5ZoB,gBAAgB;uBAIK,WAAW"}
|
package/source/DataTile.js
CHANGED
|
@@ -159,8 +159,7 @@ class DataTileSource extends TileSource {
|
|
|
159
159
|
this.crossOrigin_ = options.crossOrigin || 'anonymous';
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
* @
|
|
163
|
-
* @type {import("../transform.js").Transform}
|
|
162
|
+
* @type {import("../transform.js").Transform|null}
|
|
164
163
|
*/
|
|
165
164
|
this.transformMatrix = null;
|
|
166
165
|
}
|
package/source/TileDebug.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export type Options = {
|
|
|
18
18
|
* zoom levels. See {@link module :ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
19
19
|
*/
|
|
20
20
|
zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Tile source.
|
|
23
|
+
* This allows `projection`, `tileGrid`, `wrapX` and `zDirection` to be copied from another source.
|
|
24
|
+
* If both `source` and individual options are specified the individual options will have precedence.
|
|
25
|
+
*/
|
|
26
|
+
source?: import("./Tile.js").default<import("../Tile.js").default> | undefined;
|
|
21
27
|
/**
|
|
22
28
|
* Template for labeling the tiles.
|
|
23
29
|
* Should include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
|
|
@@ -33,6 +39,9 @@ export type Options = {
|
|
|
33
39
|
* Set to `1` when debugging `VectorTile` sources with a default configuration.
|
|
34
40
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
35
41
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
42
|
+
* @property {import("./Tile.js").default} [source] Tile source.
|
|
43
|
+
* This allows `projection`, `tileGrid`, `wrapX` and `zDirection` to be copied from another source.
|
|
44
|
+
* If both `source` and individual options are specified the individual options will have precedence.
|
|
36
45
|
* @property {string} [template='z:{z} x:{x} y:{y}'] Template for labeling the tiles.
|
|
37
46
|
* Should include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
|
|
38
47
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileDebug.d.ts","sourceRoot":"","sources":["TileDebug.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"TileDebug.d.ts","sourceRoot":"","sources":["TileDebug.js"],"names":[],"mappings":";;;;;iBAcc,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;AAFjD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAyFjB;CACF;sBAzHqB,gBAAgB"}
|
package/source/TileDebug.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* @module ol/source/TileDebug
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import DataTile from './DataTile.js';
|
|
6
|
+
import EventType from '../events/EventType.js';
|
|
5
7
|
import ImageTile from './ImageTile.js';
|
|
6
8
|
import {createCanvasContext2D} from '../dom.js';
|
|
9
|
+
import {get as getProjection} from '../proj.js';
|
|
7
10
|
import {renderXYZTemplate} from '../uri.js';
|
|
11
|
+
import {toSize} from '../size.js';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* @typedef {Object} Options
|
|
@@ -15,6 +19,9 @@ import {renderXYZTemplate} from '../uri.js';
|
|
|
15
19
|
* Set to `1` when debugging `VectorTile` sources with a default configuration.
|
|
16
20
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
17
21
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
22
|
+
* @property {import("./Tile.js").default} [source] Tile source.
|
|
23
|
+
* This allows `projection`, `tileGrid`, `wrapX` and `zDirection` to be copied from another source.
|
|
24
|
+
* If both `source` and individual options are specified the individual options will have precedence.
|
|
18
25
|
* @property {string} [template='z:{z} x:{x} y:{y}'] Template for labeling the tiles.
|
|
19
26
|
* Should include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
|
|
20
27
|
*/
|
|
@@ -36,20 +43,62 @@ class TileDebug extends ImageTile {
|
|
|
36
43
|
*/
|
|
37
44
|
options = options || {};
|
|
38
45
|
const template = options.template || 'z:{z} x:{x} y:{y}';
|
|
46
|
+
const source = options.source;
|
|
39
47
|
|
|
40
48
|
super({
|
|
41
49
|
transition: 0,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
wrapX:
|
|
51
|
+
options.wrapX !== undefined
|
|
52
|
+
? options.wrapX
|
|
53
|
+
: source !== undefined
|
|
54
|
+
? source.getWrapX()
|
|
55
|
+
: undefined,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const setReady = () => {
|
|
59
|
+
this.projection =
|
|
60
|
+
options.projection !== undefined
|
|
61
|
+
? getProjection(options.projection)
|
|
62
|
+
: source !== undefined
|
|
63
|
+
? source.getProjection()
|
|
64
|
+
: this.projection;
|
|
65
|
+
this.tileGrid =
|
|
66
|
+
options.tileGrid !== undefined
|
|
67
|
+
? options.tileGrid
|
|
68
|
+
: source !== undefined
|
|
69
|
+
? source.getTileGrid()
|
|
70
|
+
: this.tileGrid;
|
|
71
|
+
this.zDirection =
|
|
72
|
+
options.zDirection !== undefined
|
|
73
|
+
? options.zDirection
|
|
74
|
+
: source !== undefined
|
|
75
|
+
? source.zDirection
|
|
76
|
+
: this.zDirection;
|
|
77
|
+
|
|
78
|
+
if (source instanceof DataTile) {
|
|
79
|
+
this.transformMatrix = source.transformMatrix?.slice() || null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const tileGrid = this.tileGrid;
|
|
83
|
+
if (tileGrid) {
|
|
84
|
+
this.setTileSizes(
|
|
85
|
+
tileGrid
|
|
86
|
+
.getResolutions()
|
|
87
|
+
.map((r, i) =>
|
|
88
|
+
toSize(tileGrid.getTileSize(i)).map((s) =>
|
|
89
|
+
Math.max(Math.floor(s), 1),
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.setLoader((z, x, y, loaderOptions) => {
|
|
47
96
|
const text = renderXYZTemplate(template, z, x, y, loaderOptions.maxY);
|
|
48
|
-
const
|
|
49
|
-
const context = createCanvasContext2D(
|
|
97
|
+
const [width, height] = this.getTileSize(z);
|
|
98
|
+
const context = createCanvasContext2D(width, height);
|
|
50
99
|
|
|
51
100
|
context.strokeStyle = 'grey';
|
|
52
|
-
context.strokeRect(0.5, 0.5,
|
|
101
|
+
context.strokeRect(0.5, 0.5, width + 0.5, height + 0.5);
|
|
53
102
|
|
|
54
103
|
context.fillStyle = 'grey';
|
|
55
104
|
context.strokeStyle = 'white';
|
|
@@ -57,11 +106,24 @@ class TileDebug extends ImageTile {
|
|
|
57
106
|
context.textBaseline = 'middle';
|
|
58
107
|
context.font = '24px sans-serif';
|
|
59
108
|
context.lineWidth = 4;
|
|
60
|
-
context.strokeText(text,
|
|
61
|
-
context.fillText(text,
|
|
109
|
+
context.strokeText(text, width / 2, height / 2, width);
|
|
110
|
+
context.fillText(text, width / 2, height / 2, width);
|
|
62
111
|
return context.canvas;
|
|
63
|
-
}
|
|
64
|
-
|
|
112
|
+
});
|
|
113
|
+
this.setState('ready');
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (source === undefined || source.getState() === 'ready') {
|
|
117
|
+
setReady();
|
|
118
|
+
} else {
|
|
119
|
+
const handler = () => {
|
|
120
|
+
if (source.getState() === 'ready') {
|
|
121
|
+
source.removeEventListener(EventType.CHANGE, handler);
|
|
122
|
+
setReady();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
source.addEventListener(EventType.CHANGE, handler);
|
|
126
|
+
}
|
|
65
127
|
}
|
|
66
128
|
}
|
|
67
129
|
|
package/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,CAEkC"}
|
package/util.js
CHANGED