@opengeoweb/webmap 4.1.0 → 4.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/index.esm.js CHANGED
@@ -218,7 +218,6 @@ var debug = function debug(type, message) {
218
218
  * @param variable The variable to check
219
219
  * @returns true if variable is indeed defined, otherwise false.
220
220
  */
221
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
222
221
 
223
222
  var isDefined = function isDefined(variable) {
224
223
  if (variable === null) return false;
@@ -491,6 +490,43 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
491
490
  return style;
492
491
  });
493
492
  };
493
+ var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
494
+ if (!layerObjectFromWMS.Dimension) return [];
495
+ var layerDimensions = toArray(layerObjectFromWMS.Dimension);
496
+ var list = layerDimensions.map(function (layerDimension) {
497
+ return {
498
+ name: layerDimension.attr.name,
499
+ units: layerDimension.attr.units,
500
+ currentValue: layerDimension.value
501
+ };
502
+ });
503
+ return list;
504
+ };
505
+ var addBoundingBoxForLayer = function addBoundingBoxForLayer(layerObjectFromWMS) {
506
+ var _a, _b, _c, _d;
507
+
508
+ if (layerObjectFromWMS.EX_GeographicBoundingBox) {
509
+ var layerBbox = layerObjectFromWMS.EX_GeographicBoundingBox;
510
+ return {
511
+ east: ((_a = layerBbox.eastBoundLongitude) === null || _a === void 0 ? void 0 : _a.value) || null,
512
+ west: ((_b = layerBbox.westBoundLongitude) === null || _b === void 0 ? void 0 : _b.value) || null,
513
+ north: ((_c = layerBbox.northBoundLatitude) === null || _c === void 0 ? void 0 : _c.value) || null,
514
+ south: ((_d = layerBbox.southBoundLatitude) === null || _d === void 0 ? void 0 : _d.value) || null
515
+ };
516
+ }
517
+
518
+ if (layerObjectFromWMS.LatLonBoundingBox) {
519
+ var _layerBbox = layerObjectFromWMS.LatLonBoundingBox;
520
+ return {
521
+ east: _layerBbox.attr.maxx || null,
522
+ west: _layerBbox.attr.minx || null,
523
+ north: _layerBbox.attr.maxy || null,
524
+ south: _layerBbox.attr.miny || null
525
+ };
526
+ }
527
+
528
+ return undefined;
529
+ };
494
530
 
495
531
  /**
496
532
  * Returns the current time in ms
@@ -3002,7 +3038,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3002
3038
 
3003
3039
  if (!referenceTimeValueToSet) {
3004
3040
  this.reInitializeValues(this.values);
3005
- this.setClosestValue(true);
3041
+ this.setClosestValue(null);
3006
3042
  debug(DebugType.Warning);
3007
3043
  return;
3008
3044
  }
@@ -3829,7 +3865,6 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
3829
3865
 
3830
3866
  this.flyZoomToBBOXTimerStart = 1;
3831
3867
  this.flyZoomToBBOXTimerSteps = 5;
3832
- this.flyZoomToBBOXTimerLoop = undefined;
3833
3868
  this.flyZoomToBBOXDebounced = debounce;
3834
3869
  this.flyZoomToBBOXScaler = 0;
3835
3870
  this.flyZoomToBBOXCurrent = new WMBBOX();
@@ -7638,7 +7673,9 @@ rootNode, path) {
7638
7673
  return keywords.value;
7639
7674
  }),
7640
7675
  "abstract": layers[j].Abstract && layers[j].Abstract.value,
7641
- styles: addStylesForLayer(layers[j])
7676
+ styles: addStylesForLayer(layers[j]),
7677
+ dimensions: addDimensionsForLayer(layers[j]),
7678
+ geographicBoundingBox: addBoundingBoxForLayer(layers[j])
7642
7679
  };
7643
7680
  } else {
7644
7681
  var nodeText = isNull(layers[j].Title) ? 'Layer' : layers[j].Title.value;
@@ -8810,10 +8847,12 @@ var WMLayer = /*#__PURE__*/function () {
8810
8847
  } else if (JSONLayers[k].Name) {
8811
8848
  if (JSONLayers[k].Name.value === thisLayer.name) {
8812
8849
  foundLayerFunction(JSONLayers[k], path, _nestedLayerPath);
8813
- return;
8850
+ return undefined;
8814
8851
  }
8815
8852
  }
