@itwin/linear-referencing-backend 5.9.0-dev.4 → 5.9.0-dev.5

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.
@@ -2,7 +2,7 @@
2
2
  * @module LinearReferencing
3
3
  */
4
4
  import { Id64String } from "@itwin/core-bentley";
5
- import { ElementMultiAspect, IModelDb } from "@itwin/core-backend";
5
+ import { EditTxn, ElementMultiAspect, IModelDb } from "@itwin/core-backend";
6
6
  import { DistanceExpressionProps, LinearlyReferencedAtLocationAspectProps, LinearlyReferencedFromToLocationAspectProps } from "@itwin/linear-referencing-common";
7
7
  import { LinearlyReferencedAtPositionRefersToReferent, LinearlyReferencedFromPositionRefersToReferent, LinearlyReferencedToPositionRefersToReferent } from "./LinearReferencingRelationships";
8
8
  /** Core structure carrying linearly-referenced information.
@@ -34,6 +34,13 @@ export declare class LinearlyReferencedAtLocation extends LinearlyReferencedLoca
34
34
  constructor(props: LinearlyReferencedAtLocationAspectProps, iModel: IModelDb);
35
35
  private static toProps;
36
36
  static create(iModel: IModelDb, locatedElementId: Id64String, at: DistanceExpression, fromReferentId?: Id64String): LinearlyReferencedAtLocation;
37
+ /** Insert a new aspect using an explicit transaction.
38
+ * @beta
39
+ */
40
+ static insert(txn: EditTxn, locatedElementId: Id64String, at: DistanceExpression, fromReferentId?: Id64String): void;
41
+ /** Insert a new aspect.
42
+ * @deprecated Use LinearlyReferencedAtLocation.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
43
+ */
37
44
  static insert(iModel: IModelDb, locatedElementId: Id64String, at: DistanceExpression, fromReferentId?: Id64String): void;
38
45
  }
