@datagouv/components-next 0.2.0 → 1.0.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/README.md +1 -1
- package/assets/main.css +49 -22
- package/dist/Control-BNCDn-8E.js +148 -0
- package/dist/{Datafair.client-x39O4yfF.js → Datafair.client-B5lBpOl8.js} +2 -2
- package/dist/Event-BOgJUhNR.js +738 -0
- package/dist/Image-BN-4XkIn.js +247 -0
- package/dist/{JsonPreview.client-BMsC5JcY.js → JsonPreview.client-Doz1Z0BS.js} +23 -23
- package/dist/Map-BdT3i2C4.js +7609 -0
- package/dist/MapContainer.client-oiieO8H-.js +105 -0
- package/dist/OSM-CamriM9b.js +71 -0
- package/dist/PdfPreview.client-CdAhkDFJ.js +14513 -0
- package/dist/{Pmtiles.client-BaiIo4VZ.js → Pmtiles.client-B0v8tGJQ.js} +3 -3
- package/dist/ScaleLine-BiesrgOv.js +165 -0
- package/dist/Swagger.client-CsK65JnG.js +4 -0
- package/dist/Tile-DCuqwNOI.js +1206 -0
- package/dist/TileImage-CmZf8EdU.js +1067 -0
- package/dist/View-DcDc7N2K.js +2858 -0
- package/dist/{XmlPreview.client-CAdN0w_Y.js → XmlPreview.client-CrjHf74q.js} +17 -17
- package/dist/common-C4rDcQpp.js +243 -0
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +158 -117
- package/dist/components.css +1 -1
- package/dist/{MapContainer.client-DeSo8EvG.js → index-Bbu9rOHt.js} +4975 -21416
- package/dist/leaflet-src-7m1mB8LI.js +6338 -0
- package/dist/{main-Dgri3TQL.js → main-CiH8ZmBI.js} +56973 -51462
- package/dist/proj-CKwYjU38.js +1569 -0
- package/dist/tilecoord-YW3qEH_j.js +884 -0
- package/dist/{vue3-xml-viewer.common-D6skc_Ai.js → vue3-xml-viewer.common-Bi_bsV6C.js} +1 -1
- package/package.json +6 -2
- package/src/components/ActivityList/ActivityList.vue +6 -2
- package/src/components/AppLink.vue +4 -1
- package/src/components/Avatar.vue +2 -2
- package/src/components/AvatarWithName.vue +8 -4
- package/src/components/BouncingDots.vue +21 -0
- package/src/components/BrandedButton.vue +2 -0
- package/src/components/CopyButton.vue +19 -7
- package/src/components/DataserviceCard.vue +85 -120
- package/src/components/DatasetCard.vue +110 -171
- package/src/components/DatasetInformation/DatasetEmbedSection.vue +43 -0
- package/src/components/DatasetInformation/DatasetInformationSection.vue +73 -0
- package/src/components/DatasetInformation/DatasetSchemaSection.vue +74 -0
- package/src/components/DatasetInformation/DatasetSpatialSection.vue +59 -0
- package/src/components/DatasetInformation/DatasetTemporalitySection.vue +45 -0
- package/src/components/DatasetInformation/index.ts +5 -0
- package/src/components/DatasetQuality.vue +23 -16
- package/src/components/DatasetQualityInline.vue +13 -17
- package/src/components/DatasetQualityScore.vue +12 -15
- package/src/components/DatasetQualityTooltipContent.vue +3 -3
- package/src/components/DescriptionList.vue +1 -4
- package/src/components/DescriptionListDetails.vue +5 -0
- package/src/components/DescriptionListTerm.vue +5 -0
- package/src/components/DiscussionMessageCard.vue +63 -0
- package/src/components/ExtraAccordion.vue +4 -4
- package/src/components/Form/BadgeSelect.vue +35 -0
- package/src/components/Form/FormatSelect.vue +28 -0
- package/src/components/Form/GeozoneSelect.vue +52 -0
- package/src/components/Form/GranularitySelect.vue +29 -0
- package/src/components/Form/LicenseSelect.vue +30 -0
- package/src/components/Form/OrganizationSelect.vue +62 -0
- package/src/components/Form/OrganizationTypeSelect.vue +34 -0
- package/src/components/Form/ReuseTopicSelect.vue +29 -0
- package/src/components/Form/SchemaSelect.vue +30 -0
- package/src/components/Form/SearchableSelect.vue +334 -0
- package/src/components/Form/SelectGroup.vue +132 -0
- package/src/components/Form/TagSelect.vue +38 -0
- package/src/components/LeafletMap.vue +31 -0
- package/src/components/LicenseBadge.vue +24 -0
- package/src/components/LoadingBlock.vue +23 -2
- package/src/components/MarkdownViewer.vue +3 -1
- package/src/components/ObjectCard.vue +42 -0
- package/src/components/ObjectCardBadge.vue +22 -0
- package/src/components/ObjectCardHeader.vue +35 -0
- package/src/components/ObjectCardOwner.vue +43 -0
- package/src/components/ObjectCardShortDescription.vue +28 -0
- package/src/components/OrganizationCard.vue +35 -20
- package/src/components/OrganizationHorizontalCard.vue +87 -0
- package/src/components/OrganizationLogo.vue +1 -1
- package/src/components/OrganizationNameWithCertificate.vue +12 -6
- package/src/components/OwnerTypeIcon.vue +1 -0
- package/src/components/Pagination.vue +1 -1
- package/src/components/Placeholder.vue +5 -2
- package/src/components/PostCard.vue +62 -0
- package/src/components/ProgressBar.vue +31 -0
- package/src/components/RadioGroup.vue +32 -0
- package/src/components/RadioInput.vue +64 -0
- package/src/components/ResourceAccordion/Datafair.client.vue +1 -1
- package/src/components/ResourceAccordion/EditButton.vue +2 -3
- package/src/components/ResourceAccordion/JsonPreview.client.vue +3 -3
- package/src/components/ResourceAccordion/MapContainer.client.vue +21 -17
- package/src/components/ResourceAccordion/Metadata.vue +11 -24
- package/src/components/ResourceAccordion/PdfPreview.client.vue +70 -74
- package/src/components/ResourceAccordion/Pmtiles.client.vue +2 -2
- package/src/components/ResourceAccordion/Preview.vue +2 -2
- package/src/components/ResourceAccordion/ResourceAccordion.vue +35 -28
- package/src/components/ResourceAccordion/ResourceIcon.vue +1 -0
- package/src/components/ResourceAccordion/SchemaBadge.vue +2 -2
- package/src/components/ResourceAccordion/XmlPreview.client.vue +3 -3
- package/src/components/ResourceExplorer/ResourceExplorer.vue +243 -0
- package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +116 -0
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +410 -0
- package/src/components/ReuseCard.vue +8 -28
- package/src/components/ReuseHorizontalCard.vue +80 -0
- package/src/components/Search/BasicAndAdvancedFilters.vue +49 -0
- package/src/components/Search/Filter/AccessTypeFilter.vue +37 -0
- package/src/components/Search/Filter/DatasetBadgeFilter.vue +40 -0
- package/src/components/Search/Filter/FilterButtonGroup.vue +78 -0
- package/src/components/Search/Filter/FormatFamilyFilter.vue +39 -0
- package/src/components/Search/Filter/LastUpdateRangeFilter.vue +37 -0
- package/src/components/Search/Filter/ProducerTypeFilter.vue +49 -0
- package/src/components/Search/Filter/ReuseTypeFilter.vue +42 -0
- package/src/components/Search/GlobalSearch.vue +707 -0
- package/src/components/Search/SearchInput.vue +63 -0
- package/src/components/Search/Sidemenu.vue +38 -0
- package/src/components/StatBox.vue +5 -5
- package/src/components/Tag.vue +30 -0
- package/src/components/Toggletip.vue +11 -4
- package/src/components/Tooltip.vue +2 -3
- package/src/components/TopicCard.vue +134 -0
- package/src/components/radioGroupContext.ts +9 -0
- package/src/composables/useDebouncedRef.ts +31 -0
- package/src/composables/useHasTabularData.ts +15 -0
- package/src/composables/useMetrics.ts +4 -3
- package/src/composables/useResourceCapabilities.ts +131 -0
- package/src/composables/useRouteQueryBoolean.ts +10 -0
- package/src/composables/useSelectModelSync.ts +89 -0
- package/src/composables/useStableQueryParams.ts +84 -0
- package/src/composables/useTranslation.ts +2 -1
- package/src/config.ts +4 -0
- package/src/functions/api.ts +25 -6
- package/src/functions/api.types.ts +5 -3
- package/src/functions/datasets.ts +1 -29
- package/src/functions/description.ts +33 -0
- package/src/functions/helpers.ts +11 -0
- package/src/functions/markdown.ts +60 -16
- package/src/functions/metrics.ts +33 -0
- package/src/functions/organizations.ts +5 -5
- package/src/functions/resourceCapabilities.ts +55 -0
- package/src/main.ts +96 -7
- package/src/types/dataservices.ts +14 -12
- package/src/types/datasets.ts +20 -7
- package/src/types/discussions.ts +20 -0
- package/src/types/licenses.ts +3 -3
- package/src/types/organizations.ts +13 -1
- package/src/types/owned.ts +4 -2
- package/src/types/pages.ts +70 -0
- package/src/types/posts.ts +27 -0
- package/src/types/resources.ts +16 -0
- package/src/types/reuses.ts +14 -5
- package/src/types/search.ts +407 -0
- package/src/types/users.ts +12 -3
- package/dist/PdfPreview.client-COOkEkRA.js +0 -107
- package/dist/Swagger.client-CpLgaLg6.js +0 -4
- package/dist/pdf-vue3-IkJO65RH.js +0 -273
- package/dist/pdf.min-f72cfa08-CdgJTooZ.js +0 -9501
- package/src/components/DatasetInformationPanel.vue +0 -211
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
import { b as Y, e as f, d as G, h as I, w as D, I as v, R as K } from "./tilecoord-YW3qEH_j.js";
|
|
2
|
+
import { t as g, s as k, T as _ } from "./Image-BN-4XkIn.js";
|
|
3
|
+
import { aQ as N, an as W, p as b, L as q, a6 as B, N as x, R, C as S, M as H, D as $, K as y, W as V, aR as Q, U as J, B as tt, a as E, ak as et, I as it, e as z, E as nt } from "./proj-CKwYjU38.js";
|
|
4
|
+
import { a as m, w as A, x as rt, D as st } from "./common-C4rDcQpp.js";
|
|
5
|
+
const T = [0, 0, 0], d = 5;
|
|
6
|
+
class p {
|
|
7
|
+
/**
|
|
8
|
+
* @param {Options} options Tile grid options.
|
|
9
|
+
*/
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this.minZoom = t.minZoom !== void 0 ? t.minZoom : 0, this.resolutions_ = t.resolutions, m(
|
|
12
|
+
N(
|
|
13
|
+
this.resolutions_,
|
|
14
|
+
/**
|
|
15
|
+
* @param {number} a First resolution
|
|
16
|
+
* @param {number} b Second resolution
|
|
17
|
+
* @return {number} Comparison result
|
|
18
|
+
*/
|
|
19
|
+
(n, r) => r - n
|
|
20
|
+
),
|
|
21
|
+
"`resolutions` must be sorted in descending order"
|
|
22
|
+
);
|
|
23
|
+
let e;
|
|
24
|
+
if (!t.origins) {
|
|
25
|
+
for (let n = 0, r = this.resolutions_.length - 1; n < r; ++n)
|
|
26
|
+
if (!e)
|
|
27
|
+
e = this.resolutions_[n] / this.resolutions_[n + 1];
|
|
28
|
+
else if (this.resolutions_[n] / this.resolutions_[n + 1] !== e) {
|
|
29
|
+
e = void 0;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this.zoomFactor_ = e, this.maxZoom = this.resolutions_.length - 1, this.origin_ = t.origin !== void 0 ? t.origin : null, this.origins_ = null, t.origins !== void 0 && (this.origins_ = t.origins, m(
|
|
34
|
+
this.origins_.length == this.resolutions_.length,
|
|
35
|
+
"Number of `origins` and `resolutions` must be equal"
|
|
36
|
+
));
|
|
37
|
+
const i = t.extent;
|
|
38
|
+
i !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = W(i)), m(
|
|
39
|
+
!this.origin_ && this.origins_ || this.origin_ && !this.origins_,
|
|
40
|
+
"Either `origin` or `origins` must be configured, never both"
|
|
41
|
+
), this.tileSizes_ = null, t.tileSizes !== void 0 && (this.tileSizes_ = t.tileSizes, m(
|
|
42
|
+
this.tileSizes_.length == this.resolutions_.length,
|
|
43
|
+
"Number of `tileSizes` and `resolutions` must be equal"
|
|
44
|
+
)), this.tileSize_ = t.tileSize !== void 0 ? t.tileSize : this.tileSizes_ ? null : A, m(
|
|
45
|
+
!this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
|
|
46
|
+
"Either `tileSize` or `tileSizes` must be configured, never both"
|
|
47
|
+
), this.extent_ = i !== void 0 ? i : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], t.sizes !== void 0 ? this.fullTileRanges_ = t.sizes.map((n, r) => {
|
|
48
|
+
const s = new Y(
|
|
49
|
+
Math.min(0, n[0]),
|
|
50
|
+
Math.max(n[0] - 1, -1),
|
|
51
|
+
Math.min(0, n[1]),
|
|
52
|
+
Math.max(n[1] - 1, -1)
|
|
53
|
+
);
|
|
54
|
+
if (i) {
|
|
55
|
+
const l = this.getTileRangeForExtentAndZ(i, r);
|
|
56
|
+
s.minX = Math.max(l.minX, s.minX), s.maxX = Math.min(l.maxX, s.maxX), s.minY = Math.max(l.minY, s.minY), s.maxY = Math.min(l.maxY, s.maxY);
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
}) : i && this.calculateTileRanges_(i);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Call a function with each tile coordinate for a given extent and zoom level.
|
|
63
|
+
*
|
|
64
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
65
|
+
* @param {number} zoom Integer zoom level.
|
|
66
|
+
* @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
|
|
67
|
+
* @api
|
|
68
|
+
*/
|
|
69
|
+
forEachTileCoord(t, e, i) {
|
|
70
|
+
const n = this.getTileRangeForExtentAndZ(t, e);
|
|
71
|
+
for (let r = n.minX, s = n.maxX; r <= s; ++r)
|
|
72
|
+
for (let l = n.minY, a = n.maxY; l <= a; ++l)
|
|
73
|
+
i([e, r, l]);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
77
|
+
* @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
|
|
78
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
79
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
|
|
80
|
+
* @return {boolean} Callback succeeded.
|
|
81
|
+
*/
|
|
82
|
+
forEachTileCoordParentTileRange(t, e, i, n) {
|
|
83
|
+
let r, s, l, a = null, h = t[0] - 1;
|
|
84
|
+
for (this.zoomFactor_ === 2 ? (s = t[1], l = t[2]) : a = this.getTileCoordExtent(t, n); h >= this.minZoom; ) {
|
|
85
|
+
if (s !== void 0 && l !== void 0 ? (s = Math.floor(s / 2), l = Math.floor(l / 2), r = f(s, s, l, l, i)) : r = this.getTileRangeForExtentAndZ(
|
|
86
|
+
a,
|
|
87
|
+
h,
|
|
88
|
+
i
|
|
89
|
+
), e(h, r))
|
|
90
|
+
return !0;
|
|
91
|
+
--h;
|
|
92
|
+
}
|
|
93
|
+
return !1;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the extent for this tile grid, if it was configured.
|
|
97
|
+
* @return {import("../extent.js").Extent} Extent.
|
|
98
|
+
* @api
|
|
99
|
+
*/
|
|
100
|
+
getExtent() {
|
|
101
|
+
return this.extent_;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the maximum zoom level for the grid.
|
|
105
|
+
* @return {number} Max zoom.
|
|
106
|
+
* @api
|
|
107
|
+
*/
|
|
108
|
+
getMaxZoom() {
|
|
109
|
+
return this.maxZoom;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get the minimum zoom level for the grid.
|
|
113
|
+
* @return {number} Min zoom.
|
|
114
|
+
* @api
|
|
115
|
+
*/
|
|
116
|
+
getMinZoom() {
|
|
117
|
+
return this.minZoom;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the origin for the grid at the given zoom level.
|
|
121
|
+
* @param {number} z Integer zoom level.
|
|
122
|
+
* @return {import("../coordinate.js").Coordinate} Origin.
|
|
123
|
+
* @api
|
|
124
|
+
*/
|
|
125
|
+
getOrigin(t) {
|
|
126
|
+
return this.origin_ ? this.origin_ : this.origins_[t];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the resolution for the given zoom level.
|
|
130
|
+
* @param {number} z Integer zoom level.
|
|
131
|
+
* @return {number} Resolution.
|
|
132
|
+
* @api
|
|
133
|
+
*/
|
|
134
|
+
getResolution(t) {
|
|
135
|
+
return this.resolutions_[t];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the list of resolutions for the tile grid.
|
|
139
|
+
* @return {Array<number>} Resolutions.
|
|
140
|
+
* @api
|
|
141
|
+
*/
|
|
142
|
+
getResolutions() {
|
|
143
|
+
return this.resolutions_;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
147
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
148
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
|
|
149
|
+
* @return {import("../TileRange.js").default|null} Tile range.
|
|
150
|
+
*/
|
|
151
|
+
getTileCoordChildTileRange(t, e, i) {
|
|
152
|
+
if (t[0] < this.maxZoom) {
|
|
153
|
+
if (this.zoomFactor_ === 2) {
|
|
154
|
+
const r = t[1] * 2, s = t[2] * 2;
|
|
155
|
+
return f(
|
|
156
|
+
r,
|
|
157
|
+
r + 1,
|
|
158
|
+
s,
|
|
159
|
+
s + 1,
|
|
160
|
+
e
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const n = this.getTileCoordExtent(
|
|
164
|
+
t,
|
|
165
|
+
i || this.tmpExtent_
|
|
166
|
+
);
|
|
167
|
+
return this.getTileRangeForExtentAndZ(
|
|
168
|
+
n,
|
|
169
|
+
t[0] + 1,
|
|
170
|
+
e
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
177
|
+
* @param {number} z Integer zoom level.
|
|
178
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
179
|
+
* @return {import("../TileRange.js").default|null} Tile range.
|
|
180
|
+
*/
|
|
181
|
+
getTileRangeForTileCoordAndZ(t, e, i) {
|
|
182
|
+
if (e > this.maxZoom || e < this.minZoom)
|
|
183
|
+
return null;
|
|
184
|
+
const n = t[0], r = t[1], s = t[2];
|
|
185
|
+
if (e === n)
|
|
186
|
+
return f(
|
|
187
|
+
r,
|
|
188
|
+
s,
|
|
189
|
+
r,
|
|
190
|
+
s,
|
|
191
|
+
i
|
|
192
|
+
);
|
|
193
|
+
if (this.zoomFactor_) {
|
|
194
|
+
const a = Math.pow(this.zoomFactor_, e - n), h = Math.floor(r * a), u = Math.floor(s * a);
|
|
195
|
+
if (e < n)
|
|
196
|
+
return f(h, h, u, u, i);
|
|
197
|
+
const c = Math.floor(a * (r + 1)) - 1, F = Math.floor(a * (s + 1)) - 1;
|
|
198
|
+
return f(h, c, u, F, i);
|
|
199
|
+
}
|
|
200
|
+
const l = this.getTileCoordExtent(t, this.tmpExtent_);
|
|
201
|
+
return this.getTileRangeForExtentAndZ(l, e, i);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get a tile range for the given extent and integer zoom level.
|
|
205
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
206
|
+
* @param {number} z Integer zoom level.
|
|
207
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary tile range object.
|
|
208
|
+
* @return {import("../TileRange.js").default} Tile range.
|
|
209
|
+
*/
|
|
210
|
+
getTileRangeForExtentAndZ(t, e, i) {
|
|
211
|
+
this.getTileCoordForXYAndZ_(t[0], t[3], e, !1, T);
|
|
212
|
+
const n = T[1], r = T[2];
|
|
213
|
+
this.getTileCoordForXYAndZ_(t[2], t[1], e, !0, T);
|
|
214
|
+
const s = T[1], l = T[2];
|
|
215
|
+
return f(n, s, r, l, i);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
219
|
+
* @return {import("../coordinate.js").Coordinate} Tile center.
|
|
220
|
+
*/
|
|
221
|
+
getTileCoordCenter(t) {
|
|
222
|
+
const e = this.getOrigin(t[0]), i = this.getResolution(t[0]), n = g(this.getTileSize(t[0]), this.tmpSize_);
|
|
223
|
+
return [
|
|
224
|
+
e[0] + (t[1] + 0.5) * n[0] * i,
|
|
225
|
+
e[1] - (t[2] + 0.5) * n[1] * i
|
|
226
|
+
];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the extent of a tile coordinate.
|
|
230
|
+
*
|
|
231
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
232
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary extent object.
|
|
233
|
+
* @return {import("../extent.js").Extent} Extent.
|
|
234
|
+
* @api
|
|
235
|
+
*/
|
|
236
|
+
getTileCoordExtent(t, e) {
|
|
237
|
+
const i = this.getOrigin(t[0]), n = this.getResolution(t[0]), r = g(this.getTileSize(t[0]), this.tmpSize_), s = i[0] + t[1] * r[0] * n, l = i[1] - (t[2] + 1) * r[1] * n, a = s + r[0] * n, h = l + r[1] * n;
|
|
238
|
+
return b(s, l, a, h, e);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get the tile coordinate for the given map coordinate and resolution. This
|
|
242
|
+
* method considers that coordinates that intersect tile boundaries should be
|
|
243
|
+
* assigned the higher tile coordinate.
|
|
244
|
+
*
|
|
245
|
+
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
246
|
+
* @param {number} resolution Resolution.
|
|
247
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
|
|
248
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
249
|
+
* @api
|
|
250
|
+
*/
|
|
251
|
+
getTileCoordForCoordAndResolution(t, e, i) {
|
|
252
|
+
return this.getTileCoordForXYAndResolution_(
|
|
253
|
+
t[0],
|
|
254
|
+
t[1],
|
|
255
|
+
e,
|
|
256
|
+
!1,
|
|
257
|
+
i
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Note that this method should not be called for resolutions that correspond
|
|
262
|
+
* to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method.
|
|
263
|
+
* @param {number} x X.
|
|
264
|
+
* @param {number} y Y.
|
|
265
|
+
* @param {number} resolution Resolution (for a non-integer zoom level).
|
|
266
|
+
* @param {boolean} reverseIntersectionPolicy Instead of letting edge
|
|
267
|
+
* intersections go to the higher tile coordinate, let edge intersections
|
|
268
|
+
* go to the lower tile coordinate.
|
|
269
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
|
|
270
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
getTileCoordForXYAndResolution_(t, e, i, n, r) {
|
|
274
|
+
const s = this.getZForResolution(i), l = i / this.getResolution(s), a = this.getOrigin(s), h = g(this.getTileSize(s), this.tmpSize_);
|
|
275
|
+
let u = l * (t - a[0]) / i / h[0], c = l * (a[1] - e) / i / h[1];
|
|
276
|
+
return n ? (u = x(u, d) - 1, c = x(c, d) - 1) : (u = R(u, d), c = R(c, d)), G(s, u, c, r);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
|
|
280
|
+
* they should have separate implementations. This method is for integer zoom
|
|
281
|
+
* levels. The other method should only be called for resolutions corresponding
|
|
282
|
+
* to non-integer zoom levels.
|
|
283
|
+
* @param {number} x Map x coordinate.
|
|
284
|
+
* @param {number} y Map y coordinate.
|
|
285
|
+
* @param {number} z Integer zoom level.
|
|
286
|
+
* @param {boolean} reverseIntersectionPolicy Instead of letting edge
|
|
287
|
+
* intersections go to the higher tile coordinate, let edge intersections
|
|
288
|
+
* go to the lower tile coordinate.
|
|
289
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
|
|
290
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
291
|
+
* @private
|
|
292
|
+
*/
|
|
293
|
+
getTileCoordForXYAndZ_(t, e, i, n, r) {
|
|
294
|
+
const s = this.getOrigin(i), l = this.getResolution(i), a = g(this.getTileSize(i), this.tmpSize_);
|
|
295
|
+
let h = (t - s[0]) / l / a[0], u = (s[1] - e) / l / a[1];
|
|
296
|
+
return n ? (h = x(h, d) - 1, u = x(u, d) - 1) : (h = R(h, d), u = R(u, d)), G(i, h, u, r);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get a tile coordinate given a map coordinate and zoom level.
|
|
300
|
+
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
301
|
+
* @param {number} z Integer zoom level, e.g. the result of a `getZForResolution()` method call
|
|
302
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
|
|
303
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
304
|
+
* @api
|
|
305
|
+
*/
|
|
306
|
+
getTileCoordForCoordAndZ(t, e, i) {
|
|
307
|
+
return this.getTileCoordForXYAndZ_(
|
|
308
|
+
t[0],
|
|
309
|
+
t[1],
|
|
310
|
+
e,
|
|
311
|
+
!1,
|
|
312
|
+
i
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
317
|
+
* @return {number} Tile resolution.
|
|
318
|
+
*/
|
|
319
|
+
getTileCoordResolution(t) {
|
|
320
|
+
return this.resolutions_[t[0]];
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Get the tile size for a zoom level. The type of the return value matches the
|
|
324
|
+
* `tileSize` or `tileSizes` that the tile grid was configured with. To always
|
|
325
|
+
* get an {@link import("../size.js").Size}, run the result through {@link module:ol/size.toSize}.
|
|
326
|
+
* @param {number} z Z.
|
|
327
|
+
* @return {number|import("../size.js").Size} Tile size.
|
|
328
|
+
* @api
|
|
329
|
+
*/
|
|
330
|
+
getTileSize(t) {
|
|
331
|
+
return this.tileSize_ ? this.tileSize_ : this.tileSizes_[t];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @param {number} z Zoom level.
|
|
335
|
+
* @return {import("../TileRange.js").default|null} Extent tile range for the specified zoom level.
|
|
336
|
+
*/
|
|
337
|
+
getFullTileRange(t) {
|
|
338
|
+
return this.fullTileRanges_ ? this.fullTileRanges_[t] : this.extent_ ? this.getTileRangeForExtentAndZ(this.extent_, t) : null;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @param {number} resolution Resolution.
|
|
342
|
+
* @param {number|import("../array.js").NearestDirectionFunction} [opt_direction]
|
|
343
|
+
* If 0, the nearest resolution will be used.
|
|
344
|
+
* If 1, the nearest higher resolution (lower Z) will be used. If -1, the
|
|
345
|
+
* nearest lower resolution (higher Z) will be used. Default is 0.
|
|
346
|
+
* Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.
|
|
347
|
+
*
|
|
348
|
+
* For example to change tile Z at the midpoint of zoom levels
|
|
349
|
+
* ```js
|
|
350
|
+
* function(value, high, low) {
|
|
351
|
+
* return value - low * Math.sqrt(high / low);
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
* @return {number} Z.
|
|
355
|
+
* @api
|
|
356
|
+
*/
|
|
357
|
+
getZForResolution(t, e) {
|
|
358
|
+
const i = q(
|
|
359
|
+
this.resolutions_,
|
|
360
|
+
t,
|
|
361
|
+
e || 0
|
|
362
|
+
);
|
|
363
|
+
return B(i, this.minZoom, this.maxZoom);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The tile with the provided tile coordinate intersects the given viewport.
|
|
367
|
+
* @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.
|
|
368
|
+
* @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.
|
|
369
|
+
* @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
|
|
370
|
+
*/
|
|
371
|
+
tileCoordIntersectsViewport(t, e) {
|
|
372
|
+
return rt(
|
|
373
|
+
e,
|
|
374
|
+
0,
|
|
375
|
+
e.length,
|
|
376
|
+
2,
|
|
377
|
+
this.getTileCoordExtent(t)
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* @param {!import("../extent.js").Extent} extent Extent for this tile grid.
|
|
382
|
+
* @private
|
|
383
|
+
*/
|
|
384
|
+
calculateTileRanges_(t) {
|
|
385
|
+
const e = this.resolutions_.length, i = new Array(e);
|
|
386
|
+
for (let n = this.minZoom; n < e; ++n)
|
|
387
|
+
i[n] = this.getTileRangeForExtentAndZ(t, n);
|
|
388
|
+
this.fullTileRanges_ = i;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function w(o) {
|
|
392
|
+
let t = o.getDefaultTileGrid();
|
|
393
|
+
return t || (t = at(o), o.setDefaultTileGrid(t)), t;
|
|
394
|
+
}
|
|
395
|
+
function ot(o, t, e) {
|
|
396
|
+
const i = t[0], n = o.getTileCoordCenter(t), r = X(e);
|
|
397
|
+
if (!V(r, n)) {
|
|
398
|
+
const s = y(r), l = Math.ceil(
|
|
399
|
+
(r[0] - n[0]) / s
|
|
400
|
+
);
|
|
401
|
+
return n[0] += s * l, o.getTileCoordForCoordAndZ(n, i);
|
|
402
|
+
}
|
|
403
|
+
return t;
|
|
404
|
+
}
|
|
405
|
+
function lt(o, t, e, i) {
|
|
406
|
+
i = i !== void 0 ? i : "top-left";
|
|
407
|
+
const n = U(o, t, e);
|
|
408
|
+
return new p({
|
|
409
|
+
extent: o,
|
|
410
|
+
origin: Q(o, i),
|
|
411
|
+
resolutions: n,
|
|
412
|
+
tileSize: e
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function Gt(o) {
|
|
416
|
+
const t = o || {}, e = t.extent || S("EPSG:3857").getExtent(), i = {
|
|
417
|
+
extent: e,
|
|
418
|
+
minZoom: t.minZoom,
|
|
419
|
+
tileSize: t.tileSize,
|
|
420
|
+
resolutions: U(
|
|
421
|
+
e,
|
|
422
|
+
t.maxZoom,
|
|
423
|
+
t.tileSize,
|
|
424
|
+
t.maxResolution
|
|
425
|
+
)
|
|
426
|
+
};
|
|
427
|
+
return new p(i);
|
|
428
|
+
}
|
|
429
|
+
function U(o, t, e, i) {
|
|
430
|
+
t = t !== void 0 ? t : st, e = g(e !== void 0 ? e : A);
|
|
431
|
+
const n = $(o), r = y(o);
|
|
432
|
+
i = i > 0 ? i : Math.max(r / e[0], n / e[1]);
|
|
433
|
+
const s = t + 1, l = new Array(s);
|
|
434
|
+
for (let a = 0; a < s; ++a)
|
|
435
|
+
l[a] = i / Math.pow(2, a);
|
|
436
|
+
return l;
|
|
437
|
+
}
|
|
438
|
+
function at(o, t, e, i) {
|
|
439
|
+
const n = X(o);
|
|
440
|
+
return lt(n, t, e, i);
|
|
441
|
+
}
|
|
442
|
+
function X(o) {
|
|
443
|
+
o = S(o);
|
|
444
|
+
let t = o.getExtent();
|
|
445
|
+
if (!t) {
|
|
446
|
+
const e = 180 * H.degrees / o.getMetersPerUnit();
|
|
447
|
+
t = b(-e, -e, e, e);
|
|
448
|
+
}
|
|
449
|
+
return t;
|
|
450
|
+
}
|
|
451
|
+
function jt(o, t) {
|
|
452
|
+
const e = [];
|
|
453
|
+
Object.keys(t).forEach(function(n) {
|
|
454
|
+
t[n] !== null && t[n] !== void 0 && e.push(n + "=" + encodeURIComponent(t[n]));
|
|
455
|
+
});
|
|
456
|
+
const i = e.join("&");
|
|
457
|
+
return o = o.replace(/[?&]$/, ""), o += o.includes("?") ? "&" : "?", o + i;
|
|
458
|
+
}
|
|
459
|
+
const ht = /\{z\}/g, ut = /\{x\}/g, ct = /\{y\}/g, dt = /\{-y\}/g;
|
|
460
|
+
function gt(o, t, e, i, n) {
|
|
461
|
+
return o.replace(ht, t.toString()).replace(ut, e.toString()).replace(ct, i.toString()).replace(dt, function() {
|
|
462
|
+
if (n === void 0)
|
|
463
|
+
throw new Error(
|
|
464
|
+
"If the URL template has a {-y} placeholder, the grid extent must be known"
|
|
465
|
+
);
|
|
466
|
+
return (n - i).toString();
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function ft(o) {
|
|
470
|
+
const t = [];
|
|
471
|
+
let e = /\{([a-z])-([a-z])\}/.exec(o);
|
|
472
|
+
if (e) {
|
|
473
|
+
const i = e[1].charCodeAt(0), n = e[2].charCodeAt(0);
|
|
474
|
+
let r;
|
|
475
|
+
for (r = i; r <= n; ++r)
|
|
476
|
+
t.push(o.replace(e[0], String.fromCharCode(r)));
|
|
477
|
+
return t;
|
|
478
|
+
}
|
|
479
|
+
if (e = /\{(\d+)-(\d+)\}/.exec(o), e) {
|
|
480
|
+
const i = parseInt(e[2], 10);
|
|
481
|
+
for (let n = parseInt(e[1], 10); n <= i; n++)
|
|
482
|
+
t.push(o.replace(e[0], n.toString()));
|
|
483
|
+
return t;
|
|
484
|
+
}
|
|
485
|
+
return t.push(o), t;
|
|
486
|
+
}
|
|
487
|
+
function Tt(o, t) {
|
|
488
|
+
return (
|
|
489
|
+
/**
|
|
490
|
+
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
|
|
491
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
492
|
+
* @param {import("./proj/Projection.js").default} projection Projection.
|
|
493
|
+
* @return {string|undefined} Tile URL.
|
|
494
|
+
*/
|
|
495
|
+
(function(e, i, n) {
|
|
496
|
+
if (!e)
|
|
497
|
+
return;
|
|
498
|
+
let r;
|
|
499
|
+
const s = e[0];
|
|
500
|
+
if (t) {
|
|
501
|
+
const l = t.getFullTileRange(s);
|
|
502
|
+
l && (r = l.getHeight() - 1);
|
|
503
|
+
}
|
|
504
|
+
return gt(o, s, e[1], e[2], r);
|
|
505
|
+
})
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
function mt(o, t) {
|
|
509
|
+
const e = o.length, i = new Array(e);
|
|
510
|
+
for (let n = 0; n < e; ++n)
|
|
511
|
+
i[n] = Tt(o[n], t);
|
|
512
|
+
return _t(i);
|
|
513
|
+
}
|
|
514
|
+
function _t(o) {
|
|
515
|
+
return o.length === 1 ? o[0] : (
|
|
516
|
+
/**
|
|
517
|
+
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
|
|
518
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
519
|
+
* @param {import("./proj/Projection.js").default} projection Projection.
|
|
520
|
+
* @return {string|undefined} Tile URL.
|
|
521
|
+
*/
|
|
522
|
+
(function(t, e, i) {
|
|
523
|
+
if (!t)
|
|
524
|
+
return;
|
|
525
|
+
const n = I(t), r = J(n, o.length);
|
|
526
|
+
return o[r](t, e, i);
|
|
527
|
+
})
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
class Ft extends tt {
|
|
531
|
+
/**
|
|
532
|
+
* @param {Options} options Source options.
|
|
533
|
+
*/
|
|
534
|
+
constructor(t) {
|
|
535
|
+
super(), this.projection = S(t.projection), this.attributions_ = j(t.attributions), this.attributionsCollapsible_ = t.attributionsCollapsible ?? !0, this.loading = !1, this.state_ = t.state !== void 0 ? t.state : "ready", this.wrapX_ = t.wrapX !== void 0 ? t.wrapX : !1, this.interpolate_ = !!t.interpolate, this.viewResolver = null, this.viewRejector = null;
|
|
536
|
+
const e = this;
|
|
537
|
+
this.viewPromise_ = new Promise(function(i, n) {
|
|
538
|
+
e.viewResolver = i, e.viewRejector = n;
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Get the attribution function for the source.
|
|
543
|
+
* @return {?Attribution} Attribution function.
|
|
544
|
+
* @api
|
|
545
|
+
*/
|
|
546
|
+
getAttributions() {
|
|
547
|
+
return this.attributions_;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* @return {boolean} Attributions are collapsible.
|
|
551
|
+
* @api
|
|
552
|
+
*/
|
|
553
|
+
getAttributionsCollapsible() {
|
|
554
|
+
return this.attributionsCollapsible_;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Get the projection of the source.
|
|
558
|
+
* @return {import("../proj/Projection.js").default|null} Projection.
|
|
559
|
+
* @api
|
|
560
|
+
*/
|
|
561
|
+
getProjection() {
|
|
562
|
+
return this.projection;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* @param {import("../proj/Projection").default} [projection] Projection.
|
|
566
|
+
* @return {Array<number>|null} Resolutions.
|
|
567
|
+
*/
|
|
568
|
+
getResolutions(t) {
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @return {Promise<import("../View.js").ViewOptions>} A promise for view-related properties.
|
|
573
|
+
*/
|
|
574
|
+
getView() {
|
|
575
|
+
return this.viewPromise_;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Get the state of the source, see {@link import("./Source.js").State} for possible states.
|
|
579
|
+
* @return {import("./Source.js").State} State.
|
|
580
|
+
* @api
|
|
581
|
+
*/
|
|
582
|
+
getState() {
|
|
583
|
+
return this.state_;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* @return {boolean|undefined} Wrap X.
|
|
587
|
+
*/
|
|
588
|
+
getWrapX() {
|
|
589
|
+
return this.wrapX_;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* @return {boolean} Use linear interpolation when resampling.
|
|
593
|
+
*/
|
|
594
|
+
getInterpolate() {
|
|
595
|
+
return this.interpolate_;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Refreshes the source. The source will be cleared, and data from the server will be reloaded.
|
|
599
|
+
* @api
|
|
600
|
+
*/
|
|
601
|
+
refresh() {
|
|
602
|
+
this.changed();
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Set the attributions of the source.
|
|
606
|
+
* @param {AttributionLike|undefined} attributions Attributions.
|
|
607
|
+
* Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},
|
|
608
|
+
* or `undefined`.
|
|
609
|
+
* @api
|
|
610
|
+
*/
|
|
611
|
+
setAttributions(t) {
|
|
612
|
+
this.attributions_ = j(t), this.changed();
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Set the state of the source.
|
|
616
|
+
* @param {import("./Source.js").State} state State.
|
|
617
|
+
*/
|
|
618
|
+
setState(t) {
|
|
619
|
+
this.state_ = t, this.changed();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
function j(o) {
|
|
623
|
+
return o ? typeof o == "function" ? o : (Array.isArray(o) || (o = [o]), (t) => o) : null;
|
|
624
|
+
}
|
|
625
|
+
class xt extends Ft {
|
|
626
|
+
/**
|
|
627
|
+
* @param {Options} options SourceTile source options.
|
|
628
|
+
*/
|
|
629
|
+
constructor(t) {
|
|
630
|
+
super({
|
|
631
|
+
attributions: t.attributions,
|
|
632
|
+
attributionsCollapsible: t.attributionsCollapsible,
|
|
633
|
+
projection: t.projection,
|
|
634
|
+
state: t.state,
|
|
635
|
+
wrapX: t.wrapX,
|
|
636
|
+
interpolate: t.interpolate
|
|
637
|
+
}), this.on, this.once, this.un, this.tilePixelRatio_ = t.tilePixelRatio !== void 0 ? t.tilePixelRatio : 1, this.tileGrid = t.tileGrid !== void 0 ? t.tileGrid : null;
|
|
638
|
+
const e = [256, 256];
|
|
639
|
+
this.tileGrid && g(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), e), this.tmpSize = [0, 0], this.key_ = t.key || E(this), this.tileOptions = {
|
|
640
|
+
transition: t.transition,
|
|
641
|
+
interpolate: t.interpolate
|
|
642
|
+
}, this.zDirection = t.zDirection ? t.zDirection : 0;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
646
|
+
* @return {number} Gutter.
|
|
647
|
+
*/
|
|
648
|
+
getGutterForProjection(t) {
|
|
649
|
+
return 0;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Return the key to be used for all tiles in the source.
|
|
653
|
+
* @return {string} The key for all tiles.
|
|
654
|
+
*/
|
|
655
|
+
getKey() {
|
|
656
|
+
return this.key_;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Set the value to be used as the key for all tiles in the source.
|
|
660
|
+
* @param {string} key The key for tiles.
|
|
661
|
+
* @protected
|
|
662
|
+
*/
|
|
663
|
+
setKey(t) {
|
|
664
|
+
this.key_ !== t && (this.key_ = t, this.changed());
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* @param {import("../proj/Projection").default} [projection] Projection.
|
|
668
|
+
* @return {Array<number>|null} Resolutions.
|
|
669
|
+
* @override
|
|
670
|
+
*/
|
|
671
|
+
getResolutions(t) {
|
|
672
|
+
const e = t ? this.getTileGridForProjection(t) : this.tileGrid;
|
|
673
|
+
return e ? e.getResolutions() : null;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* @abstract
|
|
677
|
+
* @param {number} z Tile coordinate z.
|
|
678
|
+
* @param {number} x Tile coordinate x.
|
|
679
|
+
* @param {number} y Tile coordinate y.
|
|
680
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
681
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
682
|
+
* @return {TileType|null} Tile.
|
|
683
|
+
*/
|
|
684
|
+
getTile(t, e, i, n, r) {
|
|
685
|
+
return et();
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Return the tile grid of the tile source.
|
|
689
|
+
* @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
|
|
690
|
+
* @api
|
|
691
|
+
*/
|
|
692
|
+
getTileGrid() {
|
|
693
|
+
return this.tileGrid;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
697
|
+
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
|
|
698
|
+
*/
|
|
699
|
+
getTileGridForProjection(t) {
|
|
700
|
+
return this.tileGrid ? this.tileGrid : w(t);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Get the tile pixel ratio for this source. Subclasses may override this
|
|
704
|
+
* method, which is meant to return a supported pixel ratio that matches the
|
|
705
|
+
* provided `pixelRatio` as close as possible.
|
|
706
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
707
|
+
* @return {number} Tile pixel ratio.
|
|
708
|
+
*/
|
|
709
|
+
getTilePixelRatio(t) {
|
|
710
|
+
return this.tilePixelRatio_;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* @param {number} z Z.
|
|
714
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
715
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
716
|
+
* @return {import("../size.js").Size} Tile size.
|
|
717
|
+
*/
|
|
718
|
+
getTilePixelSize(t, e, i) {
|
|
719
|
+
const n = this.getTileGridForProjection(i), r = this.getTilePixelRatio(e), s = g(n.getTileSize(t), this.tmpSize);
|
|
720
|
+
return r == 1 ? s : k(s, r, this.tmpSize);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
|
|
724
|
+
* is outside the resolution and extent range of the tile grid, `null` will be
|
|
725
|
+
* returned.
|
|
726
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
727
|
+
* @param {import("../proj/Projection.js").default} [projection] Projection.
|
|
728
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
|
|
729
|
+
* null if no tile URL should be created for the passed `tileCoord`.
|
|
730
|
+
*/
|
|
731
|
+
getTileCoordForTileUrlFunction(t, e) {
|
|
732
|
+
const i = e !== void 0 ? e : this.getProjection(), n = e !== void 0 ? this.getTileGridForProjection(i) : this.tileGrid || this.getTileGridForProjection(i);
|
|
733
|
+
return this.getWrapX() && i.isGlobal() && (t = ot(n, t, i)), D(t, n) ? t : null;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Remove all cached reprojected tiles from the source. The next render cycle will create new tiles.
|
|
737
|
+
* @api
|
|
738
|
+
*/
|
|
739
|
+
clear() {
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* @override
|
|
743
|
+
*/
|
|
744
|
+
refresh() {
|
|
745
|
+
this.clear(), super.refresh();
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
class Rt extends it {
|
|
749
|
+
/**
|
|
750
|
+
* @param {string} type Type.
|
|
751
|
+
* @param {import("../Tile.js").default} tile The tile.
|
|
752
|
+
*/
|
|
753
|
+
constructor(t, e) {
|
|
754
|
+
super(t), this.tile = e;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
const P = {
|
|
758
|
+
/**
|
|
759
|
+
* Triggered when a tile starts loading.
|
|
760
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloadstart
|
|
761
|
+
* @api
|
|
762
|
+
*/
|
|
763
|
+
TILELOADSTART: "tileloadstart",
|
|
764
|
+
/**
|
|
765
|
+
* Triggered when a tile finishes loading, either when its data is loaded,
|
|
766
|
+
* or when loading was aborted because the tile is no longer needed.
|
|
767
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloadend
|
|
768
|
+
* @api
|
|
769
|
+
*/
|
|
770
|
+
TILELOADEND: "tileloadend",
|
|
771
|
+
/**
|
|
772
|
+
* Triggered if tile loading results in an error. Note that this is not the
|
|
773
|
+
* right place to re-fetch tiles. See {@link module:ol/ImageTile~ImageTile#load}
|
|
774
|
+
* for details.
|
|
775
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloaderror
|
|
776
|
+
* @api
|
|
777
|
+
*/
|
|
778
|
+
TILELOADERROR: "tileloaderror"
|
|
779
|
+
};
|
|
780
|
+
class C extends xt {
|
|
781
|
+
/**
|
|
782
|
+
* @param {Options} options Image tile options.
|
|
783
|
+
*/
|
|
784
|
+
constructor(t) {
|
|
785
|
+
super({
|
|
786
|
+
attributions: t.attributions,
|
|
787
|
+
cacheSize: t.cacheSize,
|
|
788
|
+
projection: t.projection,
|
|
789
|
+
state: t.state,
|
|
790
|
+
tileGrid: t.tileGrid,
|
|
791
|
+
tilePixelRatio: t.tilePixelRatio,
|
|
792
|
+
wrapX: t.wrapX,
|
|
793
|
+
transition: t.transition,
|
|
794
|
+
interpolate: t.interpolate,
|
|
795
|
+
key: t.key,
|
|
796
|
+
attributionsCollapsible: t.attributionsCollapsible,
|
|
797
|
+
zDirection: t.zDirection
|
|
798
|
+
}), this.generateTileUrlFunction_ = this.tileUrlFunction === C.prototype.tileUrlFunction, this.tileLoadFunction = t.tileLoadFunction, t.tileUrlFunction && (this.tileUrlFunction = t.tileUrlFunction), this.urls = null, t.urls ? this.setUrls(t.urls) : t.url && this.setUrl(t.url), this.tileLoadingKeys_ = {};
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Deprecated. Use an ImageTile source instead.
|
|
802
|
+
* Return the tile load function of the source.
|
|
803
|
+
* @return {import("../Tile.js").LoadFunction} TileLoadFunction
|
|
804
|
+
* @api
|
|
805
|
+
*/
|
|
806
|
+
getTileLoadFunction() {
|
|
807
|
+
return this.tileLoadFunction;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Deprecated. Use an ImageTile source instead.
|
|
811
|
+
* Return the tile URL function of the source.
|
|
812
|
+
* @return {import("../Tile.js").UrlFunction} TileUrlFunction
|
|
813
|
+
* @api
|
|
814
|
+
*/
|
|
815
|
+
getTileUrlFunction() {
|
|
816
|
+
return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction ? this.tileUrlFunction.bind(this) : this.tileUrlFunction;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Deprecated. Use an ImageTile source instead.
|
|
820
|
+
* Return the URLs used for this source.
|
|
821
|
+
* When a tileUrlFunction is used instead of url or urls,
|
|
822
|
+
* null will be returned.
|
|
823
|
+
* @return {!Array<string>|null} URLs.
|
|
824
|
+
* @api
|
|
825
|
+
*/
|
|
826
|
+
getUrls() {
|
|
827
|
+
return this.urls;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Handle tile change events.
|
|
831
|
+
* @param {import("../events/Event.js").default} event Event.
|
|
832
|
+
* @protected
|
|
833
|
+
*/
|
|
834
|
+
handleTileChange(t) {
|
|
835
|
+
const e = (
|
|
836
|
+
/** @type {import("../Tile.js").default} */
|
|
837
|
+
t.target
|
|
838
|
+
), i = E(e), n = e.getState();
|
|
839
|
+
let r;
|
|
840
|
+
n == _.LOADING ? (this.tileLoadingKeys_[i] = !0, r = P.TILELOADSTART) : i in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[i], r = n == _.ERROR ? P.TILELOADERROR : n == _.LOADED ? P.TILELOADEND : void 0), r != null && this.dispatchEvent(new Rt(r, e));
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Deprecated. Use an ImageTile source instead.
|
|
844
|
+
* Set the tile load function of the source.
|
|
845
|
+
* @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
|
|
846
|
+
* @api
|
|
847
|
+
*/
|
|
848
|
+
setTileLoadFunction(t) {
|
|
849
|
+
this.tileLoadFunction = t, this.changed();
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Deprecated. Use an ImageTile source instead.
|
|
853
|
+
* Set the tile URL function of the source.
|
|
854
|
+
* @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
|
|
855
|
+
* @param {string} [key] Optional new tile key for the source.
|
|
856
|
+
* @api
|
|
857
|
+
*/
|
|
858
|
+
setTileUrlFunction(t, e) {
|
|
859
|
+
this.tileUrlFunction = t, typeof e < "u" ? this.setKey(e) : this.changed();
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Set the URL to use for requests.
|
|
863
|
+
* @param {string} url URL.
|
|
864
|
+
* @api
|
|
865
|
+
*/
|
|
866
|
+
setUrl(t) {
|
|
867
|
+
const e = ft(t);
|
|
868
|
+
this.urls = e, this.setUrls(e);
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Deprecated. Use an ImageTile source instead.
|
|
872
|
+
* Set the URLs to use for requests.
|
|
873
|
+
* @param {Array<string>} urls URLs.
|
|
874
|
+
* @api
|
|
875
|
+
*/
|
|
876
|
+
setUrls(t) {
|
|
877
|
+
this.urls = t;
|
|
878
|
+
const e = t.join(`
|
|
879
|
+
`);
|
|
880
|
+
this.generateTileUrlFunction_ ? this.setTileUrlFunction(mt(t, this.tileGrid), e) : this.setKey(e);
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
884
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
885
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
886
|
+
* @return {string|undefined} Tile URL.
|
|
887
|
+
*/
|
|
888
|
+
tileUrlFunction(t, e, i) {
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
class bt extends C {
|
|
892
|
+
/**
|
|
893
|
+
* @param {!Options} options Image tile options.
|
|
894
|
+
*/
|
|
895
|
+
constructor(t) {
|
|
896
|
+
super({
|
|
897
|
+
attributions: t.attributions,
|
|
898
|
+
cacheSize: t.cacheSize,
|
|
899
|
+
projection: t.projection,
|
|
900
|
+
state: t.state,
|
|
901
|
+
tileGrid: t.tileGrid,
|
|
902
|
+
tileLoadFunction: t.tileLoadFunction ? t.tileLoadFunction : Et,
|
|
903
|
+
tilePixelRatio: t.tilePixelRatio,
|
|
904
|
+
tileUrlFunction: t.tileUrlFunction,
|
|
905
|
+
url: t.url,
|
|
906
|
+
urls: t.urls,
|
|
907
|
+
wrapX: t.wrapX,
|
|
908
|
+
transition: t.transition,
|
|
909
|
+
interpolate: t.interpolate !== void 0 ? t.interpolate : !0,
|
|
910
|
+
key: t.key,
|
|
911
|
+
attributionsCollapsible: t.attributionsCollapsible,
|
|
912
|
+
zDirection: t.zDirection
|
|
913
|
+
}), this.crossOrigin = t.crossOrigin !== void 0 ? t.crossOrigin : null, this.tileClass = t.tileClass !== void 0 ? t.tileClass : v, this.tileGridForProjection = {}, this.reprojectionErrorThreshold_ = t.reprojectionErrorThreshold, this.renderReprojectionEdges_ = !1;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
917
|
+
* @return {number} Gutter.
|
|
918
|
+
* @override
|
|
919
|
+
*/
|
|
920
|
+
getGutterForProjection(t) {
|
|
921
|
+
return this.getProjection() && t && !z(this.getProjection(), t) ? 0 : this.getGutter();
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* @return {number} Gutter.
|
|
925
|
+
*/
|
|
926
|
+
getGutter() {
|
|
927
|
+
return 0;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Return the key to be used for all tiles in the source.
|
|
931
|
+
* @return {string} The key for all tiles.
|
|
932
|
+
* @override
|
|
933
|
+
*/
|
|
934
|
+
getKey() {
|
|
935
|
+
let t = super.getKey();
|
|
936
|
+
return this.getInterpolate() || (t += ":disable-interpolation"), t;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
940
|
+
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
|
|
941
|
+
* @override
|
|
942
|
+
*/
|
|
943
|
+
getTileGridForProjection(t) {
|
|
944
|
+
const e = this.getProjection();
|
|
945
|
+
if (this.tileGrid && (!e || z(e, t)))
|
|
946
|
+
return this.tileGrid;
|
|
947
|
+
const i = E(t);
|
|
948
|
+
return i in this.tileGridForProjection || (this.tileGridForProjection[i] = w(t)), this.tileGridForProjection[i];
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* @param {number} z Tile coordinate z.
|
|
952
|
+
* @param {number} x Tile coordinate x.
|
|
953
|
+
* @param {number} y Tile coordinate y.
|
|
954
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
955
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
956
|
+
* @param {string} key The key set on the tile.
|
|
957
|
+
* @return {!ImageTile} Tile.
|
|
958
|
+
* @private
|
|
959
|
+
*/
|
|
960
|
+
createTile_(t, e, i, n, r, s) {
|
|
961
|
+
const l = [t, e, i], a = this.getTileCoordForTileUrlFunction(
|
|
962
|
+
l,
|
|
963
|
+
r
|
|
964
|
+
), h = a ? this.tileUrlFunction(a, n, r) : void 0, u = new this.tileClass(
|
|
965
|
+
l,
|
|
966
|
+
h !== void 0 ? _.IDLE : _.EMPTY,
|
|
967
|
+
h !== void 0 ? h : "",
|
|
968
|
+
this.crossOrigin,
|
|
969
|
+
this.tileLoadFunction,
|
|
970
|
+
this.tileOptions
|
|
971
|
+
);
|
|
972
|
+
return u.key = s, u.addEventListener(nt.CHANGE, this.handleTileChange.bind(this)), u;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* @param {number} z Tile coordinate z.
|
|
976
|
+
* @param {number} x Tile coordinate x.
|
|
977
|
+
* @param {number} y Tile coordinate y.
|
|
978
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
979
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
980
|
+
* @return {!(ImageTile|ReprojTile)} Tile.
|
|
981
|
+
* @override
|
|
982
|
+
*/
|
|
983
|
+
getTile(t, e, i, n, r) {
|
|
984
|
+
const s = this.getProjection();
|
|
985
|
+
if (!s || !r || z(s, r))
|
|
986
|
+
return this.getTileInternal(
|
|
987
|
+
t,
|
|
988
|
+
e,
|
|
989
|
+
i,
|
|
990
|
+
n,
|
|
991
|
+
s || r
|
|
992
|
+
);
|
|
993
|
+
const l = [t, e, i], a = this.getKey(), h = this.getTileGridForProjection(s), u = this.getTileGridForProjection(r), c = this.getTileCoordForTileUrlFunction(
|
|
994
|
+
l,
|
|
995
|
+
r
|
|
996
|
+
), F = new K(
|
|
997
|
+
s,
|
|
998
|
+
h,
|
|
999
|
+
r,
|
|
1000
|
+
u,
|
|
1001
|
+
l,
|
|
1002
|
+
c,
|
|
1003
|
+
this.getTilePixelRatio(n),
|
|
1004
|
+
this.getGutter(),
|
|
1005
|
+
(Z, O, L, M) => this.getTileInternal(Z, O, L, M, s),
|
|
1006
|
+
this.reprojectionErrorThreshold_,
|
|
1007
|
+
this.renderReprojectionEdges_,
|
|
1008
|
+
this.tileOptions
|
|
1009
|
+
);
|
|
1010
|
+
return F.key = a, F;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* @param {number} z Tile coordinate z.
|
|
1014
|
+
* @param {number} x Tile coordinate x.
|
|
1015
|
+
* @param {number} y Tile coordinate y.
|
|
1016
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
1017
|
+
* @param {!import("../proj/Projection.js").default} projection Projection.
|
|
1018
|
+
* @return {!ImageTile} Tile.
|
|
1019
|
+
* @protected
|
|
1020
|
+
*/
|
|
1021
|
+
getTileInternal(t, e, i, n, r) {
|
|
1022
|
+
const s = this.getKey();
|
|
1023
|
+
return this.createTile_(t, e, i, n, r, s);
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Sets whether to render reprojection edges or not (usually for debugging).
|
|
1027
|
+
* @param {boolean} render Render the edges.
|
|
1028
|
+
* @api
|
|
1029
|
+
*/
|
|
1030
|
+
setRenderReprojectionEdges(t) {
|
|
1031
|
+
this.renderReprojectionEdges_ != t && (this.renderReprojectionEdges_ = t, this.changed());
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Sets the tile grid to use when reprojecting the tiles to the given
|
|
1035
|
+
* projection instead of the default tile grid for the projection.
|
|
1036
|
+
*
|
|
1037
|
+
* This can be useful when the default tile grid cannot be created
|
|
1038
|
+
* (e.g. projection has no extent defined) or
|
|
1039
|
+
* for optimization reasons (custom tile size, resolutions, ...).
|
|
1040
|
+
*
|
|
1041
|
+
* @param {import("../proj.js").ProjectionLike} projection Projection.
|
|
1042
|
+
* @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
|
|
1043
|
+
* @api
|
|
1044
|
+
*/
|
|
1045
|
+
setTileGridForProjection(t, e) {
|
|
1046
|
+
const i = S(t);
|
|
1047
|
+
if (i) {
|
|
1048
|
+
const n = E(i);
|
|
1049
|
+
n in this.tileGridForProjection || (this.tileGridForProjection[n] = e);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
function Et(o, t) {
|
|
1054
|
+
o.getImage().src = t;
|
|
1055
|
+
}
|
|
1056
|
+
export {
|
|
1057
|
+
Ft as S,
|
|
1058
|
+
bt as T,
|
|
1059
|
+
C as U,
|
|
1060
|
+
p as a,
|
|
1061
|
+
jt as b,
|
|
1062
|
+
Gt as c,
|
|
1063
|
+
ft as d,
|
|
1064
|
+
X as e,
|
|
1065
|
+
_t as f,
|
|
1066
|
+
mt as g
|
|
1067
|
+
};
|