@itwin/core-common 3.1.0-dev.7 → 3.1.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +109 -17
  2. package/lib/cjs/CloudStorage.d.ts.map +1 -1
  3. package/lib/cjs/CloudStorage.js +14 -20
  4. package/lib/cjs/CloudStorage.js.map +1 -1
  5. package/lib/cjs/Fonts.d.ts +16 -5
  6. package/lib/cjs/Fonts.d.ts.map +1 -1
  7. package/lib/cjs/Fonts.js +6 -2
  8. package/lib/cjs/Fonts.js.map +1 -1
  9. package/lib/cjs/MapImagerySettings.d.ts +2 -0
  10. package/lib/cjs/MapImagerySettings.d.ts.map +1 -1
  11. package/lib/cjs/MapImagerySettings.js.map +1 -1
  12. package/lib/cjs/MapLayerSettings.d.ts +120 -37
  13. package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
  14. package/lib/cjs/MapLayerSettings.js +156 -86
  15. package/lib/cjs/MapLayerSettings.js.map +1 -1
  16. package/lib/cjs/SpatialClassification.d.ts +5 -0
  17. package/lib/cjs/SpatialClassification.d.ts.map +1 -1
  18. package/lib/cjs/SpatialClassification.js +7 -0
  19. package/lib/cjs/SpatialClassification.js.map +1 -1
  20. package/lib/cjs/geometry/TextString.d.ts +5 -4
  21. package/lib/cjs/geometry/TextString.d.ts.map +1 -1
  22. package/lib/cjs/geometry/TextString.js.map +1 -1
  23. package/lib/cjs/ipc/IpcWebSocket.d.ts +0 -1
  24. package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
  25. package/lib/cjs/ipc/IpcWebSocket.js +4 -13
  26. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  27. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +2 -1
  28. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  29. package/lib/cjs/ipc/IpcWebSocketTransport.js +24 -15
  30. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  31. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +1 -0
  32. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  33. package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -0
  34. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  35. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +4 -2
  36. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  37. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -2
  38. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  39. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  40. package/lib/cjs/rpc/core/RpcInvocation.js +1 -6
  41. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  42. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  43. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  44. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  45. package/lib/cjs/tile/IModelTileIO.js +2 -2
  46. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  47. package/lib/esm/CloudStorage.d.ts.map +1 -1
  48. package/lib/esm/CloudStorage.js +14 -20
  49. package/lib/esm/CloudStorage.js.map +1 -1
  50. package/lib/esm/Fonts.d.ts +16 -5
  51. package/lib/esm/Fonts.d.ts.map +1 -1
  52. package/lib/esm/Fonts.js +6 -2
  53. package/lib/esm/Fonts.js.map +1 -1
  54. package/lib/esm/MapImagerySettings.d.ts +2 -0
  55. package/lib/esm/MapImagerySettings.d.ts.map +1 -1
  56. package/lib/esm/MapImagerySettings.js.map +1 -1
  57. package/lib/esm/MapLayerSettings.d.ts +120 -37
  58. package/lib/esm/MapLayerSettings.d.ts.map +1 -1
  59. package/lib/esm/MapLayerSettings.js +152 -84
  60. package/lib/esm/MapLayerSettings.js.map +1 -1
  61. package/lib/esm/SpatialClassification.d.ts +5 -0
  62. package/lib/esm/SpatialClassification.d.ts.map +1 -1
  63. package/lib/esm/SpatialClassification.js +7 -0
  64. package/lib/esm/SpatialClassification.js.map +1 -1
  65. package/lib/esm/geometry/TextString.d.ts +5 -4
  66. package/lib/esm/geometry/TextString.d.ts.map +1 -1
  67. package/lib/esm/geometry/TextString.js.map +1 -1
  68. package/lib/esm/ipc/IpcWebSocket.d.ts +0 -1
  69. package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
  70. package/lib/esm/ipc/IpcWebSocket.js +4 -13
  71. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  72. package/lib/esm/ipc/IpcWebSocketTransport.d.ts +2 -1
  73. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  74. package/lib/esm/ipc/IpcWebSocketTransport.js +24 -15
  75. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  76. package/lib/esm/rpc/IModelReadRpcInterface.d.ts +1 -0
  77. package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  78. package/lib/esm/rpc/IModelReadRpcInterface.js +1 -0
  79. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  80. package/lib/esm/rpc/IModelTileRpcInterface.d.ts +4 -2
  81. package/lib/esm/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  82. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -2
  83. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  84. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  85. package/lib/esm/rpc/core/RpcInvocation.js +1 -6
  86. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  87. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  88. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  89. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  90. package/lib/esm/tile/IModelTileIO.js +2 -2
  91. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  92. package/package.json +7 -7