39
46
  /** Concrete multi-aspect class carrying 'from-to' linearly-referenced positions along a Linear-Element.
@@ -49,6 +56,13 @@ export declare class LinearlyReferencedFromToLocation extends LinearlyReferenced
49
56
  constructor(props: LinearlyReferencedFromToLocationAspectProps, iModel: IModelDb);
50
57
  private static toProps;
51
58
  static create(iModel: IModelDb, locatedElementId: Id64String, from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): LinearlyReferencedFromToLocation;
59
+ /** Insert a new aspect using an explicit transaction.
60
+ * @beta
61
+ */
62
+ static insert(txn: EditTxn, locatedElementId: Id64String, from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void;
63
+ /** Insert a new aspect.
64
+ * @deprecated Use LinearlyReferencedFromToLocation.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
65
+ */
52
66
  static insert(iModel: IModelDb, locatedElementId: Id64String, from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void;
53
67
  }
54
68
  //# sourceMappingURL=LinearReferencingElementAspects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinearReferencingElementAspects.d.ts","sourceRoot":"","sources":["../../src/LinearReferencingElementAspects.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EACL,uBAAuB,EAAE,uCAAuC,EAAE,2CAA2C,EAC9G,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,4CAA4C,EAAE,8CAA8C,EAAE,4CAA4C,EAC3I,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,qBAAa,kBAAmB,YAAW,uBAAuB;IACzD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,yBAAyB,CAAC,EAAE,MAAM,CAAC;gBAE9B,KAAK,EAAE,uBAAuB;WAO5B,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,kBAAkB;CAC1E;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAA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E,EAAE,kBAAkB,EAAE,cAAc,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,UAAU,GAAG,IAAI;CAOlH"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LinearlyReferencedFromToLocation = exports.LinearlyReferencedAtLocation = exports.LinearlyReferencedLocation = exports.DistanceExpression = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_backend_1 = require("@itwin/core-backend");
13
+ const Symbols_1 = require("@itwin/core-backend/lib/cjs/internal/Symbols");
13
14
  const core_common_1 = require("@itwin/core-common");
14
15
  const LinearReferencingRelationships_1 = require("./LinearReferencingRelationships");
15
16
  /** Core structure carrying linearly-referenced information.
@@ -62,8 +63,9 @@ class LinearlyReferencedAtLocation extends LinearlyReferencedLocation {
62
63
  static create(iModel, locatedElementId, at, fromReferentId) {
63
64
  return new LinearlyReferencedAtLocation(this.toProps(locatedElementId, at, fromReferentId), iModel);
64
65
  }
65
- static insert(iModel, locatedElementId, at, fromReferentId) {
66
- iModel.elements.insertAspect(this.toProps(locatedElementId, at, fromReferentId));
66
+ static insert(txnOrIModel, locatedElementId, at, fromReferentId) {
67
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
68
+ txn.insertAspect(this.toProps(locatedElementId, at, fromReferentId));
67
69
  }
68
70
  }
69
71
  exports.LinearlyReferencedAtLocation = LinearlyReferencedAtLocation;
@@ -98,8 +100,9 @@ class LinearlyReferencedFromToLocation extends LinearlyReferencedLocation {
98
100
  static create(iModel, locatedElementId, from, to, fromReferentId, toReferentId) {
99
101
  return new LinearlyReferencedFromToLocation(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId), iModel);
100
102
  }
101
- static insert(iModel, locatedElementId, from, to, fromReferentId, toReferentId) {
102
- iModel.elements.insertAspect(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId));
103
+ static insert(txnOrIModel, locatedElementId, from, to, fromReferentId, toReferentId) {
104
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
105
+ txn.insertAspect(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId));
103
106
  }
104
107
  }
105
108
  exports.LinearlyReferencedFromToLocation = LinearlyReferencedFromToLocation;
@@ -1 +1 @@
1
- {"version":3,"file":"LinearReferencingElementAspects.js","sourceRoot":"","sources":["../../src/LinearReferencingElementAspects.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAC5D,sDAAmE;AACnE,oDAAoD;AAIpD,qFAE0C;AAE1C;;GAEG;AACH,MAAa,kBAAkB;IACtB,sBAAsB,CAAS;IAC/B,+BAA+B,CAAU;IACzC,gCAAgC,CAAU;IAC1C,yBAAyB,CAAU;IAE1C,YAAY,KAA8B;QACxC,IAAI,CAAC,sBAAsB,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC/E,IAAI,CAAC,+BAA+B,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACjG,IAAI,CAAC,gCAAgC,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACnG,IAAI,CAAC,yBAAyB,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACvF,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAA6B,IAAwB,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnH;AAdD,gDAcC;AAED;;GAEG;AACH,MAAa,0BAA2B,SAAQ,iCAAkB;IAChE,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,4BAA4B,CAAC,CAAC,CAAC;CACxF;AAHD,gEAGC;AAED;;GAEG;AACH,MAAa,4BAA6B,SAA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E,gBAA4B,EACjE,IAAwB,EAAE,EAAsB,EAAE,cAA2B,EAAE,YAAyB;QACxG,OAAO,IAAI,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9H,CAAC;IAEM,MAAM,CAAC,MAAM,CAAC,MAAgB,EAAE,gBAA4B,EACjE,IAAwB,EAAE,EAAsB,EAAE,cAA2B,EAAE,YAAyB;QACxG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;IACvG,CAAC;CACF;AAxCD,4EAwCC","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 LinearReferencing\n */\n\nimport { Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ElementMultiAspect, IModelDb } from \"@itwin/core-backend\";\nimport { RelatedElement } from \"@itwin/core-common\";\nimport {\n DistanceExpressionProps, LinearlyReferencedAtLocationAspectProps, LinearlyReferencedFromToLocationAspectProps,\n} from \"@itwin/linear-referencing-common\";\nimport {\n LinearlyReferencedAtPositionRefersToReferent, LinearlyReferencedFromPositionRefersToReferent, LinearlyReferencedToPositionRefersToReferent,\n} from \"./LinearReferencingRelationships\";\n\n/** Core structure carrying linearly-referenced information.\n * @beta\n */\nexport class DistanceExpression implements DistanceExpressionProps {\n public distanceAlongFromStart: number;\n public lateralOffsetFromILinearElement?: number;\n public verticalOffsetFromILinearElement?: number;\n public distanceAlongFromReferent?: number;\n\n constructor(props: DistanceExpressionProps) {\n this.distanceAlongFromStart = JsonUtils.asDouble(props.distanceAlongFromStart);\n this.lateralOffsetFromILinearElement = JsonUtils.asDouble(props.lateralOffsetFromILinearElement);\n this.verticalOffsetFromILinearElement = JsonUtils.asDouble(props.verticalOffsetFromILinearElement);\n this.distanceAlongFromReferent = JsonUtils.asDouble(props.distanceAlongFromReferent);\n }\n\n public static fromJSON(json: DistanceExpressionProps): DistanceExpression { return new DistanceExpression(json); }\n}\n\n/** Base class for multi-aspects carrying linearly-referenced locations.\n * @beta\n */\nexport class LinearlyReferencedLocation extends ElementMultiAspect {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedLocation\"; }\n}\n\n/** Concrete multi-aspect class carrying 'at' linearly-referenced positions along a Linear-Element.\n * @beta\n */\nexport class LinearlyReferencedAtLocation extends LinearlyReferencedLocation {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedAtLocation\"; }\n\n public atPosition: DistanceExpression;\n public fromReferent?: LinearlyReferencedAtPositionRefersToReferent;\n\n constructor(props: LinearlyReferencedAtLocationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.atPosition = DistanceExpression.fromJSON(props.atPosition);\n this.fromReferent = RelatedElement.fromJSON(props.fromReferent);\n }\n\n private static toProps(locatedElementId: Id64String, at: DistanceExpression, fromReferentId?: Id64String): LinearlyReferencedAtLocationAspectProps {\n const props: LinearlyReferencedAtLocationAspectProps = {\n classFullName: LinearlyReferencedAtLocation.classFullName,\n element: { id: locatedElementId },\n atPosition: at,\n fromReferent: (fromReferentId === undefined) ? undefined : new LinearlyReferencedAtPositionRefersToReferent(fromReferentId),\n };\n\n return props;\n }\n\n public static create(iModel: IModelDb, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): LinearlyReferencedAtLocation {\n return new LinearlyReferencedAtLocation(this.toProps(locatedElementId, at, fromReferentId), iModel);\n }\n\n public static insert(iModel: IModelDb, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): void {\n iModel.elements.insertAspect(this.toProps(locatedElementId, at, fromReferentId));\n }\n}\n\n/** Concrete multi-aspect class carrying 'from-to' linearly-referenced positions along a Linear-Element.\n * @beta\n */\nexport class LinearlyReferencedFromToLocation extends LinearlyReferencedLocation {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedFromToLocation\"; }\n\n public fromPosition: DistanceExpression;\n public fromPositionFromReferent?: LinearlyReferencedFromPositionRefersToReferent;\n public toPosition: DistanceExpression;\n public toPositionFromReferent?: LinearlyReferencedToPositionRefersToReferent;\n\n constructor(props: LinearlyReferencedFromToLocationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.fromPosition = DistanceExpression.fromJSON(props.fromPosition);\n this.toPosition = DistanceExpression.fromJSON(props.toPosition);\n this.fromPositionFromReferent = RelatedElement.fromJSON(props.fromPositionFromReferent);\n this.toPositionFromReferent = RelatedElement.fromJSON(props.toPositionFromReferent);\n }\n\n private static toProps(locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): LinearlyReferencedFromToLocationAspectProps {\n const props: LinearlyReferencedFromToLocationAspectProps = {\n classFullName: LinearlyReferencedFromToLocation.classFullName,\n element: { id: locatedElementId },\n fromPosition: from,\n fromPositionFromReferent: (fromReferentId === undefined) ? undefined : new LinearlyReferencedFromPositionRefersToReferent(fromReferentId),\n toPosition: to,\n toPositionFromReferent: (toReferentId === undefined) ? undefined : new LinearlyReferencedToPositionRefersToReferent(toReferentId),\n };\n\n return props;\n }\n\n public static create(iModel: IModelDb, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): LinearlyReferencedFromToLocation {\n return new LinearlyReferencedFromToLocation(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId), iModel);\n }\n\n public static insert(iModel: IModelDb, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void {\n iModel.elements.insertAspect(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId));\n }\n}\n"]}
1
+ {"version":3,"file":"LinearRefer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AAI,EAAE,EAAE,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9H,CAAC;IAcM,MAAM,CAAC,MAAM,CAAC,WAA+B,EAAE,gBAA4B,EAChF,IAAwB,EAAE,EAAsB,EAAE,cAA2B,EAAE,YAAyB;QACxG,MAAM,GAAG,GAAG,WAAW,YAAY,sBAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,sBAAY,CAAC,CAAC;QACrF,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;IAC3F,CAAC;CACF;AArDD,4EAqDC","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 LinearReferencing\n */\n\nimport { Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { EditTxn, ElementMultiAspect, IModelDb } from \"@itwin/core-backend\";\nimport { _implicitTxn } from \"@itwin/core-backend/lib/cjs/internal/Symbols\";\nimport { RelatedElement } from \"@itwin/core-common\";\nimport {\n DistanceExpressionProps, LinearlyReferencedAtLocationAspectProps, LinearlyReferencedFromToLocationAspectProps,\n} from \"@itwin/linear-referencing-common\";\nimport {\n LinearlyReferencedAtPositionRefersToReferent, LinearlyReferencedFromPositionRefersToReferent, LinearlyReferencedToPositionRefersToReferent,\n} from \"./LinearReferencingRelationships\";\n\n/** Core structure carrying linearly-referenced information.\n * @beta\n */\nexport class DistanceExpression implements DistanceExpressionProps {\n public distanceAlongFromStart: number;\n public lateralOffsetFromILinearElement?: number;\n public verticalOffsetFromILinearElement?: number;\n public distanceAlongFromReferent?: number;\n\n constructor(props: DistanceExpressionProps) {\n this.distanceAlongFromStart = JsonUtils.asDouble(props.distanceAlongFromStart);\n this.lateralOffsetFromILinearElement = JsonUtils.asDouble(props.lateralOffsetFromILinearElement);\n this.verticalOffsetFromILinearElement = JsonUtils.asDouble(props.verticalOffsetFromILinearElement);\n this.distanceAlongFromReferent = JsonUtils.asDouble(props.distanceAlongFromReferent);\n }\n\n public static fromJSON(json: DistanceExpressionProps): DistanceExpression { return new DistanceExpression(json); }\n}\n\n/** Base class for multi-aspects carrying linearly-referenced locations.\n * @beta\n */\nexport class LinearlyReferencedLocation extends ElementMultiAspect {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedLocation\"; }\n}\n\n/** Concrete multi-aspect class carrying 'at' linearly-referenced positions along a Linear-Element.\n * @beta\n */\nexport class LinearlyReferencedAtLocation extends LinearlyReferencedLocation {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedAtLocation\"; }\n\n public atPosition: DistanceExpression;\n public fromReferent?: LinearlyReferencedAtPositionRefersToReferent;\n\n constructor(props: LinearlyReferencedAtLocationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.atPosition = DistanceExpression.fromJSON(props.atPosition);\n this.fromReferent = RelatedElement.fromJSON(props.fromReferent);\n }\n\n private static toProps(locatedElementId: Id64String, at: DistanceExpression, fromReferentId?: Id64String): LinearlyReferencedAtLocationAspectProps {\n const props: LinearlyReferencedAtLocationAspectProps = {\n classFullName: LinearlyReferencedAtLocation.classFullName,\n element: { id: locatedElementId },\n atPosition: at,\n fromReferent: (fromReferentId === undefined) ? undefined : new LinearlyReferencedAtPositionRefersToReferent(fromReferentId),\n };\n\n return props;\n }\n\n public static create(iModel: IModelDb, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): LinearlyReferencedAtLocation {\n return new LinearlyReferencedAtLocation(this.toProps(locatedElementId, at, fromReferentId), iModel);\n }\n\n /** Insert a new aspect using an explicit transaction.\n * @beta\n */\n public static insert(txn: EditTxn, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): void;\n\n /** Insert a new aspect.\n * @deprecated Use LinearlyReferencedAtLocation.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.\n */\n public static insert(iModel: IModelDb, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): void;\n\n public static insert(txnOrIModel: EditTxn | IModelDb, locatedElementId: Id64String,\n at: DistanceExpression, fromReferentId?: Id64String): void {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n txn.insertAspect(this.toProps(locatedElementId, at, fromReferentId));\n }\n}\n\n/** Concrete multi-aspect class carrying 'from-to' linearly-referenced positions along a Linear-Element.\n * @beta\n */\nexport class LinearlyReferencedFromToLocation extends LinearlyReferencedLocation {\n /** @internal */\n public static override get className(): string { return \"LinearlyReferencedFromToLocation\"; }\n\n public fromPosition: DistanceExpression;\n public fromPositionFromReferent?: LinearlyReferencedFromPositionRefersToReferent;\n public toPosition: DistanceExpression;\n public toPositionFromReferent?: LinearlyReferencedToPositionRefersToReferent;\n\n constructor(props: LinearlyReferencedFromToLocationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.fromPosition = DistanceExpression.fromJSON(props.fromPosition);\n this.toPosition = DistanceExpression.fromJSON(props.toPosition);\n this.fromPositionFromReferent = RelatedElement.fromJSON(props.fromPositionFromReferent);\n this.toPositionFromReferent = RelatedElement.fromJSON(props.toPositionFromReferent);\n }\n\n private static toProps(locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): LinearlyReferencedFromToLocationAspectProps {\n const props: LinearlyReferencedFromToLocationAspectProps = {\n classFullName: LinearlyReferencedFromToLocation.classFullName,\n element: { id: locatedElementId },\n fromPosition: from,\n fromPositionFromReferent: (fromReferentId === undefined) ? undefined : new LinearlyReferencedFromPositionRefersToReferent(fromReferentId),\n toPosition: to,\n toPositionFromReferent: (toReferentId === undefined) ? undefined : new LinearlyReferencedToPositionRefersToReferent(toReferentId),\n };\n\n return props;\n }\n\n public static create(iModel: IModelDb, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): LinearlyReferencedFromToLocation {\n return new LinearlyReferencedFromToLocation(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId), iModel);\n }\n\n /** Insert a new aspect using an explicit transaction.\n * @beta\n */\n public static insert(txn: EditTxn, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void;\n\n /** Insert a new aspect.\n * @deprecated Use LinearlyReferencedFromToLocation.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.\n */\n public static insert(iModel: IModelDb, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void;\n\n public static insert(txnOrIModel: EditTxn | IModelDb, locatedElementId: Id64String,\n from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n txn.insertAspect(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId));\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module LinearReferencing
3
3
  */
4
4
  import { Id64String } from "@itwin/core-bentley";
5
- import { IModelDb, PhysicalElement, SpatialLocationElement } from "@itwin/core-backend";
5
+ import { EditTxn, IModelDb, PhysicalElement, SpatialLocationElement } from "@itwin/core-backend";
6
6
  import { ElementProps, GeometricElement3dProps, PhysicalElementProps } from "@itwin/core-common";
7
7
  import { LinearLocationReference, LinearlyLocatedAttributionProps, LinearlyReferencedAtLocationProps, LinearlyReferencedFromToLocationProps, QueryParams, ReferentElementProps } from "@itwin/linear-referencing-common";
8
8
  import { LinearlyReferencedAtLocation, LinearlyReferencedFromToLocation } from "./LinearReferencingElementAspects";
@@ -35,9 +35,37 @@ export declare class LinearLocation extends LinearLocationElement implements Lin
35
35
  constructor(props: GeometricElement3dProps, iModel: IModelDb);
36
36
  private static toProps;
37
37
  static create(iModel: IModelDb, modelId: Id64String, categoryId: Id64String): LinearLocation;
38
+ /** Insert a new `LinearLocation` using an explicit transaction.
39
+ * @beta
40
+ */
41
+ static insertFromTo(txn: EditTxn, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps, locatedElementId: Id64String): Id64String;
42
+ /** Insert a new `LinearLocation`.
43
+ * @deprecated Use LinearLocation.insertFromTo(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
44
+ */
38
45
  static insertFromTo(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps, locatedElementId: Id64String): Id64String;
46
+ /** Insert this `LinearLocation` using an explicit transaction.
47
+ * @beta
48
+ */
49
+ insertFromTo(txn: EditTxn, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps, locatedElementId: Id64String): Id64String;
50
+ /** Insert this `LinearLocation`.
51
+ * @deprecated Use LinearLocation.insertFromTo(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
52
+ */
39
53
  insertFromTo(iModel: IModelDb, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps, locatedElementId: Id64String): Id64String;
54
+ /** Insert a new `LinearLocation` using an explicit transaction.
55
+ * @beta
56
+ */
57
+ static insertAt(txn: EditTxn, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, locatedElementId: Id64String): Id64String;
58
+ /** Insert a new `LinearLocation`.
59
+ * @deprecated Use LinearLocation.insertAt(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
60
+ */
40
61
  static insertAt(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, locatedElementId: Id64String): Id64String;
62
+ /** Insert this `LinearLocation` using an explicit transaction.
63
+ * @beta
64
+ */
65
+ insertAt(txn: EditTxn, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, locatedElementId: Id64String): Id64String;
66
+ /** Insert this `LinearLocation`.
67
+ * @deprecated Use LinearLocation.insertAt(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
68
+ */
41
69
  insertAt(iModel: IModelDb, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, locatedElementId: Id64String): Id64String;
42
70
  }
