@opengeoweb/webmap 4.9.1 → 4.11.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.
@@ -1,11 +1,11 @@
1
- import { Dimension, GeographicBoundingBox, Style } from './types';
1
+ import { LayerProps, LayerTree, WMSLayerFromGetCapabilities } from './types';
2
2
  export interface GetCapabilitiesJson {
3
3
  WMS_Capabilities?: any;
4
4
  WMT_MS_Capabilities?: any;
5
5
  ServiceExceptionReport?: any;
6
6
  }
7
7
  export interface Capability {
8
- Layer: any;
8
+ Layer: WMSLayerFromGetCapabilities;
9
9
  Request: any;
10
10
  Exception?: any;
11
11
  }
@@ -17,20 +17,6 @@ export declare const getWMSUrl: (service?: string, additionalParams?: {}) => str
17
17
  export declare const WMJSGetCapabilities: (service: string, succes: (param: any) => void, fail: (param: string) => void, options: {
18
18
  headers?: any;
19
19
  }, disableCache?: boolean) => void;
20
- interface NodeObject {
21
- title: string;
22
- leaf: boolean;
23
- name?: string;
24
- path?: string[];
25
- children?: [];
26
- keywords?: string[];
27
- abstract?: string;
28
- styles?: Style[];
29
- dimensions?: Dimension[];
30
- geographicBoundingBox?: GeographicBoundingBox;
31
- }
32
- export declare const sortByKey: (array: NodeObject[], key: string) => NodeObject[];
33
- export declare const recursivelyFindLayer: (layers: any[], rootNode: any[], path: string[]) => void;
34
20
  /**
35
21
  * WMJSService Class
36
22
  *
@@ -47,7 +33,7 @@ export declare class WMJSService {
47
33
  version: string;
48
34
  getcapabilitiesDoc: GetCapabilitiesJson;
49
35
  busy: boolean;
50
- _flatLayerObject: any[];
36
+ _flatLayerObject: LayerProps[] | undefined;
51
37
  functionCallbackList: any[];
52
38
  _options: any;
53
39
  nodeCache: any;
@@ -72,10 +58,9 @@ export declare class WMJSService {
72
58
  * Calls succes with a hierarchical node structure
73
59
  * Calls failure with a string when someting goes wrong
74
60
  */
75
- getNodes(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, options?: unknown): void;
61
+ getNodes(succes: (layerTreeStructure: LayerTree) => void, failure: (msg: string) => void, forceReload: boolean, options?: unknown): void;
76
62
  /** Calls succes with an array of all layerobjects
77
63
  * Calls failure when something goes wrong
78
64
  */
79
- getLayerObjectsFlat(succes: (param: unknown) => void, failure: (param: unknown) => void, forceReload: boolean, options?: any): void;
65
+ getLayerObjectsFlat(succes: (layers: LayerProps[]) => void, failure: (message: string) => void, forceReload: boolean, options?: any): void;
80
66
  }
81
- export {};
@@ -1,4 +1,4 @@
1
- import type { Dimension, GeographicBoundingBox, Style, WMSLayerFromGetCapabilities } from './types';
1
+ import type { Dimension, GeographicBoundingBox, LayerProps, LayerTree, Style, WMSLayerFromGetCapabilities } from './types';
2
2
  import type WMLayer from './WMLayer';
3
3
  export declare const enableConsoleDebugging = false;
4
4
  export declare enum DebugType {
@@ -67,3 +67,34 @@ export declare const dateToISO8601: (date: Date) => string;
67
67
  export declare const addStylesForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Style[];
68
68
  export declare const addDimensionsForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => Dimension[];
69
69
  export declare const addBoundingBoxForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities) => GeographicBoundingBox | undefined;
