@itwin/imodel-transformer 1.2.0 → 1.2.1-dev.0
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Change Log - @itwin/imodel-transformer
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon, 30 Jun 2025 18:36:
|
|
3
|
+
This log was last generated on Mon, 30 Jun 2025 18:36:23 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
7
|
## 1.2.0
|
|
8
8
|
|
|
9
|
-
Mon, 30 Jun 2025 18:36:
|
|
9
|
+
Mon, 30 Jun 2025 18:36:23 GMT
|
|
10
10
|
|
|
11
11
|
### Minor changes
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@ import { Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
|
2
2
|
import * as ECSchemaMetaData from "@itwin/ecschema-metadata";
|
|
3
3
|
import { Transform } from "@itwin/core-geometry";
|
|
4
4
|
import { Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, Entity, ExternalSourceAspect, IModelDb, Model, Relationship, RelationshipProps } from "@itwin/core-backend";
|
|
5
|
-
import { ChangesetIndexAndId, CodeSpec, ElementAspectProps, ElementProps, ExternalSourceAspectProps, FontProps, ModelProps, Placement2d, Placement3d } from "@itwin/core-common";
|
|
5
|
+
import { ChangesetIndexAndId, CodeSpec, ElementAspectProps, ElementProps, ExternalSourceAspectProps, FontProps, Helmert2DWithZOffset, ModelProps, Placement2d, Placement3d } from "@itwin/core-common";
|
|
6
6
|
import { ChangedInstanceIds, ExportChangesOptions, ExportSchemaResult, IModelExporter, IModelExportHandler } from "./IModelExporter";
|
|
7
7
|
import { IModelImporter, OptimizeGeometryOptions } from "./IModelImporter";
|
|
8
8
|
import { IModelCloneContext } from "./IModelCloneContext";
|
|
@@ -115,11 +115,13 @@ export interface IModelTransformOptions {
|
|
|
115
115
|
* @default undefined
|
|
116
116
|
*/
|
|
117
117
|
argsForProcessChanges?: ProcessChangesOptions;
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
118
|
+
/**
|
|
119
|
+
* A flag that determines if spatial elements from the source db should be transformed if:
|
|
120
|
+
* source and target iModel GCS/CRS data is the same, but they have differing additional transforms
|
|
121
|
+
* source and target iModel ECEF locations differ
|
|
120
122
|
* @default false
|
|
121
123
|
*/
|
|
122
|
-
|
|
124
|
+
tryAlignGeolocation?: boolean;
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* Data type for persisting change version information within provenance Scope ExternalSourceAspect.
|
|
@@ -210,10 +212,15 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
210
212
|
readonly targetDb: IModelDb;
|
|
211
213
|
/** The IModelTransformContext for this IModelTransformer. */
|
|
212
214
|
readonly context: IModelCloneContext;
|
|
213
|
-
/** The transform to be applied to the placement of spatial elements
|
|
214
|
-
*
|
|
215
|
+
/** The transform to be applied to the placement of spatial elements
|
|
216
|
+
* This transform should be applied when:
|
|
217
|
+
* - source and target db have different ECEF locations
|
|
218
|
+
* - source and target db have matching GCS/CRS data, but differing `geographicCoordinateSystem.additionalTransform.helmert2DWithZOffset`
|
|
219
|
+
* @note for ECEF transforms, this can only be used when source and target are linearly located imodels
|
|
220
|
+
* @note for non linearly located imodels, this transform will be a linear transform derived from Helmert Transforms from the src and target iModels.
|
|
221
|
+
* @beta
|
|
215
222
|
*/
|
|
216
|
-
|
|
223
|
+
private _linearSpatialTransform?;
|
|
217
224
|
private _syncType?;
|
|
218
225
|
/** The Id of the Element in the **target** iModel that represents the **source** repository as a whole and scopes its [ExternalSourceAspect]($backend) instances. */
|
|
219
226
|
get targetScopeElementId(): Id64String;
|
|
@@ -425,7 +432,9 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
425
432
|
* @returns Transform that converts relative coordinates in the source iModel to relative coordinates in the target iModel.
|
|
426
433
|
* @note This can only be used if both source and target iModels are linearly located
|
|
427
434
|
*/
|
|
428
|
-
calculateEcefTransform(
|
|
435
|
+
calculateEcefTransform(): Transform | undefined;
|
|
436
|
+
static convertHelmertToTransform(helmert: Helmert2DWithZOffset | undefined): Transform;
|
|
437
|
+
calculateTransformFromHelmertTransforms(): Transform | undefined;
|
|
429
438
|
private _deletedSourceRelationshipData?;
|
|
430
439
|
/** Returns true if a change within sourceElement is detected.
|
|
431
440
|
* @param sourceElement The Element from the source iModel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,SAAS,EACT,OAAO,EACP,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,SAAS,EACT,OAAO,EACP,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAKL,SAAS,EAEV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAaL,OAAO,EACP,aAAa,EACb,kBAAkB,EAGlB,mBAAmB,EACnB,MAAM,EAGN,oBAAoB,EAKpB,QAAQ,EAKR,KAAK,EAGL,YAAY,EACZ,iBAAiB,EAMlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,mBAAmB,EAGnB,QAAQ,EAER,kBAAkB,EAClB,YAAY,EAEZ,yBAAyB,EACzB,SAAS,EAGT,oBAAoB,EAGpB,UAAU,EACV,WAAW,EACX,WAAW,EAMZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EAEpB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,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S,EAAE,WAAW,GACrB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAkBvC;;;;;;OAMG;IACU,eAAe,CAC1B,qBAAqB,EAAE,UAAU,EACjC,aAAa,EAAE,UAAU,EACzB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAkBvC,4EAA4E;IAC5D,kBAAkB,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY;CAqDzE"}
|
|
@@ -243,7 +243,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
243
243
|
danglingReferencesBehavior: options?.danglingReferencesBehavior ?? "reject",
|
|
244
244
|
branchRelationshipDataBehavior: options?.branchRelationshipDataBehavior ?? "reject",
|
|
245
245
|
skipPropagateChangesToRootElements: options?.skipPropagateChangesToRootElements ?? true,
|
|
246
|
-
|
|
246
|
+
tryAlignGeolocation: options?.tryAlignGeolocation ?? false,
|
|
247
247
|
};
|
|
248
248
|
// check if authorization client is defined
|
|
249
249
|
if (core_backend_1.IModelHost.authorizationClient === undefined) {
|
|
@@ -299,9 +299,20 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
299
299
|
this.targetDb.codeValueBehavior = "exact";
|
|
300
300
|
}
|
|
301
301
|
/* eslint-enable @itwin/no-internal */
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
if (this._options.tryAlignGeolocation) {
|
|
303
|
+
if (this.sourceDb.geographicCoordinateSystem ||
|
|
304
|
+
this.targetDb.geographicCoordinateSystem) {
|
|
305
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Aligning Additional transforms between imodels due to imodels containing GeographicCoordinateSystem data");
|
|
306
|
+
this._linearSpatialTransform =
|
|
307
|
+
this.calculateTransformFromHelmertTransforms();
|
|
308
|
+
}
|
|
309
|
+
else if (this.sourceDb.ecefLocation && this.targetDb.ecefLocation) {
|
|
310
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Aligning ECEF Location's between imodels due to imodels not containing GeographicCoordinateSystem data");
|
|
311
|
+
this._linearSpatialTransform = this.calculateEcefTransform();
|
|
312
|
+
}
|
|
313
|
+
else
|
|
314
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "No Geolcation data to align, both GCS and ECEF are undefined");
|
|
315
|
+
}
|
|
305
316
|
}
|
|
306
317
|
/** validates that the importer set on the transformer has the same values for its shared options as the transformer.
|
|
307
318
|
* @note This expects that the importer is already set on the transformer.
|
|
@@ -925,12 +936,12 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
925
936
|
targetElementProps.jsonProperties.Subject.Job = undefined;
|
|
926
937
|
}
|
|
927
938
|
}
|
|
928
|
-
if (this.
|
|
939
|
+
if (this._linearSpatialTransform !== undefined &&
|
|
929
940
|
sourceElement instanceof core_backend_1.GeometricElement3d) {
|
|
930
941
|
// can check the sourceElement since this IModelTransformer does not remap classes
|
|
931
942
|
const placement = core_common_1.Placement3d.fromJSON(targetElementProps.placement);
|
|
932
943
|
if (placement.isValid) {
|
|
933
|
-
placement.multiplyTransform(this.
|
|
944
|
+
placement.multiplyTransform(this._linearSpatialTransform);
|
|
934
945
|
targetElementProps.placement = placement;
|
|
935
946
|
}
|
|
936
947
|
}
|
|
@@ -943,27 +954,68 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
943
954
|
* @returns Transform that converts relative coordinates in the source iModel to relative coordinates in the target iModel.
|
|
944
955
|
* @note This can only be used if both source and target iModels are linearly located
|
|
945
956
|
*/
|
|
946
|
-
calculateEcefTransform(
|
|
947
|
-
const srcEcefLoc =
|
|
948
|
-
const targetEcefLoc = targetDb.ecefLocation;
|
|
949
|
-
if (srcDb.geographicCoordinateSystem !== undefined ||
|
|
950
|
-
targetDb.geographicCoordinateSystem !== undefined) {
|
|
951
|
-
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.MismatchGcs, "Both source and target geographic coordinate systems must not be defined to calculate the linear ecef transform.");
|
|
952
|
-
}
|
|
957
|
+
calculateEcefTransform() {
|
|
958
|
+
const srcEcefLoc = this.sourceDb.ecefLocation;
|
|
959
|
+
const targetEcefLoc = this.targetDb.ecefLocation;
|
|
953
960
|
if (srcEcefLoc === undefined || targetEcefLoc === undefined) {
|
|
954
961
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NoGeoLocation, "Both source and target ECEF locations must be defined to calculate the transform.");
|
|
955
962
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
963
|
+
if (srcEcefLoc.getTransform().isAlmostEqual(targetEcefLoc.getTransform())) {
|
|
964
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "ECEF data is already aligned. No spatial transforms needed.");
|
|
965
|
+
return undefined;
|
|
966
|
+
}
|
|
967
|
+
const srcSpatialToECEF = srcEcefLoc.getTransform(); // converts relative to ECEF in relation to source
|
|
968
|
+
const targetECEFToSpatial = targetEcefLoc.getTransform().inverse(); // converts ECEF to relative in relation to target
|
|
969
|
+
if (!targetECEFToSpatial) {
|
|
970
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NoGeoLocation, "Failed to invert target ECEF transform.");
|
|
971
|
+
}
|
|
972
|
+
const ecefTransform = targetECEFToSpatial.multiplyTransformTransform(srcSpatialToECEF); // chain both transforms
|
|
973
|
+
return ecefTransform;
|
|
974
|
+
}
|
|
975
|
+
static convertHelmertToTransform(helmert) {
|
|
976
|
+
if (!helmert) {
|
|
977
|
+
return core_geometry_1.Transform.createIdentity();
|
|
978
|
+
}
|
|
979
|
+
const rotationXY = core_geometry_1.Matrix3d.createRotationAroundAxisIndex(core_geometry_1.AxisIndex.Z, core_geometry_1.Angle.createDegrees(helmert?.rotDeg));
|
|
980
|
+
rotationXY.scaleColumnsInPlace(helmert.scale, helmert.scale, 1.0);
|
|
981
|
+
const translation = core_geometry_1.Vector3d.create(helmert.translationX, helmert.translationY, helmert.translationZ);
|
|
982
|
+
const helmertTransform = core_geometry_1.Transform.createRefs(translation, rotationXY);
|
|
983
|
+
return helmertTransform;
|
|
984
|
+
}
|
|
985
|
+
calculateTransformFromHelmertTransforms() {
|
|
986
|
+
if (this.sourceDb.geographicCoordinateSystem?.horizontalCRS === undefined ||
|
|
987
|
+
this.sourceDb.geographicCoordinateSystem?.verticalCRS === undefined) {
|
|
988
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Source iModel does not have a geographic coordinate system defined.");
|
|
989
|
+
}
|
|
990
|
+
if (this.targetDb.geographicCoordinateSystem?.horizontalCRS === undefined ||
|
|
991
|
+
this.targetDb.geographicCoordinateSystem.verticalCRS === undefined) {
|
|
992
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Target iModel does not have a geographic coordinate system defined.");
|
|
993
|
+
}
|
|
994
|
+
if (!this.sourceDb.geographicCoordinateSystem.horizontalCRS.equals(this.targetDb.geographicCoordinateSystem.horizontalCRS) ||
|
|
995
|
+
!this.sourceDb.geographicCoordinateSystem.verticalCRS.equals(this.targetDb.geographicCoordinateSystem.verticalCRS)) {
|
|
996
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.MismatchGcs, "Source and target geographic coordinate systems must match to calculate the spatial transform.");
|
|
997
|
+
}
|
|
998
|
+
if (this.sourceDb.geographicCoordinateSystem.additionalTransform ===
|
|
999
|
+
this.targetDb.geographicCoordinateSystem.additionalTransform) {
|
|
1000
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Geolocation data is already aligned. No spatial transforms needed.");
|
|
1001
|
+
return undefined;
|
|
966
1002
|
}
|
|
1003
|
+
const srcScale = this.sourceDb.geographicCoordinateSystem.additionalTransform
|
|
1004
|
+
?.helmert2DWithZOffset?.scale ?? 1;
|
|
1005
|
+
const targetScale = this.targetDb.geographicCoordinateSystem.additionalTransform
|
|
1006
|
+
?.helmert2DWithZOffset?.scale ?? 1;
|
|
1007
|
+
if (srcScale !== targetScale) {
|
|
1008
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.MismatchGcs, "Spatial transform is non rigid. Source and target Helmert transforms must have the same scale to calculate a rigid spatial transform.");
|
|
1009
|
+
}
|
|
1010
|
+
const srcTransform = IModelTransformer.convertHelmertToTransform(this.sourceDb.geographicCoordinateSystem.additionalTransform
|
|
1011
|
+
?.helmert2DWithZOffset); // moves elements to where src helmert transform would move them at render time
|
|
1012
|
+
const targetTransformInv = IModelTransformer.convertHelmertToTransform(this.targetDb.geographicCoordinateSystem.additionalTransform
|
|
1013
|
+
?.helmert2DWithZOffset).inverse(); // negates target helmert transform that is applied at render time
|
|
1014
|
+
if (!targetTransformInv) {
|
|
1015
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NoGeoLocation, "Failed to invert target Helmert transform.");
|
|
1016
|
+
}
|
|
1017
|
+
const combinedTransform = targetTransformInv.multiplyTransformTransform(srcTransform);
|
|
1018
|
+
return combinedTransform;
|
|
967
1019
|
}
|
|
968
1020
|
/** Returns true if a change within sourceElement is detected.
|
|
969
1021
|
* @param sourceElement The Element from the source iModel
|