@opengeoweb/webmap 19.1.0 → 19.2.0
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/README.md +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +6984 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/lib/components/LoadDurationCounter.d.ts +17 -0
- package/dist/src/lib/components/WMBBOX.d.ts +32 -0
- package/dist/src/lib/components/WMConstants.d.ts +32 -0
- package/dist/src/lib/components/WMImage.d.ts +115 -0
- package/dist/src/lib/components/WMImageStore.d.ts +61 -0
- package/dist/src/lib/components/WMJSDimension.d.ts +126 -0
- package/dist/src/lib/components/WMJSDimensionModes.d.ts +15 -0
- package/dist/src/lib/components/WMJSTools.d.ts +62 -0
- package/dist/src/lib/components/WMLayer.d.ts +117 -0
- package/dist/src/lib/components/WMLayerTypes.d.ts +66 -0
- package/dist/src/lib/components/WMLayerUtils.d.ts +22 -0
- package/dist/src/lib/components/WMLegend.d.ts +6 -0
- package/dist/src/lib/components/WMListener.d.ts +57 -0
- package/dist/src/lib/components/WMProjection.d.ts +17 -0
- package/dist/src/lib/components/WMTime.d.ts +44 -0
- package/dist/src/lib/components/WMTimeTypes.d.ts +19 -0
- package/dist/src/lib/components/WMXMLParser.d.ts +9 -0
- package/dist/src/lib/components/index.d.ts +25 -0
- package/dist/src/lib/components/makeHashUrlForGeoReferencedImage.d.ts +6 -0
- package/dist/src/lib/components/types.d.ts +231 -0
- package/dist/src/lib/index.d.ts +5 -0
- package/dist/src/lib/query/fakeApiWmtsQueries.d.ts +208 -0
- package/dist/src/lib/query/queryConstants.d.ts +7 -0
- package/dist/src/lib/query/queryWMS.d.ts +69 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +1 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS130GetCapabilitiesHarmN25.d.ts +2 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops.d.ts +2 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS130GetCapabilitiesRadarTestWithInheritLayerprops.d.ts +2 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS130GetCapabilitiesRadarTestWithInheritLayerpropsToLayerTree.d.ts +76 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops.d.ts +2 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMSGetCapabilitiesMissingLegend.d.ts +1 -0
- package/dist/src/lib/specs/getCapabilitySpecs/WMSSmartMet.d.ts +2 -0
- package/dist/src/lib/specs/getCapabilitySpecs/radarGetCapabilities.d.ts +244 -0
- package/dist/src/lib/specs/index.d.ts +93 -0
- package/dist/src/lib/specs/layerSpecs.d.ts +34 -0
- package/dist/src/lib/specs/mockGetCapabilities.d.ts +90 -0
- package/dist/src/lib/utils/consoleErrorMessages.d.ts +12 -0
- package/dist/src/lib/utils/fakeMaxAgeResponses.d.ts +1 -0
- package/dist/src/lib/utils/getCapabilities/getWMSServiceId.d.ts +10 -0
- package/dist/src/lib/utils/getCapabilities/index.d.ts +4 -0
- package/dist/src/lib/utils/getCapabilities/utils.d.ts +64 -0
- package/dist/src/lib/utils/getCapabilities/wmsQueryClient.d.ts +7 -0
- package/dist/src/lib/utils/i18n.d.ts +6 -0
- package/dist/src/lib/utils/index.d.ts +3 -0
- package/dist/src/lib/utils/tilesettings.d.ts +27 -0
- package/dist/src/lib/utils/utils.d.ts +31 -0
- package/package.json +2 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import WMImageStore from './lib/components/WMImageStore';
|
|
2
|
+
import { mockGetCapabilities } from './lib/specs';
|
|
3
|
+
export * from './lib';
|
|
4
|
+
export * as webmapUtils from './lib/utils/utils';
|
|
5
|
+
export * as webmapTestSettings from './lib/specs';
|
|
6
|
+
export { mockGetCapabilities };
|
|
7
|
+
declare const privateWebMapUtils: {
|
|
8
|
+
privateWmsGetCapabilities: (serviceUrl: string, headers?: import("./lib").Header[], forceReload?: boolean) => Promise<import("./lib").WMSGetCapabilities>;
|
|
9
|
+
privateGetWMSServiceInfo: (getCapabilitiesJson: import("./lib").WMSGetCapabilities, serviceUrl: string) => import("./lib").WMSServiceInfo;
|
|
10
|
+
privateWmsGetLayerTree: (jsonData: import("./lib").OGCWMSWMTSGetCapabilities) => import("./lib").LayerTree | null;
|
|
11
|
+
privateWmsFlattenLayerTree: (layerTree: import("./lib").LayerTree) => import("./lib").LayerProps[];
|
|
12
|
+
privateWmtsGetCapabilities: (serviceUrl: string, headers?: import("./lib").Header[], forceReload?: boolean) => Promise<string>;
|
|
13
|
+
QUERYWMS_GETCAPABILITIES: string;
|
|
14
|
+
};
|
|
15
|
+
export { privateWebMapUtils };
|
|
16
|
+
export { WMImageStore };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum WMImageStoreLoadType {
|
|
2
|
+
'PREFETCH' = "A",
|
|
3
|
+
'GETMAP' = "B"
|
|
4
|
+
}
|
|
5
|
+
export default class LoadDurationCounter {
|
|
6
|
+
constructor();
|
|
7
|
+
private _loadingListForIds;
|
|
8
|
+
private _loadingDurationForIds;
|
|
9
|
+
setLoadingStatusForId(type: WMImageStoreLoadType, identifier: string, doneLoading: number, totalLoading: number, resetDuration?: boolean): void;
|
|
10
|
+
setLoadDurationForId(identifier: string, duration: number | undefined): void;
|
|
11
|
+
getLoadDurationForId(identifier: string): number | undefined;
|
|
12
|
+
getTotalLoadingPercentageForIds(identifierList: string[]): {
|
|
13
|
+
percentage: number;
|
|
14
|
+
doneLoading: number;
|
|
15
|
+
totalLoading: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Bbox {
|
|
2
|
+
left: number;
|
|
3
|
+
right: number;
|
|
4
|
+
top: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
}
|
|
7
|
+
export default class WMBBOX implements Bbox {
|
|
8
|
+
left: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
right: number;
|
|
11
|
+
top: number;
|
|
12
|
+
constructor(left?: number | string | Bbox, bottom?: number, right?: number, top?: number);
|
|
13
|
+
/**
|
|
14
|
+
* Clone an existing BBOX
|
|
15
|
+
*/
|
|
16
|
+
clone(): WMBBOX;
|
|
17
|
+
copy(bbox: WMBBOX): void;
|
|
18
|
+
/**
|
|
19
|
+
* setBBOX method
|
|
20
|
+
* Creates a WebMapJS bounding box based on 4 numeric values
|
|
21
|
+
* Creates a WebMapJS bounding box based on 1 string with commaseparated numeric values
|
|
22
|
+
* Creates a WebMapJS bounding box based on an exisiting WebMapJS bounding box.
|
|
23
|
+
* When no parameters are given, a global latlon bbox is generated.
|
|
24
|
+
*/
|
|
25
|
+
setBBOX(left?: number | string | Bbox, bottom?: number, right?: number, top?: number): void;
|
|
26
|
+
equals(left: number | string | WMBBOX | Bbox, bottom: number, right: number, top: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the current BBOX as a string, useful for generating WMS requests.
|
|
29
|
+
*/
|
|
30
|
+
toString(): string;
|
|
31
|
+
getExtent(): [number, number, number, number];
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const WMEmptyLayerName = "empty_layer";
|
|
2
|
+
export declare const WMEmptyLayerTitle = "empty layer";
|
|
3
|
+
export declare const WMDefaultStyleName = "default";
|
|
4
|
+
export declare const WMDateOutSideRange = "outside range";
|
|
5
|
+
export declare const WMDateTooEarlyString = "date too early";
|
|
6
|
+
export declare const WMDateTooLateString = "date too late";
|
|
7
|
+
export declare const WMDateUnit = "ISO8601";
|
|
8
|
+
export declare const WMInvalidDateValues: Set<string>;
|
|
9
|
+
export declare const WMSVersion: {
|
|
10
|
+
version100: string;
|
|
11
|
+
version111: string;
|
|
12
|
+
version130: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const WMProj4Defs: string[][];
|
|
15
|
+
export declare const mapImageStoreLength = 1000;
|
|
16
|
+
export declare const bgImageStoreLength = 360;
|
|
17
|
+
export declare const legendImageStoreLength = 500;
|
|
18
|
+
export declare const EVENT_GETCAPABILITIES_START = "onstartgetcapabilities";
|
|
19
|
+
export declare const EVENT_GETCAPABILITIES_READY = "onreadygetcapabilities";
|
|
20
|
+
export declare const WMJSMAP_LONLAT_EPSGCODE: "EPSG:4326";
|
|
21
|
+
export declare const isProjectionSupported: (srs: string, proj4Defintions?: string[][]) => boolean;
|
|
22
|
+
export interface RefTimeDimensionMode {
|
|
23
|
+
id: string;
|
|
24
|
+
servicematch: string;
|
|
25
|
+
layermatch: string;
|
|
26
|
+
ruleset: {
|
|
27
|
+
id: string;
|
|
28
|
+
moduloHH: number[];
|
|
29
|
+
relativeSteps: number[];
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
export type RefTimeDimensionModes = RefTimeDimensionMode[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export interface WMHeader {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface WMImageOptions {
|
|
6
|
+
randomizer?: boolean;
|
|
7
|
+
headers: WMHeader[];
|
|
8
|
+
fakeMaxAge?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface WMGeoReference {
|
|
11
|
+
extent: number[];
|
|
12
|
+
resolution: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the current time in ms
|
|
16
|
+
* @returns the current time in ms
|
|
17
|
+
*/
|
|
18
|
+
export declare const getCurrentImageTime: () => number;
|
|
19
|
+
/**
|
|
20
|
+
* WMImage provides an API to the HTML image element. It is used for caching and easier access to images.
|
|
21
|
+
*/
|
|
22
|
+
export default class WMImage {
|
|
23
|
+
imageLife: number;
|
|
24
|
+
randomize: boolean;
|
|
25
|
+
_srcLoaded: string;
|
|
26
|
+
_isLoaded: boolean;
|
|
27
|
+
_isLoading: boolean;
|
|
28
|
+
_hasError: boolean;
|
|
29
|
+
srcToLoad: string;
|
|
30
|
+
loadEventCallback?: (image: WMImage) => void;
|
|
31
|
+
el: HTMLImageElement;
|
|
32
|
+
headers: WMHeader[];
|
|
33
|
+
_imageTimeStampAtError: number;
|
|
34
|
+
_numFailedAttempts: number;
|
|
35
|
+
_loadStartTime: number;
|
|
36
|
+
_loadDuration?: number;
|
|
37
|
+
_maxAgeSeconds?: number | null;
|
|
38
|
+
_loadedAtTime?: number;
|
|
39
|
+
_resolveList: ((i: WMImage) => void)[];
|
|
40
|
+
geoReference: WMGeoReference | null;
|
|
41
|
+
hashUrl: string | undefined;
|
|
42
|
+
setGeoReference(geoReference: WMGeoReference): void;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param src Optionally set the source URL to load
|
|
46
|
+
* @param callback Optionally set the callback function to trigger once image has loaded
|
|
47
|
+
* @param options Additional options to the image. You can set { randomizer: true } to force unique url's and prevent caching.
|
|
48
|
+
*/
|
|
49
|
+
constructor(src: string, callback?: (image: WMImage) => void, options?: WMImageOptions);
|
|
50
|
+
private init;
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if the image has been loaded
|
|
53
|
+
*/
|
|
54
|
+
isLoaded(): boolean;
|
|
55
|
+
isLoadedWithoutErrors(): boolean;
|
|
56
|
+
hasNotStartedLoading(): boolean;
|
|
57
|
+
isStale(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Returns true if the image is still loading
|
|
60
|
+
*/
|
|
61
|
+
isLoading(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get the amount of milliseconds since the image experienced an image load.
|
|
64
|
+
* @returns milliseconds since the image had an error
|
|
65
|
+
*/
|
|
66
|
+
getLastErrorMSecondsAgo(): number;
|
|
67
|
+
/**
|
|
68
|
+
* @returns The number of failed attempts for this image
|
|
69
|
+
*/
|
|
70
|
+
getNumFailedAttempts(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Set source of image, but it will not load the image yet.
|
|
73
|
+
* @param src URL of the image to load
|
|
74
|
+
* @param options WMImageOptions to give to the image
|
|
75
|
+
*/
|
|
76
|
+
setSource(src: string, options: WMImageOptions): void;
|
|
77
|
+
/**
|
|
78
|
+
* Re-intialize the image
|
|
79
|
+
*/
|
|
80
|
+
clear(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get the URL of the image
|
|
83
|
+
*/
|
|
84
|
+
getSrc(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Check if the image has an error
|
|
87
|
+
*/
|
|
88
|
+
hasError(): boolean;
|
|
89
|
+
clearError(): void;
|
|
90
|
+
private _resolveAll;
|
|
91
|
+
/**
|
|
92
|
+
* Start loading the image
|
|
93
|
+
*/
|
|
94
|
+
loadAwait(): Promise<WMImage>;
|
|
95
|
+
load(): void;
|
|
96
|
+
forceReload(randomize?: boolean): void;
|
|
97
|
+
private static _parseMaxAgeFromCacheControl;
|
|
98
|
+
private _setMaxAgeFromResponseHeaders;
|
|
99
|
+
_getImageWithHeaders(url: string, headers: WMHeader[]): void;
|
|
100
|
+
_load(): void;
|
|
101
|
+
_loadEvent(hasError: boolean): void;
|
|
102
|
+
getLoadDuration(): number | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Get the width of the current image
|
|
105
|
+
*/
|
|
106
|
+
getWidth(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Get the height of the current image
|
|
109
|
+
*/
|
|
110
|
+
getHeight(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Get the HTMLImageElement behind the WMImage
|
|
113
|
+
*/
|
|
114
|
+
getElement(): HTMLImageElement;
|
|
115
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import LoadDurationCounter from './LoadDurationCounter';
|
|
2
|
+
import type { WMGeoReference, WMImageOptions } from './WMImage';
|
|
3
|
+
import WMImage from './WMImage';
|
|
4
|
+
export declare enum WMImageEventType {
|
|
5
|
+
Loaded = 0,
|
|
6
|
+
Deleted = 1
|
|
7
|
+
}
|
|
8
|
+
export default class WMImageStore {
|
|
9
|
+
imagesbysrc: Map<string, WMImage>;
|
|
10
|
+
imageLife: number;
|
|
11
|
+
_imageLifeCounter: number;
|
|
12
|
+
_loadEventCallbackList: {
|
|
13
|
+
id: string;
|
|
14
|
+
callback: (image: WMImage, id: string, imageEventType: WMImageEventType) => void;
|
|
15
|
+
}[];
|
|
16
|
+
_maxNumberOfImages: number;
|
|
17
|
+
_options: {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
emptyImage: WMImage;
|
|
21
|
+
imagesbyGeoRef: Map<string, WMImage[]>;
|
|
22
|
+
loadDuration: LoadDurationCounter;
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new WMImageStore with given amount of image cache.
|
|
25
|
+
* @param {*} maxNumberOfImages
|
|
26
|
+
* @param {*} options
|
|
27
|
+
*/
|
|
28
|
+
constructor(maxNumberOfImages: number, options: {
|
|
29
|
+
id: string;
|
|
30
|
+
});
|
|
31
|
+
load(imageUrl: string): Promise<WMImage>;
|
|
32
|
+
imageLoadEventCallback(_img: WMImage, imageEventType: WMImageEventType): void;
|
|
33
|
+
/**
|
|
34
|
+
* Check if we have similar images with the same source in the pipeline
|
|
35
|
+
*/
|
|
36
|
+
getImageForSrc(src: string): WMImage | undefined;
|
|
37
|
+
clear(): void;
|
|
38
|
+
addImageEventCallback(callback: (image: WMImage, id: string, imageEventType: WMImageEventType) => void, id: string): void;
|
|
39
|
+
removeAllEventCallbacks(): void;
|
|
40
|
+
removeEventCallback(id: string): void;
|
|
41
|
+
getNumImagesLoading(): number;
|
|
42
|
+
/**
|
|
43
|
+
* getAltGeoReferencedImage will return an ready and loaded image for similar query parameters as requested.
|
|
44
|
+
* This image can be used to display something during the period when the requested image one is still loading.
|
|
45
|
+
* The alternative image will have the same query parameters but can have a different extent and resolution.
|
|
46
|
+
* @param srcToLoad The url of the image for which we want to find an alternative
|
|
47
|
+
* @param _extent Extent of the requested image
|
|
48
|
+
* @param _resolution Resolution of the request image
|
|
49
|
+
* @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
|
|
50
|
+
*/
|
|
51
|
+
getAltGeoReferencedImage(srcToLoad: string, _extent: number[], _resolution: number): WMImage | false;
|
|
52
|
+
getAltGeoReferencedImages(srcToLoad: string, _extent: number[], _resolution: number): WMImage[];
|
|
53
|
+
getImageAndSetGeoReference(src: string, geoReference: WMGeoReference): WMImage;
|
|
54
|
+
getNumCached(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Get an WMImage object for given URL
|
|
57
|
+
* @param {*} src The url for the image
|
|
58
|
+
* @returns WMImage object
|
|
59
|
+
*/
|
|
60
|
+
getImage(src: string, loadOptions?: WMImageOptions): WMImage;
|
|
61
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Dimension, TimeInterval } from './types';
|
|
2
|
+
import type { RefTimeDimensionMode } from './WMConstants';
|
|
3
|
+
import { ParseISOTimeRangeDuration } from './WMTime';
|
|
4
|
+
import type { CustomDate } from './WMTimeTypes';
|
|
5
|
+
/**
|
|
6
|
+
* Re-formats isoString to the string that is expected by WMJSDimension (for time).
|
|
7
|
+
* @param dateIn The input date to re-format, usually in the format `YYYY-MM-DDThh:mm:ss.uuuZ`
|
|
8
|
+
* @returns The formated input date in the format `YYYY-MM-DDThh:mm:ssZ`
|
|
9
|
+
*/
|
|
10
|
+
export declare const handleDateUtilsISOString: (dateIn: string) => string;
|
|
11
|
+
interface WMJSDimensionConfig {
|
|
12
|
+
name?: string;
|
|
13
|
+
units?: string;
|
|
14
|
+
values?: string;
|
|
15
|
+
currentValue?: string;
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
linked?: boolean;
|
|
18
|
+
unitSymbol?: string;
|
|
19
|
+
synced?: boolean;
|
|
20
|
+
refTimeDimensionMode?: RefTimeDimensionMode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* WMJSDimension Class
|
|
24
|
+
* Keep all information for a single dimension, like time.
|
|
25
|
+
* Author : MaartenPlieger (plieger at knmi.nl)
|
|
26
|
+
* Copyright KNMI
|
|
27
|
+
*/
|
|
28
|
+
export default class WMJSDimension implements Dimension {
|
|
29
|
+
currentValue: string;
|
|
30
|
+
defaultValue: string;
|
|
31
|
+
name: string;
|
|
32
|
+
units: string;
|
|
33
|
+
unitSymbol: string;
|
|
34
|
+
linked: boolean;
|
|
35
|
+
synced: boolean;
|
|
36
|
+
used?: boolean;
|
|
37
|
+
values?: string;
|
|
38
|
+
refTimeDimensionMode?: RefTimeDimensionMode;
|
|
39
|
+
private timeRangeDuration?;
|
|
40
|
+
private _initialized;
|
|
41
|
+
private _timeRangeDurationDate;
|
|
42
|
+
private _allDates;
|
|
43
|
+
private _type;
|
|
44
|
+
private _allValues;
|
|
45
|
+
private dimMinValue;
|
|
46
|
+
private dimMaxValue;
|
|
47
|
+
private dimTimeInterval;
|
|
48
|
+
private calculatedTimeInterval;
|
|
49
|
+
constructor(config?: WMJSDimensionConfig);
|
|
50
|
+
generateAllValues(): string[];
|
|
51
|
+
setTimeValuesForReferenceTimeStandardMode(referenceTimeValueToSet: string, referenceTimeDim: WMJSDimension): void;
|
|
52
|
+
setTimeValuesForReferenceTime(referenceTimeValueToSet: string, referenceTimeDim: WMJSDimension): void;
|
|
53
|
+
reInitializeValues(values: string, forceReferenceTimeValue?: boolean): void;
|
|
54
|
+
initialize(forceothervalues?: string | undefined, forceReferenceTimeValue?: boolean): void;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the current value of this dimensions.
|
|
57
|
+
* If a ISO8601 period is set, the getValue will return a timeRange using addTimeRangeDurationToValue instead of a single value
|
|
58
|
+
*/
|
|
59
|
+
getValue(): string;
|
|
60
|
+
processCompressedRefTimeValues(ogcdimvalues: string): void;
|
|
61
|
+
createTimeStepsArray(partTimeRanges: ParseISOTimeRangeDuration): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Set current value of this dimension
|
|
64
|
+
* @param value The new value for this dimension (string)
|
|
65
|
+
* @param forceValue When set to false,check if the given value is outside range, and do nothing if this is the case
|
|
66
|
+
*/
|
|
67
|
+
setValue(value: string, forceValue?: boolean): void;
|
|
68
|
+
/**
|
|
69
|
+
* Returns values of the dimension, according to values defined in WMS specification, e.g. 2011-01-01T00:00:00Z/2012-01-01T00:00:00Z/P1M or list of values.
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
getValues(): string;
|
|
73
|
+
setClosestValue(newValue?: string | null, evenWhenOutsideRange?: boolean): void;
|
|
74
|
+
addTimeRangeDurationToValue(value: string): string;
|
|
75
|
+
setTimeRangeDuration(duration: string): void;
|
|
76
|
+
getClosestValueForTime(timeStamp: number): string;
|
|
77
|
+
getValueForSpecialString(inputValue: string, evenWhenOutsideRange?: boolean): string;
|
|
78
|
+
getExactMatchingValue(inputValue: string): string;
|
|
79
|
+
getClosestValue(inputValue: string, evenWhenOutsideRange?: boolean): string;
|
|
80
|
+
/**
|
|
81
|
+
* Get dimension value for specified index
|
|
82
|
+
*/
|
|
83
|
+
getValueForIndex(index: number): string | CustomDate;
|
|
84
|
+
/**
|
|
85
|
+
* Get value for index in as epoch time in milliseconds
|
|
86
|
+
* @param index
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
getValueForIndexAsTime(index: number): number;
|
|
90
|
+
/**
|
|
91
|
+
* Hint about the timestep size / time resolution of this dimension.
|
|
92
|
+
* @returns The dimTimeInterval
|
|
93
|
+
*/
|
|
94
|
+
getDimInterval(): TimeInterval | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Shorthand functionf or getValueForIndex
|
|
97
|
+
*/
|
|
98
|
+
get(index: number): string;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the first dimension value
|
|
101
|
+
*/
|
|
102
|
+
getFirstValue(): string;
|
|
103
|
+
getMiddleValue(): string;
|
|
104
|
+
/**
|
|
105
|
+
* Returns the last dimension value
|
|
106
|
+
*/
|
|
107
|
+
getLastValue(): string;
|
|
108
|
+
/**
|
|
109
|
+
* Get index value for specified value. Returns the index in the store for the given time value, either a date or a iso8601 string can be passes as input.
|
|
110
|
+
* @param value Either a JS Date object or an ISO8601 String
|
|
111
|
+
* @return The index of the value. If outSideOfRangeFlag is false, a valid index will
|
|
112
|
+
* always be returned. If outSideOfRangeFlag is true:
|
|
113
|
+
* -1 if the value is not in the store, and is lower than available values,
|
|
114
|
+
* -2 if the value is not in the store, and is higher than available values
|
|
115
|
+
*/
|
|
116
|
+
getIndexForValue(value: string, outSideOfRangeFlag?: boolean): number;
|
|
117
|
+
/**
|
|
118
|
+
* Get number of values
|
|
119
|
+
*/
|
|
120
|
+
size(): number;
|
|
121
|
+
/**
|
|
122
|
+
* Clone this dimension
|
|
123
|
+
*/
|
|
124
|
+
clone(): WMJSDimension;
|
|
125
|
+
}
|
|
126
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LayerOptions, RefTimeDimensionMode, RefTimeDimensionModes } from '.';
|
|
2
|
+
import type WMJSDimension from './WMJSDimension';
|
|
3
|
+
/**
|
|
4
|
+
* Determine if the time values have a special sequencing for certain services.
|
|
5
|
+
* Please check https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4311 for details.
|
|
6
|
+
* @param layer
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const wmDetermineDimensionMode: (layer: LayerOptions, refTimeDimensionModes?: RefTimeDimensionModes) => RefTimeDimensionMode | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Based on https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4311
|
|
12
|
+
* @param wmDimension
|
|
13
|
+
* @param referenceTimeValueToSet
|
|
14
|
+
*/
|
|
15
|
+
export declare const wmDimensionHandleCustomTimeFunction: (wmDimension: WMJSDimension, referenceTimeValueToSet: string) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Dimension, GeographicBoundingBox, LayerProps, Style, WMSLayerFromGetCapabilities } from './types';
|
|
2
|
+
import type WMLayer from './WMLayer';
|
|
3
|
+
export declare const enableConsoleDebugging = false;
|
|
4
|
+
export declare enum DebugType {
|
|
5
|
+
Log = 0,
|
|
6
|
+
Warning = 1,
|
|
7
|
+
Error = 2
|
|
8
|
+
}
|
|
9
|
+
export declare const debugLogger: (type: DebugType, message: string, ...optionalParam: unknown[]) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if variable is defined or not
|
|
12
|
+
* @param variable The variable to check
|
|
13
|
+
* @returns true if variable is indeed defined, otherwise false.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isDefined: <T>(variable?: T) => variable is T;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a variable to an array. If the variable is not an array it will be pushed as the first entry in a new array. If the variable is already an array, nothing will be done.
|
|
18
|
+
* @param array The variable to convert
|
|
19
|
+
* @returns Always an array
|
|
20
|
+
*/
|
|
21
|
+
export declare const toArray: <T>(array: T | T[] | null | undefined) => T[];
|
|
22
|
+
export declare const getMapDimURL: (layer: WMLayer, dimensionOverride?: Dimension[]) => URLSearchParams;
|
|
23
|
+
/**
|
|
24
|
+
* Parses url and then it it allows for setting / changing key value pairs in that URL (From https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter)
|
|
25
|
+
* @param baseUrl
|
|
26
|
+
* @param params
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare const getUriWithParam: (baseUrl: string, params?: Record<string, unknown>) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Parses url and then it it allows for setting additional key value pairs in that URL (From https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter)
|
|
32
|
+
* @param baseUrl
|
|
33
|
+
* @param params
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const getUriAddParam: (baseUrl: string, params: Record<string, unknown>) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilities document
|
|
39
|
+
* @param layerObjectFromWMS The layer object from the WMS GetCapabilities JSON document
|
|
40
|
+
* @returns Style[] Array of style objects.
|
|
41
|
+
*/
|
|
42
|
+
export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Style[];
|
|
43
|
+
export declare const addDimensionsForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Dimension[];
|
|
44
|
+
export declare const addBoundingBoxForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => GeographicBoundingBox | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Sorts an array with objects by object key.
|
|
47
|
+
*
|
|
48
|
+
* @param array Array of objects
|
|
49
|
+
* @param key The key of the object to use for sorting
|
|
50
|
+
* @returns Sorted array.
|
|
51
|
+
*/
|
|
52
|
+
export declare function sortArrayOfObjectsByKey<T>(array: T[], key: keyof T): T[];
|
|
53
|
+
/**
|
|
54
|
+
* Makes a LayerProps object from the WMSLayerFromGetCapabilities and nestedLayerPath
|
|
55
|
+
* @param layer WMSLayerFromGetCapabilities
|
|
56
|
+
* @param path The path of the layer in the WMS GetCapabilities tree (Array of strings)
|
|
57
|
+
* @param isleaf Is this a group layer or an actual layer
|
|
58
|
+
* @param nestedLayerPath The path of the layer in the WMS GetCapabilities, in this case array of LayerProps
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare const makeNodeLayerFromWMSGetCapabilityLayer: (layer: WMSLayerFromGetCapabilities, path?: string[], isleaf?: boolean, nestedLayerPath?: LayerProps[]) => LayerProps;
|
|
62
|
+
export declare const getFirstPartOfDimensionValueSet: (inputValue: string) => string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { Style, GeographicBoundingBox, OGCWMSWMTSGetCapabilities } from './types';
|
|
2
|
+
import type { RefTimeDimensionMode } from './WMConstants';
|
|
3
|
+
import WMJSDimension from './WMJSDimension';
|
|
4
|
+
import type { LayerOptions } from './WMLayerTypes';
|
|
5
|
+
import { LayerType } from './WMLayerTypes';
|
|
6
|
+
import WMProjection from './WMProjection';
|
|
7
|
+
export default class WMLayer {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
ReactWMJSLayerId?: string;
|
|
11
|
+
hasError?: boolean;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
lastError?: string;
|
|
14
|
+
legendGraphic?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
opacity?: number;
|
|
17
|
+
service: string;
|
|
18
|
+
layerType: LayerType;
|
|
19
|
+
currentStyle?: string;
|
|
20
|
+
linkedInfo: {
|
|
21
|
+
layer: string;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
headers: Headers[];
|
|
25
|
+
autoupdate: boolean;
|
|
26
|
+
timer: NodeJS.Timeout | number;
|
|
27
|
+
getmapURL: string;
|
|
28
|
+
getfeatureinfoURL: string;
|
|
29
|
+
getlegendgraphicURL: string;
|
|
30
|
+
keepOnTop: boolean;
|
|
31
|
+
transparent: boolean;
|
|
32
|
+
wms130bboxcompatibilitymode: boolean;
|
|
33
|
+
version: string;
|
|
34
|
+
path: string;
|
|
35
|
+
type: string;
|
|
36
|
+
abstract: string;
|
|
37
|
+
dimensions: WMJSDimension[];
|
|
38
|
+
projectionProperties: WMProjection[];
|
|
39
|
+
queryable: boolean;
|
|
40
|
+
styles: Style[];
|
|
41
|
+
serviceTitle: string;
|
|
42
|
+
sldURL: string;
|
|
43
|
+
active: boolean;
|
|
44
|
+
getgraphinfoURL: string;
|
|
45
|
+
format: string;
|
|
46
|
+
_options: LayerOptions;
|
|
47
|
+
onReady: (param: LayerOptions) => void;
|
|
48
|
+
optimalFormat: string;
|
|
49
|
+
wmsextensions: {
|
|
50
|
+
url: string;
|
|
51
|
+
colorscalerange: Record<string, unknown>[];
|
|
52
|
+
};
|
|
53
|
+
isConfigured: boolean;
|
|
54
|
+
geographicBoundingBox?: GeographicBoundingBox;
|
|
55
|
+
geojson?: GeoJSON.FeatureCollection;
|
|
56
|
+
currentRequestedGetMapURL?: string;
|
|
57
|
+
olSource: object | null;
|
|
58
|
+
refTimeDimensionMode: RefTimeDimensionMode | undefined;
|
|
59
|
+
init(): void;
|
|
60
|
+
constructor(options?: LayerOptions);
|
|
61
|
+
getLayerName(): string;
|
|
62
|
+
toggleAutoUpdate(): void;
|
|
63
|
+
setAutoUpdate(val: boolean, interval?: number): void;
|
|
64
|
+
setOpacity(opacityValue: number): void;
|
|
65
|
+
getOpacity(): number;
|
|
66
|
+
handleReferenceTime(name: string, value: string): void;
|
|
67
|
+
getDimensions(): WMJSDimension[];
|
|
68
|
+
setDimension(name: string, value: string): void;
|
|
69
|
+
_setWMSGetCapabilities(getCapabilitiesJson: OGCWMSWMTSGetCapabilities): void;
|
|
70
|
+
/** A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
|
|
71
|
+
* @param forceReload Do not use the cache of the WMS GetCapabilities document, but instead fetch new data from the server
|
|
72
|
+
* @returns WMLayer object
|
|
73
|
+
*/
|
|
74
|
+
parseLayer(forceReload?: boolean): Promise<WMLayer>;
|
|
75
|
+
cloneLayer(): WMLayer;
|
|
76
|
+
/**
|
|
77
|
+
* Set or change the name of this layer. This involves re-parsing the WMS GetCapabilities document and updating the affected layer properties. When done, it resolves the WMLayer
|
|
78
|
+
* @param name The name of the layer
|
|
79
|
+
* @returns Promise resolving to a WMLayer object
|
|
80
|
+
*/
|
|
81
|
+
setName(name: string): Promise<WMLayer>;
|
|
82
|
+
/**
|
|
83
|
+
* Sets the style by its name
|
|
84
|
+
* @param style: The name of the style (not the object)
|
|
85
|
+
*/
|
|
86
|
+
setStyle(styleName: string): void;
|
|
87
|
+
getStyles(): Style[];
|
|
88
|
+
/**
|
|
89
|
+
* Get the styleobject by name
|
|
90
|
+
* @param styleName The name of the style
|
|
91
|
+
* @param nextPrev, can be -1 or +1 to get the next or previous style object in circular manner.
|
|
92
|
+
*/
|
|
93
|
+
getStyleObject(styleName: string, nextPrev: number): Style;
|
|
94
|
+
getStyle(): string;
|
|
95
|
+
getDimension(name: string): WMJSDimension | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the Coordinate Reference Systems for this layer
|
|
98
|
+
* @returns List of WMProjection objects
|
|
99
|
+
*/
|
|
100
|
+
getCRS(): WMProjection[];
|
|
101
|
+
/**
|
|
102
|
+
* Get Coordinate reference system by name
|
|
103
|
+
*
|
|
104
|
+
* @param srsName Name of the coordinate reference system to get
|
|
105
|
+
* @returns A WMProjection object if found, otherwise undefined.
|
|
106
|
+
*/
|
|
107
|
+
getCRSByName(srsName: string): WMProjection;
|
|
108
|
+
/**
|
|
109
|
+
* Get Coordinate reference system by name. Note 2021-05-17: It is more inline with other function names to use the getCRSByName function instead.
|
|
110
|
+
*
|
|
111
|
+
* @param srsName Name of the coordinate reference system to get
|
|
112
|
+
* @returns A WMProjection object if found, otherwise undefined.
|
|
113
|
+
*/
|
|
114
|
+
getProjection(srsName: string): WMProjection;
|
|
115
|
+
setSLDURL(url: string): void;
|
|
116
|
+
display(displayornot: boolean): void;
|
|
117
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { FeatureCollection } from 'geojson';
|
|
2
|
+
import type { TileServerSettings } from '../utils';
|
|
3
|
+
import type { Dimension } from './types';
|
|
4
|
+
import type { RefTimeDimensionMode } from './WMConstants';
|
|
5
|
+
import type WMLayer from './WMLayer';
|
|
6
|
+
export declare enum LayerType {
|
|
7
|
+
mapLayer = "mapLayer",
|
|
8
|
+
wmtsMapLayer = "wmtsMapLayer",
|
|
9
|
+
baseLayer = "baseLayer",
|
|
10
|
+
overLayer = "overLayer",
|
|
11
|
+
featureLayer = "featureLayer",
|
|
12
|
+
edrFeatureLayer = "edrFeatureLayer",
|
|
13
|
+
stacGeoTIFFLayer = "stacGeoTIFFLayer"
|
|
14
|
+
}
|
|
15
|
+
export interface TiledLayerFoundation {
|
|
16
|
+
tileServer?: TileServerSettings;
|
|
17
|
+
}
|
|
18
|
+
export interface EDRFeatureLayerOptions {
|
|
19
|
+
collectionId: string;
|
|
20
|
+
parameterNames: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface LayerFoundation extends TiledLayerFoundation {
|
|
23
|
+
acceptanceTimeInMinutes?: number | null;
|
|
24
|
+
dimensions?: Dimension[];
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
format?: string;
|
|
27
|
+
id?: string;
|
|
28
|
+
layerType?: LayerType;
|
|
29
|
+
name?: string;
|
|
30
|
+
opacity?: number;
|
|
31
|
+
service?: string;
|
|
32
|
+
style?: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
geojson?: FeatureCollection;
|
|
36
|
+
options?: EDRFeatureLayerOptions;
|
|
37
|
+
showLayerLegend?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface LayerOptions extends LayerFoundation {
|
|
40
|
+
id: string;
|
|
41
|
+
layerType: LayerType;
|
|
42
|
+
service: string;
|
|
43
|
+
getmapURL?: string;
|
|
44
|
+
active?: boolean;
|
|
45
|
+
getgraphinfoURL?: string;
|
|
46
|
+
currentStyle?: string;
|
|
47
|
+
sldURL?: string;
|
|
48
|
+
keepOnTop?: boolean;
|
|
49
|
+
transparent?: boolean;
|
|
50
|
+
onReady?: (param: LayerOptions) => void;
|
|
51
|
+
headers?: Headers[];
|
|
52
|
+
failure?: (layer: WMLayer, message: string) => void;
|
|
53
|
+
ReactWMJSLayerId?: string;
|
|
54
|
+
onLayerError?: (layer: WMLayer, error: Error) => void;
|
|
55
|
+
onLayerReady?: (layer: WMLayer) => void;
|
|
56
|
+
geojson?: GeoJSON.FeatureCollection;
|
|
57
|
+
refTimeDimensionMode?: RefTimeDimensionMode;
|
|
58
|
+
}
|
|
59
|
+
export interface WMSLayerDimInfo {
|
|
60
|
+
name: string;
|
|
61
|
+
units: string;
|
|
62
|
+
unitSymbol: string;
|
|
63
|
+
value: string;
|
|
64
|
+
default: string;
|
|
65
|
+
linkDimensionToMap: boolean;
|
|
66
|
+
}
|