@itwin/core-backend 4.8.0-dev.2 → 4.8.0-dev.20
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 +31 -1
- package/lib/cjs/BackendHubAccess.d.ts +18 -16
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js +16 -15
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +2 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BlobContainerService.d.ts +3 -3
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +4 -2
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +0 -6
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +0 -6
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +4 -3
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +1 -0
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
- package/lib/cjs/ChangedElementsDb.js +3 -2
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +4 -26
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js +2 -101
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +2 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +49 -24
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +66 -7
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +4 -4
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/DevTools.d.ts.map +1 -1
- package/lib/cjs/DevTools.js +2 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +0 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +0 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js +2 -2
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +2 -2
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +6 -3
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +3 -3
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +3 -60
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +8 -64
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +0 -5
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +4 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +10 -0
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +22 -24
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +2 -2
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +27 -97
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +131 -55
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +2 -2
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +13 -4
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +39 -32
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +2 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +2 -2
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +17 -17
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LockControl.d.ts +66 -0
- package/lib/cjs/LockControl.d.ts.map +1 -0
- package/lib/cjs/LockControl.js +11 -0
- package/lib/cjs/LockControl.js.map +1 -0
- package/lib/cjs/Material.d.ts +2 -5
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +6 -4
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +0 -22
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +4 -25
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +17 -7
- package/lib/cjs/PropertyStore.d.ts.map +1 -1
- package/lib/cjs/PropertyStore.js +11 -5
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +0 -12
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +0 -12
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +2 -3
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +5 -6
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +1 -1
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +2 -2
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js +3 -3
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +2 -2
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js +2 -2
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js +11 -8
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js +134 -92
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +2 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +2 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -18
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +1 -18
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts +16 -2
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +14 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +17 -21
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +80 -38
- package/lib/cjs/assets/Settings/backend.setting.json5 +8 -119
- package/lib/cjs/core-backend.d.ts +3 -2
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +4 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +0 -10
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +0 -18
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +0 -18
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.js +117 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
- package/lib/cjs/internal/NativePlatform.d.ts +15 -0
- package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
- package/lib/cjs/internal/NativePlatform.js +49 -0
- package/lib/cjs/internal/NativePlatform.js.map +1 -0
- package/lib/cjs/internal/NoLocks.d.ts +6 -0
- package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
- package/lib/cjs/internal/NoLocks.js +30 -0
- package/lib/cjs/internal/NoLocks.js.map +1 -0
- package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -17
- package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
- package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +22 -17
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +9 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -0
- package/lib/cjs/internal/Symbols.js +19 -0
- package/lib/cjs/internal/Symbols.js.map +1 -0
- package/lib/cjs/internal/cross-package.d.ts +3 -0
- package/lib/cjs/internal/cross-package.d.ts.map +1 -0
- package/lib/cjs/internal/cross-package.js +14 -0
- package/lib/cjs/internal/cross-package.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +41 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
- package/lib/cjs/rpc/tracing.js +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +5 -2
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +2 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +167 -138
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +68 -138
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +1 -172
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +411 -277
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +76 -457
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
- package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
- package/package.json +15 -14
- package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
- package/lib/cjs/ServerBasedLocks.js.map +0 -1
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
package/lib/cjs/Material.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { IModelElementCloneContext } from "./IModelElementCloneContext";
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export declare abstract class PhysicalMaterial extends DefinitionElement {
|
|
14
|
-
/** @internal */
|
|
15
14
|
static get className(): string;
|
|
16
15
|
/** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.
|
|
17
16
|
* @param iModel The IModelDb
|
|
@@ -33,14 +32,12 @@ export declare abstract class PhysicalMaterial extends DefinitionElement {
|
|
|
33
32
|
* @public
|
|
34
33
|
*/
|
|
35
34
|
export declare class RenderMaterialElement extends DefinitionElement {
|
|
36
|
-
/** @internal */
|
|
37
35
|
static get className(): string;
|
|
38
36
|
/** The name of a palette that can be used to categorize multiple materials. */
|
|
39
37
|
paletteName: string;
|
|
40
38
|
/** An optional description of the material. */
|
|
41
39
|
description?: string;
|
|
42
|
-
|
|
43
|
-
constructor(props: RenderMaterialProps, iModel: IModelDb);
|
|
40
|
+
private constructor();
|
|
44
41
|
toJSON(): RenderMaterialProps;
|
|
45
42
|
/** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.
|
|
46
43
|
* @param iModel The IModelDb
|
|
@@ -68,7 +65,7 @@ export declare class RenderMaterialElement extends DefinitionElement {
|
|
|
68
65
|
* @throws [[IModelError]] if unable to insert the element.
|
|
69
66
|
*/
|
|
70
67
|
static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
71
|
-
/** @
|
|
68
|
+
/** @beta */
|
|
72
69
|
protected static onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps): void;
|
|
73
70
|
}
|
|
74
71
|
/** @public */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Material.d.ts","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACQ,IAAI,EAAE,cAAc,EAAoC,YAAY,EAAE,cAAc,EAAgC,mBAAmB,EAAE,cAAc,EAAE,eAAe,EACtL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAIxE;;;GAGG;AACH,8BAAsB,gBAAiB,SAAQ,iBAAiB;IAC9D,
|
|
1
|
+
{"version":3,"file":"Material.d.ts","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB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E,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,2BAA2B,GAAG,UAAU;IAK9I,YAAY;qBACc,QAAQ,CAAC,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY;CAgB5H;AAED,cAAc;AACd,yBAAiB,qBAAqB,CAAC;IACrC;;;;OAIG;IACH,MAAa,MAAM;QACjB,mEAAmE;QAC5D,WAAW,EAAE,MAAM,CAAC;QAC3B,qDAAqD;QAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;QAC5B,iHAAiH;QAC1G,KAAK,CAAC,EAAE,cAAc,CAAC;QAC9B,kEAAkE;QAC3D,aAAa,CAAC,EAAE,cAAc,CAAC;QACtC;;WAEG;QACI,MAAM,CAAC,EAAE,MAAM,CAAC;QACvB;;;WAGG;QACI,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wEAAwE;QACjE,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,yEAAyE;QAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,wBAAwB;QACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B;;;WAGG;QACI,UAAU,CAAC,EAAE,eAAe,CAAC;QACpC;;;;WAIG;QACI,SAAS,CAAC,EAAE,cAAc,GAAG;YAClC;;eAEG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAEF,gJAAgJ;oBAC7H,WAAW,EAAE,MAAM;KAGvC;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB,CAAC,MAAM;CAChF"}
|
package/lib/cjs/Material.js
CHANGED
|
@@ -17,7 +17,6 @@ const Element_1 = require("./Element");
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
class PhysicalMaterial extends Element_1.DefinitionElement {
|
|
20
|
-
/** @internal */
|
|
21
20
|
static get className() { return "PhysicalMaterial"; }
|
|
22
21
|
/** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.
|
|
23
22
|
* @param iModel The IModelDb
|
|
@@ -50,9 +49,7 @@ exports.PhysicalMaterial = PhysicalMaterial;
|
|
|
50
49
|
* @public
|
|
51
50
|
*/
|
|
52
51
|
class RenderMaterialElement extends Element_1.DefinitionElement {
|
|
53
|
-
/** @internal */
|
|
54
52
|
static get className() { return "RenderMaterial"; }
|
|
55
|
-
/** @internal */
|
|
56
53
|
constructor(props, iModel) {
|
|
57
54
|
super(props, iModel);
|
|
58
55
|
this.paletteName = props.paletteName;
|
|
@@ -166,13 +163,18 @@ class RenderMaterialElement extends Element_1.DefinitionElement {
|
|
|
166
163
|
const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);
|
|
167
164
|
return iModelDb.elements.insertElement(renderMaterial.toJSON());
|
|
168
165
|
}
|
|
169
|
-
/** @
|
|
166
|
+
/** @beta */
|
|
170
167
|
static onCloned(context, sourceProps, targetProps) {
|
|
171
168
|
super.onCloned(context, sourceProps, targetProps);
|
|
172
169
|
for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {
|
|
173
170
|
if (typeof mapName !== "string")
|
|
174
171
|
continue;
|
|
175
172
|
const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];
|
|
173
|
+
// sourceMap could be null/undefined, keep it the same in targetProps
|
|
174
|
+
if (!sourceMap) {
|
|
175
|
+
targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
176
178
|
if (!core_bentley_1.Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)
|
|
177
179
|
continue;
|
|
178
180
|
targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? core_bentley_1.Id64.invalid);
|
package/lib/cjs/Material.js.map
CHANGED
|
@@ -1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------------------------------------------\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 Elements\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** A PhysicalMaterial defines the matter that makes up physical elements.\r\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\r\n * @public\r\n */\r\nexport abstract class PhysicalMaterial extends DefinitionElement {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\r\n * @param name The name (codeValue) of the PhysicalMaterial\r\n */\r\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\r\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\r\n }\r\n /** Create a PhysicalMaterial\r\n * @param iModelDb The IModelDb\r\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\r\n * @param name The name (codeValue) of the PhysicalMaterial\r\n * @returns The newly constructed PhysicalMaterial\r\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\r\n */\r\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\r\n const elementProps: DefinitionElementProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n };\r\n return iModelDb.elements.createElement(elementProps);\r\n }\r\n}\r\n\r\n/** Defines a rendering material.\r\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\r\n * @public\r\n */\r\nexport class RenderMaterialElement extends DefinitionElement {\r\n /** @internal */\r\n public static override get className(): string { return \"RenderMaterial\"; }\r\n\r\n /** The name of a palette that can be used to categorize multiple materials. */\r\n public paletteName: string;\r\n /** An optional description of the material. */\r\n public description?: string;\r\n /** @internal */\r\n constructor(props: RenderMaterialProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.paletteName = props.paletteName;\r\n this.description = props.description;\r\n }\r\n\r\n public override toJSON(): RenderMaterialProps {\r\n const val = super.toJSON() as RenderMaterialProps;\r\n val.paletteName = this.paletteName;\r\n val.description = this.description;\r\n return val;\r\n }\r\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\r\n * @param name The RenderMaterial name\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\r\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\r\n }\r\n /**\r\n * Create a RenderMaterial with given parameters.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param materialName The name/CodeValue of the RenderMaterial\r\n * @param params Parameters object which describes how to construct the RenderMaterial\r\n * @returns The newly constructed RenderMaterial element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\r\n let maps: RenderMaterialAssetMapsProps | undefined;\r\n const pbr_normal = params.normalMap?.scale;\r\n if (params.patternMap || params.normalMap) {\r\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\r\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\r\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\r\n const pat = params.patternMap;\r\n if (pat && undefined !== pat[key])\r\n obj[key] = pat[key];\r\n else if (params.normalMap && undefined !== params.normalMap[key])\r\n obj[key] = params.normalMap[key];\r\n }\r\n\r\n const baseProps: TexMap = {};\r\n choose(baseProps, \"pattern_angle\");\r\n choose(baseProps, \"pattern_u_flip\");\r\n choose(baseProps, \"pattern_flip\");\r\n choose(baseProps, \"pattern_scale\");\r\n choose(baseProps, \"pattern_offset\");\r\n choose(baseProps, \"pattern_scalemode\");\r\n choose(baseProps, \"pattern_mapping\");\r\n choose(baseProps, \"pattern_weight\");\r\n choose(baseProps, \"pattern_useconstantlod\");\r\n choose(baseProps, \"pattern_constantlod_repetitions\");\r\n choose(baseProps, \"pattern_constantlod_offset\");\r\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\r\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\r\n\r\n maps = {};\r\n if (params.patternMap)\r\n maps.Pattern = { ...params.patternMap, ...baseProps };\r\n\r\n if (params.normalMap) {\r\n maps.Normal = {\r\n ...params.normalMap,\r\n ...baseProps,\r\n };\r\n\r\n delete (maps.Normal as any).scale;\r\n }\r\n }\r\n\r\n // const map = undefined !== params.patternMap ? { Pattern: params.patternMap } : undefined;\r\n const renderMaterialProps: RenderMaterialProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, materialName),\r\n paletteName: params.paletteName,\r\n description: params.description,\r\n jsonProperties: {\r\n materialAssets: {\r\n renderMaterial: {\r\n HasBaseColor: params.color !== undefined,\r\n color: params.color,\r\n HasSpecularColor: params.specularColor !== undefined,\r\n specular_color: params.specularColor,\r\n HasFinish: params.finish !== undefined,\r\n finish: params.finish,\r\n HasTransmit: params.transmit !== undefined,\r\n transmit: params.transmit,\r\n HasDiffuse: params.diffuse !== undefined,\r\n diffuse: params.diffuse,\r\n HasSpecular: params.specular !== undefined,\r\n specular: params.specular,\r\n HasReflect: params.reflect !== undefined,\r\n reflect: params.reflect,\r\n HasReflectColor: params.reflectColor !== undefined,\r\n reflect_color: params.reflectColor,\r\n Map: maps,\r\n pbr_normal,\r\n },\r\n },\r\n },\r\n model: definitionModelId,\r\n isPrivate: false,\r\n };\r\n\r\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new RenderMaterial into a model.\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new Texture into this DefinitionModel\r\n * @param materialName The name/CodeValue of the RenderMaterial\r\n * @param params Parameters object which describes how to construct the RenderMaterial\r\n * @returns The Id of the newly inserted RenderMaterial element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\r\n const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);\r\n return iModelDb.elements.insertElement(renderMaterial.toJSON());\r\n }\r\n\r\n /** @internal */\r\n protected static override onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\r\n super.onCloned(context, sourceProps, targetProps);\r\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\r\n if (typeof mapName !== \"string\")\r\n continue;\r\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\r\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\r\n continue;\r\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace RenderMaterialElement { // eslint-disable-line no-redeclare\r\n /** Parameters used to construct a [[RenderMaterial]].\r\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\r\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\r\n * @deprecated in 3.6 because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\r\n */\r\n export class Params {\r\n /** A required palette name that categorizes this RenderMaterial */\r\n public paletteName: string;\r\n /** An optional description of this RenderMaterial */\r\n public description?: string;\r\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\r\n public color?: RgbFactorProps;\r\n /** The color to use for specular illumination. Default: black. */\r\n public specularColor?: RgbFactorProps;\r\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\r\n * Default: 0.\r\n */\r\n public finish?: number;\r\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\r\n * The surface's own transparency will be multiplied by `(1 - transmit)`. permitting the material to increase but not decrease the surface transparency.\r\n * Default: 13.5.\r\n */\r\n public transmit?: number;\r\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\r\n public diffuse?: number;\r\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\r\n public specular?: number;\r\n /** Currently unused. */\r\n public reflect?: number;\r\n /** Currently unused. */\r\n public reflectColor?: number[];\r\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\r\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\r\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\r\n */\r\n public patternMap?: TextureMapProps;\r\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\r\n * surface's geometry.\r\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\r\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\r\n */\r\n public normalMap?: NormalMapProps & {\r\n /** A factor by which to multiply the components of the normal vectors read from the texture.\r\n * Default: 1.\r\n */\r\n scale?: number;\r\n };\r\n\r\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\r\n public constructor(paletteName: string) {\r\n this.paletteName = paletteName;\r\n }\r\n }\r\n}\r\n\r\n/** Parameters used to create a [[RenderMaterial]] element.\r\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\r\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\r\n * @public\r\n */\r\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line deprecation/deprecation, @typescript-eslint/no-empty-interface\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Material.js","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AACvD,oDAE4B;AAC5B,uCAA8C;AAI9C,yDAAyD;AAEzD;;;GAGG;AACH,MAAsB,gBAAiB,SAAQ,2BAAiB;IACvD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,MAAgB,EAAE,iBAAiC,EAAE,IAAY;QACxF,MAAM,QAAQ,GAAa,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,yBAAW,CAAC,gBAAgB,CAAC,CAAC;QACpF,OAAO,IAAI,kBAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;IACD;;;;;;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AE,CAAC;gBACf,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;gBAClF,SAAS;YACX,CAAC;YACD,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,SAAS,KAAK,SAAS;gBACzE,SAAS;YACX,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,SAAS,IAAI,mBAAI,CAAC,OAAO,CAAC,CAAC;QACrJ,CAAC;IACH,CAAC;CACF;AArJD,sDAqJC;AAED,cAAc;AACd,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,MAAa,MAAM;QA2CjB,gJAAgJ;QAChJ,YAAmB,WAAmB;YACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KACF;IA/CY,4BAAM,SA+ClB,CAAA;AACH,CAAC,EAtDgB,qBAAqB,qCAArB,qBAAqB,QAsDrC","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 Elements\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** A PhysicalMaterial defines the matter that makes up physical elements.\r\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\r\n * @public\r\n */\r\nexport abstract class PhysicalMaterial extends DefinitionElement {\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\r\n * @param name The name (codeValue) of the PhysicalMaterial\r\n */\r\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\r\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\r\n }\r\n /** Create a PhysicalMaterial\r\n * @param iModelDb The IModelDb\r\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\r\n * @param name The name (codeValue) of the PhysicalMaterial\r\n * @returns The newly constructed PhysicalMaterial\r\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\r\n */\r\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\r\n const elementProps: DefinitionElementProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n };\r\n return iModelDb.elements.createElement(elementProps);\r\n }\r\n}\r\n\r\n/** Defines a rendering material.\r\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\r\n * @public\r\n */\r\nexport class RenderMaterialElement extends DefinitionElement {\r\n public static override get className(): string { return \"RenderMaterial\"; }\r\n\r\n /** The name of a palette that can be used to categorize multiple materials. */\r\n public paletteName: string;\r\n /** An optional description of the material. */\r\n public description?: string;\r\n\r\n private constructor(props: RenderMaterialProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.paletteName = props.paletteName;\r\n this.description = props.description;\r\n }\r\n\r\n public override toJSON(): RenderMaterialProps {\r\n const val = super.toJSON() as RenderMaterialProps;\r\n val.paletteName = this.paletteName;\r\n val.description = this.description;\r\n return val;\r\n }\r\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\r\n * @param name The RenderMaterial name\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\r\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\r\n }\r\n /**\r\n * Create a RenderMaterial with given parameters.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param materialName The name/CodeValue of the RenderMaterial\r\n * @param params Parameters object which describes how to construct the RenderMaterial\r\n * @returns The newly constructed RenderMaterial element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\r\n let maps: RenderMaterialAssetMapsProps | undefined;\r\n const pbr_normal = params.normalMap?.scale;\r\n if (params.patternMap || params.normalMap) {\r\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\r\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\r\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\r\n const pat = params.patternMap;\r\n if (pat && undefined !== pat[key])\r\n obj[key] = pat[key];\r\n else if (params.normalMap && undefined !== params.normalMap[key])\r\n obj[key] = params.normalMap[key];\r\n }\r\n\r\n const baseProps: TexMap = {};\r\n choose(baseProps, \"pattern_angle\");\r\n choose(baseProps, \"pattern_u_flip\");\r\n choose(baseProps, \"pattern_flip\");\r\n choose(baseProps, \"pattern_scale\");\r\n choose(baseProps, \"pattern_offset\");\r\n choose(baseProps, \"pattern_scalemode\");\r\n choose(baseProps, \"pattern_mapping\");\r\n choose(baseProps, \"pattern_weight\");\r\n choose(baseProps, \"pattern_useconstantlod\");\r\n choose(baseProps, \"pattern_constantlod_repetitions\");\r\n choose(baseProps, \"pattern_constantlod_offset\");\r\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\r\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\r\n\r\n maps = {};\r\n if (params.patternMap)\r\n maps.Pattern = { ...params.patternMap, ...baseProps };\r\n\r\n if (params.normalMap) {\r\n maps.Normal = {\r\n ...params.normalMap,\r\n ...baseProps,\r\n };\r\n\r\n delete (maps.Normal as any).scale;\r\n }\r\n }\r\n\r\n // const map = undefined !== params.patternMap ? { Pattern: params.patternMap } : undefined;\r\n const renderMaterialProps: RenderMaterialProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, materialName),\r\n paletteName: params.paletteName,\r\n description: params.description,\r\n jsonProperties: {\r\n materialAssets: {\r\n renderMaterial: {\r\n HasBaseColor: params.color !== undefined,\r\n color: params.color,\r\n HasSpecularColor: params.specularColor !== undefined,\r\n specular_color: params.specularColor,\r\n HasFinish: params.finish !== undefined,\r\n finish: params.finish,\r\n HasTransmit: params.transmit !== undefined,\r\n transmit: params.transmit,\r\n HasDiffuse: params.diffuse !== undefined,\r\n diffuse: params.diffuse,\r\n HasSpecular: params.specular !== undefined,\r\n specular: params.specular,\r\n HasReflect: params.reflect !== undefined,\r\n reflect: params.reflect,\r\n HasReflectColor: params.reflectColor !== undefined,\r\n reflect_color: params.reflectColor,\r\n Map: maps,\r\n pbr_normal,\r\n },\r\n },\r\n },\r\n model: definitionModelId,\r\n isPrivate: false,\r\n };\r\n\r\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new RenderMaterial into a model.\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new Texture into this DefinitionModel\r\n * @param materialName The name/CodeValue of the RenderMaterial\r\n * @param params Parameters object which describes how to construct the RenderMaterial\r\n * @returns The Id of the newly inserted RenderMaterial element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\r\n const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);\r\n return iModelDb.elements.insertElement(renderMaterial.toJSON());\r\n }\r\n\r\n /** @beta */\r\n protected static override onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\r\n super.onCloned(context, sourceProps, targetProps);\r\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\r\n if (typeof mapName !== \"string\")\r\n continue;\r\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\r\n // sourceMap could be null/undefined, keep it the same in targetProps\r\n if (!sourceMap) {\r\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;\r\n continue;\r\n }\r\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\r\n continue;\r\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace RenderMaterialElement { // eslint-disable-line no-redeclare\r\n /** Parameters used to construct a [[RenderMaterial]].\r\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\r\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\r\n * @deprecated in 3.6 because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\r\n */\r\n export class Params {\r\n /** A required palette name that categorizes this RenderMaterial */\r\n public paletteName: string;\r\n /** An optional description of this RenderMaterial */\r\n public description?: string;\r\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\r\n public color?: RgbFactorProps;\r\n /** The color to use for specular illumination. Default: black. */\r\n public specularColor?: RgbFactorProps;\r\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\r\n * Default: 0.\r\n */\r\n public finish?: number;\r\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\r\n * The surface's own transparency will be multiplied by `(1 - transmit)`. permitting the material to increase but not decrease the surface transparency.\r\n * Default: 13.5.\r\n */\r\n public transmit?: number;\r\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\r\n public diffuse?: number;\r\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\r\n public specular?: number;\r\n /** Currently unused. */\r\n public reflect?: number;\r\n /** Currently unused. */\r\n public reflectColor?: number[];\r\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\r\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\r\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\r\n */\r\n public patternMap?: TextureMapProps;\r\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\r\n * surface's geometry.\r\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\r\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\r\n */\r\n public normalMap?: NormalMapProps & {\r\n /** A factor by which to multiply the components of the normal vectors read from the texture.\r\n * Default: 1.\r\n */\r\n scale?: number;\r\n };\r\n\r\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\r\n public constructor(paletteName: string) {\r\n this.paletteName = paletteName;\r\n }\r\n }\r\n}\r\n\r\n/** Parameters used to create a [[RenderMaterial]] element.\r\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\r\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\r\n * @public\r\n */\r\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line deprecation/deprecation, @typescript-eslint/no-empty-interface\r\n}\r\n"]}
|
package/lib/cjs/Model.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export interface OnElementInModelIdArg extends OnModelIdArg {
|
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
49
|
export declare class Model extends Entity {
|
|
50
|
-
/** @internal */
|
|
51
50
|
static get className(): string;
|
|
52
51
|
/** @internal */
|
|
53
52
|
static get protectedOperations(): string[];
|
|
@@ -161,7 +160,6 @@ export declare class Model extends Entity {
|
|
|
161
160
|
*/
|
|
162
161
|
export declare class GeometricModel extends Model {
|
|
163
162
|
geometryGuid?: GuidString;
|
|
164
|
-
/** @internal */
|
|
165
163
|
static get className(): string;
|
|
166
164
|
protected constructor(props: GeometricModelProps, iModel: IModelDb);
|
|
167
165
|
/** Query for the union of the extents of the elements contained by this model.
|
|
@@ -185,7 +183,6 @@ export declare abstract class GeometricModel3d extends GeometricModel {
|
|
|
185
183
|
readonly isNotSpatiallyLocated: boolean;
|
|
186
184
|
/** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
|
|
187
185
|
get isSpatiallyLocated(): boolean;
|
|
188
|
-
/** @internal */
|
|
189
186
|
static get className(): string;
|
|
190
187
|
protected constructor(props: GeometricModel3dProps, iModel: IModelDb);
|
|
191
188
|
toJSON(): GeometricModel3dProps;
|
|
@@ -196,7 +193,6 @@ export declare abstract class GeometricModel3d extends GeometricModel {
|
|
|
196
193
|
export declare abstract class GeometricModel2d extends GeometricModel {
|
|
197
194
|
/** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */
|
|
198
195
|
globalOrigin?: Point2d;
|
|
199
|
-
/** @internal */
|
|
200
196
|
static get className(): string;
|
|
201
197
|
protected constructor(props: GeometricModel2dProps, iModel: IModelDb);
|
|
202
198
|
toJSON(): GeometricModel2dProps;
|
|
@@ -205,7 +201,6 @@ export declare abstract class GeometricModel2d extends GeometricModel {
|
|
|
205
201
|
* @public
|
|
206
202
|
*/
|
|
207
203
|
export declare abstract class GraphicalModel2d extends GeometricModel2d {
|
|
208
|
-
/** @internal */
|
|
209
204
|
static get className(): string;
|
|
210
205
|
}
|
|
211
206
|
/** A container for persisting GraphicalElement3d instances.
|
|
@@ -214,14 +209,12 @@ export declare abstract class GraphicalModel2d extends GeometricModel2d {
|
|
|
214
209
|
* @public
|
|
215
210
|
*/
|
|
216
211
|
export declare abstract class GraphicalModel3d extends GeometricModel3d {
|
|
217
|
-
/** @internal */
|
|
218
212
|
static get className(): string;
|
|
219
213
|
}
|
|
220
214
|
/** A container for persisting 3d geometric elements that are spatially located.
|
|
221
215
|
* @public
|
|
222
216
|
*/
|
|
223
217
|
export declare abstract class SpatialModel extends GeometricModel3d {
|
|
224
|
-
/** @internal */
|
|
225
218
|
static get className(): string;
|
|
226
219
|
}
|
|
227
220
|
/** A container for persisting physical elements that model physical space.
|
|
@@ -229,7 +222,6 @@ export declare abstract class SpatialModel extends GeometricModel3d {
|
|
|
229
222
|
* @public
|
|
230
223
|
*/
|
|
231
224
|
export declare class PhysicalModel extends SpatialModel {
|
|
232
|
-
/** @internal */
|
|
233
225
|
static get className(): string;
|
|
234
226
|
/** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
|
|
235
227
|
* @param iModelDb Insert into this iModel
|
|
@@ -246,7 +238,6 @@ export declare class PhysicalModel extends SpatialModel {
|
|
|
246
238
|
* @public
|
|
247
239
|
*/
|
|
248
240
|
export declare class SpatialLocationModel extends SpatialModel {
|
|
249
|
-
/** @internal */
|
|
250
241
|
static get className(): string;
|
|
251
242
|
/** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
|
|
252
243
|
* @param iModelDb Insert into this iModel
|
|
@@ -262,14 +253,12 @@ export declare class SpatialLocationModel extends SpatialModel {
|
|
|
262
253
|
* @public
|
|
263
254
|
*/
|
|
264
255
|
export declare class DrawingModel extends GraphicalModel2d {
|
|
265
|
-
/** @internal */
|
|
266
256
|
static get className(): string;
|
|
267
257
|
}
|
|
268
258
|
/** A container for persisting section [[DrawingGraphic]]s.
|
|
269
259
|
* @public
|
|
270
260
|
*/
|
|
271
261
|
export declare class SectionDrawingModel extends DrawingModel {
|
|
272
|
-
/** @internal */
|
|
273
262
|
static get className(): string;
|
|
274
263
|
}
|
|
275
264
|
/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.
|
|
@@ -278,21 +267,18 @@ export declare class SectionDrawingModel extends DrawingModel {
|
|
|
278
267
|
* @public
|
|
279
268
|
*/
|
|
280
269
|
export declare class SheetModel extends GraphicalModel2d {
|
|
281
|
-
/** @internal */
|
|
282
270
|
static get className(): string;
|
|
283
271
|
}
|
|
284
272
|
/** A container for persisting role elements.
|
|
285
273
|
* @public
|
|
286
274
|
*/
|
|
287
275
|
export declare class RoleModel extends Model {
|
|
288
|
-
/** @internal */
|
|
289
276
|
static get className(): string;
|
|
290
277
|
}
|
|
291
278
|
/** A container for persisting information elements.
|
|
292
279
|
* @public
|
|
293
280
|
*/
|
|
294
281
|
export declare abstract class InformationModel extends Model {
|
|
295
|
-
/** @internal */
|
|
296
282
|
static get className(): string;
|
|
297
283
|
}
|
|
298
284
|
/** A container for persisting group information elements.
|
|
@@ -300,7 +286,6 @@ export declare abstract class InformationModel extends Model {
|
|
|
300
286
|
* @public
|
|
301
287
|
*/
|
|
302
288
|
export declare abstract class GroupInformationModel extends InformationModel {
|
|
303
|
-
/** @internal */
|
|
304
289
|
static get className(): string;
|
|
305
290
|
}
|
|
306
291
|
/** A container for persisting Information Record Elements
|
|
@@ -308,7 +293,6 @@ export declare abstract class GroupInformationModel extends InformationModel {
|
|
|
308
293
|
* @public
|
|
309
294
|
*/
|
|
310
295
|
export declare class InformationRecordModel extends InformationModel {
|
|
311
|
-
/** @internal */
|
|
312
296
|
static get className(): string;
|
|
313
297
|
/** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
|
|
314
298
|
* @param iModelDb Insert into this iModel
|
|
@@ -324,7 +308,6 @@ export declare class InformationRecordModel extends InformationModel {
|
|
|
324
308
|
* @public
|
|
325
309
|
*/
|
|
326
310
|
export declare class DefinitionModel extends InformationModel {
|
|
327
|
-
/** @internal */
|
|
328
311
|
static get className(): string;
|
|
329
312
|
/** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
|
|
330
313
|
* @param iModelDb Insert into this iModel
|
|
@@ -339,7 +322,6 @@ export declare class DefinitionModel extends InformationModel {
|
|
|
339
322
|
* @public
|
|
340
323
|
*/
|
|
341
324
|
export declare class RepositoryModel extends DefinitionModel {
|
|
342
|
-
/** @internal */
|
|
343
325
|
static get className(): string;
|
|
344
326
|
}
|
|
345
327
|
/** Contains a list of document elements.
|
|
@@ -347,7 +329,6 @@ export declare class RepositoryModel extends DefinitionModel {
|
|
|
347
329
|
* @public
|
|
348
330
|
*/
|
|
349
331
|
export declare class DocumentListModel extends InformationModel {
|
|
350
|
-
/** @internal */
|
|
351
332
|
static get className(): string;
|
|
352
333
|
/** Insert a DocumentPartition and a DocumentListModel that sub-models it.
|
|
353
334
|
* @param iModelDb Insert into this iModel
|
|
@@ -363,21 +344,18 @@ export declare class DocumentListModel extends InformationModel {
|
|
|
363
344
|
* @public
|
|
364
345
|
*/
|
|
365
346
|
export declare class LinkModel extends InformationModel {
|
|
366
|
-
/** @internal */
|
|
367
347
|
static get className(): string;
|
|
368
348
|
}
|
|
369
349
|
/** The singleton container for repository-specific definition elements.
|
|
370
350
|
* @public
|
|
371
351
|
*/
|
|
372
352
|
export declare class DictionaryModel extends DefinitionModel {
|
|
373
|
-
/** @internal */
|
|
374
353
|
static get className(): string;
|
|
375
354
|
}
|
|
376
355
|
/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.
|
|
377
356
|
* @public
|
|
378
357
|
*/
|
|
379
358
|
export declare class WebMercatorModel extends SpatialModel {
|
|
380
|
-
/** @internal */
|
|
381
359
|
static get className(): string;
|
|
382
360
|
}
|
|
383
361
|
//# sourceMappingURL=Model.d.ts.map
|
package/lib/cjs/Model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EACnF,UAAU,EAAE,cAAc,EAC7D,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EACnF,UAAU,EAAE,cAAc,EAC7D,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,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MG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU;CAahG;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,eAAe;IAClD,WAA2B,SAAS,IAAI,MAAM,CAA8B;CAC7E;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,WAA2B,SAAS,IAAI,MAAM,CAAgC;IAC9E;;;;;;OAMG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU;CAahG;AAED;;;GAGG;AACH,qBAAa,SAAU,SAAQ,gBAAgB;IAC7C,WAA2B,SAAS,IAAI,MAAM,CAAwB;CACvE;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,eAAe;IAClD,WAA2B,SAAS,IAAI,MAAM,CAA8B;CAC7E;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,WAA2B,SAAS,IAAI,MAAM,CAA+B;CAC9E"}
|
package/lib/cjs/Model.js
CHANGED
|
@@ -15,13 +15,13 @@ const core_common_1 = require("@itwin/core-common");
|
|
|
15
15
|
const Element_1 = require("./Element");
|
|
16
16
|
const Entity_1 = require("./Entity");
|
|
17
17
|
const NavigationRelationship_1 = require("./NavigationRelationship");
|
|
18
|
+
const Symbols_1 = require("./internal/Symbols");
|
|
18
19
|
/** A Model is a container for persisting a collection of related elements within an iModel.
|
|
19
20
|
* See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.
|
|
20
21
|
* See [Creating models]($docs/learning/backend/CreateModels.md)
|
|
21
22
|
* @public
|
|
22
23
|
*/
|
|
23
24
|
class Model extends Entity_1.Entity {
|
|
24
|
-
/** @internal */
|
|
25
25
|
static get className() { return "Model"; }
|
|
26
26
|
/** @internal */
|
|
27
27
|
static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
|
|
@@ -45,7 +45,7 @@ class Model extends Entity_1.Entity {
|
|
|
45
45
|
*/
|
|
46
46
|
static onInsert(arg) {
|
|
47
47
|
const { props, iModel } = arg;
|
|
48
|
-
iModel.channels.
|
|
48
|
+
iModel.channels[Symbols_1._verifyChannel](props.modeledElement.id);
|
|
49
49
|
if (props.parentModel) // inserting requires shared lock on parent, if present
|
|
50
50
|
iModel.locks.checkSharedLock(props.parentModel, "parent model", "insert");
|
|
51
51
|
}
|
|
@@ -65,7 +65,7 @@ class Model extends Entity_1.Entity {
|
|
|
65
65
|
*/
|
|
66
66
|
static onUpdate(arg) {
|
|
67
67
|
const id = arg.props.id; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
68
|
-
arg.iModel.channels.
|
|
68
|
+
arg.iModel.channels[Symbols_1._verifyChannel](id);
|
|
69
69
|
arg.iModel.locks.checkExclusiveLock(id, "model", "update");
|
|
70
70
|
}
|
|
71
71
|
/** Called after a Model is updated.
|
|
@@ -82,7 +82,7 @@ class Model extends Entity_1.Entity {
|
|
|
82
82
|
* @beta
|
|
83
83
|
*/
|
|
84
84
|
static onDelete(arg) {
|
|
85
|
-
arg.iModel.channels.
|
|
85
|
+
arg.iModel.channels[Symbols_1._verifyChannel](arg.id);
|
|
86
86
|
arg.iModel.locks.checkExclusiveLock(arg.id, "model", "delete");
|
|
87
87
|
}
|
|
88
88
|
/** Called after a Model was deleted.
|
|
@@ -161,7 +161,6 @@ exports.Model = Model;
|
|
|
161
161
|
* @public
|
|
162
162
|
*/
|
|
163
163
|
class GeometricModel extends Model {
|
|
164
|
-
/** @internal */
|
|
165
164
|
static get className() { return "GeometricModel"; }
|
|
166
165
|
constructor(props, iModel) { super(props, iModel); }
|
|
167
166
|
/** Query for the union of the extents of the elements contained by this model.
|
|
@@ -183,7 +182,6 @@ exports.GeometricModel = GeometricModel;
|
|
|
183
182
|
class GeometricModel3d extends GeometricModel {
|
|
184
183
|
/** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
|
|
185
184
|
get isSpatiallyLocated() { return !this.isNotSpatiallyLocated; }
|
|
186
|
-
/** @internal */
|
|
187
185
|
static get className() { return "GeometricModel3d"; }
|
|
188
186
|
constructor(props, iModel) {
|
|
189
187
|
super(props, iModel);
|
|
@@ -204,7 +202,6 @@ exports.GeometricModel3d = GeometricModel3d;
|
|
|
204
202
|
* @public
|
|
205
203
|
*/
|
|
206
204
|
class GeometricModel2d extends GeometricModel {
|
|
207
|
-
/** @internal */
|
|
208
205
|
static get className() { return "GeometricModel2d"; }
|
|
209
206
|
constructor(props, iModel) { super(props, iModel); }
|
|
210
207
|
toJSON() {
|
|
@@ -219,7 +216,6 @@ exports.GeometricModel2d = GeometricModel2d;
|
|
|
219
216
|
* @public
|
|
220
217
|
*/
|
|
221
218
|
class GraphicalModel2d extends GeometricModel2d {
|
|
222
|
-
/** @internal */
|
|
223
219
|
static get className() { return "GraphicalModel2d"; }
|
|
224
220
|
}
|
|
225
221
|
exports.GraphicalModel2d = GraphicalModel2d;
|
|
@@ -229,7 +225,6 @@ exports.GraphicalModel2d = GraphicalModel2d;
|
|
|
229
225
|
* @public
|
|
230
226
|
*/
|
|
231
227
|
class GraphicalModel3d extends GeometricModel3d {
|
|
232
|
-
/** @internal */
|
|
233
228
|
static get className() { return "GraphicalModel3d"; }
|
|
234
229
|
}
|
|
235
230
|
exports.GraphicalModel3d = GraphicalModel3d;
|
|
@@ -237,7 +232,6 @@ exports.GraphicalModel3d = GraphicalModel3d;
|
|
|
237
232
|
* @public
|
|
238
233
|
*/
|
|
239
234
|
class SpatialModel extends GeometricModel3d {
|
|
240
|
-
/** @internal */
|
|
241
235
|
static get className() { return "SpatialModel"; }
|
|
242
236
|
}
|
|
243
237
|
exports.SpatialModel = SpatialModel;
|
|
@@ -246,7 +240,6 @@ exports.SpatialModel = SpatialModel;
|
|
|
246
240
|
* @public
|
|
247
241
|
*/
|
|
248
242
|
class PhysicalModel extends SpatialModel {
|
|
249
|
-
/** @internal */
|
|
250
243
|
static get className() { return "PhysicalModel"; }
|
|
251
244
|
/** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
|
|
252
245
|
* @param iModelDb Insert into this iModel
|
|
@@ -278,7 +271,6 @@ exports.PhysicalModel = PhysicalModel;
|
|
|
278
271
|
* @public
|
|
279
272
|
*/
|
|
280
273
|
class SpatialLocationModel extends SpatialModel {
|
|
281
|
-
/** @internal */
|
|
282
274
|
static get className() { return "SpatialLocationModel"; }
|
|
283
275
|
/** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
|
|
284
276
|
* @param iModelDb Insert into this iModel
|
|
@@ -309,7 +301,6 @@ exports.SpatialLocationModel = SpatialLocationModel;
|
|
|
309
301
|
* @public
|
|
310
302
|
*/
|
|
311
303
|
class DrawingModel extends GraphicalModel2d {
|
|
312
|
-
/** @internal */
|
|
313
304
|
static get className() { return "DrawingModel"; }
|
|
314
305
|
}
|
|
315
306
|
exports.DrawingModel = DrawingModel;
|
|
@@ -317,7 +308,6 @@ exports.DrawingModel = DrawingModel;
|
|
|
317
308
|
* @public
|
|
318
309
|
*/
|
|
319
310
|
class SectionDrawingModel extends DrawingModel {
|
|
320
|
-
/** @internal */
|
|
321
311
|
static get className() { return "SectionDrawingModel"; }
|
|
322
312
|
}
|
|
323
313
|
exports.SectionDrawingModel = SectionDrawingModel;
|
|
@@ -327,7 +317,6 @@ exports.SectionDrawingModel = SectionDrawingModel;
|
|
|
327
317
|
* @public
|
|
328
318
|
*/
|
|
329
319
|
class SheetModel extends GraphicalModel2d {
|
|
330
|
-
/** @internal */
|
|
331
320
|
static get className() { return "SheetModel"; }
|
|
332
321
|
}
|
|
333
322
|
exports.SheetModel = SheetModel;
|
|
@@ -335,7 +324,6 @@ exports.SheetModel = SheetModel;
|
|
|
335
324
|
* @public
|
|
336
325
|
*/
|
|
337
326
|
class RoleModel extends Model {
|
|
338
|
-
/** @internal */
|
|
339
327
|
static get className() { return "RoleModel"; }
|
|
340
328
|
}
|
|
341
329
|
exports.RoleModel = RoleModel;
|
|
@@ -343,7 +331,6 @@ exports.RoleModel = RoleModel;
|
|
|
343
331
|
* @public
|
|
344
332
|
*/
|
|
345
333
|
class InformationModel extends Model {
|
|
346
|
-
/** @internal */
|
|
347
334
|
static get className() { return "InformationModel"; }
|
|
348
335
|
}
|
|
349
336
|
exports.InformationModel = InformationModel;
|
|
@@ -352,7 +339,6 @@ exports.InformationModel = InformationModel;
|
|
|
352
339
|
* @public
|
|
353
340
|
*/
|
|
354
341
|
class GroupInformationModel extends InformationModel {
|
|
355
|
-
/** @internal */
|
|
356
342
|
static get className() { return "GroupInformationModel"; }
|
|
357
343
|
}
|
|
358
344
|
exports.GroupInformationModel = GroupInformationModel;
|
|
@@ -361,7 +347,6 @@ exports.GroupInformationModel = GroupInformationModel;
|
|
|
361
347
|
* @public
|
|
362
348
|
*/
|
|
363
349
|
class InformationRecordModel extends InformationModel {
|
|
364
|
-
/** @internal */
|
|
365
350
|
static get className() { return "InformationRecordModel"; }
|
|
366
351
|
/** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
|
|
367
352
|
* @param iModelDb Insert into this iModel
|
|
@@ -390,7 +375,6 @@ exports.InformationRecordModel = InformationRecordModel;
|
|
|
390
375
|
* @public
|
|
391
376
|
*/
|
|
392
377
|
class DefinitionModel extends InformationModel {
|
|
393
|
-
/** @internal */
|
|
394
378
|
static get className() { return "DefinitionModel"; }
|
|
395
379
|
/** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
|
|
396
380
|
* @param iModelDb Insert into this iModel
|
|
@@ -418,7 +402,6 @@ exports.DefinitionModel = DefinitionModel;
|
|
|
418
402
|
* @public
|
|
419
403
|
*/
|
|
420
404
|
class RepositoryModel extends DefinitionModel {
|
|
421
|
-
/** @internal */
|
|
422
405
|
static get className() { return "RepositoryModel"; }
|
|
423
406
|
}
|
|
424
407
|
exports.RepositoryModel = RepositoryModel;
|
|
@@ -427,7 +410,6 @@ exports.RepositoryModel = RepositoryModel;
|
|
|
427
410
|
* @public
|
|
428
411
|
*/
|
|
429
412
|
class DocumentListModel extends InformationModel {
|
|
430
|
-
/** @internal */
|
|
431
413
|
static get className() { return "DocumentListModel"; }
|
|
432
414
|
/** Insert a DocumentPartition and a DocumentListModel that sub-models it.
|
|
433
415
|
* @param iModelDb Insert into this iModel
|
|
@@ -456,7 +438,6 @@ exports.DocumentListModel = DocumentListModel;
|
|
|
456
438
|
* @public
|
|
457
439
|
*/
|
|
458
440
|
class LinkModel extends InformationModel {
|
|
459
|
-
/** @internal */
|
|
460
441
|
static get className() { return "LinkModel"; }
|
|
461
442
|
}
|
|
462
443
|
exports.LinkModel = LinkModel;
|
|
@@ -464,7 +445,6 @@ exports.LinkModel = LinkModel;
|
|
|
464
445
|
* @public
|
|
465
446
|
*/
|
|
466
447
|
class DictionaryModel extends DefinitionModel {
|
|
467
|
-
/** @internal */
|
|
468
448
|
static get className() { return "DictionaryModel"; }
|
|
469
449
|
}
|
|
470
450
|
exports.DictionaryModel = DictionaryModel;
|
|
@@ -472,7 +452,6 @@ exports.DictionaryModel = DictionaryModel;
|
|
|
472
452
|
* @public
|
|
473
453
|
*/
|
|
474
454
|
class WebMercatorModel extends SpatialModel {
|
|
475
|
-
/** @internal */
|
|
476
455
|
static get className() { return "WebMercatorModel"; }
|
|
477
456
|
}
|
|
478
457
|
exports.WebMercatorModel = WebMercatorModel;
|