@@ -1,6 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module DisplayStyles
3
3
  */
4
+ import { Id64String } from "@itwin/core-bentley";
4
5
  import { BackgroundMapProvider, BackgroundMapProviderProps, BackgroundMapType } from "./BackgroundMapProvider";
5
6
  import { DeprecatedBackgroundMapProps } from "./BackgroundMapSettings";
6
7
  /** @beta */
@@ -57,34 +58,64 @@ export declare class MapSubLayerSettings {
57
58
  /** return a string representing this sublayer id (converting to string if underlying id is number) */
58
59
  get idString(): string;
59
60
  }
60
- /** JSON representation of the settings associated with a map layer. One or more map layers may be included within a [[MapImageryProps]] object.
61
+ /** JSON representation of properties common to both [[ImageMapLayerProps]] and [[ModelMapLayerProps]].
61
62
  * @see [[MapImageryProps]]
62
63
  * @beta
63
64
  */
64
- export interface MapLayerProps {
65
+ export interface CommonMapLayerProps {
65
66
  /** Controls visibility of layer. Defaults to 'true'. */
66
67
  visible?: boolean;
67
- /** Identifies the map layers source.*/
68
- formatId: string;
69
- /** Name */
68
+ /** A user-friendly name for the layer. */
70
69
  name: string;
70
+ /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing,
71
+ * or false to indicate the transparency should not be overridden.
72
+ * Default value: 0.
73
+ */
74
+ transparency?: number;
75
+ /** True to indicate background is transparent.
76
+ * Default: true.
77
+ */
78
+ transparentBackground?: boolean;
79
+ }
80
+ /** JSON representation of an [[ImageMapLayerSettings]].
81
+ * @see [[MapImagerySettings]].
82
+ * @beta
83
+ */
84
+ export interface ImageMapLayerProps extends CommonMapLayerProps {
71
85
  /** URL */
72
86
  url: string;
87
+ /** Identifies the map layers source.*/
88
+ formatId: string;
73
89
  /** Source layers. If undefined all layers are displayed. */
74
90
  subLayers?: MapSubLayerProps[];
75
- /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing,
76
- * or false to indicate the transparency should not be overridden. Default value: 0.
77
- * If omitted, defaults to 0. */
78
- transparency?: number;
79
- /** True to indicate background is transparent. Defaults to 'true'. */
80
- transparentBackground?: boolean;
81
- /** Is a base layer. Defaults to 'false'. */
82
- isBase?: boolean;
83
91
  /** Access Key for the Layer, like a subscription key or access token.
84
- * TODO This does not belong in the props object. It should never be persisted.
92
+ * ###TODO This does not belong in the props object. It should never be persisted.
85
93
  */
86
94
  accessKey?: MapLayerKey;
95
+ /** @internal */
96
+ modelId?: never;
87
97
  }
98
+ /** JSON representation of a [[ModelMapLayerSettings]].
99
+ * @see [[MapImagerySettings]].
100
+ * @beta
101
+ */
102
+ export interface ModelMapLayerProps extends CommonMapLayerProps {
103
+ /** The Id of the [GeometricModel]($backend) containing the geometry to be drawn by the layer. */
104
+ modelId: Id64String;
105
+ /** @internal */
106
+ url?: never;
107
+ /** @internal */
108
+ formatId?: never;
109
+ /** @internal */
110
+ subLayers?: never;
111
+ /** @internal */
112
+ accessKey?: never;
113
+ }
114
+ /** JSON representation of a [[MapLayerSettings]].
115
+ * @see [[MapImagerySettings]].
116
+ * @beta
117
+ */
118
+ export declare type MapLayerProps = ImageMapLayerProps | ModelMapLayerProps;
88
119
  /**
89
120
  * stores key-value pair to be added to all requests made involving map layer.
90
121
  * @beta
@@ -93,60 +124,112 @@ export interface MapLayerKey {
93
124
  key: string;
94
125
  value: string;
95
126
  }
96
- /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
127
+ /** Abstract base class for normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
128
+ * This class is extended by [[ImageMapLayerSettings]] and [ModelMapLayerSettings]] to create the settings for image and model based layers.
97
129
  * One or more map layers may be included within [[MapImagerySettings]] object.
98
130
  * @see [[MapImagerySettings]]
99
131
  * @beta
100
132
  */
101
- export declare class MapLayerSettings {
133
+ export declare abstract class MapLayerSettings {
102
134
  readonly visible: boolean;
103
- readonly formatId: string;
104
135
  readonly name: string;
105
- readonly url: string;
106
136
  readonly transparency: number;
107
- readonly subLayers: MapSubLayerSettings[];
108
137
  readonly transparentBackground: boolean;
109
- readonly isBase: boolean;
138
+ abstract get allSubLayersInvisible(): boolean;
139
+ abstract clone(changedProps: Partial<MapLayerProps>): MapLayerSettings;
140
+ abstract toJSON(): MapLayerProps;
141
+ /** @internal */
142
+ protected constructor(name: string, visible?: boolean, transparency?: number, transparentBackground?: boolean);
143
+ /** Create a map layer settings from its JSON representation. */
144
+ static fromJSON(props: MapLayerProps): MapLayerSettings;
145
+ /** @internal */
146
+ protected _toJSON(): CommonMapLayerProps;
147
+ /** @internal */
148
+ protected cloneProps(changedProps: Partial<MapLayerProps>): CommonMapLayerProps;
149
+ /** @internal */
150
+ displayMatches(other: MapLayerSettings): boolean;
151
+ /** Return a unique string identifying the layers source... The URL for image layer or modelID for model layer */
152
+ abstract get source(): string;
153
+ /** @internal */
154
+ matchesNameAndSource(name: string, source: string): boolean;
155
+ }
156
+ /** Normalized representation of a [[ImageMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
157
+ * Image map layers are created from servers that produce images that represent map tiles. Map layers map also be represented by models.
158
+ * One or more map layers may be included within [[MapImagerySettings]] object.
159
+ * @see [[MapImagerySettings]]
160
+ * @see [[ModelMapLayerSettings]] for model based map layer settings.
161
+ * @beta
162
+ */
163
+ export declare class ImageMapLayerSettings extends MapLayerSettings {
164
+ readonly formatId: string;
165
+ readonly url: string;
110
166
  userName?: string;
111
167
  password?: string;
112
168
  accessKey?: MapLayerKey;
113
- setCredentials(userName?: string, password?: string): void;
169
+ readonly subLayers: MapSubLayerSettings[];
170
+ get source(): string;
114
171
  /** @internal */
115
- protected constructor(url: string, name: string, formatId: string, visible?: boolean, jsonSubLayers?: MapSubLayerProps[] | undefined, transparency?: number, transparentBackground?: boolean, isBase?: boolean, userName?: string, password?: string, accessKey?: MapLayerKey);
116
- /** Construct from JSON, performing validation and applying default values for undefined fields. */
117
- static fromJSON(json: MapLayerProps): MapLayerSettings;
172
+ protected constructor(props: ImageMapLayerProps);
173
+ static fromJSON(props: ImageMapLayerProps): ImageMapLayerSettings;
118
174
  /** return JSON representation of this MapLayerSettings object */
119
- toJSON(): MapLayerProps;
120
- /** @internal */
121
- protected static mapTypeName(type: BackgroundMapType): "Aerial Imagery" | "Aerial Imagery with labels" | "Streets";
175
+ toJSON(): ImageMapLayerProps;
122
176
  /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
123
177
  * @param changedProps JSON representation of the properties to change.
124
178
  * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
125
179
  */
126
- clone(changedProps: Partial<MapLayerProps>): MapLayerSettings;
180
+ clone(changedProps: Partial<ImageMapLayerProps>): ImageMapLayerSettings;
127
181
  /** @internal */
128
- protected cloneProps(changedProps: Partial<MapLayerProps>): MapLayerProps;
182
+ protected cloneProps(changedProps: Partial<ImageMapLayerProps>): ImageMapLayerProps;
129
183
  /** @internal */
130
184
  displayMatches(other: MapLayerSettings): boolean;
131
- /** @internal */
132
- matchesNameAndUrl(name: string, url: string): boolean;
133
185
  /** Return a sublayer matching id -- or undefined if not found */
134
186
  subLayerById(id?: SubLayerId): MapSubLayerSettings | undefined;
135
187
  private hasInvisibleAncestors;
136
188
  /** Return true if sublayer is visible -- testing ancestors for visibility if they exist. */
137
189
  isSubLayerVisible(subLayer: MapSubLayerSettings): boolean;
138
- /** Return true if all sublayers are visible. */
190
+ /** Return true if all sublayers are invisible. */
139
191
  get allSubLayersInvisible(): boolean;
140
192
  /** Return the children for a sublayer */
141
193
  getSubLayerChildren(subLayer: MapSubLayerSettings): MapSubLayerSettings[] | undefined;
194
+ /** @internal */
195
+ protected static mapTypeName(type: BackgroundMapType): "Aerial Imagery" | "Aerial Imagery with labels" | "Streets";
196
+ setCredentials(userName?: string, password?: string): void;
197
+ }
198
+ /** Normalized representation of a [[ModelMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
199
+ * Model map layers are produced from models, typically from two dimensional geometry that may originate in a GIS system.
200
+ * One or more map layers may be included within [[MapImagerySettings]] object.
201
+ * @see [[MapImagerySettings]]
202
+ * @see [[ImageMapLayerSettings]] for image based map layer settings.
203
+ * @beta
204
+ */
205
+ export declare class ModelMapLayerSettings extends MapLayerSettings {
206
+ readonly modelId: Id64String;
207
+ get source(): string;
208
+ /** @internal */
209
+ protected constructor(modelId: Id64String, name: string, visible?: boolean, transparency?: number, transparentBackground?: boolean);
210
+ /** Construct from JSON, performing validation and applying default values for undefined fields. */
211
+ static fromJSON(json: ModelMapLayerProps): ModelMapLayerSettings;
212
+ /** return JSON representation of this MapLayerSettings object */
213
+ toJSON(): ModelMapLayerProps;
214
+ /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
215
+ * @param changedProps JSON representation of the properties to change.
216
+ * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
217
+ */
218
+ clone(changedProps: Partial<ModelMapLayerProps>): ModelMapLayerSettings;
219
+ /** @internal */
220
+ protected cloneProps(changedProps: Partial<ModelMapLayerProps>): ModelMapLayerProps;
221
+ /** @internal */
222
+ displayMatches(other: MapLayerSettings): boolean;
223
+ /** Return true if all sublayers are invisible (always false as model layers do not include sublayers). */
224
+ get allSubLayersInvisible(): boolean;
142
225
  }
143
226
  /** JSON representation of a [[BaseMapLayerSettings]].
144
227
  * @beta
145
228
  */
146
- export interface BaseMapLayerProps extends MapLayerProps {
229
+ export interface BaseMapLayerProps extends ImageMapLayerProps {
147
230
  provider?: BackgroundMapProviderProps;
148
231
  }
149
- /** A [[MapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
232
+ /** A [[ImageMapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
150
233
  * The base layer supports all of the same options as any other layer, but also allows for simplified configuration based
151
234
  * on a small set of known supported [[BackgroundMapProvider]]s like [Bing Maps](https://www.microsoft.com/en-us/maps).
152
235
  * If the base layer was configured from such a provider, that information will be preserved and can be queried; this allows
@@ -154,7 +237,7 @@ export interface BaseMapLayerProps extends MapLayerProps {
154
237
  * @see [[MapImagerySettings.backgroundBase]].
155
238
  * @beta
156
239
  */
157
- export declare class BaseMapLayerSettings extends MapLayerSettings {
240
+ export declare class BaseMapLayerSettings extends ImageMapLayerSettings {
158
241
  private _provider?;
159
242
  /** The provider from which this base layer was configured, if any. */
160
243
  get provider(): BackgroundMapProvider | undefined;
@@ -167,9 +250,9 @@ export declare class BaseMapLayerSettings extends MapLayerSettings {
167
250
  /** Convert this layer to its JSON representation. */
168
251
  toJSON(): BaseMapLayerProps;
169
252
  /** @internal */
170
- cloneProps(changedProps: Partial<MapLayerProps>): BaseMapLayerProps;
253
+ cloneProps(changedProps: Partial<BaseMapLayerProps>): BaseMapLayerProps;
171
254
  /** Create a copy of this layer. */
172
- clone(changedProps: Partial<MapLayerProps>): BaseMapLayerSettings;
255
+ clone(changedProps: Partial<BaseMapLayerProps>): BaseMapLayerSettings;
173
256
  /** Create a base layer from a BackgroundMapProvider. */
174
257
  static fromProvider(provider: BackgroundMapProvider, options?: {
175
258
  invisible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettings.d.ts","sourceRoot":"","sources":["../../src/MapLayerSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE,YAAY;AACZ,oBAAY,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC9B,mIAAmI;IACnI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BAAiB,GAAG,oBAAoB;IAS/E,qDAAqD;IACrC,MAAM,IAAI,iBAAiB;IAQ3C,gBAAgB;IACA,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB;IAWvF,mCAAmC;IACnB,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,oBAAoB;IAUrF,wDAAwD;WAC1C,YAAY,CAAC,QAAQ,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,oBAAoB;IA2D3I,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,4BAA4B,GAAG,oBAAoB;IAI/F,aAAa;IACN,iBAAiB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,oBAAoB;CAGhF"}
@@ -7,7 +7,7 @@
7
7
  * @module DisplayStyles
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.BaseMapLayerSettings = exports.MapLayerSettings = exports.MapSubLayerSettings = void 0;
10
+ exports.BaseMapLayerSettings = exports.ModelMapLayerSettings = exports.ImageMapLayerSettings = exports.MapLayerSettings = exports.MapSubLayerSettings = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const BackgroundMapProvider_1 = require("./BackgroundMapProvider");
13
13
  /** Normalized representation of a [[MapSubLayerProps]] for which values
@@ -72,85 +72,99 @@ class MapSubLayerSettings {
72
72
  get idString() { return (typeof this.id === "number") ? this.id.toString(10) : this.id; }
73
73
  }
74
74
  exports.MapSubLayerSettings = MapSubLayerSettings;
75
- /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
75
+ /** Abstract base class for normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
76
+ * This class is extended by [[ImageMapLayerSettings]] and [ModelMapLayerSettings]] to create the settings for image and model based layers.
76
77
  * One or more map layers may be included within [[MapImagerySettings]] object.
77
78
  * @see [[MapImagerySettings]]
78
79
  * @beta
79
80
  */
80
81
  class MapLayerSettings {
81
82
  /** @internal */
82
- constructor(url, name, formatId, visible = true, jsonSubLayers = undefined, transparency = 0, transparentBackground = true, isBase = false, userName, password, accessKey) {
83
- var _a;
84
- this.formatId = formatId;
83
+ constructor(name, visible = true, transparency = 0, transparentBackground = true) {
85
84
  this.name = name;
86
85
  this.visible = visible;
87
86
  this.transparentBackground = transparentBackground;
88
- this.isBase = isBase;
89
- this.subLayers = new Array();
90
- if (jsonSubLayers !== undefined) {
91
- let hasUnnamedGroups = false;
92
- for (const jsonSubLayer of jsonSubLayers) {
93
- const subLayer = MapSubLayerSettings.fromJSON(jsonSubLayer);
94
- if (undefined !== subLayer) {
95
- this.subLayers.push(subLayer);
96
- if (((_a = subLayer.children) === null || _a === void 0 ? void 0 : _a.length) !== 0 && !subLayer.isNamed && !hasUnnamedGroups)
97
- hasUnnamedGroups = true;
98
- }
99
- }
100
- this.userName = userName;
101
- this.password = password;
102
- }
103
- this.accessKey = accessKey;
104
87
  this.transparency = transparency;
105
- this.url = url;
106
- }
107
- setCredentials(userName, password) {
108
- this.userName = userName;
109
- this.password = password;
110
88
  }
111
- /** Construct from JSON, performing validation and applying default values for undefined fields. */
112
- static fromJSON(json) {
113
- const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;
114
- return new this(json.url, json.name, json.formatId, json.visible, json.subLayers, json.transparency, transparentBackground, json.isBase === true, undefined, undefined, json.accessKey);
89
+ /** Create a map layer settings from its JSON representation. */
90
+ static fromJSON(props) {
91
+ return undefined !== props.modelId ? ModelMapLayerSettings.fromJSON(props) : ImageMapLayerSettings.fromJSON(props);
115
92
  }
116
- /** return JSON representation of this MapLayerSettings object */
117
- toJSON() {
118
- const props = { formatId: this.formatId, name: this.name, url: this.url };
119
- if (this.subLayers.length > 0) {
120
- props.subLayers = [];
121
- this.subLayers.forEach((subLayer) => {
122
- const subLayerJson = subLayer.toJSON();
123
- if (subLayerJson)
124
- props.subLayers.push(subLayerJson);
125
- });
126
- }
93
+ /** @internal */
94
+ _toJSON() {
95
+ const props = {
96
+ name: this.name,
97
+ visible: this.visible,
98
+ };
127
99
  if (0 !== this.transparency)
128
100
  props.transparency = this.transparency;
129
101
  if (this.transparentBackground === false)
130
102
  props.transparentBackground = this.transparentBackground;
131
- if (this.isBase === true)
132
- props.isBase = this.isBase;
133
- props.visible = this.visible;
134
103
  return props;
135
104
  }
136
105
  /** @internal */
137
- static mapTypeName(type) {
138
- switch (type) {
139
- case BackgroundMapProvider_1.BackgroundMapType.Aerial:
140
- return "Aerial Imagery";
141
- default:
142
- case BackgroundMapProvider_1.BackgroundMapType.Hybrid:
143
- return "Aerial Imagery with labels";
144
- case BackgroundMapProvider_1.BackgroundMapType.Street:
145
- return "Streets";
106
+ cloneProps(changedProps) {
107
+ return {
108
+ name: undefined !== changedProps.name ? changedProps.name : this.name,
109
+ visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,
110
+ transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,
111
+ transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,
112
+ };
113
+ }
114
+ /** @internal */
115
+ displayMatches(other) {
116
+ return this.name === other.name && this.visible === other.visible && this.transparency === other.transparency && this.transparentBackground === other.transparentBackground;
117
+ }
118
+ /** @internal */
119
+ matchesNameAndSource(name, source) {
120
+ return this.name === name && this.source === source;
121
+ }
122
+ }
123
+ exports.MapLayerSettings = MapLayerSettings;
124
+ /** Normalized representation of a [[ImageMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
125
+ * Image map layers are created from servers that produce images that represent map tiles. Map layers map also be represented by models.
126
+ * One or more map layers may be included within [[MapImagerySettings]] object.
127
+ * @see [[MapImagerySettings]]
128
+ * @see [[ModelMapLayerSettings]] for model based map layer settings.
129
+ * @beta
130
+ */
131
+ class ImageMapLayerSettings extends MapLayerSettings {
132
+ /** @internal */
133
+ constructor(props) {
134
+ var _a;
135
+ const transparentBackground = (_a = props.transparentBackground) !== null && _a !== void 0 ? _a : true;
136
+ super(props.name, props.visible, props.transparency, transparentBackground);
137
+ this.formatId = props.formatId;
138
+ this.url = props.url;
139
+ this.accessKey = props.accessKey;
140
+ this.subLayers = [];
141
+ if (!props.subLayers)
142
+ return;
143
+ for (const subLayerProps of props.subLayers) {
144
+ const subLayer = MapSubLayerSettings.fromJSON(subLayerProps);
145
+ if (subLayer)
146
+ this.subLayers.push(subLayer);
146
147
  }
147
148
  }
149
+ get source() { return this.url; }
150
+ static fromJSON(props) {
151
+ return new this(props);
152
+ }
153
+ /** return JSON representation of this MapLayerSettings object */
154
+ toJSON() {
155
+ const props = super._toJSON();
156
+ props.url = this.url;
157
+ props.formatId = this.formatId;
158
+ if (this.subLayers.length > 0)
159
+ props.subLayers = this.subLayers.map((x) => x.toJSON());
160
+ return props;
161
+ }
148
162
  /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
149
163
  * @param changedProps JSON representation of the properties to change.
150
164
  * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
151
165
  */
152
166
  clone(changedProps) {
153
- const clone = MapLayerSettings.fromJSON(this.cloneProps(changedProps));
167
+ const clone = ImageMapLayerSettings.fromJSON(this.cloneProps(changedProps));
154
168
  // Clone members not part of MapLayerProps
155
169
  clone.userName = this.userName;
156
170
  clone.password = this.password;
@@ -159,27 +173,19 @@ class MapLayerSettings {
159
173
  }
160
174
  /** @internal */
161
175
  cloneProps(changedProps) {
162
- return {
163
- name: undefined !== changedProps.name ? changedProps.name : this.name,
164
- formatId: undefined !== changedProps.formatId ? changedProps.formatId : this.formatId,
165
- visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,
166
- url: undefined !== changedProps.url ? changedProps.url : this.url,
167
- transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,
168
- transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,
169
- subLayers: undefined !== changedProps.subLayers ? changedProps.subLayers : this.subLayers,
170
- accessKey: undefined !== changedProps.accessKey ? changedProps.accessKey : this.accessKey,
171
- };
176
+ var _a, _b, _c, _d;
177
+ const props = super.cloneProps(changedProps);
178
+ props.formatId = (_a = changedProps.formatId) !== null && _a !== void 0 ? _a : this.formatId;
179
+ props.url = (_b = changedProps.url) !== null && _b !== void 0 ? _b : this.url;
180
+ props.accessKey = (_c = changedProps.accessKey) !== null && _c !== void 0 ? _c : this.accessKey;
181
+ props.subLayers = (_d = changedProps.subLayers) !== null && _d !== void 0 ? _d : this.subLayers;
182
+ return props;
172
183
  }
173
184
  /** @internal */
174
185
  displayMatches(other) {
175
- if (!this.matchesNameAndUrl(other.name, other.url)
176
- || this.visible !== other.visible
177
- || this.transparency !== other.transparency
178
- || this.transparentBackground !== other.transparentBackground
179
- || this.subLayers.length !== other.subLayers.length) {
186
+ if (!(other instanceof ImageMapLayerSettings) || !super.displayMatches(other))
180
187
  return false;
181
- }
182
- if (this.userName !== other.userName || this.password !== other.password) {
188
+ if (this.userName !== other.userName || this.password !== other.password || this.subLayers.length !== other.subLayers.length) {
183
189
  return false;
184
190
  }
185
191
  for (let i = 0; i < this.subLayers.length; i++)
@@ -187,10 +193,6 @@ class MapLayerSettings {
187
193
  return false;
188
194
  return true;
189
195
  }
190
- /** @internal */
191
- matchesNameAndUrl(name, url) {
192
- return this.name === name && this.url === url;
193
- }
194
196
  /** Return a sublayer matching id -- or undefined if not found */
195
197
  subLayerById(id) {
196
198
  return id === undefined ? undefined : this.subLayers.find((subLayer) => subLayer.id === id);
@@ -211,7 +213,7 @@ class MapLayerSettings {
211
213
  return false;
212
214
  return !this.hasInvisibleAncestors(subLayer);
213
215
  }
214
- /** Return true if all sublayers are visible. */
216
+ /** Return true if all sublayers are invisible. */
215
217
  get allSubLayersInvisible() {
216
218
  if (this.subLayers.length === 0)
217
219
  return false;
@@ -229,9 +231,76 @@ class MapLayerSettings {
229
231
  });
230
232
  return children;
231
233
  }
234
+ /** @internal */
235
+ static mapTypeName(type) {
236
+ switch (type) {
237
+ case BackgroundMapProvider_1.BackgroundMapType.Aerial:
238
+ return "Aerial Imagery";
239
+ default:
240
+ case BackgroundMapProvider_1.BackgroundMapType.Hybrid:
241
+ return "Aerial Imagery with labels";
242
+ case BackgroundMapProvider_1.BackgroundMapType.Street:
243
+ return "Streets";
244
+ }
245
+ }
246
+ setCredentials(userName, password) {
247
+ this.userName = userName;
248
+ this.password = password;
249
+ }
232
250
  }
233
- exports.MapLayerSettings = MapLayerSettings;
234
- /** A [[MapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
251
+ exports.ImageMapLayerSettings = ImageMapLayerSettings;
252
+ /** Normalized representation of a [[ModelMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
253
+ * Model map layers are produced from models, typically from two dimensional geometry that may originate in a GIS system.
254
+ * One or more map layers may be included within [[MapImagerySettings]] object.
255
+ * @see [[MapImagerySettings]]
256
+ * @see [[ImageMapLayerSettings]] for image based map layer settings.
257
+ * @beta
258
+ */
259
+ class ModelMapLayerSettings extends MapLayerSettings {
260
+ /** @internal */
261
+ constructor(modelId, name, visible = true, transparency = 0, transparentBackground = true) {
262
+ super(name, visible, transparency, transparentBackground);
263
+ this.modelId = modelId;
264
+ }
265
+ get source() { return this.modelId; }
266
+ /** Construct from JSON, performing validation and applying default values for undefined fields. */
267
+ static fromJSON(json) {
268
+ const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;
269
+ return new this(json.modelId, json.name, json.visible, json.transparency, transparentBackground);
270
+ }
271
+ /** return JSON representation of this MapLayerSettings object */
272
+ toJSON() {
273
+ const props = super._toJSON();
274
+ props.modelId = this.modelId;
275
+ return props;
276
+ }
277
+ /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
278
+ * @param changedProps JSON representation of the properties to change.
279
+ * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
280
+ */
281
+ clone(changedProps) {
282
+ return ModelMapLayerSettings.fromJSON(this.cloneProps(changedProps));
283
+ }
284
+ /** @internal */
285
+ cloneProps(changedProps) {
286
+ var _a;
287
+ const props = super.cloneProps(changedProps);
288
+ props.modelId = (_a = changedProps.modelId) !== null && _a !== void 0 ? _a : this.modelId;
289
+ return props;
290
+ }
291
+ /** @internal */
292
+ displayMatches(other) {
293
+ if (!(other instanceof ModelMapLayerSettings) || !super.displayMatches(other))
294
+ return false;
295
+ return this.modelId === other.modelId;
296
+ }
297
+ /** Return true if all sublayers are invisible (always false as model layers do not include sublayers). */
298
+ get allSubLayersInvisible() {
299
+ return false;
300
+ }
301
+ }
302
+ exports.ModelMapLayerSettings = ModelMapLayerSettings;
303
+ /** A [[ImageMapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
235
304
  * The base layer supports all of the same options as any other layer, but also allows for simplified configuration based
236
305
  * on a small set of known supported [[BackgroundMapProvider]]s like [Bing Maps](https://www.microsoft.com/en-us/maps).
237
306
  * If the base layer was configured from such a provider, that information will be preserved and can be queried; this allows
@@ -239,7 +308,7 @@ exports.MapLayerSettings = MapLayerSettings;
239
308
  * @see [[MapImagerySettings.backgroundBase]].
240
309
  * @beta
241
310
  */
242
- class BaseMapLayerSettings extends MapLayerSettings {
311
+ class BaseMapLayerSettings extends ImageMapLayerSettings {
243
312
  /** The provider from which this base layer was configured, if any. */
244
313
  get provider() { return this._provider; }
245
314
  /** Create a base layer from its JSON representation.
@@ -264,7 +333,9 @@ class BaseMapLayerSettings extends MapLayerSettings {
264
333
  /** @internal */
265
334
  cloneProps(changedProps) {
266
335
  const props = super.cloneProps(changedProps);
267
- if (this.provider)
336
+ if (changedProps.provider)
337
+ props.provider = changedProps.provider;
338
+ else if (this.provider)
268
339
  props.provider = this.provider.toJSON();
269
340
  return props;
270
341
  }
@@ -296,21 +367,21 @@ class BaseMapLayerSettings extends MapLayerSettings {
296
367
  imagerySet = "AerialWithLabels";
297
368
  break;
298
369
  }
299
- name = `Bing Maps: ${MapLayerSettings.mapTypeName(provider.type)}`;
370
+ name = `Bing Maps: ${ImageMapLayerSettings.mapTypeName(provider.type)}`;
300
371
  url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${imagerySet}?o=json&incl=ImageryProviders&key={bingKey}`;
301
372
  break;
302
373
  case "MapBoxProvider":
303
374
  formatId = "MapboxImagery";
304
- name = `MapBox: ${MapLayerSettings.mapTypeName(provider.type)}`;
375
+ name = `MapBox: ${ImageMapLayerSettings.mapTypeName(provider.type)}`;
305
376
  switch (provider.type) {
306
377
  case BackgroundMapProvider_1.BackgroundMapType.Street:
307
- url = "https://api.mapbox.com/v4/mapbox.streets/";
378
+ url = "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/";
308
379
  break;
309
380
  case BackgroundMapProvider_1.BackgroundMapType.Aerial:
310
- url = "https://api.mapbox.com/v4/mapbox.satellite/";
381
+ url = "https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/";
311
382
  break;
312
383
  case BackgroundMapProvider_1.BackgroundMapType.Hybrid:
313
- url = "https://api.mapbox.com/v4/mapbox.streets-satellite/";
384
+ url = "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/";
314
385
  break;
315
386
  }
316
387
  break;
@@ -320,7 +391,6 @@ class BaseMapLayerSettings extends MapLayerSettings {
320
391
  formatId,
321
392
  url,
322
393
  transparentBackground: false,
323
- isBase: true,
324
394
  visible: !(options === null || options === void 0 ? void 0 : options.invisible),
325
395
  transparency: options === null || options === void 0 ? void 0 : options.transparency,
326
396
  });