@itwin/core-common 3.1.0-dev.8 → 3.2.0-dev.12

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 (86) hide show
  1. package/CHANGELOG.md +87 -17
  2. package/lib/cjs/BackgroundMapProvider.d.ts +4 -0
  3. package/lib/cjs/BackgroundMapProvider.d.ts.map +1 -1
  4. package/lib/cjs/BackgroundMapProvider.js +9 -0
  5. package/lib/cjs/BackgroundMapProvider.js.map +1 -1
  6. package/lib/cjs/Fonts.d.ts +16 -5
  7. package/lib/cjs/Fonts.d.ts.map +1 -1
  8. package/lib/cjs/Fonts.js +6 -2
  9. package/lib/cjs/Fonts.js.map +1 -1
  10. package/lib/cjs/MapImagerySettings.d.ts +2 -0
  11. package/lib/cjs/MapImagerySettings.d.ts.map +1 -1
  12. package/lib/cjs/MapImagerySettings.js.map +1 -1
  13. package/lib/cjs/MapLayerSettings.d.ts +120 -37
  14. package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
  15. package/lib/cjs/MapLayerSettings.js +156 -86
  16. package/lib/cjs/MapLayerSettings.js.map +1 -1
  17. package/lib/cjs/SpatialClassification.d.ts +5 -0
  18. package/lib/cjs/SpatialClassification.d.ts.map +1 -1
  19. package/lib/cjs/SpatialClassification.js +7 -0
  20. package/lib/cjs/SpatialClassification.js.map +1 -1
  21. package/lib/cjs/geometry/TextString.d.ts +5 -4
  22. package/lib/cjs/geometry/TextString.d.ts.map +1 -1
  23. package/lib/cjs/geometry/TextString.js.map +1 -1
  24. package/lib/cjs/ipc/IpcWebSocket.d.ts +0 -1
  25. package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
  26. package/lib/cjs/ipc/IpcWebSocket.js +4 -13
  27. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  28. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +2 -1
  29. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  30. package/lib/cjs/ipc/IpcWebSocketTransport.js +24 -15
  31. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  32. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +1 -0
  33. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  34. package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -0
  35. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  36. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  37. package/lib/cjs/rpc/core/RpcInvocation.js +1 -6
  38. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  39. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  40. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  41. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  42. package/lib/cjs/tile/IModelTileIO.js +2 -2
  43. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  44. package/lib/esm/BackgroundMapProvider.d.ts +4 -0
  45. package/lib/esm/BackgroundMapProvider.d.ts.map +1 -1
  46. package/lib/esm/BackgroundMapProvider.js +9 -0
  47. package/lib/esm/BackgroundMapProvider.js.map +1 -1
  48. package/lib/esm/Fonts.d.ts +16 -5
  49. package/lib/esm/Fonts.d.ts.map +1 -1
  50. package/lib/esm/Fonts.js +6 -2
  51. package/lib/esm/Fonts.js.map +1 -1
  52. package/lib/esm/MapImagerySettings.d.ts +2 -0
  53. package/lib/esm/MapImagerySettings.d.ts.map +1 -1
  54. package/lib/esm/MapImagerySettings.js.map +1 -1
  55. package/lib/esm/MapLayerSettings.d.ts +120 -37
  56. package/lib/esm/MapLayerSettings.d.ts.map +1 -1
  57. package/lib/esm/MapLayerSettings.js +152 -84
  58. package/lib/esm/MapLayerSettings.js.map +1 -1
  59. package/lib/esm/SpatialClassification.d.ts +5 -0
  60. package/lib/esm/SpatialClassification.d.ts.map +1 -1
  61. package/lib/esm/SpatialClassification.js +7 -0
  62. package/lib/esm/SpatialClassification.js.map +1 -1
  63. package/lib/esm/geometry/TextString.d.ts +5 -4
  64. package/lib/esm/geometry/TextString.d.ts.map +1 -1
  65. package/lib/esm/geometry/TextString.js.map +1 -1
  66. package/lib/esm/ipc/IpcWebSocket.d.ts +0 -1
  67. package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
  68. package/lib/esm/ipc/IpcWebSocket.js +4 -13
  69. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  70. package/lib/esm/ipc/IpcWebSocketTransport.d.ts +2 -1
  71. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  72. package/lib/esm/ipc/IpcWebSocketTransport.js +24 -15
  73. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  74. package/lib/esm/rpc/IModelReadRpcInterface.d.ts +1 -0
  75. package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  76. package/lib/esm/rpc/IModelReadRpcInterface.js +1 -0
  77. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  78. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  79. package/lib/esm/rpc/core/RpcInvocation.js +1 -6
  80. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  81. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  82. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  83. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  84. package/lib/esm/tile/IModelTileIO.js +2 -2
  85. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  86. 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,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,aAAa;IACb,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,gIAAgI;IAChI,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,oFAAoF;IACpF,SAAgB,EAAE,EAAE,UAAU,CAAC;IAC/B,oCAAoC;IACpC,SAAgB,QAAQ,CAAC,EAAE,UA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,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"}
