@opengeoweb/webmap 2.1.3 → 2.2.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.
@@ -18,6 +18,7 @@ interface CanvasBBOX {
18
18
  export interface CanvasGeoLayer {
19
19
  bbox: CanvasBBOX;
20
20
  opacity: number;
21
+ imageAge: number;
21
22
  imageSource: string;
22
23
  }
23
24
  /**
@@ -49,12 +50,11 @@ export declare const getSharedImagesList: () => Record<string, CanvasGeoLayer[]>
49
50
  */
50
51
  export declare const geClosestBBox: (rect1: CanvasBBOX, rect2: CanvasBBOX) => number;
51
52
  /**
52
- * Sort the imageslist by overlapping area, highest area first
53
+ * Sort the imageslist by imagedate, newewst image first.
53
54
  * @param imagesList
54
- * @param bbox
55
55
  * @returns
56
56
  */
57
- export declare const sortByOverlappingArea: (imagesList: CanvasGeoLayer[], bbox: CanvasBBOX) => CanvasGeoLayer[];
57
+ export declare const sortByImageDate: (imagesList: CanvasGeoLayer[]) => CanvasGeoLayer[];
58
58
  /**
59
59
  * Function to find the an alternative available image for an image url that is not yet loaded
60
60
  * @param imageUrl The image source / url to find an alternative for
@@ -62,7 +62,7 @@ export declare const sortByOverlappingArea: (imagesList: CanvasGeoLayer[], bbox:
62
62
  * @param bbox The boundingbox to search this image for
63
63
  * @returns A canvasLayer, containing the new image source with its geo properties
64
64
  */
65
- export declare const getAlternativeImage: (imageUrl: string, imageStore: WMImageStore, bbox: CanvasBBOX) => CanvasGeoLayer;
65
+ export declare const getAlternativeImage: (imageUrl: string, imageStore: WMImageStore, _bbox: CanvasBBOX) => CanvasGeoLayer;
66
66
  export default class WMCanvasBuffer {
67
67
  canvas: HTMLCanvasElement;
68
68
  _ctx: CanvasRenderingContext2D;
@@ -2,6 +2,11 @@ export interface WMImageOptions {
2
2
  randomizer?: boolean;
3
3
  headers: Headers[];
4
4
  }
5
+ /**
6
+ * Returns the current time in ms
7
+ * @returns the current time in ms
8
+ */
9
+ export declare const getCurrentImageTime: () => number;
5
10
  /**
6
11
  * WMImage provides an API to the HTML image element. It is used for caching and easier access to images.
7
12
  */
@@ -16,6 +21,8 @@ export default class WMImage {
16
21
  loadEventCallback: (image: WMImage) => void;
17
22
  el: HTMLImageElement;
18
23
  headers: Headers[];
24
+ _imageTimeStampAtError: number;
25
+ _numFailedAttempts: number;
19
26
  /**
20
27
  *
21
28
  * @param src Optionally set the source URL to load
@@ -32,6 +39,15 @@ export default class WMImage {
32
39
  * Returns true if the image is still loading
33
40
  */
34
41
  isLoading(): boolean;
42
+ /**
43
+ * Get the amount of milliseconds since the image experienced an image load.
44
+ * @returns milliseconds since the image had an error
45
+ */
46
+ getLastErrorMSecondsAgo(): number;
47
+ /**
48
+ * @returns The number of failed attempts for this image
49
+ */
50
+ getNumFailedAttempts(): number;
35
51
  /**
36
52
  * Set source of image, but it will not load the image yet.
37
53
  * @param src URL of the image to load
@@ -54,6 +70,7 @@ export default class WMImage {
54
70
  * Start loading the image
55
71
  */
56
72
  load(): void;
73
+ forceReload(): void;
57
74
  private _getImageWithHeaders;
58
75
  private _load;
59
76
  private _loadEvent;
@@ -1,3 +1,4 @@
1
+ import { DateInterval } from './WMTime';
1
2
  interface WMJSDimensionConfig {
2
3
  name?: string;
3
4
  units?: string;
@@ -24,15 +25,15 @@ export default class WMJSDimension {
24
25
  synced: boolean;
25
26
  used?: boolean;
26
27
  values?: string;
27
- timeRangeDuration?: any;
28
+ private timeRangeDuration?;
28
29
  private _initialized;
29
30
  private _timeRangeDurationDate;
30
31
  private _allDates;
31
32
  private _type;
32
33
  private _allValues;
33
- dimMinValue: string;
34
- dimMaxValue: string;
35
- dimTimeInterval: any;
34
+ private dimMinValue;
35
+ private dimMaxValue;
36
+ private dimTimeInterval;
36
37
  constructor(config?: WMJSDimensionConfig);
37
38
  generateAllValues(): number[];
38
39
  setTimeValuesForReferenceTime(referenceTimeValueToSet: string, referenceTimeDim: WMJSDimension): void;
@@ -49,6 +50,11 @@ export default class WMJSDimension {
49
50
  * @param forceValue When set to false,check if the given value is outside range, and do nothing if this is the case
50
51
  */
51
52
  setValue(value: string, forceValue?: boolean): void;
53
+ /**
54
+ * 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.
55
+ * @returns
56
+ */
57
+ getValues(): string;
52
58
  setClosestValue(newValue?: any, evenWhenOutsideRange?: boolean): void;
53
59
  addTimeRangeDurationToValue(value: string): string;
54
60
  setTimeRangeDuration(duration: string): void;
@@ -57,6 +63,11 @@ export default class WMJSDimension {
57
63
  * Get dimension value for specified index
58
64
  */
59
65
  getValueForIndex(index: number): string;
66
+ /**
67
+ * Hint about the timestep size / time resolution of this dimension.
68
+ * @returns The dimTimeInterval
69
+ */
70
+ getDimInterval(): DateInterval;
60
71
  /**
61
72
  * Shorthand functionf or getValueForIndex
62
73
  */
@@ -1,3 +1,4 @@
1
+ import { Style } from './types';
1
2
  export interface GetCapabilitiesJson {
2
3
  WMS_Capabilities?: any;
3
4
  WMT_MS_Capabilities?: any;
@@ -20,13 +21,14 @@ interface NodeObject {
20
21
  text: string;
21
22
  leaf: boolean;
22
23
  name?: string;
23
- path?: string;
24
+ path?: string[];
24
25
  children?: [];
25
26
  keywords?: string[];
26
27
  abstract?: string;
28
+ styles?: Style[];
27
29
  }
28
30
  export declare const sortByKey: (array: NodeObject[], key: string) => NodeObject[];
29
- export declare const recursivelyFindLayer: (layers: any[], rootNode: any[], path: string) => void;
31
+ export declare const recursivelyFindLayer: (layers: any[], rootNode: any[], path: string[]) => void;
30
32
  /**
31
33
  * WMJSService Class
32
34
  *
@@ -1,3 +1,4 @@
1
+ import type { Style, WMSLayerFromGetCapabilities } from './types';
1
2
  import type WMLayer from './WMLayer';
2
3
  export declare const enableConsoleDebugging = false;
3
4
  export declare enum DebugType {
@@ -58,3 +59,9 @@ export declare const getUriAddParam: (baseUrl: string, params: Record<string, an
58
59
  * @returns ISO8601 string
59
60
  */
60
61
  export declare const dateToISO8601: (date: Date) => string;
62
+ /**
63
+ * Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
64
+ * @param layerObjectFromWMS The layer object from the WMS GetCapabilities JSON document
65
+ * @returns Style[] Array of style objects.
66
+ */
67
+ export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Style[];
@@ -3,7 +3,7 @@ import type WMJSMap from './WMJSMap';
3
3
  import WMJSDimension from './WMJSDimension';
4
4
  import WMProjection from './WMProjection';
5
5
  import { GetCapabilitiesJson } from './WMJSService';
6
- import { Style, Dimension } from './types';
6
+ import { Style, Dimension, WMSLayerFromGetCapabilities } from './types';
7
7
  export declare enum LayerType {
8
8
  mapLayer = "mapLayer",
9
9
  baseLayer = "baseLayer",
@@ -34,20 +34,6 @@ export interface LayerOptions {
34
34
  ReactWMJSLayerId?: string;
35
35
  onLayerError?: (layer: WMLayer, error: Error, webmapInstance: WMJSMap) => void;
36
36
  }
37
- /**
38
- * This interface is for reading from the WMS GetCapabilties document, which can have different structures for V1.1.1 and V1.3.0
39
- */
40
- interface WMSLayerFromGetCapabilities {
41
- Dimension: unknown;
42
- Style: unknown;
43
- Extent: unknown;
44
- }
45
- /**
46
- * Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
47
- * @param layerStyles The layer styles object from the WMS GetCapabilities
48
- * @param layer The WMLayer to configure
49
- */
50
- export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities, layer: WMLayer) => void;
51
37
  /**
52
38
  * Helper function to figure out the dimensions from the WMS layer object (From WMS GetCapabilities). Parses both WMS 1.1.1 and WMS 1.3.0.
53
39
  * @param layerObjectFromWMS The corresponding layer object from the WMS GetCapabilities.
@@ -137,7 +123,7 @@ export default class WMLayer {
137
123
  * Calls options.failure with error message.
138
124
  * Throws string exceptions when someting goes wrong
139
125
  */
140
- parseLayer(_layerDoneCallback: (layer: WMLayer) => void, forceReload: boolean): void;
126
+ parseLayer(_layerDoneCallback: (layer: WMLayer) => void, forceReload: boolean, origin: string): void;
141
127
  /**
142
128
  * A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
143
129
  * @param forceReload Do not use the cache of the WMS GetCapabilties document, but instead fetch new data from the server
@@ -191,4 +177,3 @@ export default class WMLayer {
191
177
  setSLDURL(url: string): void;
192
178
  display(displayornot: boolean): void;
193
179
  }
194
- export {};
@@ -1,6 +1,6 @@
1
- import WMJSDimension from './WMJSDimension';
1
+ import type WMJSDimension from './WMJSDimension';
2
2
  import type WMLayer from './WMLayer';
3
- import { DateInterval } from './WMTime';
3
+ import type { DateInterval } from './WMTime';
4
4
  export declare type WMPosition = {
5
5
  x: number;
6
6
  y: number;
@@ -35,3 +35,11 @@ export declare type WMLayerType = {
35
35
  title?: string;
36
36
  headers?: Headers[];
37
37
  };
38
+ /**
39
+ * This interface is for reading from the WMS GetCapabilties document, which can have different structures for V1.1.1 and V1.3.0
40
+ */
41
+ export interface WMSLayerFromGetCapabilities {
42
+ Dimension: unknown;
43
+ Style: unknown;
44
+ Extent: unknown;
45
+ }
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "2.1.3",
3
+ "version": "2.2.1",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
- "main": "./webmap.umd.js",
11
- "module": "./webmap.esm.js",
10
+ "main": "./index.umd.js",
11
+ "module": "./index.esm.js",
12
12
  "typings": "./index.d.ts",
13
13
  "dependencies": {},
14
14
  "peerDependencies": {
15
15
  "moment": "^2.29.0",
16
16
  "throttle-debounce": "^3.0.1",
17
17
  "proj4": "^2.6.2",
18
- "react": "16.14.0",
19
- "@material-ui/core": "^4.11.0"
18
+ "react": "^17.0.2",
19
+ "@mui/styles": "^5.2.3"
20
20
  }
21
21
  }