@itwin/core-backend
Version:
iTwin.js backend components
130 lines • 5.85 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.DrawingGraphicRepresentsFunctionalElement = exports.PhysicalElementFulfillsFunction = exports.FunctionalElementIsOfType = exports.FunctionalType = exports.FunctionalComponentElement = exports.FunctionalComposite = exports.FunctionalBreakdownElement = exports.FunctionalElement = exports.FunctionalModel = exports.FunctionalPartition = void 0;
const core_common_1 = require("@itwin/core-common");
const Element_1 = require("../Element");
const Model_1 = require("../Model");
const NavigationRelationship_1 = require("../NavigationRelationship");
const Relationship_1 = require("../Relationship");
/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented
* to a Subject and broken down by a FunctionalModel.
* @public
*/
class FunctionalPartition extends Element_1.InformationPartitionElement {
static get className() { return "FunctionalPartition"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalPartition = FunctionalPartition;
/** A container for persisting FunctionalElements.
* @public
*/
class FunctionalModel extends Model_1.RoleModel {
static get className() { return "FunctionalModel"; }
constructor(props, iModel) {
super(props, iModel);
}
/** Insert a FunctionalPartition and a FunctionalModel that breaks it down.
* @param iModelDb Insert into this iModel
* @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.
* @param name The name of the FunctionalPartition that the new FunctionalModel will break down.
* @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).
* @throws [[IModelError]] if there is an insert problem.
*/
static insert(iModelDb, parentSubjectId, name) {
const partitionProps = {
classFullName: FunctionalPartition.classFullName,
model: core_common_1.IModel.repositoryModelId,
parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
code: FunctionalPartition.createCode(iModelDb, parentSubjectId, name),
};
const partitionId = iModelDb.elements.insertElement(partitionProps);
return iModelDb.models.insertModel({
classFullName: this.classFullName,
modeledElement: { id: partitionId },
});
}
}
exports.FunctionalModel = FunctionalModel;
/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.
* @public
*/
class FunctionalElement extends Element_1.RoleElement {
static get className() { return "FunctionalElement"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalElement = FunctionalElement;
/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.
* @public
*/
class FunctionalBreakdownElement extends FunctionalElement {
static get className() { return "FunctionalBreakdownElement"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalBreakdownElement = FunctionalBreakdownElement;
/** @public */
class FunctionalComposite extends FunctionalBreakdownElement {
static get className() { return "FunctionalComposite"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalComposite = FunctionalComposite;
/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.
* @public
*/
class FunctionalComponentElement extends FunctionalElement {
static get className() { return "FunctionalComponentElement"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalComponentElement = FunctionalComponentElement;
/** Defines a set of properties (the 'type') that can be associated with a Functional Element.
* @public
*/
class FunctionalType extends Element_1.TypeDefinitionElement {
static get className() { return "FunctionalType"; }
constructor(props, iModel) {
super(props, iModel);
}
}
exports.FunctionalType = FunctionalType;
/** Relates a [[FunctionalElement]] to its [[FunctionalType]]
* @public
*/
class FunctionalElementIsOfType extends core_common_1.RelatedElement {
static get className() { return "FunctionalElementIsOfType"; }
static classFullName = "Functional:FunctionalElementIsOfType";
constructor(id, relClassName = FunctionalElementIsOfType.classFullName) {
super({ id, relClassName });
}
}
exports.FunctionalElementIsOfType = FunctionalElementIsOfType;
/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.
* @public
*/
class PhysicalElementFulfillsFunction extends Relationship_1.ElementRefersToElements {
static get className() { return "PhysicalElementFulfillsFunction"; }
}
exports.PhysicalElementFulfillsFunction = PhysicalElementFulfillsFunction;
/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents
* @public
*/
class DrawingGraphicRepresentsFunctionalElement extends Relationship_1.DrawingGraphicRepresentsElement {
static get className() { return "DrawingGraphicRepresentsFunctionalElement"; }
}
exports.DrawingGraphicRepresentsFunctionalElement = DrawingGraphicRepresentsFunctionalElement;
//# sourceMappingURL=FunctionalElements.js.map