8816
8853
  }
8854
+
8855
+ return undefined;
8817
8856
  } // Try to recursively find the name in the getcap doc
8818
8857
 
8819
8858
 
package/index.umd.js CHANGED
@@ -160,7 +160,6 @@
160
160
  * @param variable The variable to check
161
161
  * @returns true if variable is indeed defined, otherwise false.
162
162
  */
163
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
164
163
 
165
164
  var isDefined = function isDefined(variable) {
166
165
  if (variable === null) return false;
@@ -438,6 +437,43 @@
438
437
  return style;
439
438
  });
440
439
  };
440
+ var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
441
+ if (!layerObjectFromWMS.Dimension) return [];
442
+ var layerDimensions = toArray(layerObjectFromWMS.Dimension);
443
+ var list = layerDimensions.map(function (layerDimension) {
444
+ return {
445
+ name: layerDimension.attr.name,
446
+ units: layerDimension.attr.units,
447
+ currentValue: layerDimension.value
448
+ };
449
+ });
450
+ return list;
451
+ };
452
+ var addBoundingBoxForLayer = function addBoundingBoxForLayer(layerObjectFromWMS) {
453
+ var _a, _b, _c, _d;
454
+
455
+ if (layerObjectFromWMS.EX_GeographicBoundingBox) {
456
+ var layerBbox = layerObjectFromWMS.EX_GeographicBoundingBox;
457
+ return {
458
+ east: ((_a = layerBbox.eastBoundLongitude) === null || _a === void 0 ? void 0 : _a.value) || null,
459
+ west: ((_b = layerBbox.westBoundLongitude) === null || _b === void 0 ? void 0 : _b.value) || null,
460
+ north: ((_c = layerBbox.northBoundLatitude) === null || _c === void 0 ? void 0 : _c.value) || null,
461
+ south: ((_d = layerBbox.southBoundLatitude) === null || _d === void 0 ? void 0 : _d.value) || null
462
+ };
463
+ }
464
+
465
+ if (layerObjectFromWMS.LatLonBoundingBox) {
466
+ var layerBbox = layerObjectFromWMS.LatLonBoundingBox;
467
+ return {
468
+ east: layerBbox.attr.maxx || null,
469
+ west: layerBbox.attr.minx || null,
470
+ north: layerBbox.attr.maxy || null,
471
+ south: layerBbox.attr.miny || null
472
+ };
473
+ }
474
+
475
+ return undefined;
476
+ };
441
477
 