43
71
  /** Base class for Physical Elements that are inherently linearly located along a Linear-Element.
@@ -67,7 +95,21 @@ export declare class Referent extends ReferentElement {
67
95
  constructor(props: ReferentElementProps, iModel: IModelDb);
68
96
  private static toProps;
69
97
  static create(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, referencedElementId: Id64String): Referent;
98
+ /** Insert a new `Referent` using an explicit transaction.
99
+ * @beta
100
+ */
101
+ static insertAt(txn: EditTxn, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, referencedElementId: Id64String): Id64String;
102
+ /** Insert a new `Referent`.
103
+ * @deprecated Use Referent.insertAt(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
104
+ */
70
105
  static insertAt(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps, referencedElementId: Id64String): Id64String;
106
+ /** Insert this `Referent` using an explicit transaction.
107
+ * @beta
108
+ */
109
+ insertAt(txn: EditTxn, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps): Id64String;
110
+ /** Insert this `Referent`.
111
+ * @deprecated Use Referent.insertAt(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
112
+ */
71
113
  insertAt(iModel: IModelDb, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps): Id64String;
72
114
  }
73
115
  /** A class offering services for LinearlyLocated elements.
@@ -75,6 +117,15 @@ export declare class Referent extends ReferentElement {
75
117
  */
