map_view_vue3 0.0.0-stage → 0.0.2
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 +231 -2
- package/favicon.svg +1 -0
- package/icons.svg +24 -0
- package/map_view_vue3.css +2 -0
- package/map_view_vue3.js +19327 -0
- package/map_view_vue3.umd.cjs +10 -0
- package/package.json +11 -4
- package/types/index.d.ts +404 -0
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map_view_vue3",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "map_view_vue3.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC"
|
|
13
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type MapViewerTheme = 'light' | 'dark';
|
|
4
|
+
export type MapViewerSourceCategory = 'raster' | 'vector';
|
|
5
|
+
export type MapViewerTab = 'image' | 'tiles' | 'url' | 'geojson';
|
|
6
|
+
export type MapViewerToastType = 'info' | 'ok' | 'warn' | 'err';
|
|
7
|
+
|
|
8
|
+
export type Extent4 = [number, number, number, number];
|
|
9
|
+
export type ExtentInput = Extent4 | number[] | string | null;
|
|
10
|
+
|
|
11
|
+
export interface CrsOption {
|
|
12
|
+
code: string;
|
|
13
|
+
name: string;
|
|
14
|
+
def?: string;
|
|
15
|
+
geoBox?: Extent4;
|
|
16
|
+
pixel?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CrsGroup {
|
|
20
|
+
label: string;
|
|
21
|
+
items: CrsOption[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface AutoLoadImageConfig {
|
|
25
|
+
type: 'image';
|
|
26
|
+
url: string;
|
|
27
|
+
name?: string | null;
|
|
28
|
+
crs?: string | null;
|
|
29
|
+
worldFile?: string | null;
|
|
30
|
+
worldText?: string | null;
|
|
31
|
+
extent?: ExtentInput;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AutoLoadManifestConfig {
|
|
35
|
+
type: 'manifest';
|
|
36
|
+
url: string;
|
|
37
|
+
baseUrl?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type AutoLoadConfig = AutoLoadImageConfig | AutoLoadManifestConfig;
|
|
41
|
+
|
|
42
|
+
export interface MapViewerProps {
|
|
43
|
+
theme?: MapViewerTheme;
|
|
44
|
+
dataCrs?: string;
|
|
45
|
+
zoom?: number;
|
|
46
|
+
hidePanels?: boolean;
|
|
47
|
+
width?: string | number | null;
|
|
48
|
+
height?: string | number | null;
|
|
49
|
+
mapBackground?: string | null;
|
|
50
|
+
autoLoad?: AutoLoadConfig | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface MapViewerEmits {
|
|
54
|
+
(e: 'theme-changed', theme: MapViewerTheme): void;
|
|
55
|
+
(e: 'view-changed', state: MapViewerViewState): void;
|
|
56
|
+
(e: 'active-map-changed', payload: { id: number; name: string; kind: string }): void;
|
|
57
|
+
(e: 'map-removed', payload: { id: number; name: string; kind: string }): void;
|
|
58
|
+
(e: 'layer-removed', payload: { isGroup: boolean; name: string; layerCount: number | null; group: string | null }): void;
|
|
59
|
+
(e: 'notify', payload: { message: string; type: string }): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface MapViewerViewState {
|
|
63
|
+
center: number[] | null;
|
|
64
|
+
zoom: number | null;
|
|
65
|
+
crs: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface MapViewerActiveMapInfo {
|
|
69
|
+
id: number;
|
|
70
|
+
name: string;
|
|
71
|
+
kind: string;
|
|
72
|
+
dataCrs: string;
|
|
73
|
+
viewCrs: string;
|
|
74
|
+
extent: number[] | null;
|
|
75
|
+
sublayerCount: number;
|
|
76
|
+
center: number[] | null;
|
|
77
|
+
zoom: number | null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface MapInfoState {
|
|
81
|
+
active: boolean;
|
|
82
|
+
name: string;
|
|
83
|
+
kind: string;
|
|
84
|
+
dataCrs: string;
|
|
85
|
+
extent: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface MapExtentState {
|
|
89
|
+
minx: string | number;
|
|
90
|
+
miny: string | number;
|
|
91
|
+
maxx: string | number;
|
|
92
|
+
maxy: string | number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface MapViewerFormState {
|
|
96
|
+
dataCrs: string;
|
|
97
|
+
viewCrs: string;
|
|
98
|
+
urlExtentCrs: string;
|
|
99
|
+
imgFileName: string;
|
|
100
|
+
worldFileName: string;
|
|
101
|
+
zoneHint: { message: string; options: CrsOption[] };
|
|
102
|
+
tilesDirName: string;
|
|
103
|
+
tilesInfo: string;
|
|
104
|
+
tilesTms: boolean;
|
|
105
|
+
geojsonDirName: string;
|
|
106
|
+
geojsonInfo: string;
|
|
107
|
+
geojsonCrsHint: string;
|
|
108
|
+
geojsonCrsOptions: CrsOption[];
|
|
109
|
+
urlTemplate: string;
|
|
110
|
+
urlInfo: string;
|
|
111
|
+
urlMinzoom: string | number;
|
|
112
|
+
urlMaxzoom: string | number;
|
|
113
|
+
customEpsg: string | number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface Sublayer {
|
|
117
|
+
name: string;
|
|
118
|
+
kind: string;
|
|
119
|
+
layer: unknown;
|
|
120
|
+
visible: boolean;
|
|
121
|
+
group?: string | null;
|
|
122
|
+
groupVisible?: boolean;
|
|
123
|
+
featureCount?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface MapEntry {
|
|
127
|
+
id: number;
|
|
128
|
+
name: string;
|
|
129
|
+
kind: string;
|
|
130
|
+
projection: unknown;
|
|
131
|
+
sourceCrs?: string | null;
|
|
132
|
+
viewProjectionCode: string;
|
|
133
|
+
extent?: number[] | null;
|
|
134
|
+
sublayers: Sublayer[];
|
|
135
|
+
viewState?: { center: number[]; resolution: number } | null;
|
|
136
|
+
layer: unknown;
|
|
137
|
+
sources?: Array<{ refresh(): void }>;
|
|
138
|
+
cleanup?: () => void;
|
|
139
|
+
expandedLayerGroups?: Set<string>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface MapListItem {
|
|
143
|
+
id: number;
|
|
144
|
+
entry: MapEntry;
|
|
145
|
+
active: boolean;
|
|
146
|
+
icon: string;
|
|
147
|
+
name: string;
|
|
148
|
+
meta: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface LayerRow {
|
|
152
|
+
type: 'layer' | 'group';
|
|
153
|
+
key?: string;
|
|
154
|
+
name: string;
|
|
155
|
+
meta?: string;
|
|
156
|
+
visible?: boolean;
|
|
157
|
+
collapsed?: boolean;
|
|
158
|
+
sublayer?: Sublayer;
|
|
159
|
+
children?: Array<{ key: string; name: string; meta: string; visible: boolean; sublayer: Sublayer }>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface MapViewerLoadImageOptions {
|
|
163
|
+
url: string;
|
|
164
|
+
name?: string | null;
|
|
165
|
+
crs?: string | null;
|
|
166
|
+
worldFileUrl?: string | null;
|
|
167
|
+
worldText?: string | null;
|
|
168
|
+
extent?: ExtentInput;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface MapViewerGeoJsonLayerData {
|
|
172
|
+
name: string;
|
|
173
|
+
geojson: string | Record<string, unknown>;
|
|
174
|
+
sld?: string | Record<string, unknown> | null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AddImageFromUrlOptions {
|
|
178
|
+
url: string;
|
|
179
|
+
name: string;
|
|
180
|
+
worldText?: string | null;
|
|
181
|
+
extent?: ExtentInput;
|
|
182
|
+
crs?: string | null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface GeoJsonPair {
|
|
186
|
+
file: File;
|
|
187
|
+
sld?: File | null;
|
|
188
|
+
layerTitle?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface MapViewerXyzOptions {
|
|
192
|
+
url: string;
|
|
193
|
+
crs?: string;
|
|
194
|
+
minZoom?: number;
|
|
195
|
+
maxZoom?: number;
|
|
196
|
+
extent?: ExtentInput;
|
|
197
|
+
extentCrs?: string | null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ManifestEntry {
|
|
201
|
+
url: string;
|
|
202
|
+
type?: string | null;
|
|
203
|
+
name?: string | null;
|
|
204
|
+
crs?: string | null;
|
|
205
|
+
worldFile?: string | null;
|
|
206
|
+
worldText?: string | null;
|
|
207
|
+
extent?: ExtentInput;
|
|
208
|
+
sld?: string | null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ManifestLayerItem {
|
|
212
|
+
name?: string;
|
|
213
|
+
title?: string;
|
|
214
|
+
geojson?: string;
|
|
215
|
+
sld?: string;
|
|
216
|
+
crs?: string;
|
|
217
|
+
worldFile?: string;
|
|
218
|
+
worldText?: string;
|
|
219
|
+
extent?: ExtentInput;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface ManifestInput {
|
|
223
|
+
files?: Array<string | ManifestEntry>;
|
|
224
|
+
layers?: ManifestLayerItem[];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export type ManifestLike = Array<string | ManifestEntry | ManifestLayerItem> | ManifestInput;
|
|
228
|
+
|
|
229
|
+
export interface MapViewerInstance {
|
|
230
|
+
viewerReady: boolean;
|
|
231
|
+
sidebarWidth: number;
|
|
232
|
+
loadingTasks: number;
|
|
233
|
+
olLoading: boolean;
|
|
234
|
+
dropVisible: boolean;
|
|
235
|
+
sourceCategory: MapViewerSourceCategory;
|
|
236
|
+
currentTab: MapViewerTab;
|
|
237
|
+
loadDialogVisible: boolean;
|
|
238
|
+
sidebarCollapsed: boolean;
|
|
239
|
+
panelRightCollapsed: boolean;
|
|
240
|
+
isLight: boolean;
|
|
241
|
+
themeIcon: string;
|
|
242
|
+
themeTitle: string;
|
|
243
|
+
statusInfo: string;
|
|
244
|
+
toastText: string;
|
|
245
|
+
toastType: MapViewerToastType;
|
|
246
|
+
toastVisible: boolean;
|
|
247
|
+
mapInfo: MapInfoState;
|
|
248
|
+
mapListItems: MapListItem[];
|
|
249
|
+
layerListVisible: boolean;
|
|
250
|
+
layerListHint: string;
|
|
251
|
+
layerTotal: number;
|
|
252
|
+
layerFeatureTotal: number;
|
|
253
|
+
layerListItems: LayerRow[];
|
|
254
|
+
crsOptions: { dataCrs: CrsGroup[]; viewCrs: CrsGroup[]; urlExtentCrs: CrsGroup[] };
|
|
255
|
+
customCrsOptions: CrsOption[];
|
|
256
|
+
mapExtent: MapExtentState;
|
|
257
|
+
viewExtent: MapExtentState;
|
|
258
|
+
form: MapViewerFormState;
|
|
259
|
+
|
|
260
|
+
initViewer(): void;
|
|
261
|
+
pushLoading(): void;
|
|
262
|
+
popLoading(): void;
|
|
263
|
+
startSidebarResize(event: MouseEvent): void;
|
|
264
|
+
collapseSidebar(): void;
|
|
265
|
+
expandSidebar(): void;
|
|
266
|
+
collapsePanelRight(): void;
|
|
267
|
+
expandPanelRight(): void;
|
|
268
|
+
toggleTheme(): void;
|
|
269
|
+
loadToMap(): Promise<void> | void;
|
|
270
|
+
destroyViewer(): void;
|
|
271
|
+
createFitAllControl(): unknown;
|
|
272
|
+
gkDef(cm: number, x0: number): string;
|
|
273
|
+
addGroup(label: string, items: CrsOption[]): void;
|
|
274
|
+
buildCrsOptionGroups(includePixel?: boolean): CrsGroup[];
|
|
275
|
+
refillCrsSelects(): void;
|
|
276
|
+
ensureProjection(code: string): unknown;
|
|
277
|
+
formatCoord(coord: number[]): string;
|
|
278
|
+
attachViewListener(): void;
|
|
279
|
+
fmtRes(resolution: number): string;
|
|
280
|
+
updateStatus(): void;
|
|
281
|
+
updateMapExtent(): void;
|
|
282
|
+
updateViewExtent(): void;
|
|
283
|
+
fmtExtentInput(value: number | string): string;
|
|
284
|
+
toast(message: string, type?: MapViewerToastType): void;
|
|
285
|
+
kindIcon(kind: string): string;
|
|
286
|
+
selectAndFitMap(entry: MapEntry): void;
|
|
287
|
+
renderMapList(): void;
|
|
288
|
+
renderMapInfo(): void;
|
|
289
|
+
inferGeoJsonGroup(features: unknown[]): string | null;
|
|
290
|
+
buildLayerGroups(sublayers: Sublayer[]): LayerRow[];
|
|
291
|
+
isLayerEffectivelyVisible(sublayer: Sublayer): boolean;
|
|
292
|
+
renderLayerList(): void;
|
|
293
|
+
toggleLayerVisible(row: LayerRow): void;
|
|
294
|
+
toggleLayerGroupExpanded(row: LayerRow): void;
|
|
295
|
+
toggleLayerGroupVisible(row: LayerRow): void;
|
|
296
|
+
toggleLayerChildVisible(row: LayerRow, child: unknown): void;
|
|
297
|
+
getVectorSourceExtent(sublayer: Sublayer): number[] | null;
|
|
298
|
+
zoomToLayer(row: LayerRow): void;
|
|
299
|
+
zoomToLayerGroup(row: LayerRow): void;
|
|
300
|
+
removeSublayerInternal(sublayer: Sublayer): void;
|
|
301
|
+
afterLayersRemoved(message?: string): void;
|
|
302
|
+
removeLayerItem(row: LayerRow): void;
|
|
303
|
+
removeLayerGroup(row: LayerRow): void;
|
|
304
|
+
normalizeSublayers(entry: MapEntry): Sublayer[];
|
|
305
|
+
saveActiveViewState(): void;
|
|
306
|
+
selectMapEntry(entry: MapEntry): void;
|
|
307
|
+
addMapEntry(entry: MapEntry): void;
|
|
308
|
+
deleteMapEntry(entry: MapEntry): void;
|
|
309
|
+
fitActiveMap(): void;
|
|
310
|
+
fitToExtent(extent: ExtentInput, projection?: string | object): void;
|
|
311
|
+
syncViewCrsSelect(): void;
|
|
312
|
+
computeViewTransition(newProj: unknown): unknown;
|
|
313
|
+
setViewProjection(proj: string | object, options?: Record<string, any>): void | Promise<void>;
|
|
314
|
+
worldSquareExtent(proj: unknown): number[] | null;
|
|
315
|
+
buildTileGrid(proj: unknown, maxZoom: number, minZoom?: number, extentOverride?: number[] | null): unknown;
|
|
316
|
+
tilesExtent(grid: unknown, stats: unknown): number[] | null;
|
|
317
|
+
fmtExtentNum(value: number | string): string;
|
|
318
|
+
extentText(extent: number[] | null): string;
|
|
319
|
+
extentFromTileMap(tmap: unknown, crsCode: string): number[] | null;
|
|
320
|
+
scanTileFiles(files: FileList | File[], tms: boolean): unknown;
|
|
321
|
+
tileStats(tmap: unknown): unknown;
|
|
322
|
+
clampInt(value: unknown, lo: number, hi: number, defaultValue?: number): number;
|
|
323
|
+
getImageSize(url: string): Promise<{ width: number; height: number }>;
|
|
324
|
+
parseWorldFile(text: string): number[];
|
|
325
|
+
extentFromWorldFile(width: number, height: number, wf: number[]): number[] | null;
|
|
326
|
+
guessCrsFromExtent(extent: number[] | null): string | null;
|
|
327
|
+
updateZoneHint(extent: number[] | null): void;
|
|
328
|
+
applyWorldFileToExtent(): void;
|
|
329
|
+
readExtentInputs(): number[] | null;
|
|
330
|
+
onImageFileChosen(file: File): Promise<void>;
|
|
331
|
+
loadImageLayer(): Promise<void>;
|
|
332
|
+
addImageFromUrl(options: AddImageFromUrlOptions): Promise<void>;
|
|
333
|
+
createXyzEntry(template: string, crsCode: string, minZoom?: number | null, maxZoom?: number | null, extentOpt?: { extent: number[]; crs: string } | null): Promise<{ entry?: MapEntry; error?: string }>;
|
|
334
|
+
loadUrlLayer(): Promise<void>;
|
|
335
|
+
detectGeoJsonCrsHints(pairs: GeoJsonPair[], token: number): Promise<void>;
|
|
336
|
+
orderGeoJsonPairsByMetadata(pairs: GeoJsonPair[], metadataFile: File): Promise<{ pairs: GeoJsonPair[]; metadata: Record<string, unknown> | null }>;
|
|
337
|
+
onTilesDirChosen(fileList: FileList | File[]): void;
|
|
338
|
+
updateTilesInfo(): void;
|
|
339
|
+
loadTilesLayer(): void;
|
|
340
|
+
updateUrlTemplateHint(): void;
|
|
341
|
+
vectorColor(name: string): string;
|
|
342
|
+
descendants(root: unknown, localName: string): unknown[];
|
|
343
|
+
svgParameters(parent: unknown): Record<string, string>;
|
|
344
|
+
strokeFromParams(params: Record<string, string>, prefix?: string): unknown;
|
|
345
|
+
parseSldStyles(text: string): unknown[];
|
|
346
|
+
sldLabelProperty(text: string): string | null;
|
|
347
|
+
parseCadColor(value: unknown): unknown;
|
|
348
|
+
parseCadColor24(value: unknown): unknown;
|
|
349
|
+
resolveGeoJsonCadColor(feature: unknown): unknown;
|
|
350
|
+
setStyleColor(style: unknown, color: unknown, geometryType: string): void;
|
|
351
|
+
makeSldStyleFunction(styles: unknown[], labelProperty?: string | null): unknown;
|
|
352
|
+
defaultVectorStyle(feature: unknown, resolution?: number): unknown;
|
|
353
|
+
featuresExtent(features: unknown[]): number[] | null;
|
|
354
|
+
createReprojectingVectorSource(features: unknown[], dataProjection: string | object): unknown;
|
|
355
|
+
geoJsonCrsCode(object: unknown): string | null;
|
|
356
|
+
geoJsonCrsChipLabel(code: string, count: number): string;
|
|
357
|
+
updateGeoJsonCrsHint(codes: Set<string>, checkedCount: number): void;
|
|
358
|
+
isMetadataJson(file: File): boolean;
|
|
359
|
+
matchGeoJsonPairs(files: FileList | File[]): unknown[];
|
|
360
|
+
onGeoJsonDirChosen(fileList: FileList | File[]): void;
|
|
361
|
+
loadGeoJsonLayers(): Promise<void>;
|
|
362
|
+
switchViewProjection(): void;
|
|
363
|
+
registerCustom(code: string, def: string): boolean;
|
|
364
|
+
fetchAndRegisterEpsg(): Promise<void>;
|
|
365
|
+
setSourceCategory(category: MapViewerSourceCategory): void;
|
|
366
|
+
setActiveTab(name: MapViewerTab): void;
|
|
367
|
+
setSourceCategoryAndDefault(category: MapViewerSourceCategory): void;
|
|
368
|
+
resetLoadDialog(): void;
|
|
369
|
+
openLoadDialog(): void;
|
|
370
|
+
closeLoadDialog(): void;
|
|
371
|
+
getViewState(): MapViewerViewState | null;
|
|
372
|
+
getActiveMapInfo(): MapViewerActiveMapInfo | null;
|
|
373
|
+
addXyzLayer(options?: MapViewerXyzOptions): Promise<MapEntry | null>;
|
|
374
|
+
loadImageFromUrl(options?: MapViewerLoadImageOptions): Promise<MapEntry | null>;
|
|
375
|
+
loadGeoJsonFromFiles(files: FileList | File[]): Promise<MapEntry | null>;
|
|
376
|
+
loadGeoJsonFromManifest(manifest: ManifestLike, baseUrl?: string): Promise<MapEntry | null>;
|
|
377
|
+
manifestEntries(manifest: ManifestLike): ManifestEntry[];
|
|
378
|
+
resolveManifestUrl(url: string, baseUrl?: string): string;
|
|
379
|
+
manifestUrlName(url: string): string;
|
|
380
|
+
loadGeoJsonFromData(layers: MapViewerGeoJsonLayerData[]): Promise<MapEntry | null>;
|
|
381
|
+
loadGeoJsonForCurrentSource(): Promise<void>;
|
|
382
|
+
waitViewerReady(): Promise<void>;
|
|
383
|
+
processAutoLoad(): Promise<void>;
|
|
384
|
+
applyTheme(theme: MapViewerTheme): void;
|
|
385
|
+
readDroppedEntry(entry: DataTransferItem, path?: string): Promise<File[]>;
|
|
386
|
+
filesFromDataTransfer(dataTransfer: DataTransfer): Promise<File[]>;
|
|
387
|
+
normalizeEpsg(value: string | number): string | null;
|
|
388
|
+
|
|
389
|
+
[key: string]: unknown;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export type MapViewerComponent = DefineComponent<
|
|
393
|
+
MapViewerProps,
|
|
394
|
+
MapViewerEmits,
|
|
395
|
+
MapViewerInstance
|
|
396
|
+
>;
|
|
397
|
+
|
|
398
|
+
declare const MapViewVue3: MapViewerComponent;
|
|
399
|
+
export default MapViewVue3;
|
|
400
|
+
|
|
401
|
+
declare module '*.vue' {
|
|
402
|
+
const component: MapViewerComponent;
|
|
403
|
+
export default component;
|
|
404
|
+
}
|