@opengeoweb/webmap 9.15.0 → 9.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "9.15.0",
3
+ "version": "9.16.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,23 +1,26 @@
1
- /// <reference types="node" />
2
- import WMImage from './WMImage';
3
- import WMImageStore from './WMImageStore';
4
1
  import WMBBOX from './WMBBOX';
5
- import { LinkedInfo, LinkedInfoContent, WMPosition } from './types';
2
+ import { LinkedInfo, LinkedInfoContent } from './types';
6
3
  import type WMJSMap from './WMJSMap';
7
- interface InternalCallback {
4
+ export type SharedImageListType = Record<string, CanvasGeoLayer[]>;
5
+ interface CanvasBufferCallbacks {
8
6
  beforecanvasstartdraw?: (context: CanvasRenderingContext2D) => void;
9
7
  beforecanvasdisplay?: (context: CanvasRenderingContext2D) => void;
10
8
  canvasonerror?: (e: LinkedInfo[]) => void;
11
9
  aftercanvasdisplay?: (c: CanvasRenderingContext2D) => void;
12
10
  }
13
- interface CanvasBBOX {
11
+ export interface CanvasBBOX {
14
12
  left: number;
15
13
  right: number;
16
14
  top: number;
17
15
  bottom: number;
18
16
  }
19
17
  export interface CanvasGeoLayer {
18
+ intersect: number;
19
+ areaFractionClosest: number;
20
+ areaFraction: number;
20
21
  bbox: CanvasBBOX;
22
+ width: number;
23
+ height: number;
21
24
  opacity: number;
22
25
  imageAge: number;
23
26
  imageSource: string;
@@ -29,79 +32,75 @@ export interface CanvasGeoLayer {
29
32
  */
30
33
  export declare const makeQueryStringWithoutGeoInfo: (imageSource: string) => string;
31
34
  /**
32
- * Add an image to the sharedimages list
33
- * @param newLayer A canvaslayer object to add.
34
- */
35
- export declare const addAlternativeImage: (newLayer: CanvasGeoLayer) => void;
36
- /**
37
- * Removes the image from the alternative imageslist (in case imagestore cache gets cleaned), this used when the imagestore triggers a delete event for an image
38
- * @param imageUrl The url for the image to remove
39
- */
40
- export declare const removeAlternativeImage: (imageUrl: string) => void;
41
- /**
42
- * Made accessible for testing purposes
43
- * @returns
44
- */
45
- export declare const getSharedImagesList: () => Record<string, CanvasGeoLayer[]>;
46
- /**
47
- * Algorithm two determine how much two bboxes are similar
48
- * @param rect1
49
- * @param rect2
50
- * @returns
51
- */
52
- export declare const geClosestBBox: (rect1: CanvasBBOX, rect2: CanvasBBOX) => number;
53
- /**
54
- * Sort the imageslist by imagedate, newewst image first.
35
+ * Sort the imageslist
55
36
  * @param imagesList
56
37
  * @returns
57
38
  */
58
- export declare const sortByImageDate: (imagesList: CanvasGeoLayer[]) => CanvasGeoLayer[];
59
- /**
60
- * Function to find the an alternative available image for an image url that is not yet loaded
61
- * @param imageUrl The image source / url to find an alternative for
62
- * @param imageStore The imagestore where the other images are located
63
- * @param bbox The boundingbox to search this image for
64
- * @returns A canvasLayer, containing the new image source with its geo properties
65
- */
66
- export declare const getAlternativeImage: (imageUrl: string, imageStore: WMImageStore, _bbox: CanvasBBOX) => CanvasGeoLayer | undefined;
39
+ export declare const getSortedListOfImages: (imagesList: CanvasGeoLayer[], bbox: CanvasBBOX) => void;
67
40
  export default class WMCanvasBuffer {
68
- canvas: HTMLCanvasElement;
69
- _ctx: CanvasRenderingContext2D;
70
- _imageStore: WMImageStore;
71
- ready: boolean;
72
- layers: CanvasGeoLayer[];
73
- _currentbbox: WMBBOX;
74
- _currentnewbbox: WMBBOX;
75
- _width: number;
76
- _height: number;
77
- _webMapJS: WMJSMap;
78
- nrLoading: number;
79
- onLoadReadyFunction: (param: unknown) => void;
80
- _internalCallbacks: InternalCallback;
81
- srs: string;
82
- bbox: WMBBOX;
83
- animationFrameRequest: number;
84
- timerHandle: NodeJS.Timeout;
85
- _errorList: LinkedInfo[];
86
- _isBufferLoading: boolean;
87
- constructor(webMapJS: WMJSMap, w: number, h: number, internalCallbacks: InternalCallback);
88
- getCanvasContext(): CanvasRenderingContext2D;
41
+ private canvas;
42
+ private _ctx;
43
+ private _imageStore;
44
+ private _ready;
45
+ private _canvasLayers;
46
+ private _currentnewbbox;
47
+ private _width;
48
+ private _height;
49
+ private _webMapJS;
50
+ private _internalCallbacks;
51
+ private _animationFrameRequest;
52
+ private _timerHandle;
53
+ private _errorList;
54
+ private _isBufferLoading;
55
+ private _onLoadReadyFunction;
56
+ private sharedImagesList;
57
+ constructor(webMapJS: WMJSMap, w: number, h: number, internalCallbacks: CanvasBufferCallbacks);
89
58
  /**
90
59
  * Triggered by the WMImageStore when an image completes loading
91
60
  * @param image
92
61
  */
93
- imageLoadComplete(image: WMImage): void;
62
+ private _imageLoadComplete;
63
+ private _drawCanvasGeoLayer;
64
+ private _display;
65
+ private _finishedLoading;
66
+ private _checkIfLoading;
67
+ private _isImageStoreLoading;
68
+ private _getPixelCoordFromGeoCoord;
94
69
  /**
95
- * Checks if all images are loaded, if so it will call finishedLoading
70
+ * Made accessible for testing purposes
71
+ * @returns
72
+ */
73
+ getSharedImagesList(): SharedImageListType;
74
+ /**
75
+ * Function to find the an alternative available image for an image url that is not yet loaded
76
+ * @param imageUrl The image source / url to find an alternative for
77
+ * @param imageStore The imagestore where the other images are located
78
+ * @param bbox The boundingbox to search this image for
79
+ * @param filterUnsuitableAlternatives When true, images which have an overlap or ratio less then given threshold will be discarded as alternative
80
+ * @returns A canvasLayer, containing the new image source with its geo properties
81
+ */
82
+ getAlternativeImage(imageUrl: string, bbox: CanvasBBOX, filterUnsuitableAlternatives?: boolean): CanvasGeoLayer[];
83
+ /**
84
+ * Removes the image from the alternative imageslist (in case imagestore cache gets cleaned), this used when the imagestore triggers a delete event for an image
85
+ * @param imageUrl The url for the image to remove
86
+ */
87
+ removeAlternativeImage(imageUrl: string): void;
88
+ /**
89
+ * Add an image to the sharedimages list
90
+ * @param newLayer A canvaslayer object to add.
91
+ */
92
+ addAlternativeImage(newLayer: CanvasGeoLayer): void;
93
+ /**
94
+ * Used to tell the canvas that the map is resized,
95
+ * @param w
96
+ * @param h
96
97
  * @returns
97
98
  */
98
- _statDivBufferImageLoaded(): void;
99
- reset(): void;
100
- _drawImage(canvasLayer: CanvasGeoLayer): void;
101
- display(): void;
102
- _display(): void;
103
- finishedLoading(): void;
104
99
  resize(w: string, h: string): void;
100
+ /**
101
+ * Reset when a new set of layers have been added
102
+ */
103
+ initCanvasLayers(): void;
105
104
  /**
106
105
  * Set's a layer inside the canvasbuffer with given index and imagesource.
107
106
  * The image is directly loaded, but if loading is not complete when drawing, an alternative image is search in the alternative images list
@@ -112,12 +111,13 @@ export default class WMCanvasBuffer {
112
111
  * @param bbox The boundingbox for this layer
113
112
  * @returns Void
114
113
  */
115
- setSrc(layerIndex: number, imageSource: string, linkedInfo: LinkedInfoContent, opacity: number, bbox: WMBBOX): void;
116
- checkIfLoading(): void;
117
- isImageStoreLoading(): boolean;
118
- _getPixelCoordFromGeoCoord(coordinates: WMPosition, b: WMBBOX): WMPosition;
119
- setBBOX(newbbox: WMBBOX, loadedbbox: WMBBOX): void;
114
+ addLayerToCanvas(layerIndex: number, imageSource: string, linkedInfo: LinkedInfoContent, opacity: number, bbox: WMBBOX): void;
115
+ display(): void;
116
+ setBBOX(newbbox: WMBBOX): void;
117
+ /**
118
+ * Used when the map is destroyed
119
+ */
120
120
  destroy(): void;
121
- getBuffer(): HTMLCanvasElement;
121
+ getHTMLCanvasElement(): HTMLCanvasElement;
122
122
  }
123
123
  export {};
@@ -1,12 +1,14 @@
1
1
  import WMImageStore from './WMImageStore';
2
2
  import WMBBOX from './WMBBOX';
3
3
  import WMListener from './WMListener';
4
+ import { CanvasBBOX, CanvasGeoLayer } from './WMCanvasBuffer';
4
5
  import { proj4 } from './WMJSExternalDependencies';
5
6
  import WMJSDimension from './WMJSDimension';
6
7
  import MapPin from './WMMapPin';
7
8
  import WMLayer from './WMLayer';
8
9
  import { AnimationStep, Dimension, LinkedInfo } from './types';
9
10
  import { WMMemo } from './WMMemo';
11
+ import type { TileServerDefinition, TileServerSettings } from '../utils';
10
12
  export declare const detectLeftButton: (evt: MouseEvent) => boolean;
11
13
  export declare const detectRightButton: (evt: MouseEvent) => boolean;
12
14
  export declare const getErrorsToDisplay: (canvasErrors: LinkedInfo[], getLayerByServiceAndName: (layerservice: string, layername: string) => WMLayer) => string[];
@@ -61,7 +63,7 @@ export default class WMJSMap {
61
63
  updateBBOX: WMBBOX;
62
64
  private loadedBBOX?;
63
65
  drawnBBOX: WMBBOX;
64
- private divBuffer;
66
+ private canvasLayerBuffer;
65
67
  private mapHeader;
66
68
  private currentCursor;
67
69
  private mapIsActivated;
@@ -119,7 +121,8 @@ export default class WMJSMap {
119
121
  getMapImageStore: WMImageStore;
120
122
  holdShiftToScroll: boolean;
121
123
  constructor(_element: HTMLElement);
122
- setWMTileRendererTileSettings(_WMTileRendererTileSettings: unknown): void;
124
+ setWMTileRendererTileSettings(tileRenderSettings: TileServerSettings): void;
125
+ addWMTileRendererTileSetting(tileRenderSetting: TileServerDefinition): void;
123
126
  /**
124
127
  * Function which make a component ID which is unique over several WebMapJS instances
125
128
  * @param the desired id
@@ -206,6 +209,7 @@ export default class WMJSMap {
206
209
  url: string;
207
210
  headers: Headers[];
208
211
  }[];
212
+ getAlternativeImage(imageUrl: string, bbox: CanvasBBOX, filterBad?: boolean): CanvasGeoLayer[];
209
213
  addLayersToCanvasAndDisplayThem(): void;
210
214
  _updateBoundingBox(_mapbbox: WMBBOX, triggerEvent?: boolean): void;
211
215
  redrawBuffer(): void;
@@ -5,13 +5,17 @@ import WMJSDimension from './WMJSDimension';
5
5
  import WMProjection from './WMProjection';
6
6
  import { GetCapabilitiesJson } from './WMJSService';
7
7
  import { Style, Dimension, LayerProps, GeographicBoundingBox } from './types';
8
+ import type { TileServerSettings } from '../utils/tilesettings';
8
9
  export declare enum LayerType {
9
10
  mapLayer = "mapLayer",
10
11
  baseLayer = "baseLayer",
11
12
  overLayer = "overLayer",
12
13
  featureLayer = "featureLayer"
13
14
  }
14
- export interface LayerFoundation {
15
+ export interface TiledLayerFoundation {
16
+ tileServer?: TileServerSettings;
17
+ }
18
+ export interface LayerFoundation extends TiledLayerFoundation {
15
19
  acceptanceTimeInMinutes?: number;
16
20
  dimensions?: Dimension[];
17
21
  enabled?: boolean;
@@ -1,7 +1,6 @@
1
+ import type { EPSGCode, TileServerMap, TileSettings } from '../utils';
1
2
  import WMBBOX from './WMBBOX';
2
3
  import WMImageStore from './WMImageStore';
3
4
  export default class WMTileRenderer {
4
- render(currentBBOX: WMBBOX, newBBOX: WMBBOX, srs: string, width: number, height: number, ctx: CanvasRenderingContext2D, bgMapImageStore: WMImageStore, tileOptions: any, layerName: string): {
5
- attributionText: string;
6
- };
5
+ render(currentBBOX: WMBBOX, newBBOX: WMBBOX, srs: EPSGCode, width: number, height: number, ctx: CanvasRenderingContext2D, bgMapImageStore: WMImageStore, tileOptions: TileServerMap, layerName: string): TileSettings | undefined;
7
6
  }
@@ -7,14 +7,13 @@ import WMImage from './WMImage';
7
7
  import { getLegendGraphicURLForLayer, legendImageStore } from './WMLegend';
8
8
  import { WMImageEventType } from './WMImageStore';
9
9
  import { WMJSService, wmServiceListener } from './WMJSService';
10
- import { getAlternativeImage } from './WMCanvasBuffer';
11
10
  import WMListener from './WMListener';
12
11
  export { default as WMJSDimension, handleDateUtilsISOString, } from './WMJSDimension';
13
12
  export { default as WMLayer, LayerType } from './WMLayer';
14
13
  export type { LayerOptions, LayerFoundation } from './WMLayer';
15
14
  export { default as WMBBOX } from './WMBBOX';
16
15
  export type { Bbox } from './WMBBOX';
17
- export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getUriWithParam, getAlternativeImage, wmServiceListener, WMListener, };
16
+ export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getUriWithParam, wmServiceListener, WMListener, };
18
17
  export * from './types';
19
18
  export * from './WMTimeTypes';
20
19
  export * from './WMConstants';
@@ -9,6 +9,8 @@ export interface TileSettings {
9
9
  resolution?: number;
10
10
  title?: string;
11
11
  tileSize?: number;
12
+ tileServerFormat?: string;
13
+ tms?: boolean;
12
14
  }
13
15
  export declare enum EPSGCode {
14
16
  EPSG3857 = "EPSG:3857",
@@ -23,14 +25,14 @@ export declare enum EPSGCode {
23
25
  EPSG3575 = "EPSG:3575",
24
26
  EPSG3067 = "EPSG:3067"
25
27
  }
26
- type EPSGSettings = {
28
+ export type TileSettingPerProjection = {
27
29
  [code in EPSGCode]?: TileSettings;
28
30
  };
29
31
  export interface Title {
30
32
  title?: string;
31
33
  }
32
- export interface MapType extends Title, EPSGSettings {
34
+ export interface TileServerDefinition extends Title, TileSettingPerProjection {
33
35
  }
34
- export type TileServers = Record<string, MapType>;
35
- export declare const tilesettings: TileServers;
36
- export {};
36
+ export type TileServerMap = Map<string, TileServerDefinition>;
37
+ export type TileServerSettings = Record<string, TileServerDefinition>;
38
+ export declare const tilesettings: TileServerSettings;