76
118
  export declare class LinearlyLocated {
77
119
  private static insertBasic;
120
+ /** Insert a new LinearlyLocated element into an iModel at a specific location along an existing Linear-Element.
121
+ * @param txn The EditTxn used to perform inserts.
122
+ * @param elProps The properties of the new element.
123
+ * @param linearElementId The Id of the Linear-Element along which the new LinearlyLocated will be inserted.
124
+ * @param atPosition Linear position.
125
+ * @returns The newly inserted element's Id.
126
+ * @throws [[IModelError]] if unable to insert the element.
127
+ */
128
+ static insertAt(txn: EditTxn, elProps: ElementProps, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps): Id64String;
78
129
  /** Insert a new LinearlyLocated element into an iModel at a specific location along an existing Linear-Element.
79
130
  * @param iModel The iModel to insert the new element into.
80
131
  * @param elProps The properties of the new element.
@@ -82,8 +133,18 @@ export declare class LinearlyLocated {
82
133
  * @param atPosition Linear position.
83
134
  * @returns The newly inserted element's Id.
84
135
  * @throws [[IModelError]] if unable to insert the element.
136
+ * @deprecated Use LinearlyLocated.insertAt(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
85
137
  */
86
138
  static insertAt(iModel: IModelDb, elProps: ElementProps, linearElementId: Id64String, atPosition: LinearlyReferencedAtLocationProps): Id64String;
139
+ /** Insert a new LinearlyLocated element into an iModel at a specific from-to location along an existing Linear-Element.
140
+ * @param txn The EditTxn used to perform inserts.
141
+ * @param elProps The properties of the new element.
142
+ * @param linearElementId The Id of the Linear-Element along which the new LinearlyLocated will be inserted.
143
+ * @param fromToPosition Linear position.
144
+ * @returns The newly inserted element's Id.
145
+ * @throws [[IModelError]] if unable to insert the element.
146
+ */
147
+ static insertFromTo(txn: EditTxn, elProps: ElementProps, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps): Id64String;
87
148
  /** Insert a new LinearlyLocated element into an iModel at a specific from-to location along an existing Linear-Element.
88
149
  * @param iModel The iModel to insert the new element into.
89
150
  * @param elProps The properties of the new element.
@@ -91,6 +152,7 @@ export declare class LinearlyLocated {
91
152
  * @param fromToPosition Linear position.
92
153
  * @returns The newly inserted element's Id.
93
154
  * @throws [[IModelError]] if unable to insert the element.
155
+ * @deprecated Use LinearlyLocated.insertFromTo(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
94
156
  */
95
157
  static insertFromTo(iModel: IModelDb, elProps: ElementProps, linearElementId: Id64String, fromToPosition: LinearlyReferencedFromToLocationProps): Id64String;
96
158
  private static getLinearLocations;
@@ -115,16 +177,20 @@ export declare class LinearlyLocated {
115
177
  * @param linearLocationProps The properties to use to update the LinearlyReferencedAtLocation aspect.
116
178
  * @param aspectId The Id of the aspect to update. If not known, the first aspectId will be looked-up.
117
179
  * @throws [[IModelError]]
180
+ * @deprecated Use LinearlyLocated.updateAtLocation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
118
181
  */
119
182
  static updateAtLocation(iModel: IModelDb, linearlyLocatedElementId: Id64String, linearLocationProps: LinearlyReferencedAtLocationProps, aspectId?: Id64String): void;
183
+ static updateAtLocation(txn: EditTxn, linearlyLocatedElementId: Id64String, linearLocationProps: LinearlyReferencedAtLocationProps, aspectId?: Id64String): void;
120
184
  /** Update an existing LinearlyReferencedFromToLocation aspect within the iModel.
121
185
  * @param iModel The iModel to update.
122
186
  * @param linearlyLocatedElementId The Id of the owning Linearly Located Element.
123
187
  * @param linearLocationProps The properties to use to update the LinearlyReferencedFromToLocation aspect.
124
188
  * @param aspectId The Id of the aspect to update. If not known, the first aspectId will be looked-up.
125
189
  * @throws [[IModelError]]
190
+ * @deprecated Use LinearlyLocated.updateFromToLocation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
126
191
  */
127
192
  static updateFromToLocation(iModel: IModelDb, linearlyLocatedElementId: Id64String, linearLocationProps: LinearlyReferencedFromToLocationProps, aspectId?: Id64String): void;
193
+ static updateFromToLocation(txn: EditTxn, linearlyLocatedElementId: Id64String, linearLocationProps: LinearlyReferencedFromToLocationProps, aspectId?: Id64String): void;
128
194
  /** Query for the Id of the Linear-Element along which the specified LinearlyLocated Element is located.
129
195
  * @param iModel The iModel to query from.
130
196
  * @param linearlyLocatedElementId The id of the LinearlyLocated Element to query a Linear-Element for.
@@ -1 +1 @@
1
- {"version":3,"file":"LinearReferencingElements.d.ts","sourceRoot":"","sources":["../../src/LinearReferencingElements.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAiC,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAQ,YAAY,EAAE,uBAAuB,EAAe,oBAAoB,EAAkB,MAAM,oBAAoB,CAAC;AACpI,OAAO,EACa,uBAAuB,EAAE,+BAA+B,EAC1E,iCAAiC,EAA+C,qCAAqC,EACrF,WAAW,EAAE,oBAAoB,EAClE,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACnH,OAAO,EAC+D,iCAAiC,EAAE,0BAA0B,EAClI,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,8BAAsB,0BAA2B,SAAQ,sBAAsB;IAC7E,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAAyC;IAEhF,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;gBAE1C,KAAK,EAAE,+BAA+B,EAAE,MAAM,EAAE,QAAQ;IAKpE,kBAAkB,IAAI,UAAU,GAAG,SAAS;CAGpD;AAED;;GAEG;AACH,8BAAsB,qBAAsB,SAAQ,sBAAuB,YAAW,mBAAmB;IACvG,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAAoC;gBAE/D,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAA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,CAAC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,GAAG,uBAAuB,EAAE;CAwBvI"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LinearElement = exports.LinearlyLocated = exports.Referent = exports.ReferentElement = exports.LinearPhysicalElement = exports.LinearLocation = exports.LinearLocationElement = exports.LinearlyLocatedAttribution = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_backend_1 = require("@itwin/core-backend");
13
+ const Symbols_1 = require("@itwin/core-backend/lib/cjs/internal/Symbols");
13
14
  const core_common_1 = require("@itwin/core-common");
14
15
  const linear_referencing_common_1 = require("@itwin/linear-referencing-common");
15
16
  const LinearReferencingElementAspects_1 = require("./LinearReferencingElementAspects");
@@ -65,24 +66,28 @@ class LinearLocation extends LinearLocationElement {
65
66
  static create(iModel, modelId, categoryId) {
66
67
  return new LinearLocation(this.toProps(modelId, categoryId), iModel);
67
68
  }
68
- static insertFromTo(iModel, modelId, categoryId, linearElementId, fromToPosition, locatedElementId) {
69
- const newId = LinearlyLocated.insertFromTo(iModel, this.toProps(modelId, categoryId), linearElementId, fromToPosition);
70
- LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(iModel, newId, locatedElementId);
69
+ static insertFromTo(txnOrIModel, modelId, categoryId, linearElementId, fromToPosition, locatedElementId) {
70
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
71
+ const newId = LinearlyLocated.insertFromTo(txn, this.toProps(modelId, categoryId), linearElementId, fromToPosition);
72
+ LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(txn, newId, locatedElementId);
71
73
  return newId;
72
74
  }
73
- insertFromTo(iModel, linearElementId, fromToPosition, locatedElementId) {
74
- const newId = LinearlyLocated.insertFromTo(iModel, this.toJSON(), linearElementId, fromToPosition);
75
- LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(iModel, newId, locatedElementId);
75
+ insertFromTo(txnOrIModel, linearElementId, fromToPosition, locatedElementId) {
76
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
77
+ const newId = LinearlyLocated.insertFromTo(txn, this.toJSON(), linearElementId, fromToPosition);
78
+ LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(txn, newId, locatedElementId);
76
79
  return newId;
77
80
  }
78
- static insertAt(iModel, modelId, categoryId, linearElementId, atPosition, locatedElementId) {
79
- const newId = LinearlyLocated.insertAt(iModel, this.toProps(modelId, categoryId), linearElementId, atPosition);
80
- LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(iModel, newId, locatedElementId);
81
+ static insertAt(txnOrIModel, modelId, categoryId, linearElementId, atPosition, locatedElementId) {
82
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
83
+ const newId = LinearlyLocated.insertAt(txn, this.toProps(modelId, categoryId), linearElementId, atPosition);
84
+ LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(txn, newId, locatedElementId);
81
85
  return newId;
82
86
  }
83
- insertAt(iModel, linearElementId, atPosition, locatedElementId) {
84
- const newId = LinearlyLocated.insertAt(iModel, this.toJSON(), linearElementId, atPosition);
85
- LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(iModel, newId, locatedElementId);
87
+ insertAt(txnOrIModel, linearElementId, atPosition, locatedElementId) {
88
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
89
+ const newId = LinearlyLocated.insertAt(txn, this.toJSON(), linearElementId, atPosition);
90
+ LinearReferencingRelationships_1.ILinearLocationLocatesElement.insert(txn, newId, locatedElementId);
86
91
  return newId;
87
92
  }
88
93
  }
@@ -136,11 +141,13 @@ class Referent extends ReferentElement {
136
141
  static create(iModel, modelId, categoryId, referencedElementId) {
137
142
  return new Referent(this.toProps(modelId, categoryId, referencedElementId), iModel);
138
143
  }
139
- static insertAt(iModel, modelId, categoryId, linearElementId, atPosition, referencedElementId) {
140
- return LinearlyLocated.insertAt(iModel, this.toProps(modelId, categoryId, referencedElementId), linearElementId, atPosition);
144
+ static insertAt(txnOrIModel, modelId, categoryId, linearElementId, atPosition, referencedElementId) {
145
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
146
+ return LinearlyLocated.insertAt(txn, this.toProps(modelId, categoryId, referencedElementId), linearElementId, atPosition);
141
147
  }
142
- insertAt(iModel, linearElementId, atPosition) {
143
- return LinearlyLocated.insertAt(iModel, this.toJSON(), linearElementId, atPosition);
148
+ insertAt(txnOrIModel, linearElementId, atPosition) {
149
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
150
+ return LinearlyLocated.insertAt(txn, this.toJSON(), linearElementId, atPosition);
144
151
  }
145
152
  }
146
153
  exports.Referent = Referent;
@@ -416,36 +423,22 @@ class QueryLinearLocationsECSQLGen {
416
423
  * @beta
417
424
  */
418
425
  class LinearlyLocated {
419
- static insertBasic(iModel, elProps, linearElementId) {
420
- const newId = iModel.elements.insertElement(elProps);
421
- const linearlyLocatedAlongLinearElement = LinearReferencingRelationships_1.ILinearlyLocatedAlongILinearElement.create(iModel, newId, linearElementId);
422
- linearlyLocatedAlongLinearElement.insert();
426
+ static insertBasic(txn, elProps, linearElementId) {
427
+ const newId = txn.insertElement(elProps);
428
+ const linearlyLocatedAlongLinearElement = LinearReferencingRelationships_1.ILinearlyLocatedAlongILinearElement.create(txn.iModel, newId, linearElementId);
429
+ linearlyLocatedAlongLinearElement.insert(txn);
423
430
  return newId;
424
431
  }
425
- /** Insert a new LinearlyLocated element into an iModel at a specific location along an existing Linear-Element.
426
- * @param iModel The iModel to insert the new element into.
427
- * @param elProps The properties of the new element.
428
- * @param linearElementId The Id of the Linear-Element along which the new LinearlyLocated will be inserted.
429
- * @param atPosition Linear position.
430
- * @returns The newly inserted element's Id.
431
- * @throws [[IModelError]] if unable to insert the element.
432
- */
433
- static insertAt(iModel, elProps, linearElementId, atPosition) {
434
- const newId = this.insertBasic(iModel, elProps, linearElementId);
435
- LinearReferencingElementAspects_1.LinearlyReferencedAtLocation.insert(iModel, newId, atPosition.atPosition, (atPosition.fromReferent === undefined) ? undefined : atPosition.fromReferent.id);
432
+ static insertAt(txnOrIModel, elProps, linearElementId, atPosition) {
433
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
434
+ const newId = this.insertBasic(txn, elProps, linearElementId);
435
+ LinearReferencingElementAspects_1.LinearlyReferencedAtLocation.insert(txn, newId, atPosition.atPosition, atPosition.fromReferent === undefined ? undefined : atPosition.fromReferent.id);
436
436
  return newId;
437
437
  }
438
- /** Insert a new LinearlyLocated element into an iModel at a specific from-to location along an existing Linear-Element.
439
- * @param iModel The iModel to insert the new element into.
440
- * @param elProps The properties of the new element.
441
- * @param linearElementId The Id of the Linear-Element along which the new LinearlyLocated will be inserted.
442
- * @param fromToPosition Linear position.
443
- * @returns The newly inserted element's Id.
444
- * @throws [[IModelError]] if unable to insert the element.
445
- */
446
- static insertFromTo(iModel, elProps, linearElementId, fromToPosition) {
447
- const newId = this.insertBasic(iModel, elProps, linearElementId);
448
- LinearReferencingElementAspects_1.LinearlyReferencedFromToLocation.insert(iModel, newId, fromToPosition.fromPosition, fromToPosition.toPosition, (fromToPosition.fromPositionFromReferent === undefined) ? undefined : fromToPosition.fromPositionFromReferent.id, (fromToPosition.toPositionFromReferent === undefined) ? undefined : fromToPosition.toPositionFromReferent.id);
438
+ static insertFromTo(txnOrIModel, elProps, linearElementId, fromToPosition) {
439
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
440
+ const newId = this.insertBasic(txn, elProps, linearElementId);
441
+ LinearReferencingElementAspects_1.LinearlyReferencedFromToLocation.insert(txn, newId, fromToPosition.fromPosition, fromToPosition.toPosition, fromToPosition.fromPositionFromReferent === undefined ? undefined : fromToPosition.fromPositionFromReferent.id, fromToPosition.toPositionFromReferent === undefined ? undefined : fromToPosition.toPositionFromReferent.id);
449
442
  return newId;
450
443
  }
451
444
  static getLinearLocations(iModel, linearlyLocatedElementId, fullClassName) {
@@ -493,19 +486,17 @@ class LinearlyLocated {
493
486
  return linearLocations[0];
494
487
  }
495
488
  }
496
- /** Update an existing LinearlyReferencedAtLocation aspect within the iModel.
497
- * @param iModel The iModel to update.
498
- * @param linearlyLocatedElementId The Id of the owning Linearly Located Element.
499
- * @param linearLocationProps The properties to use to update the LinearlyReferencedAtLocation aspect.
500
- * @param aspectId The Id of the aspect to update. If not known, the first aspectId will be looked-up.
501
- * @throws [[IModelError]]
502
- */
503
- static updateAtLocation(iModel, linearlyLocatedElementId, linearLocationProps, aspectId) {
489
+ static updateAtLocation(txnOrIModel, linearlyLocatedElementId, linearLocationProps, aspectId) {
490
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
491
+ const iModel = txn.iModel;
504
492
  let linearLocAspectId;
505
493
  if (aspectId !== undefined)
506
494
  linearLocAspectId = aspectId;
507
495
  else {
508
- linearLocAspectId = this.queryFirstLinearLocationAspectId(iModel, linearlyLocatedElementId, "LinearlyReferencedAtLocation");
496
+ const queriedAspectId = this.queryFirstLinearLocationAspectId(iModel, linearlyLocatedElementId, "LinearlyReferencedAtLocation");
497
+ if (queriedAspectId === undefined)
498
+ throw new Error("LinearlyReferencedAtLocation aspect not found");
499
+ linearLocAspectId = queriedAspectId;
509
500
  }
510
501
  const linearLocationAspectProps = {
511
502
  id: linearLocAspectId,
@@ -514,21 +505,19 @@ class LinearlyLocated {
514
505
  atPosition: linearLocationProps.atPosition,
515
506
  fromReferent: linearLocationProps.fromReferent,
516
507
  };
517
- iModel.elements.updateAspect(linearLocationAspectProps);
508
+ txn.updateAspect(linearLocationAspectProps);
518
509
  }
519
- /** Update an existing LinearlyReferencedFromToLocation aspect within the iModel.
520
- * @param iModel The iModel to update.
521
- * @param linearlyLocatedElementId The Id of the owning Linearly Located Element.
522
- * @param linearLocationProps The properties to use to update the LinearlyReferencedFromToLocation aspect.
523
- * @param aspectId The Id of the aspect to update. If not known, the first aspectId will be looked-up.
524
- * @throws [[IModelError]]
525
- */
526
- static updateFromToLocation(iModel, linearlyLocatedElementId, linearLocationProps, aspectId) {
510
+ static updateFromToLocation(txnOrIModel, linearlyLocatedElementId, linearLocationProps, aspectId) {
511
+ const txn = txnOrIModel instanceof core_backend_1.EditTxn ? txnOrIModel : txnOrIModel[Symbols_1._implicitTxn];
512
+ const iModel = txn.iModel;
527
513
  let linearLocAspectId;
528
514
  if (aspectId !== undefined)
529
515
  linearLocAspectId = aspectId;
530
516
  else {
531
- linearLocAspectId = this.queryFirstLinearLocationAspectId(iModel, linearlyLocatedElementId, "LinearlyReferencedFromToLocation");
517
+ const queriedAspectId = this.queryFirstLinearLocationAspectId(iModel, linearlyLocatedElementId, "LinearlyReferencedFromToLocation");
518
+ if (queriedAspectId === undefined)
519
+ throw new Error("LinearlyReferencedFromToLocation aspect not found");
520
+ linearLocAspectId = queriedAspectId;
532
521
  }
533
522
  const linearLocationAspectProps = {
534
523
  id: linearLocAspectId,
@@ -539,7 +528,7 @@ class LinearlyLocated {
539
528
  toPosition: linearLocationProps.toPosition,
540
529
  toPositionFromReferent: linearLocationProps.toPositionFromReferent,
541
530
  };
542
- iModel.elements.updateAspect(linearLocationAspectProps);
531
+ txn.updateAspect(linearLocationAspectProps);
543
532
  }
544
533
  /** Query for the Id of the Linear-Element along which the specified LinearlyLocated Element is located.
545
534
  * @param iModel The iModel to query from.