@itwin/core-backend 5.0.0-dev.3 → 5.0.0-dev.32
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 +30 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.d.ts +22 -1
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +242 -242
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +5 -5
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +2 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +2 -0
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/FontFile.d.ts +68 -0
- package/lib/cjs/FontFile.d.ts.map +1 -0
- package/lib/cjs/FontFile.js +36 -0
- package/lib/cjs/FontFile.js.map +1 -0
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +9 -10
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +19 -24
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.d.ts +54 -0
- package/lib/cjs/IModelDbFonts.d.ts.map +1 -0
- package/lib/cjs/IModelDbFonts.js +11 -0
- package/lib/cjs/IModelDbFonts.js.map +1 -0
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +0 -2
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts.map +1 -1
- package/lib/cjs/IModelJsFs.js +8 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.d.ts +6 -3
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js +3 -3
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
- package/lib/cjs/core-backend.d.ts +2 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +2 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/FontFileImpl.d.ts +34 -0
- package/lib/cjs/internal/FontFileImpl.d.ts.map +1 -0
- package/lib/cjs/internal/FontFileImpl.js +153 -0
- package/lib/cjs/internal/FontFileImpl.js.map +1 -0
- package/lib/cjs/internal/IModelDbFontsImpl.d.ts +7 -0
- package/lib/cjs/internal/IModelDbFontsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/IModelDbFontsImpl.js +196 -0
- package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -0
- package/lib/cjs/internal/NativePlatform.js.map +1 -1
- package/lib/cjs/internal/NoLocks.js.map +1 -1
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +3 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +4 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +21 -19
- package/lib/cjs/ChangedElementsManager.d.ts +0 -42
- package/lib/cjs/ChangedElementsManager.d.ts.map +0 -1
- package/lib/cjs/ChangedElementsManager.js +0 -91
- package/lib/cjs/ChangedElementsManager.js.map +0 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +0 -17
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +0 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js +0 -40
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAE4B;AAC5B,wCAA6F;AAE7F,oCAAqC;AACrC,sEAAyE;AACzE,kDAA2F;AAE3F;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qCAA2B;IAC3D,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAEhF,YAAsB,KAAuC,EAAE,MAAgB;QAC7E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,kDAMC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,iBAAS;IACrC,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAE5E,YAAmB,KAAiB,EAAE,MAAgB;QACpD,KAAK,CAAC,K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AAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,kDAMC;AAED;;GAEG;AACH,MAAsB,0BAA2B,SAAQ,iBAAiB;IACjE,MAAM,KAAc,SAAS,KAAa,OAAO,4BAA4B,CAAC,CAAC,CAAC;IAEvF,YAAsB,KAA6B,EAAE,MAAgB;QACnE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,gEAMC;AAED;;GAEG;AACH,MAAsB,cAAe,SAAQ,+BAAqB;IACzD,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAE3E,YAAsB,KAAiC,EAAE,MAAgB;QACvE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,wCAMC;AAED;;GAEG;AACH,MAAa,yBAA0B,SAAQ,4BAAc;IACpD,MAAM,KAAK,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAE7E,YAAmB,EAAc,EAAE,eAAuB,yBAAyB,CAAC,aAAa;QAC/F,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9B,CAAC;;AALH,8DAMC;AAJe,uCAAa,GAAG,sCAAsC,CAAC;AAMvE;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sCAAuB;IACnE,MAAM,KAAc,SAAS,KAAa,OAAO,iCAAiC,CAAC,CAAC,CAAC;CAC7F;AAFD,0EAEC;AAED;;GAEG;AACH,MAAa,yCAA0C,SAAQ,8CAA+B;IACrF,MAAM,KAAc,SAAS,KAAa,OAAO,2CAA2C,CAAC,CAAC,CAAC;CACvG;AAFD,8FAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAE4B;AAC5B,wC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MvE;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sCAAuB;IACnE,MAAM,KAAc,SAAS,KAAa,OAAO,iCAAiC,CAAC,CAAC,CAAC;CAC7F;AAFD,0EAEC;AAED;;GAEG;AACH,MAAa,yCAA0C,SAAQ,8CAA+B;IACrF,MAAM,KAAc,SAAS,KAAa,OAAO,2CAA2C,CAAC,CAAC,CAAC;CACvG;AAFD,8FAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n FunctionalElementProps, IModel, InformationPartitionElementProps, ModelProps, RelatedElement, TypeDefinitionElementProps,\n} from \"@itwin/core-common\";\nimport { InformationPartitionElement, RoleElement, TypeDefinitionElement } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { RoleModel } from \"../Model\";\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\nimport { DrawingGraphicRepresentsElement, ElementRefersToElements } from \"../Relationship\";\n\n/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented\n * to a Subject and broken down by a FunctionalModel.\n * @public\n */\nexport class FunctionalPartition extends InformationPartitionElement {\n public static override get className(): string { return \"FunctionalPartition\"; }\n\n protected constructor(props: InformationPartitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A container for persisting FunctionalElements.\n * @public\n */\nexport class FunctionalModel extends RoleModel {\n public static override get className(): string { return \"FunctionalModel\"; }\n\n public constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n /** Insert a FunctionalPartition and a FunctionalModel that breaks it down.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.\n * @param name The name of the FunctionalPartition that the new FunctionalModel will break down.\n * @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: FunctionalPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: FunctionalPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.\n * @public\n */\nexport abstract class FunctionalElement extends RoleElement {\n public static override get className(): string { return \"FunctionalElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.\n * @public\n */\nexport abstract class FunctionalBreakdownElement extends FunctionalElement {\n public static override get className(): string { return \"FunctionalBreakdownElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** @public */\nexport class FunctionalComposite extends FunctionalBreakdownElement {\n public static override get className(): string { return \"FunctionalComposite\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.\n * @public\n */\nexport abstract class FunctionalComponentElement extends FunctionalElement {\n public static override get className(): string { return \"FunctionalComponentElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Defines a set of properties (the 'type') that can be associated with a Functional Element.\n * @public\n */\nexport abstract class FunctionalType extends TypeDefinitionElement {\n public static override get className(): string { return \"FunctionalType\"; }\n\n protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Relates a [[FunctionalElement]] to its [[FunctionalType]]\n * @public\n */\nexport class FunctionalElementIsOfType extends RelatedElement {\n public static get className(): string { return \"FunctionalElementIsOfType\"; }\n public static classFullName = \"Functional:FunctionalElementIsOfType\";\n public constructor(id: Id64String, relClassName: string = FunctionalElementIsOfType.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.\n * @public\n */\nexport class PhysicalElementFulfillsFunction extends ElementRefersToElements {\n public static override get className(): string { return \"PhysicalElementFulfillsFunction\"; }\n}\n\n/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents\n * @public\n */\nexport class DrawingGraphicRepresentsFunctionalElement extends DrawingGraphicRepresentsElement {\n public static override get className(): string { return \"DrawingGraphicRepresentsFunctionalElement\"; }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionalSchema.js","sourceRoot":"","sources":["../../../src/domains/FunctionalSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,sDAA+C;AAC/C,oDAAiD;AACjD,oDAAiD;AAEjD,8CAA+C;AAC/C,sCAA4C;AAC5C,uDAAuD;AACvD,iDAAgD;AAEhD,cAAc;AACd,MAAa,gBAAiB,SAAQ,eAAM;IACnC,MAAM,KAAc,UAAU,KAAa,OAAO,YAAY,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/J,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1D,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,cAAc;IACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAAkB;QACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;YAC1B,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,mBAAS,CAAC,CAAC,sBAAsB,EAAE,CAAC;QAC1D,IAAI,uBAAQ,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF;AArBD,4CAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"FunctionalSchema.js","sourceRoot":"","sources":["../../../src/domains/FunctionalSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,sDAA+C;AAC/C,oDAAiD;AACjD,oDAAiD;AAEjD,8CAA+C;AAC/C,sCAA4C;AAC5C,uDAAuD;AACvD,iDAAgD;AAEhD,cAAc;AACd,MAAa,gBAAiB,SAAQ,eAAM;IACnC,MAAM,KAAc,UAAU,KAAa,OAAO,YAAY,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/J,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1D,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,cAAc;IACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAAkB;QACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;YAC1B,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,mBAAS,CAAC,CAAC,sBAAsB,EAAE,CAAC;QAC1D,IAAI,uBAAQ,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF;AArBD,4CAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport * as path from \"path\";\nimport { DbResult } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { IModelDb } from \"../IModelDb\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./FunctionalElements\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\n/** @public */\nexport class FunctionalSchema extends Schema {\n public static override get schemaName(): string { return \"Functional\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Domain\", `${FunctionalSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n\n /** @public */\n public static async importSchema(iModelDb: IModelDb) {\n if (iModelDb.isBriefcaseDb())\n await iModelDb.acquireSchemaLock();\n\n const stat = iModelDb[_nativeDb].importFunctionalSchema();\n if (DbResult.BE_SQLITE_OK !== stat) {\n throw new IModelError(stat, \"Error importing Functional schema\");\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericElements.js","sourceRoot":"","sources":["../../../src/domains/GenericElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAG4B;AAC5B,wCAGoB;AAEpB,0CAA+C;AAC/C,oCAAmE;AACnE,sEAAyE;AAEzE;;GAEG;AACH,MAAsB,eAAgB,SAAQ,4BAAkB;IACvD,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAA8B,EAAE,MAAgB;QACjE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,0CAKC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,eAAe;IACrC,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;IACtE,YAAmB,KAA8B,EAAE,MAAgB;QACjE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,8BAKC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,eAAe;IAC/C,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAChF,YAAmB,KAA+B,EAAE,MAAgB;QAClE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,kDAKC;AAED;;GAEG;AACH,MAAsB,OAAQ,SAAQ,eAAe;IAC5C,MAAM,KAAc,SAAS,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IACpE,YAAmB,KAAmB,EAAE,MAAgB;QACtD,KAAK,CAAC,KAAK,EAAE,MAAM,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gB;IACpD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E,YAAmB,KAA6B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,0DAKC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAY;IAC5C,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,kDAKC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IAClD,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,wDAKC","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 { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\r\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\r\n PhysicalElement, PhysicalType, SpatialLocationElement,\r\n} from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { PhysicalMaterial } from \"../Material\";\r\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\n\r\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\r\n * @public\r\n */\r\nexport abstract class DetailingSymbol extends GraphicalElement2d {\r\n public static override get className(): string { return \"DetailingSymbol\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains title text.\r\n * @public\r\n */\r\nexport class TitleText extends DetailingSymbol {\r\n public static override get className(): string { return \"TitleText\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains a view attachment label.\r\n * @public\r\n */\r\nexport class ViewAttachmentLabel extends DetailingSymbol {\r\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\r\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\r\n * @public\r\n */\r\nexport abstract class Callout extends DetailingSymbol {\r\n public static override get className(): string { return \"Callout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a section drawing.\r\n * @public\r\n */\r\nexport class SectionCallout extends Callout {\r\n public static override get className(): string { return \"SectionCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references an elevation drawing.\r\n * @public\r\n */\r\nexport class ElevationCallout extends Callout {\r\n public static override get className(): string { return \"ElevationCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a plan drawing.\r\n * @public\r\n */\r\nexport class PlanCallout extends Callout {\r\n public static override get className(): string { return \"PlanCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a detail drawing.\r\n * @public\r\n */\r\nexport class DetailCallout extends Callout {\r\n public static override get className(): string { return \"DetailCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\r\n * @public\r\n */\r\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\r\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GraphicalPartition3d.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\r\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class Graphic3d extends GraphicalElement3d {\r\n public static override get className(): string { return \"Graphic3d\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\r\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class PhysicalObject extends PhysicalElement {\r\n public static override get className(): string { return \"PhysicalObject\"; }\r\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\r\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class SpatialLocation extends SpatialLocationElement {\r\n public static override get className(): string { return \"SpatialLocation\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for BisCore:GroupInformationElement instances.\r\n * @public\r\n */\r\nexport class GroupModel extends GroupInformationModel {\r\n public static override get className(): string { return \"GroupModel\"; }\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\r\n * @returns The Id of the newly inserted GroupModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GroupInformationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The Generic:Group class is used when the group cannot be further classified.\r\n * @public\r\n */\r\nexport class Group extends GroupInformationElement {\r\n public static override get className(): string { return \"Group\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:Document class is used when a document cannot be further classified.\r\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericDocument extends Document {\r\n public static override get className(): string { return \"Document\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\r\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\r\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalType extends PhysicalType {\r\n public static override get className(): string { return \"PhysicalType\"; }\r\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\r\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericGraphicalType2d extends GraphicalType2d {\r\n public static override get className(): string { return \"GraphicalType2d\"; }\r\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GenericElements.js","sourceRoot":"","sources":["../../../src/domains/G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,CAAC,CAAC,CAAC;IACzE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,kDAKC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IAClD,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,wDAKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\n} from \"@itwin/core-common\";\nimport {\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\n PhysicalElement, PhysicalType, SpatialLocationElement,\n} from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { PhysicalMaterial } from \"../Material\";\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\n\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\n * @public\n */\nexport abstract class DetailingSymbol extends GraphicalElement2d {\n public static override get className(): string { return \"DetailingSymbol\"; }\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that contains title text.\n * @public\n */\nexport class TitleText extends DetailingSymbol {\n public static override get className(): string { return \"TitleText\"; }\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that contains a view attachment label.\n * @public\n */\nexport class ViewAttachmentLabel extends DetailingSymbol {\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\n * @public\n */\nexport abstract class Callout extends DetailingSymbol {\n public static override get className(): string { return \"Callout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a section drawing.\n * @public\n */\nexport class SectionCallout extends Callout {\n public static override get className(): string { return \"SectionCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references an elevation drawing.\n * @public\n */\nexport class ElevationCallout extends Callout {\n public static override get className(): string { return \"ElevationCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a plan drawing.\n * @public\n */\nexport class PlanCallout extends Callout {\n public static override get className(): string { return \"PlanCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a detail drawing.\n * @public\n */\nexport class DetailCallout extends Callout {\n public static override get className(): string { return \"DetailCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\n * @public\n */\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\n public static override get className(): string { return \"GraphicalModel3d\"; }\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: GraphicalPartition3d.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\n * @public\n */\nexport class Graphic3d extends GraphicalElement3d {\n public static override get className(): string { return \"Graphic3d\"; }\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\n * @public\n */\nexport class PhysicalObject extends PhysicalElement {\n public static override get className(): string { return \"PhysicalObject\"; }\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\n * @public\n */\nexport class SpatialLocation extends SpatialLocationElement {\n public static override get className(): string { return \"SpatialLocation\"; }\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A generic container for BisCore:GroupInformationElement instances.\n * @public\n */\nexport class GroupModel extends GroupInformationModel {\n public static override get className(): string { return \"GroupModel\"; }\n public constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\n * @returns The Id of the newly inserted GroupModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: GroupInformationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** The Generic:Group class is used when the group cannot be further classified.\n * @public\n */\nexport class Group extends GroupInformationElement {\n public static override get className(): string { return \"Group\"; }\n public constructor(props: ElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:Document class is used when a document cannot be further classified.\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\n * @public\n */\nexport class GenericDocument extends Document {\n public static override get className(): string { return \"Document\"; }\n public constructor(props: ElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\n * @public\n */\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\n public static override get className(): string { return \"PhysicalMaterial\"; }\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\n * @public\n */\nexport class GenericPhysicalType extends PhysicalType {\n public static override get className(): string { return \"PhysicalType\"; }\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\n * @public\n */\nexport class GenericGraphicalType2d extends GraphicalType2d {\n public static override get className(): string { return \"GraphicalType2d\"; }\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1D,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1D,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport * as path from \"path\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./GenericElements\";\n\n/** @public */\nexport class GenericSchema extends Schema {\n public static override get schemaName(): string { return \"Generic\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangesetConflictArgs.js","sourceRoot":"","sources":["../../../src/internal/ChangesetConflictArgs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ChangesetConflictArgs.js","sourceRoot":"","sources":["../../../src/internal/ChangesetConflictArgs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { DbChangeStage, DbConflictCause, DbOpcode, DbValueType, Id64String } from \"@itwin/core-bentley\";\n\nexport interface ChangesetConflictArgs {\n cause: DbConflictCause;\n opcode: DbOpcode;\n indirect: boolean;\n tableName: string;\n changesetFile?: string;\n columnCount: number;\n getForeignKeyConflicts: () => number;\n dump: () => void;\n setLastError: (message: string) => void;\n getPrimaryKeyColumns: () => number[];\n getValueType: (columnIndex: number, stage: DbChangeStage) => DbValueType | null | undefined;\n getValueBinary: (columnIndex: number, stage: DbChangeStage) => Uint8Array | null | undefined;\n getValueId: (columnIndex: number, stage: DbChangeStage) => Id64String | null | undefined;\n getValueText: (columnIndex: number, stage: DbChangeStage) => string | null | undefined;\n getValueInteger: (columnIndex: number, stage: DbChangeStage) => number | null | undefined;\n getValueDouble: (columnIndex: number, stage: DbChangeStage) => number | null | undefined;\n isValueNull: (columnIndex: number, stage: DbChangeStage) => boolean | undefined;\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F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I,CAAC,eAAe,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,gBAAgB,CAAC,UAAsB;QAC5C,IAAI,UAAU,KAAK,+BAAc,CAAC,iBAAiB;YACjD,oEAAoE;YACpE,OAAO,oBAAM,CAAC,aAAa,CAAC;QAE9B,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,0BAA0B,YAAY,CAAC,gBAAgB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC/B,OAAO,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACvF,CAAC,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,8HAA8H;YAC9H,+EAA+E;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;IAEH,CAAC;;AA/GsB,6BAAgB,GAAG,uBAAuB,AAA1B,CAA2B;AAkHpE,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,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 Elements\r\n */\r\n\r\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\r\nimport { Subject } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { ChannelControl, ChannelKey } from \"../ChannelControl\";\r\nimport { _implementationProhibited, _nativeDb, _verifyChannel } from \"./Symbols\";\r\n\r\nclass ChannelAdmin implements ChannelControl {\r\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\r\n\r\n public readonly [_implementationProhibited] = undefined;\r\n private _allowedChannels = new Set<ChannelKey>();\r\n private _allowedModels = new Set<Id64String>();\r\n private _deniedModels = new Map<Id64String, ChannelKey>();\r\n\r\n public constructor(private _iModel: IModelDb) {\r\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\r\n if (IModelHost.configuration?.allowSharedChannel !== false)\r\n this._allowedChannels.add(ChannelControl.sharedChannelName);\r\n }\r\n\r\n public addAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.add(channelKey);\r\n this._deniedModels.clear();\r\n }\r\n\r\n public removeAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.delete(channelKey);\r\n this._allowedModels.clear();\r\n }\r\n\r\n public getChannelKey(elementId: Id64String): ChannelKey {\r\n if (elementId === IModel.rootSubjectId)\r\n return ChannelControl.sharedChannelName;\r\n\r\n try {\r\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\r\n stmt.bindId(1, elementId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\r\n });\r\n\r\n if (channel !== undefined)\r\n return channel;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return ChannelControl.sharedChannelName;\r\n }\r\n\r\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\r\n stmt.bindId(1, elementId);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\r\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\r\n });\r\n\r\n return this.getChannelKey(parentId);\r\n }\r\n\r\n public [_verifyChannel](modelId: Id64String): void {\r\n // Note: indirect changes are permitted to change any channel\r\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].isIndirectChanges())\r\n return;\r\n\r\n const deniedChannel = this._deniedModels.get(modelId);\r\n if (undefined !== deniedChannel)\r\n throw new Error(`channel \"${deniedChannel}\" is not allowed`);\r\n\r\n const channel = this.getChannelKey(modelId);\r\n if (this._allowedChannels.has(channel)) {\r\n this._allowedModels.add(modelId);\r\n return;\r\n }\r\n\r\n this._deniedModels.set(modelId, channel);\r\n return this[_verifyChannel](modelId);\r\n }\r\n\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }) {\r\n if (ChannelControl.sharedChannelName !== this.getChannelKey(args.elementId))\r\n throw new Error(\"channels may not nest\");\r\n\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n throw new Error(\"a channel root for the specified key already exists\");\r\n\r\n const props: ChannelRootAspectProps = { classFullName: ChannelAdmin.channelClassName, element: { id: args.elementId }, owner: args.channelKey };\r\n this._iModel.elements.insertAspect(props);\r\n }\r\n\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String {\r\n // Check if channelKey already exists before inserting Subject.\r\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\r\n // Prefer to check twice instead of deleting the Subject in the latter option.\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n throw new Error(\"a channel root for the specified key already exists\");\r\n\r\n const elementId = Subject.insert(this._iModel, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\r\n this.makeChannelRoot({ elementId, channelKey: args.channelKey });\r\n return elementId;\r\n }\r\n\r\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\r\n if (channelKey === ChannelControl.sharedChannelName)\r\n // RootSubject acts as the ChannelRoot element of the shared channel\r\n return IModel.rootSubjectId;\r\n\r\n try {\r\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\r\n stmt.bindString(1, channelKey);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\r\n });\r\n\r\n return channelRoot;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return undefined;\r\n }\r\n\r\n }\r\n}\r\n\r\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\r\n return new ChannelAdmin(iModel);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA6HH,oDAEC;AA7HD,sDAAyE;AACzE,oDAAiF;AACjF,wCAAqC;AAErC,8CAA2C;AAC3C,sDAA+D;AAC/D,uCAAiF;AAEjF,MAAM,YAAY;IAQhB,YAA2B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;QAL5B,QAA2B,GAAG,SAAS,CAAC;QAChD,qBAAgB,GAAG,IAAI,GAAG,EAAc,CAAC;QACzC,mBAAc,GAAG,IAAI,GAAG,EAAc,CAAC;QACvC,kBAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;QAGxD,2GAA2G;QAC3G,IAAI,uBAAU,CAAC,aAAa,EAAE,kBAAkB,KAAK,KAAK;YACxD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,+BAAc,CAAC,iBAAiB,CAAC,CAAC;IAChE,CAAC;IAEM,iBAAiB,CAAC,UAAsB;QAC7C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CA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AC,CAAC,SAAS,CAAC;YACvF,CAAC,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,8HAA8H;YAC9H,+EAA+E;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;IAEH,CAAC;;AA/GsB,6BAAgB,GAAG,uBAAuB,AAA1B,CAA2B;AAkHpE,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\nimport { Subject } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { ChannelControl, ChannelKey } from \"../ChannelControl\";\nimport { _implementationProhibited, _nativeDb, _verifyChannel } from \"./Symbols\";\n\nclass ChannelAdmin implements ChannelControl {\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\n\n public readonly [_implementationProhibited] = undefined;\n private _allowedChannels = new Set<ChannelKey>();\n private _allowedModels = new Set<Id64String>();\n private _deniedModels = new Map<Id64String, ChannelKey>();\n\n public constructor(private _iModel: IModelDb) {\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\n if (IModelHost.configuration?.allowSharedChannel !== false)\n this._allowedChannels.add(ChannelControl.sharedChannelName);\n }\n\n public addAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.add(channelKey);\n this._deniedModels.clear();\n }\n\n public removeAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.delete(channelKey);\n this._allowedModels.clear();\n }\n\n public getChannelKey(elementId: Id64String): ChannelKey {\n if (elementId === IModel.rootSubjectId)\n return ChannelControl.sharedChannelName;\n\n try {\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\n stmt.bindId(1, elementId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\n });\n\n if (channel !== undefined)\n return channel;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return ChannelControl.sharedChannelName;\n }\n\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, elementId);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\n });\n\n return this.getChannelKey(parentId);\n }\n\n public [_verifyChannel](modelId: Id64String): void {\n // Note: indirect changes are permitted to change any channel\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].isIndirectChanges())\n return;\n\n const deniedChannel = this._deniedModels.get(modelId);\n if (undefined !== deniedChannel)\n throw new Error(`channel \"${deniedChannel}\" is not allowed`);\n\n const channel = this.getChannelKey(modelId);\n if (this._allowedChannels.has(channel)) {\n this._allowedModels.add(modelId);\n return;\n }\n\n this._deniedModels.set(modelId, channel);\n return this[_verifyChannel](modelId);\n }\n\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }) {\n if (ChannelControl.sharedChannelName !== this.getChannelKey(args.elementId))\n throw new Error(\"channels may not nest\");\n\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n throw new Error(\"a channel root for the specified key already exists\");\n\n const props: ChannelRootAspectProps = { classFullName: ChannelAdmin.channelClassName, element: { id: args.elementId }, owner: args.channelKey };\n this._iModel.elements.insertAspect(props);\n }\n\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String {\n // Check if channelKey already exists before inserting Subject.\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\n // Prefer to check twice instead of deleting the Subject in the latter option.\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n throw new Error(\"a channel root for the specified key already exists\");\n\n const elementId = Subject.insert(this._iModel, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\n this.makeChannelRoot({ elementId, channelKey: args.channelKey });\n return elementId;\n }\n\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\n if (channelKey === ChannelControl.sharedChannelName)\n // RootSubject acts as the ChannelRoot element of the shared channel\n return IModel.rootSubjectId;\n\n try {\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\n stmt.bindString(1, channelKey);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\n });\n\n return channelRoot;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return undefined;\n }\n\n }\n}\n\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\n return new ChannelAdmin(iModel);\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FontFace, FontType, LocalFileName } from "@itwin/core-common";
|
|
2
|
+
import type { IModelJsNative } from "@bentley/imodeljs-native";
|
|
3
|
+
import { CreateFontFileFromRscBlobArgs, CreateFontFileFromShxBlobArgs, FontFile } from "../FontFile";
|
|
4
|
+
import { _faceProps, _getData, _implementationProhibited, _key } from "./Symbols";
|
|
5
|
+
import { IModelDb } from "../IModelDb";
|
|
6
|
+
declare abstract class FontFileImpl implements FontFile {
|
|
7
|
+
readonly [_implementationProhibited]: undefined;
|
|
8
|
+
readonly faces: ReadonlyArray<Readonly<FontFace>>;
|
|
9
|
+
abstract get type(): FontType;
|
|
10
|
+
get isEmbeddable(): boolean;
|
|
11
|
+
readonly [_key]: string;
|
|
12
|
+
readonly [_faceProps]: IModelJsNative.FontFaceProps[];
|
|
13
|
+
protected constructor(faces: IModelJsNative.FontFaceProps[]);
|
|
14
|
+
abstract [_getData](): Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
/** Holds the binary representation of a SHX or RSC font in memory. */
|
|
17
|
+
export declare class CadFontFile extends FontFileImpl {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(data: Uint8Array, type: FontType.Shx | FontType.Rsc, faces: IModelJsNative.FontFaceProps[]);
|
|
20
|
+
get type(): FontType;
|
|
21
|
+
[_getData](): Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
/** Points to a font file in any format embedded in an iModel. */
|
|
24
|
+
export declare class EmbeddedFontFile extends FontFileImpl {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(db: IModelDb, id: number, type: FontType, faces: IModelJsNative.FontFaceProps[]);
|
|
27
|
+
get type(): FontType;
|
|
28
|
+
[_getData](): Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export declare function shxFontFileFromBlob(args: CreateFontFileFromShxBlobArgs): FontFile;
|
|
31
|
+
export declare function rscFontFileFromBlob(args: CreateFontFileFromRscBlobArgs): FontFile;
|
|
32
|
+
export declare function trueTypeFontFileFromFileName(fileName: LocalFileName): FontFile;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=FontFileImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontFileImpl.d.ts","sourceRoot":"","sources":["../../../src/internal/FontFileImpl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,a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,GAAG,QAAQ,CAejF;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,CAQ9E"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
14
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
15
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
16
|
+
};
|
|
17
|
+
var _a, _TrueTypeFontFile_fileName, _TrueTypeFontFile_embeddable, _CadFontFile_data, _CadFontFile_type, _EmbeddedFontFile_db, _EmbeddedFontFile_id, _EmbeddedFontFile_type;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.EmbeddedFontFile = exports.CadFontFile = void 0;
|
|
20
|
+
exports.shxFontFileFromBlob = shxFontFileFromBlob;
|
|
21
|
+
exports.rscFontFileFromBlob = rscFontFileFromBlob;
|
|
22
|
+
exports.trueTypeFontFileFromFileName = trueTypeFontFileFromFileName;
|
|
23
|
+
const fs = require("fs");
|
|
24
|
+
const core_common_1 = require("@itwin/core-common");
|
|
25
|
+
const Symbols_1 = require("./Symbols");
|
|
26
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
27
|
+
const NativePlatform_1 = require("./NativePlatform");
|
|
28
|
+
class FontFileImpl {
|
|
29
|
+
get isEmbeddable() { return true; }
|
|
30
|
+
constructor(faces) {
|
|
31
|
+
this[_a] = undefined;
|
|
32
|
+
this.faces = faces.map((face) => {
|
|
33
|
+
return {
|
|
34
|
+
familyName: face.familyName,
|
|
35
|
+
isBold: face.faceName.startsWith("bold"),
|
|
36
|
+
isItalic: face.faceName.endsWith("italic"),
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
this[Symbols_1._faceProps] = faces;
|
|
40
|
+
// Sort the face props in canonical order so we can compare FontFiles for equivalent contents.
|
|
41
|
+
this[Symbols_1._faceProps].sort((a, b) => a.familyName.localeCompare(b.familyName) || a.faceName.localeCompare(b.faceName) || (0, core_bentley_1.compareNumbersOrUndefined)(a.subId, b.subId));
|
|
42
|
+
// Stringify the face props so that the key properties (and no other properties) appear in a canonical order. for trivial comparisons.
|
|
43
|
+
this[Symbols_1._key] = JSON.stringify(this[Symbols_1._faceProps], ["familyName", "faceName", "type", "subId"]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
_a = Symbols_1._implementationProhibited;
|
|
47
|
+
/** Points to an OpenType font file on disk. */
|
|
48
|
+
class TrueTypeFontFile extends FontFileImpl {
|
|
49
|
+
constructor(fileName, embeddable, faces) {
|
|
50
|
+
super(faces);
|
|
51
|
+
_TrueTypeFontFile_fileName.set(this, void 0);
|
|
52
|
+
_TrueTypeFontFile_embeddable.set(this, void 0);
|
|
53
|
+
__classPrivateFieldSet(this, _TrueTypeFontFile_fileName, fileName, "f");
|
|
54
|
+
__classPrivateFieldSet(this, _TrueTypeFontFile_embeddable, embeddable, "f");
|
|
55
|
+
}
|
|
56
|
+
get type() { return core_common_1.FontType.TrueType; }
|
|
57
|
+
get isEmbeddable() { return __classPrivateFieldGet(this, _TrueTypeFontFile_embeddable, "f"); }
|
|
58
|
+
[(_TrueTypeFontFile_fileName = new WeakMap(), _TrueTypeFontFile_embeddable = new WeakMap(), Symbols_1._getData)]() {
|
|
59
|
+
return fs.readFileSync(__classPrivateFieldGet(this, _TrueTypeFontFile_fileName, "f"));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Holds the binary representation of a SHX or RSC font in memory. */
|
|
63
|
+
class CadFontFile extends FontFileImpl {
|
|
64
|
+
constructor(data, type, faces) {
|
|
65
|
+
super(faces);
|
|
66
|
+
_CadFontFile_data.set(this, void 0);
|
|
67
|
+
_CadFontFile_type.set(this, void 0);
|
|
68
|
+
__classPrivateFieldSet(this, _CadFontFile_data, data, "f");
|
|
69
|
+
__classPrivateFieldSet(this, _CadFontFile_type, type, "f");
|
|
70
|
+
}
|
|
71
|
+
get type() { return __classPrivateFieldGet(this, _CadFontFile_type, "f"); }
|
|
72
|
+
[(_CadFontFile_data = new WeakMap(), _CadFontFile_type = new WeakMap(), Symbols_1._getData)]() { return __classPrivateFieldGet(this, _CadFontFile_data, "f"); }
|
|
73
|
+
}
|
|
74
|
+
exports.CadFontFile = CadFontFile;
|
|
75
|
+
/** Points to a font file in any format embedded in an iModel. */
|
|
76
|
+
class EmbeddedFontFile extends FontFileImpl {
|
|
77
|
+
constructor(db, id, type, faces) {
|
|
78
|
+
super(faces);
|
|
79
|
+
// The value of the Id column for the row in the be_Prop table that embeds this font's data.
|
|
80
|
+
_EmbeddedFontFile_db.set(this, void 0);
|
|
81
|
+
_EmbeddedFontFile_id.set(this, void 0);
|
|
82
|
+
_EmbeddedFontFile_type.set(this, void 0);
|
|
83
|
+
__classPrivateFieldSet(this, _EmbeddedFontFile_db, db, "f");
|
|
84
|
+
__classPrivateFieldSet(this, _EmbeddedFontFile_id, id, "f");
|
|
85
|
+
__classPrivateFieldSet(this, _EmbeddedFontFile_type, type, "f");
|
|
86
|
+
}
|
|
87
|
+
get type() { return __classPrivateFieldGet(this, _EmbeddedFontFile_type, "f"); }
|
|
88
|
+
[(_EmbeddedFontFile_db = new WeakMap(), _EmbeddedFontFile_id = new WeakMap(), _EmbeddedFontFile_type = new WeakMap(), Symbols_1._getData)]() {
|
|
89
|
+
const data = __classPrivateFieldGet(this, _EmbeddedFontFile_db, "f").queryFilePropertyBlob({
|
|
90
|
+
namespace: "dgn_Font",
|
|
91
|
+
name: "EmbeddedFaceData",
|
|
92
|
+
id: __classPrivateFieldGet(this, _EmbeddedFontFile_id, "f"),
|
|
93
|
+
});
|
|
94
|
+
if (!data) {
|
|
95
|
+
throw new Error("Embedded font not found");
|
|
96
|
+
}
|
|
97
|
+
return data;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.EmbeddedFontFile = EmbeddedFontFile;
|
|
101
|
+
function shxFontFileFromBlob(args) {
|
|
102
|
+
if (args.familyName.length === 0) {
|
|
103
|
+
throw new Error("Font family name cannot be empty");
|
|
104
|
+
}
|
|
105
|
+
// An SHX file with fewer than 40 bytes isn't valid.
|
|
106
|
+
const minShxSize = 40;
|
|
107
|
+
const shxHeaders = [
|
|
108
|
+
"AutoCAD-86 unifont 1.0",
|
|
109
|
+
"AutoCAD-86 shapes 1.0",
|
|
110
|
+
"AutoCAD-86 shapes 1.1",
|
|
111
|
+
].map((shxHeader) => Array.from(shxHeader))
|
|
112
|
+
.map((chars) => new Uint8Array(chars.map((ch) => ch.charCodeAt(0))));
|
|
113
|
+
// See https://github.com/iTwin/imodel-native/blob/91f509c2175dc49ce1efcf5a906c9a9aa193451d/iModelCore/iModelPlatform/DgnCore/ShxFont.cpp#L44
|
|
114
|
+
function validateShx(blob) {
|
|
115
|
+
if (blob.length >= minShxSize) {
|
|
116
|
+
for (const header of shxHeaders) {
|
|
117
|
+
if (header.every((char, index) => char === blob[index])) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
throw new Error("Failed to read font file");
|
|
123
|
+
}
|
|
124
|
+
validateShx(args.blob);
|
|
125
|
+
return new CadFontFile(args.blob, core_common_1.FontType.Shx, [{
|
|
126
|
+
faceName: "regular",
|
|
127
|
+
familyName: args.familyName,
|
|
128
|
+
type: core_common_1.FontType.Shx,
|
|
129
|
+
}]);
|
|
130
|
+
}
|
|
131
|
+
function rscFontFileFromBlob(args) {
|
|
132
|
+
if (args.familyName.length === 0) {
|
|
133
|
+
throw new Error("Font family name cannot be empty");
|
|
134
|
+
}
|
|
135
|
+
if (!NativePlatform_1.IModelNative.platform.isRscFontData(args.blob)) {
|
|
136
|
+
throw new Error("Failed to read font file");
|
|
137
|
+
}
|
|
138
|
+
return new CadFontFile(args.blob, core_common_1.FontType.Rsc, [{
|
|
139
|
+
faceName: "regular",
|
|
140
|
+
familyName: args.familyName,
|
|
141
|
+
type: core_common_1.FontType.Rsc,
|
|
142
|
+
encoding: args.encoding,
|
|
143
|
+
}]);
|
|
144
|
+
}
|
|
145
|
+
function trueTypeFontFileFromFileName(fileName) {
|
|
146
|
+
const metadata = NativePlatform_1.IModelNative.platform.getTrueTypeFontMetadata(fileName);
|
|
147
|
+
if (metadata.faces.length === 0) {
|
|
148
|
+
// The input was almost certainly not a TrueType font file.
|
|
149
|
+
throw new Error("Failed to read font file");
|
|
150
|
+
}
|
|
151
|
+
return new TrueTypeFontFile(fileName, metadata.embeddable, metadata.faces);
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=FontFileImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontFileImpl.js","sourceRoot":"","sources":["../../../src/internal/FontFileImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;AA8G/F,kDAmCC;AAED,kDAeC;AAED,oEAQC;AA1KD,yBAAyB;AACzB,oDAAuE;AAGvE,uCAAkF;AAClF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C7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport * as fs from \"fs\";\nimport { FontFace, FontType, LocalFileName } from \"@itwin/core-common\";\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { CreateFontFileFromRscBlobArgs, CreateFontFileFromShxBlobArgs, FontFile } from \"../FontFile\";\nimport { _faceProps, _getData, _implementationProhibited, _key } from \"./Symbols\";\nimport { compareNumbersOrUndefined } from \"@itwin/core-bentley\";\nimport { IModelNative } from \"./NativePlatform\"; \nimport { IModelDb } from \"../IModelDb\";\n\nabstract class FontFileImpl implements FontFile {\n public readonly [_implementationProhibited] = undefined;\n\n public readonly faces: ReadonlyArray<Readonly<FontFace>>;\n public abstract get type(): FontType;\n public get isEmbeddable(): boolean { return true; }\n\n public readonly [_key]: string;\n public readonly [_faceProps]: IModelJsNative.FontFaceProps[];\n\n protected constructor(faces: IModelJsNative.FontFaceProps[]) {\n this.faces = faces.map((face) => {\n return {\n familyName: face.familyName,\n isBold: face.faceName.startsWith(\"bold\"),\n isItalic: face.faceName.endsWith(\"italic\"),\n };\n });\n\n this[_faceProps] = faces;\n\n // Sort the face props in canonical order so we can compare FontFiles for equivalent contents.\n this[_faceProps].sort((a, b) =>\n a.familyName.localeCompare(b.familyName) || a.faceName.localeCompare(b.faceName) || compareNumbersOrUndefined(a.subId, b.subId)\n );\n\n // Stringify the face props so that the key properties (and no other properties) appear in a canonical order. for trivial comparisons.\n this[_key] = JSON.stringify(this[_faceProps], [\"familyName\", \"faceName\", \"type\", \"subId\"]);\n }\n\n public abstract [_getData](): Uint8Array;\n}\n\n/** Points to an OpenType font file on disk. */\nclass TrueTypeFontFile extends FontFileImpl {\n readonly #fileName: LocalFileName;\n readonly #embeddable: boolean;\n \n public constructor(fileName: LocalFileName, embeddable: boolean, faces: IModelJsNative.FontFaceProps[]) {\n super(faces);\n this.#fileName = fileName;\n this.#embeddable = embeddable;\n }\n\n public override get type(): FontType { return FontType.TrueType; }\n public override get isEmbeddable(): boolean { return this.#embeddable; }\n\n public override [_getData](): Uint8Array {\n return fs.readFileSync(this.#fileName);\n }\n}\n\n/** Holds the binary representation of a SHX or RSC font in memory. */\nexport class CadFontFile extends FontFileImpl {\n readonly #data: Uint8Array;\n readonly #type: FontType.Shx | FontType.Rsc;\n\n public constructor(data: Uint8Array, type: FontType.Shx | FontType.Rsc, faces: IModelJsNative.FontFaceProps[]) {\n super(faces);\n this.#data = data;\n this.#type = type;\n }\n\n public override get type(): FontType { return this.#type; }\n\n public override [_getData](): Uint8Array { return this.#data; }\n}\n\n/** Points to a font file in any format embedded in an iModel. */\nexport class EmbeddedFontFile extends FontFileImpl {\n // The value of the Id column for the row in the be_Prop table that embeds this font's data.\n readonly #db: IModelDb;\n readonly #id: number;\n readonly #type: FontType;\n\n public constructor(db: IModelDb, id: number, type: FontType, faces: IModelJsNative.FontFaceProps[]) {\n super(faces);\n this.#db = db;\n this.#id = id;\n this.#type = type;\n }\n\n public override get type(): FontType { return this.#type; }\n\n public override [_getData](): Uint8Array {\n const data = this.#db.queryFilePropertyBlob({\n namespace: \"dgn_Font\",\n name: \"EmbeddedFaceData\",\n id: this.#id,\n });\n\n if (!data) {\n throw new Error(\"Embedded font not found\");\n }\n\n return data;\n }\n}\n\nexport function shxFontFileFromBlob(args: CreateFontFileFromShxBlobArgs): FontFile {\n if (args.familyName.length === 0) {\n throw new Error(\"Font family name cannot be empty\");\n }\n\n// An SHX file with fewer than 40 bytes isn't valid.\n const minShxSize = 40;\n\n const shxHeaders = [\n \"AutoCAD-86 unifont 1.0\",\n \"AutoCAD-86 shapes 1.0\",\n \"AutoCAD-86 shapes 1.1\",\n ].map((shxHeader) => Array.from(shxHeader))\n .map((chars) => new Uint8Array(chars.map((ch) => ch.charCodeAt(0))));\n\n // See https://github.com/iTwin/imodel-native/blob/91f509c2175dc49ce1efcf5a906c9a9aa193451d/iModelCore/iModelPlatform/DgnCore/ShxFont.cpp#L44\n function validateShx(blob: Uint8Array): void {\n if (blob.length >= minShxSize) {\n for (const header of shxHeaders) {\n if (header.every((char, index) => char === blob[index])) {\n return;\n }\n }\n }\n\n throw new Error(\"Failed to read font file\");\n }\n\n validateShx(args.blob);\n\n return new CadFontFile(args.blob, FontType.Shx, [{\n faceName: \"regular\",\n familyName: args.familyName,\n type: FontType.Shx,\n }]);\n}\n\nexport function rscFontFileFromBlob(args: CreateFontFileFromRscBlobArgs): FontFile {\n if (args.familyName.length === 0) {\n throw new Error(\"Font family name cannot be empty\");\n }\n\n if (!IModelNative.platform.isRscFontData(args.blob)) {\n throw new Error(\"Failed to read font file\");\n }\n\n return new CadFontFile(args.blob, FontType.Rsc, [{\n faceName: \"regular\",\n familyName: args.familyName,\n type: FontType.Rsc,\n encoding: args.encoding,\n }]);\n}\n\nexport function trueTypeFontFileFromFileName(fileName: LocalFileName): FontFile {\n const metadata = IModelNative.platform.getTrueTypeFontMetadata(fileName);\n if (metadata.faces.length === 0) {\n // The input was almost certainly not a TrueType font file.\n throw new Error(\"Failed to read font file\");\n }\n\n return new TrueTypeFontFile(fileName, metadata.embeddable, metadata.faces);\n}\n\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
4
|
+
import { IModelDb } from "../IModelDb";
|
|
5
|
+
import { IModelDbFonts } from "../IModelDbFonts";
|
|
6
|
+
export declare function createIModelDbFonts(db: IModelDb): IModelDbFonts;
|
|
7
|
+
//# sourceMappingURL=IModelDbFontsImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelDbFontsImpl.d.ts","sourceRoot":"","sources":["../../../src/internal/IModelDbFontsImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAqB,aAAa,EAA2B,MAAM,kBAAkB,CAAC;AA8M7F,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,GAAG,aAAa,CAE/D"}
|