@opengeoweb/webmap 2.1.2 → 2.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.
@@ -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;
@@ -1,3 +1,3 @@
1
1
  import { WMJSService } from './WMJSService';
2
- declare const WMGetServiceFromStore: (serviceName: string, xml2jsonrequestURL?: string) => WMJSService;
2
+ declare const WMGetServiceFromStore: (serviceName: string) => WMJSService;
3
3
  export default WMGetServiceFromStore;
@@ -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
  */
@@ -109,13 +109,11 @@ export default class WMJSMap {
109
109
  private proj4;
110
110
  private previousMouseButtonState;
111
111
  private longlat;
112
- xml2jsonrequest: string;
113
112
  private tileRenderSettings;
114
113
  private drawPending;
115
114
  private needsRedraw;
116
115
  private buildLayerDimsBusy;
117
116
  constructor(_element: HTMLElement);
118
- setXML2JSONURL(_xml2jsonrequest: string): void;
119
117
  setWMTileRendererTileSettings(_WMTileRendererTileSettings: unknown): void;
120
118
  /**
121
119
  * Function which make a component ID which is unique over several WebMapJS instances
@@ -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;
@@ -13,26 +14,26 @@ export declare const getWMSUrl: (service?: string, additionalParams?: {}) => str
13
14
  /**
14
15
  * Global getcapabilities function
15
16
  */
16
- export declare const WMJSGetCapabilities: (service: string, succes: (param: any) => void, fail: (param: string) => void, xml2jsonrequestURL: string, options: {
17
+ export declare const WMJSGetCapabilities: (service: string, succes: (param: any) => void, fail: (param: string) => void, options: {
17
18
  headers?: any;
18
19
  }, disableCache?: boolean) => void;
19
20
  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
  *
33
35
  * options:
34
36
  * service
35
- * xml2jsonrequestURL
36
37
  * title (optional)
37
38
  */
38
39
  export declare class WMJSService {
@@ -44,13 +45,11 @@ export declare class WMJSService {
44
45
  getcapabilitiesDoc: GetCapabilitiesJson;
45
46
  busy: boolean;
46
47
  _flatLayerObject: any[];
47
- xml2jsonrequestURL: string;
48
48
  functionCallbackList: any[];
49
49
  _options: any;
50
50
  nodeCache: any;
51
51
  constructor(options: {
52
52
  service: string;
53
- xml2jsonrequestURL: string;
54
53
  title?: string;
55
54
  });
56
55
  checkVersion111(jsonData: GetCapabilitiesJson): void;
@@ -64,16 +63,16 @@ export declare class WMJSService {
64
63
  * @param succescallback Function called upon succes, cannot be left blank
65
64
  * @param failcallback Function called upon failure, cannot be left blank
66
65
  */
67
- getCapabilities(succescallback: (param: GetCapabilitiesJson) => void, failcallback: (param: unknown) => void, forceReload: boolean, xml2jsonrequestURL: string, options: unknown): void;
66
+ getCapabilities(succescallback: (param: GetCapabilitiesJson) => void, failcallback: (param: unknown) => void, forceReload: boolean, options: unknown): void;
68
67
  checkException(jsonData: GetCapabilitiesJson): string | undefined;
69
68
  /**
70
69
  * Calls succes with a hierarchical node structure
71
70
  * Calls failure with a string when someting goes wrong
72
71
  */
73
- getNodes(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, xml2jsonrequestURL?: string, options?: unknown): void;
72
+ getNodes(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, options?: unknown): void;
74
73
  /** Calls succes with an array of all layerobjects
75
74
  * Calls failure when something goes wrong
76
75
  */
77
- getLayerObjectsFlat(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, xml2jsonrequestURL?: string, options?: any): void;
76
+ getLayerObjectsFlat(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, options?: any): void;
78
77
  }
79
78
  export {};
@@ -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[];
@@ -1,11 +1,9 @@
1
- /// <reference types="react" />
2
1
  /// <reference types="node" />
3
2
  import type WMJSMap from './WMJSMap';
4
3
  import WMJSDimension from './WMJSDimension';
5
4
  import WMProjection from './WMProjection';
6
- import WMImage from './WMImage';
7
- import { GetCapabilitiesJson, WMJSService } from './WMJSService';
8
- import { Style, Dimension } from './types';
5
+ import { GetCapabilitiesJson } from './WMJSService';
6
+ import { Style, Dimension, WMSLayerFromGetCapabilities } from './types';
9
7
  export declare enum LayerType {
10
8
  mapLayer = "mapLayer",
11
9
  baseLayer = "baseLayer",
@@ -29,27 +27,13 @@ export interface LayerOptions {
29
27
  transparent?: boolean;
30
28
  onReady?: (param: any) => void;
31
29
  type?: string;
32
- parentMaps?: WMJSMap[];
30
+ parentMap?: WMJSMap;
33
31
  dimensions?: Dimension[];
34
32
  headers?: Headers[];
35
33
  failure?: (layer: WMLayer, message: string) => void;
36
34
  ReactWMJSLayerId?: string;
37
35
  onLayerError?: (layer: WMLayer, error: Error, webmapInstance: WMJSMap) => void;
38
36
  }
39
- /**
40
- * This interface is for reading from the WMS GetCapabilties document, which can have different structures for V1.1.1 and V1.3.0
41
- */
42
- interface WMSLayerFromGetCapabilities {
43
- Dimension: unknown;
44
- Style: unknown;
45
- Extent: unknown;
46
- }
47
- /**
48
- * Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
49
- * @param layerStyles The layer styles object from the WMS GetCapabilities
50
- * @param layer The WMLayer to configure
51
- */
52
- export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities, layer: WMLayer) => void;
53
37
  /**
54
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.
55
39
  * @param layerObjectFromWMS The corresponding layer object from the WMS GetCapabilities.
@@ -73,7 +57,6 @@ export default class WMLayer {
73
57
  id: string;
74
58
  name?: string;
75
59
  ReactWMJSLayerId?: string;
76
- reactWebMapJSLayer?: React.ReactElement;
77
60
  hasError?: boolean;
78
61
  enabled?: boolean;
79
62
  lastError?: string;
@@ -83,7 +66,6 @@ export default class WMLayer {
83
66
  service: string;
84
67
  layerType: LayerType;
85
68
  currentStyle?: string;
86
- image?: WMImage;
87
69
  linkedInfo: {
88
70
  layer: string;
89
71
  message: string;
@@ -91,7 +73,6 @@ export default class WMLayer {
91
73
  headers: Headers[];
92
74
  autoupdate: boolean;
93
75
  timer: NodeJS.Timeout;
94
- WMJSService: WMJSService;
95
76
  getmapURL: string;
96
77
  getfeatureinfoURL: string;
97
78
  getlegendgraphicURL: string;
@@ -107,9 +88,8 @@ export default class WMLayer {
107
88
  projectionProperties: WMProjection[];
108
89
  queryable: boolean;
109
90
  styles: Style[];
110
- getCapabilitiesDoc: GetCapabilitiesJson;
111
91
  serviceTitle: string;
112
- parentMaps: WMJSMap[];
92
+ parentMap: WMJSMap;
113
93
  sldURL: string;
114
94
  active: boolean;
115
95
  getgraphinfoURL: string;
@@ -121,7 +101,6 @@ export default class WMLayer {
121
101
  url: string;
122
102
  colorscalerange: Record<string, unknown>[];
123
103
  };
124
- jsonlayer: this;
125
104
  isConfigured: boolean;
126
105
  init(): void;
127
106
  constructor(options?: LayerOptions);
@@ -138,13 +117,13 @@ export default class WMLayer {
138
117
  handleReferenceTime(name: string, value: string, updateMapDimensions?: boolean): void;
139
118
  getDimensions(): WMJSDimension[];
140
119
  setDimension(name: string, value: string, updateMapDimensions?: boolean): void;
141
- __parseGetCapForLayer(layer: WMLayer, getcapabilitiesjson: GetCapabilitiesJson, layerDoneCallback: (layer: WMLayer) => void, fail: (layer: WMLayer, message: string) => void): void;
120
+ __parseGetCapForLayer(getcapabilitiesjson: GetCapabilitiesJson, layerDoneCallback: (layer: WMLayer) => void, fail: (layer: WMLayer, message: string) => void): void;
142
121
  /**
143
122
  * Calls success with a configured layer object
144
123
  * Calls options.failure with error message.
145
124
  * Throws string exceptions when someting goes wrong
146
125
  */
147
- parseLayer(_layerDoneCallback: (layer: WMLayer) => void, forceReload: boolean, xml2jsonrequest?: string): void;
126
+ parseLayer(_layerDoneCallback: (layer: WMLayer) => void, forceReload: boolean, origin: string): void;
148
127
  /**
149
128
  * A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
150
129
  * @param forceReload Do not use the cache of the WMS GetCapabilties document, but instead fetch new data from the server
@@ -198,4 +177,3 @@ export default class WMLayer {
198
177
  setSLDURL(url: string): void;
199
178
  display(displayornot: boolean): void;
200
179
  }
201
- 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.2",
3
+ "version": "2.2.0",
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
  }