442
478
  /* *
443
479
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3022,7 +3058,7 @@
3022
3058
 
3023
3059
  if (!referenceTimeValueToSet) {
3024
3060
  this.reInitializeValues(this.values);
3025
- this.setClosestValue(true);
3061
+ this.setClosestValue(null);
3026
3062
  debug(exports.DebugType.Warning, 'returning');
3027
3063
  return;
3028
3064
  }
@@ -3882,7 +3918,6 @@
3882
3918
 
3883
3919
  this.flyZoomToBBOXTimerStart = 1;
3884
3920
  this.flyZoomToBBOXTimerSteps = 5;
3885
- this.flyZoomToBBOXTimerLoop = undefined;
3886
3921
  this.flyZoomToBBOXDebounced = throttleDebounce.debounce;
3887
3922
  this.flyZoomToBBOXScaler = 0;
3888
3923
  this.flyZoomToBBOXCurrent = new WMBBOX();
@@ -7603,7 +7638,9 @@
7603
7638
  return keywords.value;
7604
7639
  }),
7605
7640
  "abstract": layers[j].Abstract && layers[j].Abstract.value,
7606
- styles: addStylesForLayer(layers[j])
7641
+ styles: addStylesForLayer(layers[j]),
7642
+ dimensions: addDimensionsForLayer(layers[j]),
7643
+ geographicBoundingBox: addBoundingBoxForLayer(layers[j])
7607
7644
  };
7608
7645
  } else {
7609
7646
  var nodeText = isNull(layers[j].Title) ? 'Layer' : layers[j].Title.value;
@@ -8774,10 +8811,12 @@
8774
8811
  } else if (JSONLayers[k].Name) {
8775
8812
  if (JSONLayers[k].Name.value === thisLayer.name) {
8776
8813
  foundLayerFunction(JSONLayers[k], path, nestedLayerPath_1);
8777
- return;
8814
+ return undefined;
8778
8815
  }
8779
8816
  }
8780
8817
  }
8818
+
8819
+ return undefined;
8781
8820
  } // Try to recursively find the name in the getcap doc
8782
8821
 
8783
8822
 
@@ -4,7 +4,7 @@ export default class WMFlyToBBox {
4
4
  private wmMap;
5
5
  private flyZoomToBBOXTimerStart;
6
6
  private flyZoomToBBOXTimerSteps;
7
- private flyZoomToBBOXTimerLoop;
7
+ private flyZoomToBBOXTimerLoop?;
8
8
  private flyZoomToBBOXDebounced;
9
9
  private flyZoomToBBOXScaler;
10
10
  private flyZoomToBBOXCurrent;
@@ -1,7 +1,8 @@
1
+ import type { WMJSService } from './WMJSService';
1
2
  /**
2
3
  * Global service store for re-use of services
3
4
  */
4
- export declare const WMServiceStore: any[];
5
+ export declare const WMServiceStore: WMJSService[];
5
6
  export declare const WMServiceStoreXML2JSONRequest: {
6
7
  proxy: string;
7
8
  };
