@itwin/core-common 4.0.0-dev.4 → 4.0.0-dev.41
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/CHANGELOG.md +35 -17
- package/lib/cjs/BackendTypes.d.ts +3 -3
- package/lib/cjs/BackendTypes.d.ts.map +1 -1
- package/lib/cjs/BackendTypes.js.map +1 -1
- package/lib/cjs/BackgroundMapProvider.js +1 -2
- package/lib/cjs/BackgroundMapProvider.js.map +1 -1
- package/lib/cjs/BackgroundMapSettings.js +11 -13
- package/lib/cjs/BackgroundMapSettings.js.map +1 -1
- package/lib/cjs/BriefcaseTypes.d.ts +2 -0
- package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/ClipStyle.js +6 -8
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/CloudStorage.d.ts +5 -5
- package/lib/cjs/CloudStorage.js +3 -3
- package/lib/cjs/CloudStorage.js.map +1 -1
- package/lib/cjs/CloudStorageTileCache.d.ts +1 -1
- package/lib/cjs/CloudStorageTileCache.js +2 -3
- package/lib/cjs/CloudStorageTileCache.js.map +1 -1
- package/lib/cjs/Code.d.ts +3 -3
- package/lib/cjs/Code.js +4 -5
- package/lib/cjs/Code.js.map +1 -1
- package/lib/cjs/ColorDef.js +1 -2
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContextRealityModel.js +6 -8
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/cjs/DisplayStyleSettings.js +16 -20
- package/lib/cjs/DisplayStyleSettings.js.map +1 -1
- package/lib/cjs/Environment.js +12 -15
- package/lib/cjs/Environment.js.map +1 -1
- package/lib/cjs/FeatureSymbology.js +1 -2
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/FeatureTable.js +1 -1
- package/lib/cjs/FeatureTable.js.map +1 -1
- package/lib/cjs/Gradient.js +2 -4
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/GraphicParams.js +1 -1
- package/lib/cjs/GraphicParams.js.map +1 -1
- package/lib/cjs/GroundPlane.js +3 -4
- package/lib/cjs/GroundPlane.js.map +1 -1
- package/lib/cjs/HSLColor.js +1 -1
- package/lib/cjs/HSLColor.js.map +1 -1
- package/lib/cjs/HSVColor.js +1 -1
- package/lib/cjs/HSVColor.js.map +1 -1
- package/lib/cjs/HiddenLine.js +3 -5
- package/lib/cjs/HiddenLine.js.map +1 -1
- package/lib/cjs/IModel.d.ts +1 -2
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +1 -1
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/LightSettings.js +18 -23
- package/lib/cjs/LightSettings.js.map +1 -1
- package/lib/cjs/MapImagerySettings.js +2 -2
- package/lib/cjs/MapImagerySettings.js.map +1 -1
- package/lib/cjs/MapLayerSettings.js +9 -13
- package/lib/cjs/MapLayerSettings.js.map +1 -1
- package/lib/cjs/ModelClipGroup.js +3 -5
- package/lib/cjs/ModelClipGroup.js.map +1 -1
- package/lib/cjs/QPoint.js +5 -7
- package/lib/cjs/QPoint.js.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.js +14 -15
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
- package/lib/cjs/RenderMaterial.js +1 -2
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/RenderSchedule.js +30 -40
- package/lib/cjs/RenderSchedule.js.map +1 -1
- package/lib/cjs/SkyBox.js +10 -11
- package/lib/cjs/SkyBox.js.map +1 -1
- package/lib/cjs/SolarShadows.js +1 -2
- package/lib/cjs/SolarShadows.js.map +1 -1
- package/lib/cjs/SpatialClassification.js +1 -2
- package/lib/cjs/SpatialClassification.js.map +1 -1
- package/lib/cjs/TerrainSettings.js +7 -9
- package/lib/cjs/TerrainSettings.js.map +1 -1
- package/lib/cjs/TextureMapping.js +4 -5
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/ThematicDisplay.js +1 -2
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/TileProps.js +1 -1
- package/lib/cjs/TileProps.js.map +1 -1
- package/lib/cjs/ViewDetails.js +1 -1
- package/lib/cjs/ViewDetails.js.map +1 -1
- package/lib/cjs/ViewFlags.js +24 -25
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/WhiteOnWhiteReversalSettings.js +1 -1
- package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/cjs/geometry/AreaPattern.js +1 -2
- package/lib/cjs/geometry/AreaPattern.js.map +1 -1
- package/lib/cjs/geometry/BoundingSphere.js +1 -1
- package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
- package/lib/cjs/geometry/CoordinateReferenceSystem.js +1 -2
- package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +1 -1
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.d.ts.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.js +0 -4
- package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.js +1 -2
- package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
- package/lib/cjs/geometry/GeodeticEllipsoid.js +1 -2
- package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/cjs/geometry/GeometryStream.js +5 -6
- package/lib/cjs/geometry/GeometryStream.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js +1 -2
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -2
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +2 -2
- package/lib/cjs/rpc/IModelTileRpcInterface.js +2 -2
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.js +1 -1
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPendingQueue.js +1 -2
- package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRegistry.js +1 -2
- package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +2 -4
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/cjs/tile/TileMetadata.js +1 -2
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/esm/BackendTypes.d.ts +3 -3
- package/lib/esm/BackendTypes.d.ts.map +1 -1
- package/lib/esm/BackendTypes.js.map +1 -1
- package/lib/esm/BackgroundMapProvider.js +1 -2
- package/lib/esm/BackgroundMapProvider.js.map +1 -1
- package/lib/esm/BackgroundMapSettings.js +11 -13
- package/lib/esm/BackgroundMapSettings.js.map +1 -1
- package/lib/esm/BriefcaseTypes.d.ts +2 -0
- package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/ClipStyle.js +6 -8
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/CloudStorage.d.ts +5 -5
- package/lib/esm/CloudStorage.js +3 -3
- package/lib/esm/CloudStorage.js.map +1 -1
- package/lib/esm/CloudStorageTileCache.d.ts +1 -1
- package/lib/esm/CloudStorageTileCache.js +2 -3
- package/lib/esm/CloudStorageTileCache.js.map +1 -1
- package/lib/esm/Code.d.ts +3 -3
- package/lib/esm/Code.js +4 -5
- package/lib/esm/Code.js.map +1 -1
- package/lib/esm/ColorDef.js +1 -2
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContextRealityModel.js +6 -8
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/lib/esm/DisplayStyleSettings.js +16 -20
- package/lib/esm/DisplayStyleSettings.js.map +1 -1
- package/lib/esm/Environment.js +12 -15
- package/lib/esm/Environment.js.map +1 -1
- package/lib/esm/FeatureSymbology.js +1 -2
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/FeatureTable.js +1 -1
- package/lib/esm/FeatureTable.js.map +1 -1
- package/lib/esm/Gradient.js +2 -4
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/GraphicParams.js +1 -1
- package/lib/esm/GraphicParams.js.map +1 -1
- package/lib/esm/GroundPlane.js +3 -4
- package/lib/esm/GroundPlane.js.map +1 -1
- package/lib/esm/HSLColor.js +1 -1
- package/lib/esm/HSLColor.js.map +1 -1
- package/lib/esm/HSVColor.js +1 -1
- package/lib/esm/HSVColor.js.map +1 -1
- package/lib/esm/HiddenLine.js +3 -5
- package/lib/esm/HiddenLine.js.map +1 -1
- package/lib/esm/IModel.d.ts +1 -2
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +1 -1
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/LightSettings.js +18 -23
- package/lib/esm/LightSettings.js.map +1 -1
- package/lib/esm/MapImagerySettings.js +2 -2
- package/lib/esm/MapImagerySettings.js.map +1 -1
- package/lib/esm/MapLayerSettings.js +9 -13
- package/lib/esm/MapLayerSettings.js.map +1 -1
- package/lib/esm/ModelClipGroup.js +3 -5
- package/lib/esm/ModelClipGroup.js.map +1 -1
- package/lib/esm/QPoint.js +5 -7
- package/lib/esm/QPoint.js.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.js +14 -15
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
- package/lib/esm/RenderMaterial.js +1 -2
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/RenderSchedule.js +30 -40
- package/lib/esm/RenderSchedule.js.map +1 -1
- package/lib/esm/SkyBox.js +10 -11
- package/lib/esm/SkyBox.js.map +1 -1
- package/lib/esm/SolarShadows.js +1 -2
- package/lib/esm/SolarShadows.js.map +1 -1
- package/lib/esm/SpatialClassification.js +1 -2
- package/lib/esm/SpatialClassification.js.map +1 -1
- package/lib/esm/TerrainSettings.js +7 -9
- package/lib/esm/TerrainSettings.js.map +1 -1
- package/lib/esm/TextureMapping.js +4 -5
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/ThematicDisplay.js +1 -2
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/TileProps.js +1 -1
- package/lib/esm/TileProps.js.map +1 -1
- package/lib/esm/ViewDetails.js +1 -1
- package/lib/esm/ViewDetails.js.map +1 -1
- package/lib/esm/ViewFlags.js +24 -25
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/WhiteOnWhiteReversalSettings.js +1 -1
- package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/esm/geometry/AreaPattern.js +1 -2
- package/lib/esm/geometry/AreaPattern.js.map +1 -1
- package/lib/esm/geometry/BoundingSphere.js +1 -1
- package/lib/esm/geometry/BoundingSphere.js.map +1 -1
- package/lib/esm/geometry/CoordinateReferenceSystem.js +1 -2
- package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +1 -1
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.d.ts.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.js +0 -4
- package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.js +1 -2
- package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
- package/lib/esm/geometry/GeodeticEllipsoid.js +1 -2
- package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/esm/geometry/GeometryStream.js +5 -6
- package/lib/esm/geometry/GeometryStream.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js +1 -2
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js +6 -2
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.d.ts +2 -2
- package/lib/esm/rpc/IModelTileRpcInterface.js +2 -2
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcControl.js +1 -1
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +3 -5
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcPendingQueue.js +1 -2
- package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/esm/rpc/core/RpcRegistry.js +1 -2
- package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +2 -4
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/esm/tile/TileMetadata.js +1 -2
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/package.json +9 -9
package/lib/esm/ClipStyle.js
CHANGED
|
@@ -15,7 +15,7 @@ import { FeatureAppearance } from "./FeatureSymbology";
|
|
|
15
15
|
*/
|
|
16
16
|
export class CutStyle {
|
|
17
17
|
constructor(viewflags, hiddenLine, appearance) {
|
|
18
|
-
this.viewflags = viewflags
|
|
18
|
+
this.viewflags = viewflags ?? {};
|
|
19
19
|
if (hiddenLine && !hiddenLine.matchesDefaults)
|
|
20
20
|
this.hiddenLine = hiddenLine;
|
|
21
21
|
if (appearance && !appearance.matchesDefaults)
|
|
@@ -29,9 +29,9 @@ export class CutStyle {
|
|
|
29
29
|
}
|
|
30
30
|
static fromJSON(props) {
|
|
31
31
|
if (JsonUtils.isNonEmptyObject(props)) {
|
|
32
|
-
const viewflags = { ...props
|
|
33
|
-
const hiddenLine =
|
|
34
|
-
const appearance =
|
|
32
|
+
const viewflags = { ...props?.viewflags };
|
|
33
|
+
const hiddenLine = props?.hiddenLine ? HiddenLine.Settings.fromJSON(props.hiddenLine) : undefined;
|
|
34
|
+
const appearance = props?.appearance ? FeatureAppearance.fromJSON(props.appearance) : undefined;
|
|
35
35
|
return this.create(viewflags, hiddenLine, appearance);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -40,14 +40,13 @@ export class CutStyle {
|
|
|
40
40
|
}
|
|
41
41
|
/** Return JSON representation. The representation is `undefined` if this style matches the default style. */
|
|
42
42
|
toJSON() {
|
|
43
|
-
var _a;
|
|
44
43
|
if (this.matchesDefaults)
|
|
45
44
|
return undefined;
|
|
46
45
|
const props = {};
|
|
47
46
|
if (JsonUtils.isNonEmptyObject(this.viewflags))
|
|
48
47
|
props.viewflags = this.viewflags;
|
|
49
48
|
if (this.hiddenLine && !this.hiddenLine.matchesDefaults)
|
|
50
|
-
props.hiddenLine =
|
|
49
|
+
props.hiddenLine = this.hiddenLine?.toJSON();
|
|
51
50
|
if (this.appearance && !this.appearance.matchesDefaults)
|
|
52
51
|
props.appearance = this.appearance.toJSON();
|
|
53
52
|
return props;
|
|
@@ -79,9 +78,8 @@ export class ClipStyle {
|
|
|
79
78
|
return new ClipStyle(produceCutGeometry, cutStyle, insideColor, outsideColor);
|
|
80
79
|
}
|
|
81
80
|
static fromJSON(props) {
|
|
82
|
-
var _a;
|
|
83
81
|
if (JsonUtils.isNonEmptyObject(props)) {
|
|
84
|
-
const produceCutGeometry =
|
|
82
|
+
const produceCutGeometry = props.produceCutGeometry ?? false;
|
|
85
83
|
const cutStyle = CutStyle.fromJSON(props.cutStyle);
|
|
86
84
|
const inside = props.insideColor ? RgbColor.fromJSON(props.insideColor) : undefined;
|
|
87
85
|
const outside = props.outsideColor ? RgbColor.fromJSON(props.outsideColor) : undefined;
|
package/lib/esm/ClipStyle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipStyle.js","sourceRoot":"","sources":["../../src/ClipStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAgB/E;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAWnB,YAAoB,SAAuC,EAAE,UAAgC,EAAE,UAA8B;QAC3H,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;QACjC,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,eAAe;YAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE/B,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,eAAe;YAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,6CAA6C;IAC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vC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC3B;QAED,IAAI,IAAI,CAAC,WAAW;YAClB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAEhD,IAAI,IAAI,CAAC,YAAY;YACnB,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uHAAuH;IACvH,IAAW,eAAe;QACxB,IAAI,IAAI,KAAK,SAAS,CAAC,QAAQ;YAC7B,OAAO,IAAI,CAAC;QAEd,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC9G,CAAC;;AA7DD,sEAAsE;AAC/C,kBAAQ,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ViewFlagOverrides } from \"./ViewFlags\";\r\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\r\nimport { HiddenLine } from \"./HiddenLine\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\n\r\n/** Wire format describing a [[CutStyle]] applied to section-cut geometry produced at intersections with a view's [ClipVector]($core-geometry).\r\n * @see [[ClipStyleProps.cutStyle]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CutStyleProps {\r\n /** If defined, overrides aspects of the view's [[ViewFlags]] when drawing the cut geometry. */\r\n viewflags?: ViewFlagOverrides;\r\n /** If defined, overrides the view's [[HiddenLine.Settings]] when drawing the cut geometry. */\r\n hiddenLine?: HiddenLine.SettingsProps;\r\n /** If defined, overrides aspects of the cut geometry's symbology. */\r\n appearance?: FeatureAppearanceProps;\r\n}\r\n\r\n/** As part of a [[ClipStyle]], describes how section-cut graphics should be displayed.\r\n * @note Section-cut graphics are only produced if [[ClipStyle.produceCutGeometry]] is `true`.\r\n * @public\r\n */\r\nexport class CutStyle {\r\n /** Selectively overrides some of the view's [[ViewFlags]] when drawing the section-cut graphics. */\r\n public readonly viewflags: Readonly<ViewFlagOverrides>;\r\n /** If defined, overrides the settings the view uses to draw the edges of the section-cut graphics. */\r\n public readonly hiddenLine?: HiddenLine.Settings;\r\n /** If defined, overrides aspects of the symbology of the section-cut graphics. */\r\n public readonly appearance?: FeatureAppearance;\r\n\r\n /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */\r\n public static readonly defaults = new CutStyle();\r\n\r\n private constructor(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance) {\r\n this.viewflags = viewflags ?? {};\r\n if (hiddenLine && !hiddenLine.matchesDefaults)\r\n this.hiddenLine = hiddenLine;\r\n\r\n if (appearance && !appearance.matchesDefaults)\r\n this.appearance = appearance;\r\n }\r\n\r\n /** Create a CutStyle from its components. */\r\n public static create(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance): CutStyle {\r\n if ((viewflags && JsonUtils.isNonEmptyObject(viewflags)) || (hiddenLine && !hiddenLine.matchesDefaults) || (appearance && !appearance.matchesDefaults))\r\n return new CutStyle(viewflags, hiddenLine, appearance);\r\n\r\n return this.defaults;\r\n }\r\n\r\n public static fromJSON(props?: CutStyleProps): CutStyle {\r\n if (JsonUtils.isNonEmptyObject(props)) {\r\n const viewflags = { ...props?.viewflags };\r\n const hiddenLine = props?.hiddenLine ? HiddenLine.Settings.fromJSON(props.hiddenLine) : undefined;\r\n const appearance = props?.appearance ? FeatureAppearance.fromJSON(props.appearance) : undefined;\r\n\r\n return this.create(viewflags, hiddenLine, appearance);\r\n } else {\r\n return this.defaults;\r\n }\r\n }\r\n\r\n /** Return JSON representation. The representation is `undefined` if this style matches the default style. */\r\n public toJSON(): CutStyleProps | undefined {\r\n if (this.matchesDefaults)\r\n return undefined;\r\n\r\n const props: CutStyleProps = {};\r\n if (JsonUtils.isNonEmptyObject(this.viewflags))\r\n props.viewflags = this.viewflags;\r\n\r\n if (this.hiddenLine && !this.hiddenLine.matchesDefaults)\r\n props.hiddenLine = this.hiddenLine?.toJSON();\r\n\r\n if (this.appearance && !this.appearance.matchesDefaults)\r\n props.appearance = this.appearance.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this style matches the default style - that is, it overrides none of the view's settings. */\r\n public get matchesDefaults(): boolean {\r\n if (this === CutStyle.defaults)\r\n return true;\r\n\r\n return !JsonUtils.isNonEmptyObject(this.viewflags) && (!this.hiddenLine || this.hiddenLine.matchesDefaults) && (!this.appearance || this.appearance.matchesDefaults);\r\n }\r\n}\r\n\r\n/** Wire format describing a [[ClipStyle]].\r\n * @see [[DisplayStyleSettingsProps.clipStyle]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ClipStyleProps {\r\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\r\n * - Solids (closed volumes) will produce facets on the clip planes.\r\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\r\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\r\n */\r\n produceCutGeometry?: boolean;\r\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\r\n cutStyle?: CutStyleProps;\r\n /** If defined, geometry inside the clip planes will be drawn in this color. */\r\n insideColor?: RgbColorProps;\r\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\r\n outsideColor?: RgbColorProps;\r\n}\r\n\r\n/** Describes symbology and behavior applied to a [ClipVector]($core-geometry) when applied to a [ViewState]($frontend) or [[ModelClipGroup]].\r\n * @see [[DisplayStyleSettings.clipStyle]].\r\n * @public\r\n */\r\nexport class ClipStyle {\r\n /** If `true`, geometry will be produced at the clip planes.\r\n * - Solids (closed volumes) will produce facets on the clip planes.\r\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\r\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\r\n */\r\n public readonly produceCutGeometry: boolean;\r\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\r\n public readonly cutStyle: CutStyle;\r\n /** If defined, geometry inside the clip planes will be drawn in this color. */\r\n public readonly insideColor?: RgbColor;\r\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\r\n public readonly outsideColor?: RgbColor;\r\n\r\n /** The default style, which overrides none of the view's settings. */\r\n public static readonly defaults = new ClipStyle(false, CutStyle.defaults, undefined, undefined);\r\n\r\n private constructor(produceCutGeometry: boolean, cutStyle: CutStyle, inside: RgbColor | undefined, outside: RgbColor | undefined) {\r\n this.produceCutGeometry = produceCutGeometry;\r\n this.cutStyle = cutStyle;\r\n this.insideColor = inside;\r\n this.outsideColor = outside;\r\n }\r\n\r\n /** Create a style from its components. */\r\n public static create(produceCutGeometry: boolean, cutStyle: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle {\r\n if (!produceCutGeometry && cutStyle.matchesDefaults && !insideColor && !outsideColor)\r\n return this.defaults;\r\n\r\n return new ClipStyle(produceCutGeometry, cutStyle, insideColor, outsideColor);\r\n }\r\n\r\n public static fromJSON(props?: ClipStyleProps): ClipStyle {\r\n if (JsonUtils.isNonEmptyObject(props)) {\r\n const produceCutGeometry = props.produceCutGeometry ?? false;\r\n const cutStyle = CutStyle.fromJSON(props.cutStyle);\r\n const inside = props.insideColor ? RgbColor.fromJSON(props.insideColor) : undefined;\r\n const outside = props.outsideColor ? RgbColor.fromJSON(props.outsideColor) : undefined;\r\n\r\n return this.create(produceCutGeometry, cutStyle, inside, outside);\r\n }\r\n\r\n return this.defaults;\r\n }\r\n\r\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\r\n public toJSON(): ClipStyleProps | undefined {\r\n if (this.matchesDefaults)\r\n return undefined;\r\n\r\n const props: ClipStyleProps = {};\r\n if (this.produceCutGeometry)\r\n props.produceCutGeometry = true;\r\n\r\n const cutStyle = this.cutStyle.toJSON();\r\n if (cutStyle) {\r\n assert(!this.cutStyle.matchesDefaults);\r\n props.cutStyle = cutStyle;\r\n }\r\n\r\n if (this.insideColor)\r\n props.insideColor = this.insideColor.toJSON();\r\n\r\n if (this.outsideColor)\r\n props.outsideColor = this.outsideColor.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this style matches the [[ClipStyle.defaults]] - that is, it overrides no settings from the view. */\r\n public get matchesDefaults(): boolean {\r\n if (this === ClipStyle.defaults)\r\n return true;\r\n\r\n return !this.produceCutGeometry && !this.insideColor && !this.outsideColor && this.cutStyle.matchesDefaults;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ClipStyle.js","sourceRoot":"","sources":["../../src/ClipStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAgB/E;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAWnB,YAAoB,SAAuC,EAAE,UAAgC,EAAE,UAA8B;QAC3H,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC;QACjC,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,eAAe;YAC3C,IAAI,CAAC,UAAU,GAA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Q,CAAC,eAAe,CAAC,CAAC;YACvC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC3B;QAED,IAAI,IAAI,CAAC,WAAW;YAClB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAEhD,IAAI,IAAI,CAAC,YAAY;YACnB,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uHAAuH;IACvH,IAAW,eAAe;QACxB,IAAI,IAAI,KAAK,SAAS,CAAC,QAAQ;YAC7B,OAAO,IAAI,CAAC;QAEd,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC9G,CAAC;;AA7DD,sEAAsE;AAC/C,kBAAQ,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ViewFlagOverrides } from \"./ViewFlags\";\r\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\r\nimport { HiddenLine } from \"./HiddenLine\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\n\r\n/** Wire format describing a [[CutStyle]] applied to section-cut geometry produced at intersections with a view's [ClipVector]($core-geometry).\r\n * @see [[ClipStyleProps.cutStyle]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CutStyleProps {\r\n /** If defined, overrides aspects of the view's [[ViewFlags]] when drawing the cut geometry. */\r\n viewflags?: ViewFlagOverrides;\r\n /** If defined, overrides the view's [[HiddenLine.Settings]] when drawing the cut geometry. */\r\n hiddenLine?: HiddenLine.SettingsProps;\r\n /** If defined, overrides aspects of the cut geometry's symbology. */\r\n appearance?: FeatureAppearanceProps;\r\n}\r\n\r\n/** As part of a [[ClipStyle]], describes how section-cut graphics should be displayed.\r\n * @note Section-cut graphics are only produced if [[ClipStyle.produceCutGeometry]] is `true`.\r\n * @public\r\n */\r\nexport class CutStyle {\r\n /** Selectively overrides some of the view's [[ViewFlags]] when drawing the section-cut graphics. */\r\n public readonly viewflags: Readonly<ViewFlagOverrides>;\r\n /** If defined, overrides the settings the view uses to draw the edges of the section-cut graphics. */\r\n public readonly hiddenLine?: HiddenLine.Settings;\r\n /** If defined, overrides aspects of the symbology of the section-cut graphics. */\r\n public readonly appearance?: FeatureAppearance;\r\n\r\n /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */\r\n public static readonly defaults = new CutStyle();\r\n\r\n private constructor(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance) {\r\n this.viewflags = viewflags ?? {};\r\n if (hiddenLine && !hiddenLine.matchesDefaults)\r\n this.hiddenLine = hiddenLine;\r\n\r\n if (appearance && !appearance.matchesDefaults)\r\n this.appearance = appearance;\r\n }\r\n\r\n /** Create a CutStyle from its components. */\r\n public static create(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance): CutStyle {\r\n if ((viewflags && JsonUtils.isNonEmptyObject(viewflags)) || (hiddenLine && !hiddenLine.matchesDefaults) || (appearance && !appearance.matchesDefaults))\r\n return new CutStyle(viewflags, hiddenLine, appearance);\r\n\r\n return this.defaults;\r\n }\r\n\r\n public static fromJSON(props?: CutStyleProps): CutStyle {\r\n if (JsonUtils.isNonEmptyObject(props)) {\r\n const viewflags = { ...props?.viewflags };\r\n const hiddenLine = props?.hiddenLine ? HiddenLine.Settings.fromJSON(props.hiddenLine) : undefined;\r\n const appearance = props?.appearance ? FeatureAppearance.fromJSON(props.appearance) : undefined;\r\n\r\n return this.create(viewflags, hiddenLine, appearance);\r\n } else {\r\n return this.defaults;\r\n }\r\n }\r\n\r\n /** Return JSON representation. The representation is `undefined` if this style matches the default style. */\r\n public toJSON(): CutStyleProps | undefined {\r\n if (this.matchesDefaults)\r\n return undefined;\r\n\r\n const props: CutStyleProps = {};\r\n if (JsonUtils.isNonEmptyObject(this.viewflags))\r\n props.viewflags = this.viewflags;\r\n\r\n if (this.hiddenLine && !this.hiddenLine.matchesDefaults)\r\n props.hiddenLine = this.hiddenLine?.toJSON();\r\n\r\n if (this.appearance && !this.appearance.matchesDefaults)\r\n props.appearance = this.appearance.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this style matches the default style - that is, it overrides none of the view's settings. */\r\n public get matchesDefaults(): boolean {\r\n if (this === CutStyle.defaults)\r\n return true;\r\n\r\n return !JsonUtils.isNonEmptyObject(this.viewflags) && (!this.hiddenLine || this.hiddenLine.matchesDefaults) && (!this.appearance || this.appearance.matchesDefaults);\r\n }\r\n}\r\n\r\n/** Wire format describing a [[ClipStyle]].\r\n * @see [[DisplayStyleSettingsProps.clipStyle]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ClipStyleProps {\r\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\r\n * - Solids (closed volumes) will produce facets on the clip planes.\r\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\r\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\r\n */\r\n produceCutGeometry?: boolean;\r\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\r\n cutStyle?: CutStyleProps;\r\n /** If defined, geometry inside the clip planes will be drawn in this color. */\r\n insideColor?: RgbColorProps;\r\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\r\n outsideColor?: RgbColorProps;\r\n}\r\n\r\n/** Describes symbology and behavior applied to a [ClipVector]($core-geometry) when applied to a [ViewState]($frontend) or [[ModelClipGroup]].\r\n * @see [[DisplayStyleSettings.clipStyle]].\r\n * @public\r\n */\r\nexport class ClipStyle {\r\n /** If `true`, geometry will be produced at the clip planes.\r\n * - Solids (closed volumes) will produce facets on the clip planes.\r\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\r\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\r\n */\r\n public readonly produceCutGeometry: boolean;\r\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\r\n public readonly cutStyle: CutStyle;\r\n /** If defined, geometry inside the clip planes will be drawn in this color. */\r\n public readonly insideColor?: RgbColor;\r\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\r\n public readonly outsideColor?: RgbColor;\r\n\r\n /** The default style, which overrides none of the view's settings. */\r\n public static readonly defaults = new ClipStyle(false, CutStyle.defaults, undefined, undefined);\r\n\r\n private constructor(produceCutGeometry: boolean, cutStyle: CutStyle, inside: RgbColor | undefined, outside: RgbColor | undefined) {\r\n this.produceCutGeometry = produceCutGeometry;\r\n this.cutStyle = cutStyle;\r\n this.insideColor = inside;\r\n this.outsideColor = outside;\r\n }\r\n\r\n /** Create a style from its components. */\r\n public static create(produceCutGeometry: boolean, cutStyle: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle {\r\n if (!produceCutGeometry && cutStyle.matchesDefaults && !insideColor && !outsideColor)\r\n return this.defaults;\r\n\r\n return new ClipStyle(produceCutGeometry, cutStyle, insideColor, outsideColor);\r\n }\r\n\r\n public static fromJSON(props?: ClipStyleProps): ClipStyle {\r\n if (JsonUtils.isNonEmptyObject(props)) {\r\n const produceCutGeometry = props.produceCutGeometry ?? false;\r\n const cutStyle = CutStyle.fromJSON(props.cutStyle);\r\n const inside = props.insideColor ? RgbColor.fromJSON(props.insideColor) : undefined;\r\n const outside = props.outsideColor ? RgbColor.fromJSON(props.outsideColor) : undefined;\r\n\r\n return this.create(produceCutGeometry, cutStyle, inside, outside);\r\n }\r\n\r\n return this.defaults;\r\n }\r\n\r\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\r\n public toJSON(): ClipStyleProps | undefined {\r\n if (this.matchesDefaults)\r\n return undefined;\r\n\r\n const props: ClipStyleProps = {};\r\n if (this.produceCutGeometry)\r\n props.produceCutGeometry = true;\r\n\r\n const cutStyle = this.cutStyle.toJSON();\r\n if (cutStyle) {\r\n assert(!this.cutStyle.matchesDefaults);\r\n props.cutStyle = cutStyle;\r\n }\r\n\r\n if (this.insideColor)\r\n props.insideColor = this.insideColor.toJSON();\r\n\r\n if (this.outsideColor)\r\n props.outsideColor = this.outsideColor.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this style matches the [[ClipStyle.defaults]] - that is, it overrides no settings from the view. */\r\n public get matchesDefaults(): boolean {\r\n if (this === ClipStyle.defaults)\r\n return true;\r\n\r\n return !this.produceCutGeometry && !this.insideColor && !this.outsideColor && this.cutStyle.matchesDefaults;\r\n }\r\n}\r\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @beta
|
|
6
|
-
* @deprecated in 3.x.
|
|
6
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
7
7
|
*/
|
|
8
8
|
export declare enum CloudStorageProvider {
|
|
9
9
|
Azure = 0,
|
|
@@ -14,7 +14,7 @@ export declare enum CloudStorageProvider {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* @beta
|
|
17
|
-
* @deprecated in 3.x.
|
|
17
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
18
18
|
*/
|
|
19
19
|
export interface CloudStorageContainerDescriptor {
|
|
20
20
|
provider?: CloudStorageProvider;
|
|
@@ -23,7 +23,7 @@ export interface CloudStorageContainerDescriptor {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @beta
|
|
26
|
-
* @deprecated in 3.x.
|
|
26
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
27
27
|
*/
|
|
28
28
|
export interface CloudStorageContainerUrl {
|
|
29
29
|
descriptor: CloudStorageContainerDescriptor;
|
|
@@ -36,14 +36,14 @@ export interface CloudStorageContainerUrl {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* @beta
|
|
39
|
-
* @deprecated in 3.x.
|
|
39
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
40
40
|
*/
|
|
41
41
|
export declare namespace CloudStorageContainerUrl {
|
|
42
42
|
function empty(): CloudStorageContainerUrl;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* @beta
|
|
46
|
-
* @deprecated in 3.x.
|
|
46
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
47
47
|
*/
|
|
48
48
|
export declare abstract class CloudStorageCache<TContentId, TContentType> {
|
|
49
49
|
private _containers;
|
package/lib/esm/CloudStorage.js
CHANGED
|
@@ -9,7 +9,7 @@ import { UnexpectedErrors } from "@itwin/core-bentley";
|
|
|
9
9
|
/* eslint-disable deprecation/deprecation */
|
|
10
10
|
/**
|
|
11
11
|
* @beta
|
|
12
|
-
* @deprecated in 3.x.
|
|
12
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
13
13
|
*/
|
|
14
14
|
export var CloudStorageProvider;
|
|
15
15
|
(function (CloudStorageProvider) {
|
|
@@ -21,7 +21,7 @@ export var CloudStorageProvider;
|
|
|
21
21
|
})(CloudStorageProvider || (CloudStorageProvider = {}));
|
|
22
22
|
/**
|
|
23
23
|
* @beta
|
|
24
|
-
* @deprecated in 3.x.
|
|
24
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
25
25
|
*/
|
|
26
26
|
export var CloudStorageContainerUrl;
|
|
27
27
|
(function (CloudStorageContainerUrl) {
|
|
@@ -37,7 +37,7 @@ export var CloudStorageContainerUrl;
|
|
|
37
37
|
})(CloudStorageContainerUrl || (CloudStorageContainerUrl = {}));
|
|
38
38
|
/**
|
|
39
39
|
* @beta
|
|
40
|
-
* @deprecated in 3.x.
|
|
40
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
41
41
|
*/
|
|
42
42
|
export class CloudStorageCache {
|
|
43
43
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,4CAA4C;AAE5C;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,iEAAK,CAAA;IACL,mEAAM,CAAA;IACN,uEAAQ,CAAA;IACR,uEAAQ,CAAA;IACR,qEAAO,CAAA;AACT,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AA0BD;;;GAGG;AACH,MAAM,KAAW,wBAAwB,CASxC;AATD,WAAiB,wBAAwB;IACvC,SAAgB,KAAK;QACnB,OAAO;YACL,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,EAAE;SACR,CAAC;IACJ,CAAC;IAPe,8BAAK,QAOpB,CAAA;AACH,CAAC,EATgB,wBAAwB,KAAxB,wBAAwB,QASxC;AAED;;;GAGG;AACH,MAAM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E,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;wBAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,OAAO,CAAC,SAAS,CAAC,CAAC;qBACpB;oBAAC,OAAO,GAAG,EAAE;wBACZ,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x.\r\n */\r\nexport enum CloudStorageProvider {\r\n Azure,\r\n Amazon,\r\n AliCloud,\r\n External,\r\n Unknown,\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x.\r\n */\r\nexport interface CloudStorageContainerDescriptor {\r\n provider?: CloudStorageProvider;\r\n name: string;\r\n resource?: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x.\r\n */\r\nexport interface CloudStorageContainerUrl {\r\n descriptor: CloudStorageContainerDescriptor;\r\n valid: number;\r\n expires: number;\r\n url: string;\r\n method?: string;\r\n headers?: Record<string, string>;\r\n bound?: boolean;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x.\r\n */\r\nexport namespace CloudStorageContainerUrl {\r\n export function empty(): CloudStorageContainerUrl {\r\n return {\r\n descriptor: { name: \"\" },\r\n valid: 0,\r\n expires: 0,\r\n url: \"\",\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x.\r\n */\r\nexport abstract class CloudStorageCache<TContentId, TContentType> {\r\n private _containers: Map<string, CloudStorageContainerUrl>;\r\n\r\n public provider: CloudStorageProvider = CloudStorageProvider.Unknown;\r\n public abstract formContainerName(id: TContentId): string;\r\n public abstract formResourceName(id: TContentId): string;\r\n protected formContainerKey(id: TContentId): string { return this.formContainerName(id); }\r\n protected abstract obtainContainerUrl(id: TContentId, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl>;\r\n protected abstract instantiateResource(response: Response): Promise<TContentType | undefined>;\r\n protected supplyUrlBase(_container: CloudStorageContainerUrl, _id: TContentId): string | undefined { return undefined; }\r\n\r\n public constructor() {\r\n this._containers = new Map();\r\n }\r\n\r\n public async retrieve(id: TContentId): Promise<TContentType | undefined> {\r\n try {\r\n const container = await this.getContainer(id);\r\n if (!container.url)\r\n return undefined;\r\n\r\n const response = await this.requestResource(container, id);\r\n if (response.ok) {\r\n const content = await this.instantiateResource(response);\r\n return content;\r\n }\r\n } catch (err) {\r\n UnexpectedErrors.handle(err);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n protected async requestResource(container: CloudStorageContainerUrl, id: TContentId): Promise<Response> {\r\n const base = this.supplyUrlBase(container, id);\r\n const url = (undefined === base || \"\" === base) ? new URL(container.url) : new URL(container.url, base);\r\n\r\n if (!container.bound) {\r\n url.pathname += `/${this.formResourceName(id)}`;\r\n }\r\n\r\n const init: RequestInit = {\r\n headers: container.headers,\r\n method: \"GET\",\r\n };\r\n\r\n return fetch(url.toString(), init);\r\n }\r\n\r\n private _pendingContainerRequests: Map<string, Promise<CloudStorageContainerUrl>> = new Map();\r\n\r\n protected async getContainer(id: TContentId): Promise<CloudStorageContainerUrl> {\r\n const now = new Date().getTime();\r\n const name = this.formContainerName(id);\r\n const resource = this.formResourceName(id);\r\n const key = this.formContainerKey(id);\r\n\r\n let container = this._containers.get(key);\r\n if (container && container.url && (container.valid > now || container.expires < now)) {\r\n container = undefined;\r\n this._containers.delete(key);\r\n }\r\n\r\n if (!container) {\r\n let request = this._pendingContainerRequests.get(key);\r\n if (!request) {\r\n request = new Promise(async (resolve, reject) => {\r\n try {\r\n container = await this.obtainContainerUrl(id, { name, resource });\r\n this._containers.set(key, container);\r\n this._pendingContainerRequests.delete(key);\r\n resolve(container);\r\n } catch (err) {\r\n this._pendingContainerRequests.delete(key);\r\n reject(err);\r\n }\r\n });\r\n\r\n this._pendingContainerRequests.set(key, request);\r\n }\r\n\r\n return request;\r\n }\r\n\r\n return container;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,4CAA4C;AAE5C;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,iEAAK,CAAA;IACL,mEAAM,CAAA;IACN,uEAAQ,CAAA;IACR,uEAAQ,CAAA;IACR,qEAAO,CAAA;AACT,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AA0BD;;;GAGG;AACH,MAAM,KAAW,wBAAwB,CASxC;AATD,WAAiB,wBAAwB;IACvC,SAAgB,KAAK;QACnB,OAAO;YACL,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,EAAE;SACR,CAAC;IACJ,CAAC;IAPe,8BAAK,QAOpB,CAAA;AACH,CAAC,EATgB,wBAAwB,KAAxB,w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MAAM,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;wBAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,OAAO,CAAC,SAAS,CAAC,CAAC;qBACpB;oBAAC,OAAO,GAAG,EAAE;wBACZ,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport enum CloudStorageProvider {\r\n Azure,\r\n Amazon,\r\n AliCloud,\r\n External,\r\n Unknown,\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport interface CloudStorageContainerDescriptor {\r\n provider?: CloudStorageProvider;\r\n name: string;\r\n resource?: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport interface CloudStorageContainerUrl {\r\n descriptor: CloudStorageContainerDescriptor;\r\n valid: number;\r\n expires: number;\r\n url: string;\r\n method?: string;\r\n headers?: Record<string, string>;\r\n bound?: boolean;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport namespace CloudStorageContainerUrl {\r\n export function empty(): CloudStorageContainerUrl {\r\n return {\r\n descriptor: { name: \"\" },\r\n valid: 0,\r\n expires: 0,\r\n url: \"\",\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport abstract class CloudStorageCache<TContentId, TContentType> {\r\n private _containers: Map<string, CloudStorageContainerUrl>;\r\n\r\n public provider: CloudStorageProvider = CloudStorageProvider.Unknown;\r\n public abstract formContainerName(id: TContentId): string;\r\n public abstract formResourceName(id: TContentId): string;\r\n protected formContainerKey(id: TContentId): string { return this.formContainerName(id); }\r\n protected abstract obtainContainerUrl(id: TContentId, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl>;\r\n protected abstract instantiateResource(response: Response): Promise<TContentType | undefined>;\r\n protected supplyUrlBase(_container: CloudStorageContainerUrl, _id: TContentId): string | undefined { return undefined; }\r\n\r\n public constructor() {\r\n this._containers = new Map();\r\n }\r\n\r\n public async retrieve(id: TContentId): Promise<TContentType | undefined> {\r\n try {\r\n const container = await this.getContainer(id);\r\n if (!container.url)\r\n return undefined;\r\n\r\n const response = await this.requestResource(container, id);\r\n if (response.ok) {\r\n const content = await this.instantiateResource(response);\r\n return content;\r\n }\r\n } catch (err) {\r\n UnexpectedErrors.handle(err);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n protected async requestResource(container: CloudStorageContainerUrl, id: TContentId): Promise<Response> {\r\n const base = this.supplyUrlBase(container, id);\r\n const url = (undefined === base || \"\" === base) ? new URL(container.url) : new URL(container.url, base);\r\n\r\n if (!container.bound) {\r\n url.pathname += `/${this.formResourceName(id)}`;\r\n }\r\n\r\n const init: RequestInit = {\r\n headers: container.headers,\r\n method: \"GET\",\r\n };\r\n\r\n return fetch(url.toString(), init);\r\n }\r\n\r\n private _pendingContainerRequests: Map<string, Promise<CloudStorageContainerUrl>> = new Map();\r\n\r\n protected async getContainer(id: TContentId): Promise<CloudStorageContainerUrl> {\r\n const now = new Date().getTime();\r\n const name = this.formContainerName(id);\r\n const resource = this.formResourceName(id);\r\n const key = this.formContainerKey(id);\r\n\r\n let container = this._containers.get(key);\r\n if (container && container.url && (container.valid > now || container.expires < now)) {\r\n container = undefined;\r\n this._containers.delete(key);\r\n }\r\n\r\n if (!container) {\r\n let request = this._pendingContainerRequests.get(key);\r\n if (!request) {\r\n request = new Promise(async (resolve, reject) => {\r\n try {\r\n container = await this.obtainContainerUrl(id, { name, resource });\r\n this._containers.set(key, container);\r\n this._pendingContainerRequests.delete(key);\r\n resolve(container);\r\n } catch (err) {\r\n this._pendingContainerRequests.delete(key);\r\n reject(err);\r\n }\r\n });\r\n\r\n this._pendingContainerRequests.set(key, request);\r\n }\r\n\r\n return request;\r\n }\r\n\r\n return container;\r\n }\r\n}\r\n"]}
|
|
@@ -12,7 +12,7 @@ export interface TileContentIdentifier {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* @beta
|
|
15
|
-
* @deprecated in 3.x.
|
|
15
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
16
16
|
*/
|
|
17
17
|
export declare class CloudStorageTileCache extends CloudStorageCache<TileContentIdentifier, Uint8Array> {
|
|
18
18
|
private static _instance;
|
|
@@ -10,7 +10,7 @@ import { CloudStorageCache, CloudStorageProvider } from "./CloudStorage";
|
|
|
10
10
|
import { IModelTileRpcInterface } from "./rpc/IModelTileRpcInterface";
|
|
11
11
|
/**
|
|
12
12
|
* @beta
|
|
13
|
-
* @deprecated in 3.x.
|
|
13
|
+
* @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.
|
|
14
14
|
*/
|
|
15
15
|
export class CloudStorageTileCache extends CloudStorageCache {
|
|
16
16
|
constructor() {
|
|
@@ -48,8 +48,7 @@ export class CloudStorageTileCache extends CloudStorageCache {
|
|
|
48
48
|
return `${id.tokenProps.iModelId}`;
|
|
49
49
|
}
|
|
50
50
|
formResourceName(id) {
|
|
51
|
-
|
|
52
|
-
const changesetId = ((_a = id.tokenProps.changeset) === null || _a === void 0 ? void 0 : _a.id) || "first";
|
|
51
|
+
const changesetId = id.tokenProps.changeset?.id || "first";
|
|
53
52
|
const version = id.guid ? id.guid : changesetId; // NB: id.guid can be null (backend) OR undefined (frontend) here...
|
|
54
53
|
return `tiles/${id.treeId}/${version}/${id.contentId}`;
|
|
55
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorageTileCache.js","sourceRoot":"","sources":["../../src/CloudStorageTileCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,4CAA4C;AAE5C,OAAO,EAAE,iBAAiB,EAA6D,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEpI,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAUtE;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAoD;IA0B7F;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAzBM,MAAM,CAAC,QAAQ;QACpB,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE;YACpC,qBAAqB,CAAC,SAAS,GAAG,IAAI,qBAAqB,EAAE,CAAC;SAC/D;QAED,OAAO,qBAAqB,CAAC,SAAS,CAAC;IACzC,CAAC;IAEM,2BAA2B,CAAC,GAAoC;QACrE,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAE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,CAAC;IAC9B,CAAC;IAEM,iBAAiB,CAAC,EAAyB;QAChD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAEM,gBAAgB,CAAC,EAAyB;QAC/C,MAAM,WAAW,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,IAAI,OAAO,CAAC;QAC3D,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,oEAAoE;QACrH,OAAO,SAAS,EAAE,CAAC,MAAM,IAAI,OAAO,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;IACzD,CAAC;IAEkB,gBAAgB,CAAC,EAAyB;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAoB,CAAC,QAAQ,EAAE;YACnD,OAAO,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;SAC/D;QAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nimport { CloudStorageCache, CloudStorageContainerDescriptor, CloudStorageContainerUrl, CloudStorageProvider } from \"./CloudStorage\";\r\nimport { IModelRpcProps } from \"./IModel\";\r\nimport { IModelTileRpcInterface } from \"./rpc/IModelTileRpcInterface\";\r\n\r\n/** @beta */\r\nexport interface TileContentIdentifier {\r\n tokenProps: IModelRpcProps;\r\n treeId: string;\r\n contentId: string;\r\n guid: string | undefined;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 3.x. Use [TileStorage]($frontend) (frontend) and [TileStorage]($backend) (backend) instead.\r\n */\r\nexport class CloudStorageTileCache extends CloudStorageCache<TileContentIdentifier, Uint8Array> {\r\n private static _instance: CloudStorageTileCache;\r\n\r\n public static getCache(): CloudStorageTileCache {\r\n if (!CloudStorageTileCache._instance) {\r\n CloudStorageTileCache._instance = new CloudStorageTileCache();\r\n }\r\n\r\n return CloudStorageTileCache._instance;\r\n }\r\n\r\n public supplyExpiryForContainerUrl(_id: CloudStorageContainerDescriptor): Date {\r\n const expiry = new Date();\r\n\r\n const today = new Date().getDay();\r\n const rolloverDay = 6; // saturday\r\n expiry.setHours((rolloverDay - today) * 24);\r\n\r\n expiry.setHours(23);\r\n expiry.setMinutes(59);\r\n expiry.setSeconds(59);\r\n expiry.setMilliseconds(999);\r\n\r\n return expiry;\r\n }\r\n\r\n protected constructor() {\r\n super();\r\n }\r\n\r\n protected async obtainContainerUrl(id: TileContentIdentifier, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl> {\r\n const client = IModelTileRpcInterface.getClient();\r\n return client.getTileCacheContainerUrl(id.tokenProps, descriptor);\r\n }\r\n\r\n protected async instantiateResource(response: Response): Promise<Uint8Array | undefined> {\r\n const data = await response.arrayBuffer();\r\n if (!data.byteLength) {\r\n return undefined;\r\n }\r\n\r\n return new Uint8Array(data);\r\n }\r\n\r\n public formContainerName(id: TileContentIdentifier): string {\r\n return `${id.tokenProps.iModelId}`;\r\n }\r\n\r\n public formResourceName(id: TileContentIdentifier): string {\r\n const changesetId = id.tokenProps.changeset?.id || \"first\";\r\n const version = id.guid ? id.guid : changesetId; // NB: id.guid can be null (backend) OR undefined (frontend) here...\r\n return `tiles/${id.treeId}/${version}/${id.contentId}`;\r\n }\r\n\r\n protected override formContainerKey(id: TileContentIdentifier): string {\r\n if (this.provider === CloudStorageProvider.AliCloud) {\r\n return this.formContainerName(id) + this.formResourceName(id);\r\n }\r\n\r\n return super.formContainerKey(id);\r\n }\r\n}\r\n"]}
|
package/lib/esm/Code.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
import { GuidString, Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { IModel } from "./IModel";
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
8
|
-
* For
|
|
7
|
+
* The ElementId of the element that defines the scope for a Code value.
|
|
8
|
+
* @note For insert or update, you may supply the FederationGuid of the scope element and it will be converted to the ElementId of that element.
|
|
9
9
|
* @public
|
|
10
10
|
* @extensions
|
|
11
11
|
*/
|
|
12
12
|
export declare type CodeScopeProps = Id64String | GuidString;
|
|
13
|
-
/** The
|
|
13
|
+
/** The parameters that define a Code
|
|
14
14
|
* @public
|
|
15
15
|
* @extensions
|
|
16
16
|
*/
|
package/lib/esm/Code.js
CHANGED
|
@@ -19,8 +19,8 @@ export class Code {
|
|
|
19
19
|
/** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element
|
|
20
20
|
* @note Leading and trailing whitespace is invalid so is automatically trimmed.
|
|
21
21
|
*/
|
|
22
|
-
get value() {
|
|
23
|
-
set value(val) { this._value = val
|
|
22
|
+
get value() { return this._value ?? ""; }
|
|
23
|
+
set value(val) { this._value = val?.trim(); }
|
|
24
24
|
/** Create an empty, non-unique code with no special meaning. */
|
|
25
25
|
static createEmpty() {
|
|
26
26
|
const id = Id64.fromLocalAndBriefcaseIds(1, 0);
|
|
@@ -214,7 +214,7 @@ export class CodeSpec {
|
|
|
214
214
|
this.iModel = iModel;
|
|
215
215
|
this.id = id;
|
|
216
216
|
this.name = name;
|
|
217
|
-
this.properties = properties
|
|
217
|
+
this.properties = properties ?? { scopeSpec: { type: CodeScopeSpec.Type.Repository } };
|
|
218
218
|
}
|
|
219
219
|
/** Create a new CodeSpec from the specified parameters
|
|
220
220
|
* > Note: CodeSpec.id will not be valid until inserted
|
|
@@ -253,8 +253,7 @@ export class CodeSpec {
|
|
|
253
253
|
* @deprecated in 3.6 Use scopeReq instead.
|
|
254
254
|
*/
|
|
255
255
|
get isManagedWithIModel() {
|
|
256
|
-
|
|
257
|
-
return (_b = (_a = this.properties.spec) === null || _a === void 0 ? void 0 : _a.isManagedWithDgnDb) !== null && _b !== void 0 ? _b : true;
|
|
256
|
+
return this.properties.spec?.isManagedWithDgnDb ?? true;
|
|
258
257
|
}
|
|
259
258
|
set isManagedWithIModel(value) {
|
|
260
259
|
if (!this.properties.spec)
|
package/lib/esm/Code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAwB9E;;;GAGG;AACH,MAAM,OAAO,IAAI;IAYf,YAAY,SAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAXD;;OAEG;IACH,IAAW,KAAK,aAAK,OAAO,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,CAAC;IAChD,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAS5D,gEAAgE;IACzD,MAAM,CAAC,WAAW;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE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UAAU,CAAC,CAAC;IACpD,CAAC;IAED,wDAAwD;IACxD,IAAW,OAAO,KAAc,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE/D,uCAAuC;IACvC,IAAW,SAAS,KAAyB,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,IAAW,SAAS,CAAC,SAA6B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IAEnG;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC;IAC5I,CAAC;IACD,IAAW,QAAQ,CAAC,GAAmC;QACrD,IAAI,aAAa,CAAC,gBAAgB,CAAC,cAAc,KAAK,GAAG;YACvD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC;;YAE/C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;;QAC5B,OAAO,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,0CAAE,kBAAkB,mCAAI,IAAI,CAAC;IAC1D,CAAC;IACD,IAAW,mBAAmB,CAAC,KAAc;QAC3C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { GuidString, Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"./IModel\";\r\n\r\n/**\r\n * The identity of the element defining the scope for a Code value.\r\n * For query input, may either be an ElementId or a FederationGuid. When returned from a query, it will be an ElementId.\r\n * @public\r\n * @extensions\r\n */\r\nexport type CodeScopeProps = Id64String | GuidString;\r\n\r\n/** The wire format for a Code\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CodeProps {\r\n /** Either the stringified 64-bit Id of the CodeSpec for this code, or the name of the CodeSpec. */\r\n spec: Id64String | string;\r\n /** Either the ElementId or the FederationGuid of the element that provides the scope for this code. */\r\n scope: CodeScopeProps;\r\n /** the value of this code. May be undefined. */\r\n value?: string;\r\n}\r\n\r\n/**\r\n * A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element\r\n * @public\r\n */\r\nexport class Code implements CodeProps {\r\n /** The id of the [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec) of the Element */\r\n public spec: Id64String;\r\n /** The [CodeScope]($docs/bis/guide/fundamentals/codes.md#codescope-property) of the Element */\r\n public scope: Id64String;\r\n /** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element\r\n * @note Leading and trailing whitespace is invalid so is automatically trimmed.\r\n */\r\n public get value() { return this._value ?? \"\"; }\r\n public set value(val: string) { this._value = val?.trim(); }\r\n private _value?: string;\r\n\r\n constructor(codeProps: CodeProps) {\r\n this.spec = Id64.fromJSON(codeProps.spec);\r\n this.scope = JsonUtils.asString(codeProps.scope);\r\n this.value = JsonUtils.asString(codeProps.value);\r\n }\r\n\r\n /** Create an empty, non-unique code with no special meaning. */\r\n public static createEmpty(): Code {\r\n const id = Id64.fromLocalAndBriefcaseIds(1, 0);\r\n return new Code({ spec: id, scope: id });\r\n }\r\n\r\n public static fromJSON(json?: any): Code { return json ? new Code(json) : Code.createEmpty(); }\r\n public toJSON(): CodeProps { return { spec: this.spec, scope: this.scope, value: this.value }; }\r\n public equals(other: Code): boolean { return Code.equalCodes(this, other); }\r\n /** @internal */\r\n public static equalCodes(c1: CodeProps, c2: CodeProps): boolean {\r\n return c1.spec === c2.spec && c1.scope === c2.scope && c1.value === c2.value;\r\n }\r\n /** Determine whether this Code is valid. */\r\n public static isValid(c: CodeProps): boolean { return Id64.isValidId64(c.spec); }\r\n /** Determine if this code is valid but not otherwise meaningful (and therefore not necessarily unique) */\r\n public static isEmpty(c: CodeProps): boolean { return this.isValid(c) && (c.value === undefined || c.value === \"\"); }\r\n}\r\n\r\n/** Names of the internal BIS CodeSpecs. These names match those specified by the native library.\r\n * For other domains, the best practice is to include the domain name or alias as part of the CodeSpec name to ensure global uniqueness.\r\n * @public\r\n* @extensions\r\n* @see [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec)\r\n */\r\nexport enum BisCodeSpec {\r\n /** The name of the standard [[CodeSpec]] used when creating *empty* codes.\r\n * @see [[Code.createEmpty]]\r\n */\r\n nullCodeSpec = \"bis:NullCodeSpec\",\r\n /** @internal */\r\n annotationFrameStyle = \"bis:AnnotationFrameStyle\",\r\n /** @internal */\r\n annotationLeaderStyle = \"bis:AnnotationLeaderStyle\",\r\n /** @internal */\r\n annotationTextStyle = \"bis:AnnotationTextStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem2d]($backend) elements.\r\n * @see [AuxCoordSystem2d.createCode]($backend)\r\n */\r\n auxCoordSystem2d = \"bis:AuxCoordSystem2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem3d]($backend) elements.\r\n * @see [AuxCoordSystem3d.createCode]($backend)\r\n */\r\n auxCoordSystem3d = \"bis:AuxCoordSystem3d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystemSpatial]($backend) elements.\r\n * @see [AuxCoordSystemSpatial.createCode]($backend)\r\n */\r\n auxCoordSystemSpatial = \"bis:AuxCoordSystemSpatial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [CategorySelector]($backend) elements.\r\n * @see [CategorySelector.createCode]($backend)\r\n */\r\n categorySelector = \"bis:CategorySelector\",\r\n /** @internal */\r\n colorBook = \"bis:ColorBook\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DisplayStyle]($backend) elements.\r\n * @see [DisplayStyle.createCode]($backend)\r\n */\r\n displayStyle = \"bis:DisplayStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Drawing]($backend) elements.\r\n * @see [Drawing.createCode]($backend)\r\n */\r\n drawing = \"bis:Drawing\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DrawingCategory]($backend) elements.\r\n * @see [DrawingCategory.createCode]($backend)\r\n */\r\n drawingCategory = \"bis:DrawingCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSource]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSource.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSource = \"bis:ExternalSource\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSourceAttachment]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSourceAttachment.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSourceAttachment = \"bis:ExternalSourceAttachment\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GeometryPart]($backend) elements.\r\n * @see [GeometryPart.createCode]($backend)\r\n */\r\n geometryPart = \"bis:GeometryPart\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GraphicalType2d]($backend) elements.\r\n * @see [GraphicalType2d.createCode]($backend)\r\n */\r\n graphicalType2d = \"bis:GraphicalType2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LineStyle]($backend) elements.\r\n * @see [LineStyle.createCode]($backend)\r\n */\r\n lineStyle = \"bis:LineStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LinkElement]($backend) elements.\r\n * @see [LinkElement.createCode]($backend)\r\n */\r\n linkElement = \"bis:LinkElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ModelSelector]($backend) elements.\r\n * @see [ModelSelector.createCode]($backend)\r\n */\r\n modelSelector = \"bis:ModelSelector\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalMaterial]($backend) elements.\r\n * @see [PhysicalMaterial.createCode]($backend)\r\n */\r\n physicalMaterial = \"bis:PhysicalMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalType]($backend) elements.\r\n * @see [PhysicalType.createCode]($backend)\r\n */\r\n physicalType = \"bis:PhysicalType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [InformationPartitionElement]($backend) elements.\r\n * @see [InformationPartitionElement.createCode]($backend)\r\n */\r\n informationPartitionElement = \"bis:InformationPartitionElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [RenderMaterialElement]($backend) elements.\r\n * @see [RenderMaterialElement.createCode]($backend)\r\n */\r\n renderMaterial = \"bis:RenderMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Sheet]($backend) elements.\r\n * @see [Sheet.createCode]($backend)\r\n */\r\n sheet = \"bis:Sheet\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialCategory]($backend) elements.\r\n * @see [SpatialCategory.createCode]($backend)\r\n */\r\n spatialCategory = \"bis:SpatialCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialLocationType]($backend) elements.\r\n * @see [SpatialLocationType.createCode]($backend)\r\n */\r\n spatialLocationType = \"bis:SpatialLocationType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SubCategory]($backend) elements.\r\n * @see [SubCategory.createCode]($backend)\r\n */\r\n subCategory = \"bis:SubCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Subject]($backend) elements.\r\n * @see [Subject.createCode]($backend)\r\n */\r\n subject = \"bis:Subject\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe2d]($backend) elements.\r\n * @see [TemplateRecipe2d.createCode]($backend)\r\n */\r\n templateRecipe2d = \"bis:TemplateRecipe2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe3d]($backend) elements.\r\n * @see [TemplateRecipe3d.createCode]($backend)\r\n */\r\n templateRecipe3d = \"bis:TemplateRecipe3d\",\r\n /** @internal */\r\n textAnnotationSeed = \"bis:TextAnnotationSeed\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Texture]($backend) elements.\r\n * @see [Texture.createCode]($backend)\r\n */\r\n texture = \"bis:Texture\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ViewDefinition]($backend) elements.\r\n * @see [ViewDefinition.createCode]($backend)\r\n */\r\n viewDefinition = \"bis:ViewDefinition\",\r\n}\r\n\r\n/** The scope of the Code.\r\n * @public\r\n */\r\nexport namespace CodeScopeSpec {\r\n /** The standard ways the CodeScope can be specified.\r\n * @public\r\n */\r\n export enum Type {\r\n /** The Code value must be unique within (at least) the iModel repository */\r\n Repository = 1,\r\n /** The Code value must be unique within the scope of the Model */\r\n Model = 2,\r\n /** The Code value must be unique among other children of the same parent element */\r\n ParentElement = 3,\r\n /** The Code value must be unique among other elements also scoped by the same element */\r\n RelatedElement = 4,\r\n }\r\n\r\n /**\r\n * Requirements for how the CodeScope Element is identified.\r\n * @public\r\n */\r\n export enum ScopeRequirement {\r\n /** The ElementId of CodeScope element identifies its scope. Used for Codes that are unique only within a single iModel. */\r\n ElementId = 1,\r\n /** The FederationGuid of the CodeScope element identifies its scope. Used for Codes that are globally unique. */\r\n FederationGuid = 2,\r\n }\r\n}\r\n\r\n/**\r\n * The JSON properties of a CodeSpec\r\n * @public\r\n */\r\nexport interface CodeSpecProperties {\r\n scopeSpec: {\r\n /** the type of CodeSpec */\r\n type: CodeScopeSpec.Type;\r\n /** If true, the federationGuid of the scope element identifies the scope, for Codes that are globally unique.\r\n * Otherwise, the ElementId of the scopeElement is used, for Codes that are scoped only within a single iModel.\r\n */\r\n fGuidRequired?: boolean;\r\n /** The relationship className (in the form \"schema:class\"), when `type` is `CodeScopeSpec.Type.RelatedElement` */\r\n relationship?: string;\r\n };\r\n spec?: {\r\n isManagedWithDgnDb?: boolean;\r\n };\r\n version?: string;\r\n}\r\n\r\n/** A [Code Specification]($docs/bis/guide/references/glossary#codespec) captures the rules for encoding and decoding significant business information into\r\n * and from a Code (string). This specification is used to generate and validate Codes.\r\n *\r\n * A CodeSpec defines the format of a Code for a certain type of Element in an IModel.\r\n * A CodeSpec can identify an external system that maintains and/or assigns Codes.\r\n * @public\r\n */\r\nexport class CodeSpec {\r\n /** The iModel holding this CodeSpec. */\r\n public iModel: IModel;\r\n /** The id of this CodeSpec. */\r\n public id: Id64String;\r\n /** The name of this CodeSpec. */\r\n public name: string;\r\n /** The JSON properties for this CodeSpec.\r\n * @note Use the getters and setters instead of accessing this directly.\r\n * @internal\r\n */\r\n public properties: CodeSpecProperties;\r\n\r\n private constructor(iModel: IModel, id: Id64String, name: string, properties?: CodeSpecProperties) {\r\n this.iModel = iModel;\r\n this.id = id;\r\n this.name = name;\r\n this.properties = properties ?? { scopeSpec: { type: CodeScopeSpec.Type.Repository } };\r\n }\r\n\r\n /** Create a new CodeSpec from the specified parameters\r\n * > Note: CodeSpec.id will not be valid until inserted\r\n * @see [CodeSpecs.insert]($backend)\r\n */\r\n public static create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec {\r\n const props: CodeSpecProperties = { scopeSpec: { type: scopeType } };\r\n if (scopeReq)\r\n props.scopeSpec.fGuidRequired = scopeReq === CodeScopeSpec.ScopeRequirement.FederationGuid;\r\n\r\n return new CodeSpec(iModel, Id64.invalid, name, props);\r\n }\r\n\r\n /** Create a new CodeSpec directly from JSON. Used internally by the CodeSpecs.load function.\r\n * @internal\r\n */\r\n public static createFromJson(iModel: IModel, id: Id64String, name: string, properties?: CodeSpecProperties): CodeSpec {\r\n return new CodeSpec(iModel, id, name, properties);\r\n }\r\n\r\n /** Will be true if the id of this CodeSpec is valid. */\r\n public get isValid(): boolean { return Id64.isValid(this.id); }\r\n\r\n /** The scope type of this CodeSpec. */\r\n public get scopeType(): CodeScopeSpec.Type { return this.properties.scopeSpec.type; }\r\n public set scopeType(scopeType: CodeScopeSpec.Type) { this.properties.scopeSpec.type = scopeType; }\r\n\r\n /** Will be `CodeScopeSpec.ScopeRequirement.FederationGuid` if the scoping element is required to have a FederationGuid or\r\n * CodeScopeSpec.ScopeRequirement.ElementId` otherwise (the default).\r\n */\r\n public get scopeReq(): CodeScopeSpec.ScopeRequirement {\r\n return this.properties.scopeSpec.fGuidRequired ? CodeScopeSpec.ScopeRequirement.FederationGuid : CodeScopeSpec.ScopeRequirement.ElementId;\r\n }\r\n public set scopeReq(req: CodeScopeSpec.ScopeRequirement) {\r\n if (CodeScopeSpec.ScopeRequirement.FederationGuid === req)\r\n this.properties.scopeSpec.fGuidRequired = true;\r\n else\r\n this.properties.scopeSpec.fGuidRequired = undefined;\r\n }\r\n\r\n /** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.\r\n * @deprecated in 3.6 Use scopeReq instead.\r\n */\r\n public get isManagedWithIModel(): boolean {\r\n return this.properties.spec?.isManagedWithDgnDb ?? true;\r\n }\r\n public set isManagedWithIModel(value: boolean) {\r\n if (!this.properties.spec)\r\n this.properties.spec = {};\r\n\r\n this.properties.spec.isManagedWithDgnDb = value;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,IAAI,EAAc,SAAS,EAAE,MAAM,q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,gBAAgB,CAAC,SAAS,CAAC;IAC5I,CAAC;IACD,IAAW,QAAQ,CAAC,GAAmC;QACrD,IAAI,aAAa,CAAC,gBAAgB,CAAC,cAAc,KAAK,GAAG;YACvD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC;;YAE/C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,kBAAkB,IAAI,IAAI,CAAC;IAC1D,CAAC;IACD,IAAW,mBAAmB,CAAC,KAAc;QAC3C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { GuidString, Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"./IModel\";\r\n\r\n/**\r\n * The ElementId of the element that defines the scope for a Code value.\r\n * @note For insert or update, you may supply the FederationGuid of the scope element and it will be converted to the ElementId of that element.\r\n * @public\r\n * @extensions\r\n */\r\nexport type CodeScopeProps = Id64String | GuidString;\r\n\r\n/** The parameters that define a Code\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CodeProps {\r\n /** Either the stringified 64-bit Id of the CodeSpec for this code, or the name of the CodeSpec. */\r\n spec: Id64String | string;\r\n /** Either the ElementId or the FederationGuid of the element that provides the scope for this code. */\r\n scope: CodeScopeProps;\r\n /** the value of this code. May be undefined. */\r\n value?: string;\r\n}\r\n\r\n/**\r\n * A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element\r\n * @public\r\n */\r\nexport class Code implements CodeProps {\r\n /** The id of the [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec) of the Element */\r\n public spec: Id64String;\r\n /** The [CodeScope]($docs/bis/guide/fundamentals/codes.md#codescope-property) of the Element */\r\n public scope: Id64String;\r\n /** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element\r\n * @note Leading and trailing whitespace is invalid so is automatically trimmed.\r\n */\r\n public get value() { return this._value ?? \"\"; }\r\n public set value(val: string) { this._value = val?.trim(); }\r\n private _value?: string;\r\n\r\n constructor(codeProps: CodeProps) {\r\n this.spec = Id64.fromJSON(codeProps.spec);\r\n this.scope = JsonUtils.asString(codeProps.scope);\r\n this.value = JsonUtils.asString(codeProps.value);\r\n }\r\n\r\n /** Create an empty, non-unique code with no special meaning. */\r\n public static createEmpty(): Code {\r\n const id = Id64.fromLocalAndBriefcaseIds(1, 0);\r\n return new Code({ spec: id, scope: id });\r\n }\r\n\r\n public static fromJSON(json?: any): Code { return json ? new Code(json) : Code.createEmpty(); }\r\n public toJSON(): CodeProps { return { spec: this.spec, scope: this.scope, value: this.value }; }\r\n public equals(other: Code): boolean { return Code.equalCodes(this, other); }\r\n /** @internal */\r\n public static equalCodes(c1: CodeProps, c2: CodeProps): boolean {\r\n return c1.spec === c2.spec && c1.scope === c2.scope && c1.value === c2.value;\r\n }\r\n /** Determine whether this Code is valid. */\r\n public static isValid(c: CodeProps): boolean { return Id64.isValidId64(c.spec); }\r\n /** Determine if this code is valid but not otherwise meaningful (and therefore not necessarily unique) */\r\n public static isEmpty(c: CodeProps): boolean { return this.isValid(c) && (c.value === undefined || c.value === \"\"); }\r\n}\r\n\r\n/** Names of the internal BIS CodeSpecs. These names match those specified by the native library.\r\n * For other domains, the best practice is to include the domain name or alias as part of the CodeSpec name to ensure global uniqueness.\r\n * @public\r\n* @extensions\r\n* @see [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec)\r\n */\r\nexport enum BisCodeSpec {\r\n /** The name of the standard [[CodeSpec]] used when creating *empty* codes.\r\n * @see [[Code.createEmpty]]\r\n */\r\n nullCodeSpec = \"bis:NullCodeSpec\",\r\n /** @internal */\r\n annotationFrameStyle = \"bis:AnnotationFrameStyle\",\r\n /** @internal */\r\n annotationLeaderStyle = \"bis:AnnotationLeaderStyle\",\r\n /** @internal */\r\n annotationTextStyle = \"bis:AnnotationTextStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem2d]($backend) elements.\r\n * @see [AuxCoordSystem2d.createCode]($backend)\r\n */\r\n auxCoordSystem2d = \"bis:AuxCoordSystem2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem3d]($backend) elements.\r\n * @see [AuxCoordSystem3d.createCode]($backend)\r\n */\r\n auxCoordSystem3d = \"bis:AuxCoordSystem3d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystemSpatial]($backend) elements.\r\n * @see [AuxCoordSystemSpatial.createCode]($backend)\r\n */\r\n auxCoordSystemSpatial = \"bis:AuxCoordSystemSpatial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [CategorySelector]($backend) elements.\r\n * @see [CategorySelector.createCode]($backend)\r\n */\r\n categorySelector = \"bis:CategorySelector\",\r\n /** @internal */\r\n colorBook = \"bis:ColorBook\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DisplayStyle]($backend) elements.\r\n * @see [DisplayStyle.createCode]($backend)\r\n */\r\n displayStyle = \"bis:DisplayStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Drawing]($backend) elements.\r\n * @see [Drawing.createCode]($backend)\r\n */\r\n drawing = \"bis:Drawing\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DrawingCategory]($backend) elements.\r\n * @see [DrawingCategory.createCode]($backend)\r\n */\r\n drawingCategory = \"bis:DrawingCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSource]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSource.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSource = \"bis:ExternalSource\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSourceAttachment]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSourceAttachment.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSourceAttachment = \"bis:ExternalSourceAttachment\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GeometryPart]($backend) elements.\r\n * @see [GeometryPart.createCode]($backend)\r\n */\r\n geometryPart = \"bis:GeometryPart\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GraphicalType2d]($backend) elements.\r\n * @see [GraphicalType2d.createCode]($backend)\r\n */\r\n graphicalType2d = \"bis:GraphicalType2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LineStyle]($backend) elements.\r\n * @see [LineStyle.createCode]($backend)\r\n */\r\n lineStyle = \"bis:LineStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LinkElement]($backend) elements.\r\n * @see [LinkElement.createCode]($backend)\r\n */\r\n linkElement = \"bis:LinkElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ModelSelector]($backend) elements.\r\n * @see [ModelSelector.createCode]($backend)\r\n */\r\n modelSelector = \"bis:ModelSelector\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalMaterial]($backend) elements.\r\n * @see [PhysicalMaterial.createCode]($backend)\r\n */\r\n physicalMaterial = \"bis:PhysicalMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalType]($backend) elements.\r\n * @see [PhysicalType.createCode]($backend)\r\n */\r\n physicalType = \"bis:PhysicalType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [InformationPartitionElement]($backend) elements.\r\n * @see [InformationPartitionElement.createCode]($backend)\r\n */\r\n informationPartitionElement = \"bis:InformationPartitionElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [RenderMaterialElement]($backend) elements.\r\n * @see [RenderMaterialElement.createCode]($backend)\r\n */\r\n renderMaterial = \"bis:RenderMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Sheet]($backend) elements.\r\n * @see [Sheet.createCode]($backend)\r\n */\r\n sheet = \"bis:Sheet\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialCategory]($backend) elements.\r\n * @see [SpatialCategory.createCode]($backend)\r\n */\r\n spatialCategory = \"bis:SpatialCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialLocationType]($backend) elements.\r\n * @see [SpatialLocationType.createCode]($backend)\r\n */\r\n spatialLocationType = \"bis:SpatialLocationType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SubCategory]($backend) elements.\r\n * @see [SubCategory.createCode]($backend)\r\n */\r\n subCategory = \"bis:SubCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Subject]($backend) elements.\r\n * @see [Subject.createCode]($backend)\r\n */\r\n subject = \"bis:Subject\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe2d]($backend) elements.\r\n * @see [TemplateRecipe2d.createCode]($backend)\r\n */\r\n templateRecipe2d = \"bis:TemplateRecipe2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe3d]($backend) elements.\r\n * @see [TemplateRecipe3d.createCode]($backend)\r\n */\r\n templateRecipe3d = \"bis:TemplateRecipe3d\",\r\n /** @internal */\r\n textAnnotationSeed = \"bis:TextAnnotationSeed\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Texture]($backend) elements.\r\n * @see [Texture.createCode]($backend)\r\n */\r\n texture = \"bis:Texture\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ViewDefinition]($backend) elements.\r\n * @see [ViewDefinition.createCode]($backend)\r\n */\r\n viewDefinition = \"bis:ViewDefinition\",\r\n}\r\n\r\n/** The scope of the Code.\r\n * @public\r\n */\r\nexport namespace CodeScopeSpec {\r\n /** The standard ways the CodeScope can be specified.\r\n * @public\r\n */\r\n export enum Type {\r\n /** The Code value must be unique within (at least) the iModel repository */\r\n Repository = 1,\r\n /** The Code value must be unique within the scope of the Model */\r\n Model = 2,\r\n /** The Code value must be unique among other children of the same parent element */\r\n ParentElement = 3,\r\n /** The Code value must be unique among other elements also scoped by the same element */\r\n RelatedElement = 4,\r\n }\r\n\r\n /**\r\n * Requirements for how the CodeScope Element is identified.\r\n * @public\r\n */\r\n export enum ScopeRequirement {\r\n /** The ElementId of CodeScope element identifies its scope. Used for Codes that are unique only within a single iModel. */\r\n ElementId = 1,\r\n /** The FederationGuid of the CodeScope element identifies its scope. Used for Codes that are globally unique. */\r\n FederationGuid = 2,\r\n }\r\n}\r\n\r\n/**\r\n * The JSON properties of a CodeSpec\r\n * @public\r\n */\r\nexport interface CodeSpecProperties {\r\n scopeSpec: {\r\n /** the type of CodeSpec */\r\n type: CodeScopeSpec.Type;\r\n /** If true, the federationGuid of the scope element identifies the scope, for Codes that are globally unique.\r\n * Otherwise, the ElementId of the scopeElement is used, for Codes that are scoped only within a single iModel.\r\n */\r\n fGuidRequired?: boolean;\r\n /** The relationship className (in the form \"schema:class\"), when `type` is `CodeScopeSpec.Type.RelatedElement` */\r\n relationship?: string;\r\n };\r\n spec?: {\r\n isManagedWithDgnDb?: boolean;\r\n };\r\n version?: string;\r\n}\r\n\r\n/** A [Code Specification]($docs/bis/guide/references/glossary#codespec) captures the rules for encoding and decoding significant business information into\r\n * and from a Code (string). This specification is used to generate and validate Codes.\r\n *\r\n * A CodeSpec defines the format of a Code for a certain type of Element in an IModel.\r\n * A CodeSpec can identify an external system that maintains and/or assigns Codes.\r\n * @public\r\n */\r\nexport class CodeSpec {\r\n /** The iModel holding this CodeSpec. */\r\n public iModel: IModel;\r\n /** The id of this CodeSpec. */\r\n public id: Id64String;\r\n /** The name of this CodeSpec. */\r\n public name: string;\r\n /** The JSON properties for this CodeSpec.\r\n * @note Use the getters and setters instead of accessing this directly.\r\n * @internal\r\n */\r\n public properties: CodeSpecProperties;\r\n\r\n private constructor(iModel: IModel, id: Id64String, name: string, properties?: CodeSpecProperties) {\r\n this.iModel = iModel;\r\n this.id = id;\r\n this.name = name;\r\n this.properties = properties ?? { scopeSpec: { type: CodeScopeSpec.Type.Repository } };\r\n }\r\n\r\n /** Create a new CodeSpec from the specified parameters\r\n * > Note: CodeSpec.id will not be valid until inserted\r\n * @see [CodeSpecs.insert]($backend)\r\n */\r\n public static create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec {\r\n const props: CodeSpecProperties = { scopeSpec: { type: scopeType } };\r\n if (scopeReq)\r\n props.scopeSpec.fGuidRequired = scopeReq === CodeScopeSpec.ScopeRequirement.FederationGuid;\r\n\r\n return new CodeSpec(iModel, Id64.invalid, name, props);\r\n }\r\n\r\n /** Create a new CodeSpec directly from JSON. Used internally by the CodeSpecs.load function.\r\n * @internal\r\n */\r\n public static createFromJson(iModel: IModel, id: Id64String, name: string, properties?: CodeSpecProperties): CodeSpec {\r\n return new CodeSpec(iModel, id, name, properties);\r\n }\r\n\r\n /** Will be true if the id of this CodeSpec is valid. */\r\n public get isValid(): boolean { return Id64.isValid(this.id); }\r\n\r\n /** The scope type of this CodeSpec. */\r\n public get scopeType(): CodeScopeSpec.Type { return this.properties.scopeSpec.type; }\r\n public set scopeType(scopeType: CodeScopeSpec.Type) { this.properties.scopeSpec.type = scopeType; }\r\n\r\n /** Will be `CodeScopeSpec.ScopeRequirement.FederationGuid` if the scoping element is required to have a FederationGuid or\r\n * CodeScopeSpec.ScopeRequirement.ElementId` otherwise (the default).\r\n */\r\n public get scopeReq(): CodeScopeSpec.ScopeRequirement {\r\n return this.properties.scopeSpec.fGuidRequired ? CodeScopeSpec.ScopeRequirement.FederationGuid : CodeScopeSpec.ScopeRequirement.ElementId;\r\n }\r\n public set scopeReq(req: CodeScopeSpec.ScopeRequirement) {\r\n if (CodeScopeSpec.ScopeRequirement.FederationGuid === req)\r\n this.properties.scopeSpec.fGuidRequired = true;\r\n else\r\n this.properties.scopeSpec.fGuidRequired = undefined;\r\n }\r\n\r\n /** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.\r\n * @deprecated in 3.6 Use scopeReq instead.\r\n */\r\n public get isManagedWithIModel(): boolean {\r\n return this.properties.spec?.isManagedWithDgnDb ?? true;\r\n }\r\n public set isManagedWithIModel(value: boolean) {\r\n if (!this.properties.spec)\r\n this.properties.spec = {};\r\n\r\n this.properties.spec.isManagedWithDgnDb = value;\r\n }\r\n}\r\n"]}
|
package/lib/esm/ColorDef.js
CHANGED
|
@@ -129,8 +129,7 @@ export class ColorDef {
|
|
|
129
129
|
* @see [[tryComputeTbgrFromString]] to determine if `val` is a valid color string.
|
|
130
130
|
*/
|
|
131
131
|
static computeTbgrFromString(val) {
|
|
132
|
-
|
|
133
|
-
return (_a = this.tryComputeTbgrFromString(val)) !== null && _a !== void 0 ? _a : 0;
|
|
132
|
+
return this.tryComputeTbgrFromString(val) ?? 0;
|
|
134
133
|
}
|
|
135
134
|
/** Try to compute the 0xTTBBGGRR value corresponding to a string representation of a ColorDef.
|
|
136
135
|
* @returns the corresponding numeric representation, or `undefined` if the input does not represent a color.
|