@@ -68,85 +68,98 @@ export class MapSubLayerSettings {
68
68
  /** return a string representing this sublayer id (converting to string if underlying id is number) */
69
69
  get idString() { return (typeof this.id === "number") ? this.id.toString(10) : this.id; }
70
70
  }
71
- /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
71
+ /** 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.
72
+ * This class is extended by [[ImageMapLayerSettings]] and [ModelMapLayerSettings]] to create the settings for image and model based layers.
72
73
  * One or more map layers may be included within [[MapImagerySettings]] object.
73
74
  * @see [[MapImagerySettings]]
74
75
  * @beta
75
76
  */
76
77
  export class MapLayerSettings {
77
78
  /** @internal */
78
- constructor(url, name, formatId, visible = true, jsonSubLayers = undefined, transparency = 0, transparentBackground = true, isBase = false, userName, password, accessKey) {
79
- var _a;
80
- this.formatId = formatId;
79
+ constructor(name, visible = true, transparency = 0, transparentBackground = true) {
81
80
  this.name = name;
82
81
  this.visible = visible;
83
82
  this.transparentBackground = transparentBackground;
84
- this.isBase = isBase;
85
- this.subLayers = new Array();
86
- if (jsonSubLayers !== undefined) {
87
- let hasUnnamedGroups = false;
88
- for (const jsonSubLayer of jsonSubLayers) {
89
- const subLayer = MapSubLayerSettings.fromJSON(jsonSubLayer);
90
- if (undefined !== subLayer) {
91
- this.subLayers.push(subLayer);
92
- if (((_a = subLayer.children) === null || _a === void 0 ? void 0 : _a.length) !== 0 && !subLayer.isNamed && !hasUnnamedGroups)
93
- hasUnnamedGroups = true;
94
- }
95
- }
96
- this.userName = userName;
97
- this.password = password;
98
- }
99
- this.accessKey = accessKey;
100
83
  this.transparency = transparency;
101
- this.url = url;
102
- }
103
- setCredentials(userName, password) {
104
- this.userName = userName;
105
- this.password = password;
106
84
  }
107
- /** Construct from JSON, performing validation and applying default values for undefined fields. */
108
- static fromJSON(json) {
109
- const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;
110
- return new this(json.url, json.name, json.formatId, json.visible, json.subLayers, json.transparency, transparentBackground, json.isBase === true, undefined, undefined, json.accessKey);
85
+ /** Create a map layer settings from its JSON representation. */
86
+ static fromJSON(props) {
87
+ return undefined !== props.modelId ? ModelMapLayerSettings.fromJSON(props) : ImageMapLayerSettings.fromJSON(props);
111
88
  }
112
- /** return JSON representation of this MapLayerSettings object */
113
- toJSON() {
114
- const props = { formatId: this.formatId, name: this.name, url: this.url };
115
- if (this.subLayers.length > 0) {
116
- props.subLayers = [];
117
- this.subLayers.forEach((subLayer) => {
118
- const subLayerJson = subLayer.toJSON();
119
- if (subLayerJson)
120
- props.subLayers.push(subLayerJson);
121
- });
122
- }
89
+ /** @internal */
90
+ _toJSON() {
91
+ const props = {
92
+ name: this.name,
93
+ visible: this.visible,
94
+ };
123
95
  if (0 !== this.transparency)
124
96
  props.transparency = this.transparency;
125
97
  if (this.transparentBackground === false)
126
98
  props.transparentBackground = this.transparentBackground;
127
- if (this.isBase === true)
128
- props.isBase = this.isBase;
129
- props.visible = this.visible;
130
99
  return props;
131
100
  }
132
101
  /** @internal */
133
- static mapTypeName(type) {
134
- switch (type) {
135
- case BackgroundMapType.Aerial:
136
- return "Aerial Imagery";
137
- default:
138
- case BackgroundMapType.Hybrid:
139
- return "Aerial Imagery with labels";
140
- case BackgroundMapType.Street:
141
- return "Streets";
102
+ cloneProps(changedProps) {
103
+ return {
104
+ name: undefined !== changedProps.name ? changedProps.name : this.name,
105
+ visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,
106
+ transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,
107
+ transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,
108
+ };
109
+ }
110
+ /** @internal */
111
+ displayMatches(other) {
112
+ return this.name === other.name && this.visible === other.visible && this.transparency === other.transparency && this.transparentBackground === other.transparentBackground;
113
+ }
114
+ /** @internal */
115
+ matchesNameAndSource(name, source) {
116
+ return this.name === name && this.source === source;
117
+ }
118
+ }
119
+ /** Normalized representation of a [[ImageMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
120
+ * Image map layers are created from servers that produce images that represent map tiles. Map layers map also be represented by models.
121
+ * One or more map layers may be included within [[MapImagerySettings]] object.
122
+ * @see [[MapImagerySettings]]
123
+ * @see [[ModelMapLayerSettings]] for model based map layer settings.
124
+ * @beta
125
+ */
126
+ export class ImageMapLayerSettings extends MapLayerSettings {
127
+ /** @internal */
128
+ constructor(props) {
129
+ var _a;
130
+ const transparentBackground = (_a = props.transparentBackground) !== null && _a !== void 0 ? _a : true;
131
+ super(props.name, props.visible, props.transparency, transparentBackground);
132
+ this.formatId = props.formatId;
133
+ this.url = props.url;
134
+ this.accessKey = props.accessKey;
135
+ this.subLayers = [];
136
+ if (!props.subLayers)
137
+ return;
138
+ for (const subLayerProps of props.subLayers) {
139
+ const subLayer = MapSubLayerSettings.fromJSON(subLayerProps);
140
+ if (subLayer)
141
+ this.subLayers.push(subLayer);
142
142
  }
143
143
  }
144
+ get source() { return this.url; }
145
+ static fromJSON(props) {
146
+ return new this(props);
147
+ }
148
+ /** return JSON representation of this MapLayerSettings object */
149
+ toJSON() {
150
+ const props = super._toJSON();
151
+ props.url = this.url;
152
+ props.formatId = this.formatId;
153
+ if (this.subLayers.length > 0)
154
+ props.subLayers = this.subLayers.map((x) => x.toJSON());
155
+ return props;
156
+ }
144
157
  /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
145
158
  * @param changedProps JSON representation of the properties to change.
146
159
  * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
147
160
  */
148
161
  clone(changedProps) {
149
- const clone = MapLayerSettings.fromJSON(this.cloneProps(changedProps));
162
+ const clone = ImageMapLayerSettings.fromJSON(this.cloneProps(changedProps));
150
163
  // Clone members not part of MapLayerProps
151
164
  clone.userName = this.userName;
152
165
  clone.password = this.password;
@@ -155,27 +168,19 @@ export class MapLayerSettings {
155
168
  }
156
169
  /** @internal */
157
170
  cloneProps(changedProps) {
158
- return {
159
- name: undefined !== changedProps.name ? changedProps.name : this.name,
160
- formatId: undefined !== changedProps.formatId ? changedProps.formatId : this.formatId,
161
- visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,
162
- url: undefined !== changedProps.url ? changedProps.url : this.url,
163
- transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,
164
- transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,
165
- subLayers: undefined !== changedProps.subLayers ? changedProps.subLayers : this.subLayers,
166
- accessKey: undefined !== changedProps.accessKey ? changedProps.accessKey : this.accessKey,
167
- };
171
+ var _a, _b, _c, _d;
172
+ const props = super.cloneProps(changedProps);
173
+ props.formatId = (_a = changedProps.formatId) !== null && _a !== void 0 ? _a : this.formatId;
174
+ props.url = (_b = changedProps.url) !== null && _b !== void 0 ? _b : this.url;
175
+ props.accessKey = (_c = changedProps.accessKey) !== null && _c !== void 0 ? _c : this.accessKey;
176
+ props.subLayers = (_d = changedProps.subLayers) !== null && _d !== void 0 ? _d : this.subLayers;
177
+ return props;
168
178
  }
169
179
  /** @internal */
170
180
  displayMatches(other) {
171
- if (!this.matchesNameAndUrl(other.name, other.url)
172
- || this.visible !== other.visible
173
- || this.transparency !== other.transparency
174
- || this.transparentBackground !== other.transparentBackground
175
- || this.subLayers.length !== other.subLayers.length) {
181
+ if (!(other instanceof ImageMapLayerSettings) || !super.displayMatches(other))
176
182
  return false;
177
- }
178
- if (this.userName !== other.userName || this.password !== other.password) {
183
+ if (this.userName !== other.userName || this.password !== other.password || this.subLayers.length !== other.subLayers.length) {
179
184
  return false;
180
185
  }
181
186
  for (let i = 0; i < this.subLayers.length; i++)
@@ -183,10 +188,6 @@ export class MapLayerSettings {
183
188
  return false;
184
189
  return true;
185
190
  }
186
- /** @internal */
187
- matchesNameAndUrl(name, url) {
188
- return this.name === name && this.url === url;
189
- }
190
191
  /** Return a sublayer matching id -- or undefined if not found */
191
192
  subLayerById(id) {
192
193
  return id === undefined ? undefined : this.subLayers.find((subLayer) => subLayer.id === id);
@@ -207,7 +208,7 @@ export class MapLayerSettings {
207
208
  return false;
208
209
  return !this.hasInvisibleAncestors(subLayer);
209
210
  }
210
- /** Return true if all sublayers are visible. */
211
+ /** Return true if all sublayers are invisible. */
211
212
  get allSubLayersInvisible() {
212
213
  if (this.subLayers.length === 0)
213
214
  return false;
@@ -225,8 +226,74 @@ export class MapLayerSettings {
225
226
  });
226
227
  return children;
227
228
  }
229
+ /** @internal */
230
+ static mapTypeName(type) {
231
+ switch (type) {
232
+ case BackgroundMapType.Aerial:
233
+ return "Aerial Imagery";
234
+ default:
235
+ case BackgroundMapType.Hybrid:
236
+ return "Aerial Imagery with labels";
237
+ case BackgroundMapType.Street:
238
+ return "Streets";
239
+ }
240
+ }
241
+ setCredentials(userName, password) {
242
+ this.userName = userName;
243
+ this.password = password;
244
+ }
245
+ }
246
+ /** Normalized representation of a [[ModelMapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
247
+ * Model map layers are produced from models, typically from two dimensional geometry that may originate in a GIS system.
248
+ * One or more map layers may be included within [[MapImagerySettings]] object.
249
+ * @see [[MapImagerySettings]]
250
+ * @see [[ImageMapLayerSettings]] for image based map layer settings.
251
+ * @beta
252
+ */
253
+ export class ModelMapLayerSettings extends MapLayerSettings {
254
+ /** @internal */
255
+ constructor(modelId, name, visible = true, transparency = 0, transparentBackground = true) {
256
+ super(name, visible, transparency, transparentBackground);
257
+ this.modelId = modelId;
258
+ }
259
+ get source() { return this.modelId; }
260
+ /** Construct from JSON, performing validation and applying default values for undefined fields. */
261
+ static fromJSON(json) {
262
+ const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;
263
+ return new this(json.modelId, json.name, json.visible, json.transparency, transparentBackground);
264
+ }
265
+ /** return JSON representation of this MapLayerSettings object */
266
+ toJSON() {
267
+ const props = super._toJSON();
268
+ props.modelId = this.modelId;
269
+ return props;
270
+ }
271
+ /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.
272
+ * @param changedProps JSON representation of the properties to change.
273
+ * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
274
+ */
275
+ clone(changedProps) {
276
+ return ModelMapLayerSettings.fromJSON(this.cloneProps(changedProps));
277
+ }
278
+ /** @internal */
279
+ cloneProps(changedProps) {
280
+ var _a;
281
+ const props = super.cloneProps(changedProps);
282
+ props.modelId = (_a = changedProps.modelId) !== null && _a !== void 0 ? _a : this.modelId;
283
+ return props;
284
+ }
285
+ /** @internal */
286
+ displayMatches(other) {
287
+ if (!(other instanceof ModelMapLayerSettings) || !super.displayMatches(other))
288
+ return false;
289
+ return this.modelId === other.modelId;
290
+ }
291
+ /** Return true if all sublayers are invisible (always false as model layers do not include sublayers). */
292
+ get allSubLayersInvisible() {
293
+ return false;
294
+ }
228
295
  }
229
- /** A [[MapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
296
+ /** A [[ImageMapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].
230
297
  * The base layer supports all of the same options as any other layer, but also allows for simplified configuration based
231
298
  * on a small set of known supported [[BackgroundMapProvider]]s like [Bing Maps](https://www.microsoft.com/en-us/maps).
232
299
  * If the base layer was configured from such a provider, that information will be preserved and can be queried; this allows
@@ -234,7 +301,7 @@ export class MapLayerSettings {
234
301
  * @see [[MapImagerySettings.backgroundBase]].
235
302
  * @beta
236
303
  */
237
- export class BaseMapLayerSettings extends MapLayerSettings {
304
+ export class BaseMapLayerSettings extends ImageMapLayerSettings {
238
305
  /** The provider from which this base layer was configured, if any. */
239
306
  get provider() { return this._provider; }
240
307
  /** Create a base layer from its JSON representation.
@@ -259,7 +326,9 @@ export class BaseMapLayerSettings extends MapLayerSettings {
259
326
  /** @internal */
260
327
  cloneProps(changedProps) {
261
328
  const props = super.cloneProps(changedProps);
262
- if (this.provider)
329
+ if (changedProps.provider)
330
+ props.provider = changedProps.provider;
331
+ else if (this.provider)
263
332
  props.provider = this.provider.toJSON();
264
333
  return props;
265
334
  }
@@ -291,21 +360,21 @@ export class BaseMapLayerSettings extends MapLayerSettings {
291
360
  imagerySet = "AerialWithLabels";
292
361
  break;
293
362
  }
294
- name = `Bing Maps: ${MapLayerSettings.mapTypeName(provider.type)}`;
363
+ name = `Bing Maps: ${ImageMapLayerSettings.mapTypeName(provider.type)}`;
295
364
  url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${imagerySet}?o=json&incl=ImageryProviders&key={bingKey}`;
296
365
  break;
297
366
  case "MapBoxProvider":
298
367
  formatId = "MapboxImagery";
299
- name = `MapBox: ${MapLayerSettings.mapTypeName(provider.type)}`;
368
+ name = `MapBox: ${ImageMapLayerSettings.mapTypeName(provider.type)}`;
300
369
  switch (provider.type) {
301
370
  case BackgroundMapType.Street:
302
- url = "https://api.mapbox.com/v4/mapbox.streets/";
371
+ url = "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/";
303
372
  break;
304
373
  case BackgroundMapType.Aerial:
305
- url = "https://api.mapbox.com/v4/mapbox.satellite/";
374
+ url = "https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/";
306
375
  break;
307
376
  case BackgroundMapType.Hybrid:
308
- url = "https://api.mapbox.com/v4/mapbox.streets-satellite/";
377
+ url = "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/";
309
378
  break;
310
379
  }
311
380
  break;
@@ -315,7 +384,6 @@ export class BaseMapLayerSettings extends MapLayerSettings {
315
384
  formatId,
316
385
  url,
317
386
  transparentBackground: false,
318
- isBase: true,
319
387
  visible: !(options === null || options === void 0 ? void 0 : options.invisible),
320
388
  transparency: options === null || options === void 0 ? void 0 : options.transparency,
321
389
  });