@@ -35,10 +35,10 @@ export default class WMJSDimension {
35
35
  private dimMaxValue;
36
36
  private dimTimeInterval;
37
37
  constructor(config?: WMJSDimensionConfig);
38
- generateAllValues(): number[];
38
+ generateAllValues(): number | string[];
39
39
  setTimeValuesForReferenceTime(referenceTimeValueToSet: string, referenceTimeDim: WMJSDimension): void;
40
40
  reInitializeValues(values: string, forceReferenceTimeValue?: boolean): void;
41
- initialize(forceothervalues?: any, forceReferenceTimeValue?: boolean): void;
41
+ initialize(forceothervalues?: string | undefined, forceReferenceTimeValue?: boolean): void;
42
42
  /**
43
43
  * Returns the current value of this dimensions.
44
44
  * If a ISO8601 period is set, the getValue will return a timeRange using addTimeRangeDurationToValue instead of a single value
@@ -55,7 +55,7 @@ export default class WMJSDimension {
55
55
  * @returns
56
56
  */
57
57
  getValues(): string;
58
- setClosestValue(newValue?: any, evenWhenOutsideRange?: boolean): void;
58
+ setClosestValue(newValue?: string | null, evenWhenOutsideRange?: boolean): void;
59
59
  addTimeRangeDurationToValue(value: string): string;
60
60
  setTimeRangeDuration(duration: string): void;
61
61
  getClosestValue(_newValue: string, evenWhenOutsideRange?: boolean): string;
@@ -1,4 +1,4 @@
1
- import { Style } from './types';
1
+ import { Dimension, GeographicBoundingBox, Style } from './types';
2
2
  export interface GetCapabilitiesJson {
3
3
  WMS_Capabilities?: any;
4
4
  WMT_MS_Capabilities?: any;
@@ -26,6 +26,8 @@ interface NodeObject {
26
26
  keywords?: string[];
27
27
  abstract?: string;
28
28
  styles?: Style[];
29
+ dimensions?: Dimension[];
30
+ geographicBoundingBox?: GeographicBoundingBox;
29
31
  }
30
32
  export declare const sortByKey: (array: NodeObject[], key: string) => NodeObject[];
31
33
  export declare const recursivelyFindLayer: (layers: any[], rootNode: any[], path: string[]) => void;
@@ -64,7 +66,7 @@ export declare class WMJSService {
64
66
  * @param succescallback Function called upon succes, cannot be left blank
65
67
  * @param failcallback Function called upon failure, cannot be left blank
66
68
  */
67
- getCapabilities(succescallback: (param: GetCapabilitiesJson) => void, failcallback: (param: unknown) => void, forceReload: boolean, options: unknown): void;
69
+ getCapabilities(succescallback: (param: GetCapabilitiesJson) => void, failcallback: (param: unknown) => void, forceReload: boolean, options: any): void;
68
70
  checkException(jsonData: GetCapabilitiesJson): string | undefined;
69
71
  /**
70
72
  * Calls succes with a hierarchical node structure
@@ -1,4 +1,4 @@
1
- import type { Style, WMSLayerFromGetCapabilities } from './types';
1
+ import type { Dimension, GeographicBoundingBox, Style, WMSLayerFromGetCapabilities } from './types';
2
2
  import type WMLayer from './WMLayer';
3
3
  export declare const enableConsoleDebugging = false;
4
4
  export declare enum DebugType {
@@ -12,7 +12,7 @@ export declare const debug: (type: DebugType, message: string, ...optionalParam:
12
12
  * @param variable The variable to check
13
13
  * @returns true if variable is indeed defined, otherwise false.
14
14
  */
15
- export declare const isDefined: (variable: any) => boolean;
15
+ export declare const isDefined: <T>(variable?: T | undefined) => variable is T;
16
16
  /**
17
17
  * Checks if a variable is null or not
18
18
  * @param variable The variable to check
@@ -65,3 +65,5 @@ export declare const dateToISO8601: (date: Date) => string;
65
65
  * @returns Style[] Array of style objects.
66
66
  */
67
67
  export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Style[];
68
+ export declare const addDimensionsForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Dimension[];
69
+ export declare const addBoundingBoxForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => GeographicBoundingBox | undefined;
@@ -14,7 +14,7 @@ declare class MapPin {
14
14
  redrawMap: () => void;
15
15
  drawMarker(ctx: CanvasRenderingContext2D): void;
16
16
  repositionMapPin: (_bbox: WMBBOX) => void;
17
- setMapPin: (_x: number, _y: number, _bbox?: WMBBOX) => void;
17
+ setMapPin: (_x: number, _y: number, _bbox?: WMBBOX | undefined) => void;
18
18
  positionMapPinByLatLon: (coord: {
19
19
  x: number;
20
20
  y: number;
@@ -28,6 +28,12 @@ export interface Style {
28
28
  legendURL: string;
29
29
  abstract: string;
30
30
  }
31
+ export interface GeographicBoundingBox {
32
+ west: string;
33
+ east: string;
34
+ north: string;
35
+ south: string;
36
+ }
31
37
  export declare type WMLayerType = {
32
38
  setDimension: (name: string, value: string, updateMapDimensions: boolean) => void;
33
39
  getDimension: (name: string) => WMJSDimension;
@@ -42,4 +48,18 @@ export interface WMSLayerFromGetCapabilities {
42
48
  Dimension: unknown;
43
49
  Style: unknown;
44
50
  Extent: unknown;
51
+ EX_GeographicBoundingBox?: {
52
+ northBoundLatitude: any;
53
+ southBoundLatitude: any;
54
+ westBoundLongitude: any;
55
+ eastBoundLongitude: any;
56
+ };
57
+ LatLonBoundingBox?: {
58
+ attr: {
59
+ maxy: any;
60
+ miny: any;
61
+ maxx: any;
62
+ minx: any;
63
+ };
64
+ };
45
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {