@itwin/core-backend
Version:
iTwin.js backend components
225 lines • 8.89 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* 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";
/** 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);
}
/** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it.
* @param iModelDb Insert into this iModel
* @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.
* @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.
* @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
* @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).
* @throws [[IModelError]] if there is an insert problem.
*/
static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
const partitionProps = {
classFullName: GraphicalPartition3d.classFullName,
model: IModel.repositoryModelId,
parent: new SubjectOwnsPartitionElements(parentSubjectId),
code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),
};
const partitionId = iModelDb.elements.insertElement(partitionProps);
const modelProps = {
classFullName: this.classFullName,
modeledElement: { id: partitionId },
isPlanProjection,
};
return iModelDb.models.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);
}
/** Insert a GroupInformationPartition and a GroupModel that breaks it down.
* @param iModelDb Insert into this iModel
* @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.
* @param name The name of the GroupInformationPartition that the new GroupModel will break down.
* @returns The Id of the newly inserted GroupModel.
* @throws [[IModelError]] if there is an insert problem.
*/
static insert(iModelDb, parentSubjectId, name) {
const partitionProps = {
classFullName: GroupInformationPartition.classFullName,
model: IModel.repositoryModelId,
parent: new SubjectOwnsPartitionElements(parentSubjectId),
code: GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),
};
const partitionId = iModelDb.elements.insertElement(partitionProps);
return iModelDb.models.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