70
+ /**
71
+ * Sorts an array with objects by object key.
72
+ *
73
+ * @param array Array of objects
74
+ * @param key The key of the object to use for sorting
75
+ * @returns Sorted array.
76
+ */
77
+ export declare function sortArrayOfObjectsByKey<ArrayOfObjects>(array: ArrayOfObjects[], key: string): ArrayOfObjects[];
78
+ /**
79
+ * A LayerTree with deeply nested children will be flattened into a 1D array. Children properties are removed and result is sorted alphabetically by the layers title.
80
+ * @param layerTree a WMS LayerTree
81
+ * @returns Flat array of layers as LayerProps[]
82
+ */
83
+ export declare const flattenLayerTree: (layerTree: LayerTree) => LayerProps[];
84
+ /**
85
+ * Makes a LayerProps object from the WMSLayerFromGetCapabilities and nestedLayerPath
86
+ * @param layer WMSLayerFromGetCapabilities
87
+ * @param path The path of the layer in the WMS GetCapabilities tree (Array of strings)
88
+ * @param isleaf Is this a group layer or an actual layer
89
+ * @param nestedLayerPath The path of the layer in the WMS GetCapabilities, in this case array of LayerProps
90
+ * @returns
91
+ */
92
+ export declare const makeNodeLayerFromWMSGetCapabilityLayer: (layer: WMSLayerFromGetCapabilities, path?: string[], isleaf?: boolean, nestedLayerPath?: LayerProps[]) => LayerProps;
93
+ /**
94
+ * Builds a standardized LayerTree object based on WMSLayerFromGetCapabilities object.
95
+ * @param wmsLayer The WMSLayerFromGetCapabilities object
96
+ * @param nestedPath - Optional, only to be used by buildLayerTreeFromNestedWMSLayer
97
+ * @param nestedLayerPath - Optional, only to be used by buildLayerTreeFromNestedWMSLayer
98
+ * @returns A LayerTree object.
99
+ */
100
+ export declare const buildLayerTreeFromNestedWMSLayer: (wmsLayer: WMSLayerFromGetCapabilities, nestedPath?: string[], nestedLayerPath?: LayerProps[]) => LayerTree;
@@ -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, WMSLayerFromGetCapabilities } from './types';
6
+ import { Style, Dimension, LayerProps, GeographicBoundingBox } from './types';
7
7
  export declare enum LayerType {
8
8
  mapLayer = "mapLayer",
9
9
  baseLayer = "baseLayer",
@@ -40,19 +40,20 @@ export interface LayerOptions {
40
40
  * @param layer THe WMLayer to configure
41
41
  * @param layerDimNamesToRemove A set of dimensions names which are flagged for removal, this function removes the dimension from the set if found in the layer.
42
42
  */
43
- export declare const addDimsForLayer: (layerObjectFromWMS: WMSLayerFromGetCapabilities, layer: WMLayer, layerDimNamesToRemove: Set<string>) => void;
43
+ export declare const addDimsForLayer: (layerProps: LayerProps, layer: WMLayer, layerDimNamesToRemove: Set<string>) => void;
44
44
  /**
45
45
  * Helper function to configure the WMS Styles from the WMS GetCapabilities document.
46
46
  * @param nestedLayerPath Array of WMS Layers from `[Root WMS Layer] => [Parent(s) WMS Layer] => [This WMS layer]`.
47
47
  * @param wmLayer The WMLayer object to configure
48
48
  */
49
- export declare const configureStyles: (nestedLayerPath: WMSLayerFromGetCapabilities[], wmLayer: WMLayer) => void;
49
+ export declare const configureStyles: (layerProps: LayerProps, wmLayer: WMLayer) => void;
50
50
  /**
51
51
  * Helper function to configure the dimensions for this layer from the WMS GetCapabilities document.
52
52
  * @param nestedLayerPath Array of WMS Layers from `[Root WMS Layer] => [Parent(s) WMS Layer] => [This WMS layer]`.
53
53
  * @param wmLayer The WMLayer object to configure
54
54
  */
55
- export declare const configureDimensions: (nestedLayerPath: WMSLayerFromGetCapabilities[], wmLayer: WMLayer) => void;
55
+ export declare const configureDimensions: (layerProps: LayerProps, wmLayer: WMLayer) => void;
56
+ export declare const configureGeographicBoundingBox: (layerProps: LayerProps, wmLayer: WMLayer) => void;
56
57
  export default class WMLayer {
57
58
  id: string;
58
59
  name?: string;
@@ -102,6 +103,7 @@ export default class WMLayer {
102
103
  colorscalerange: Record<string, unknown>[];
103
104
  };
104
105
  isConfigured: boolean;
106
+ geographicBoundingBox?: GeographicBoundingBox;
105
107
  init(): void;
106
108
  constructor(options?: LayerOptions);
107
109
  getLayerName(): string;
@@ -137,10 +139,6 @@ export default class WMLayer {
137
139
  * @returns Promise resolving to a WMLayer object
138
140
  */
139
141
  setName(name: string): Promise<WMLayer>;
140
- getLayerRelative(success: (layer: WMLayer, index: number, length: number) => void, failure: (param: string) => void, prevNext: number): void;
141
- autoSelectLayer(success: (layer: WMLayer) => void, failure: (param: string) => void): void;
142
- getNextLayer(success: (layer: WMLayer, index: number, length: number) => void, failure: (param: string) => void): void;
143
- getPreviousLayer(success: (layer: WMLayer, index: number, length: number) => void, failure: (param: string) => void): void;
144
142
  /**
145
143
  * Sets the style by its name
146
144
  * @param style: The name of the style (not the object)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "4.9.1",
3
+ "version": "4.11.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,6 +14,7 @@
14
14
  "peerDependencies": {
15
15
  "moment": "^2.29.0",
16
16
  "throttle-debounce": "^3.0.1",
17
- "proj4": "^2.6.2"
17
+ "proj4": "^2.6.2",
18
+ "lodash": "^4.17.20"
18
19
  }
19
20
  }