UNPKG

@itwin/core-backend

Version:
214 lines • 7.93 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Elements */ import { IModel, } from "@itwin/core-common"; import { Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition, PhysicalElement, PhysicalType, SpatialLocationElement, } from "../Element"; import { PhysicalMaterial } from "../Material"; import { GraphicalModel3d, GroupInformationModel } from "../Model"; import { SubjectOwnsPartitionElements } from "../NavigationRelationship"; import { EditTxn } from "../EditTxn"; import { _implicitTxn } from "../internal/Symbols"; /** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]]. * @public */ export class DetailingSymbol extends GraphicalElement2d { static get className() { return "DetailingSymbol"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical DetailingSymbol that contains title text. * @public */ export class TitleText extends DetailingSymbol { static get className() { return "TitleText"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical DetailingSymbol that contains a view attachment label. * @public */ export class ViewAttachmentLabel extends DetailingSymbol { static get className() { return "ViewAttachmentLabel"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical DetailingSymbol that calls out a reference to another drawing. * @public */ export class Callout extends DetailingSymbol { static get className() { return "Callout"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical Callout that references a section drawing. * @public */ export class SectionCallout extends Callout { static get className() { return "SectionCallout"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical Callout that references an elevation drawing. * @public */ export class ElevationCallout extends Callout { static get className() { return "ElevationCallout"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical Callout that references a plan drawing. * @public */ export class PlanCallout extends Callout { static get className() { return "PlanCallout"; } constructor(props, iModel) { super(props, iModel); } } /** A graphical Callout that references a detail drawing. * @public */ export class DetailCallout extends Callout { static get className() { return "DetailCallout"; } constructor(props, iModel) { super(props, iModel); } } /** A generic container for persisting BisCore:GraphicalElement3d instances. * @public */ export class GenericGraphicalModel3d extends GraphicalModel3d { static get className() { return "GraphicalModel3d"; } constructor(props, iModel) { super(props, iModel); } static insert(txnOrDb, parentSubjectId, name, isPlanProjection) { const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn]; const iModelDb = txn.iModel; const partitionProps = { classFullName: GraphicalPartition3d.classFullName, model: IModel.repositoryModelId, parent: new SubjectOwnsPartitionElements(parentSubjectId), code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name), }; const partitionId = txn.insertElement(partitionProps); const modelProps = { classFullName: this.classFullName, modeledElement: { id: partitionId }, isPlanProjection, }; return txn.insertModel(modelProps); } } /** The Generic:Graphic3d class is used when 3D graphics cannot be further classified. * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible. * @public */ export class Graphic3d extends GraphicalElement3d { static get className() { return "Graphic3d"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:PhysicalObject class is used when physical elements cannot be further classified. * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible. * @public */ export class PhysicalObject extends PhysicalElement { static get className() { return "PhysicalObject"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:SpatialLocation class is used when spatial locations cannot be further classified. * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible. * @public */ export class SpatialLocation extends SpatialLocationElement { static get className() { return "SpatialLocation"; } constructor(props, iModel) { super(props, iModel); } } /** A generic container for BisCore:GroupInformationElement instances. * @public */ export class GroupModel extends GroupInformationModel { static get className() { return "GroupModel"; } constructor(props, iModel) { super(props, iModel); } static insert(txnOrDb, parentSubjectId, name) { const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn]; const partitionId = txn.insertElement({ classFullName: GroupInformationPartition.classFullName, model: IModel.repositoryModelId, parent: new SubjectOwnsPartitionElements(parentSubjectId), code: GroupInformationPartition.createCode(txn.iModel, parentSubjectId, name), }); return txn.insertModel({ classFullName: this.classFullName, modeledElement: { id: partitionId }, }); } } /** The Generic:Group class is used when the group cannot be further classified. * @public */ export class Group extends GroupInformationElement { static get className() { return "Group"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:Document class is used when a document cannot be further classified. * @note More-specific BisCore:Document subclasses should be used wherever possible. * @public */ export class GenericDocument extends Document { static get className() { return "Document"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified. * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible. * @public */ export class GenericPhysicalMaterial extends PhysicalMaterial { static get className() { return "PhysicalMaterial"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:PhysicalType class is used when the physical type cannot be further classified. * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible. * @public */ export class GenericPhysicalType extends PhysicalType { static get className() { return "PhysicalType"; } constructor(props, iModel) { super(props, iModel); } } /** The Generic:GraphicalType2d class is used when graphical types cannot be further classified. * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible. * @public */ export class GenericGraphicalType2d extends GraphicalType2d { static get className() { return "GraphicalType2d"; } constructor(props, iModel) { super(props, iModel); } } //# sourceMappingURL=GenericElements.js.map