@itwin/core-backend
Version:
iTwin.js backend components
246 lines • 10.1 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericGraphicalType2d = exports.GenericPhysicalType = exports.GenericPhysicalMaterial = exports.GenericDocument = exports.Group = exports.GroupModel = exports.SpatialLocation = exports.PhysicalObject = exports.Graphic3d = exports.GenericGraphicalModel3d = exports.DetailCallout = exports.PlanCallout = exports.ElevationCallout = exports.SectionCallout = exports.Callout = exports.ViewAttachmentLabel = exports.TitleText = exports.DetailingSymbol = void 0;
const core_common_1 = require("@itwin/core-common");
const Element_1 = require("../Element");
const Material_1 = require("../Material");
const Model_1 = require("../Model");
const NavigationRelationship_1 = require("../NavigationRelationship");
/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].
* @public
*/
class DetailingSymbol extends Element_1.GraphicalElement2d {
static get className() { return "DetailingSymbol"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.DetailingSymbol = DetailingSymbol;
/** A graphical DetailingSymbol that contains title text.
* @public
*/
class TitleText extends DetailingSymbol {
static get className() { return "TitleText"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.TitleText = TitleText;
/** A graphical DetailingSymbol that contains a view attachment label.
* @public
*/
class ViewAttachmentLabel extends DetailingSymbol {
static get className() { return "ViewAttachmentLabel"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.ViewAttachmentLabel = ViewAttachmentLabel;
/** A graphical DetailingSymbol that calls out a reference to another drawing.
* @public
*/
class Callout extends DetailingSymbol {
static get className() { return "Callout"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.Callout = Callout;
/** A graphical Callout that references a section drawing.
* @public
*/
class SectionCallout extends Callout {
static get className() { return "SectionCallout"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.SectionCallout = SectionCallout;
/** A graphical Callout that references an elevation drawing.
* @public
*/
class ElevationCallout extends Callout {
static get className() { return "ElevationCallout"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.ElevationCallout = ElevationCallout;
/** A graphical Callout that references a plan drawing.
* @public
*/
class PlanCallout extends Callout {
static get className() { return "PlanCallout"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.PlanCallout = PlanCallout;
/** A graphical Callout that references a detail drawing.
* @public
*/
class DetailCallout extends Callout {
static get className() { return "DetailCallout"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.DetailCallout = DetailCallout;
/** A generic container for persisting BisCore:GraphicalElement3d instances.
* @public
*/
class GenericGraphicalModel3d extends Model_1.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: Element_1.GraphicalPartition3d.classFullName,
model: core_common_1.IModel.repositoryModelId,
parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
code: Element_1.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);
}
}
exports.GenericGraphicalModel3d = GenericGraphicalModel3d;
/** 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
*/
class Graphic3d extends Element_1.GraphicalElement3d {
static get className() { return "Graphic3d"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.Graphic3d = Graphic3d;
/** 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
*/
class PhysicalObject extends Element_1.PhysicalElement {
static get className() { return "PhysicalObject"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.PhysicalObject = PhysicalObject;
/** 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
*/
class SpatialLocation extends Element_1.SpatialLocationElement {
static get className() { return "SpatialLocation"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.SpatialLocation = SpatialLocation;
/** A generic container for BisCore:GroupInformationElement instances.
* @public
*/
class GroupModel extends Model_1.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: Element_1.GroupInformationPartition.classFullName,
model: core_common_1.IModel.repositoryModelId,
parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
code: Element_1.GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),
};
const partitionId = iModelDb.elements.insertElement(partitionProps);
return iModelDb.models.insertModel({
classFullName: this.classFullName,
modeledElement: { id: partitionId },
});
}
}
exports.GroupModel = GroupModel;
/** The Generic:Group class is used when the group cannot be further classified.
* @public
*/
class Group extends Element_1.GroupInformationElement {
static get className() { return "Group"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.Group = Group;
/** 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
*/
class GenericDocument extends Element_1.Document {
static get className() { return "Document"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.GenericDocument = GenericDocument;
/** 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
*/
class GenericPhysicalMaterial extends Material_1.PhysicalMaterial {
static get className() { return "PhysicalMaterial"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.GenericPhysicalMaterial = GenericPhysicalMaterial;
/** 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
*/
class GenericPhysicalType extends Element_1.PhysicalType {
static get className() { return "PhysicalType"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.GenericPhysicalType = GenericPhysicalType;
/** 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
*/
class GenericGraphicalType2d extends Element_1.GraphicalType2d {
static get className() { return "GraphicalType2d"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.GenericGraphicalType2d = GenericGraphicalType2d;
//# sourceMappingURL=GenericElements.js.map