@itwin/core-frontend 5.7.0-dev.9 → 5.7.1
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 +34 -1
- package/lib/cjs/CategorySelectorState.d.ts +8 -0
- package/lib/cjs/CategorySelectorState.d.ts.map +1 -1
- package/lib/cjs/CategorySelectorState.js +12 -0
- package/lib/cjs/CategorySelectorState.js.map +1 -1
- package/lib/cjs/GeoServices.js +1 -1
- package/lib/cjs/GeoServices.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +0 -2
- package/lib/cjs/IModelConnection.d.ts.map +1 -1
- package/lib/cjs/IModelConnection.js +110 -105
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +2 -0
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +2 -1
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +10 -3
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/common/gltf/GltfParser.js +1 -1
- package/lib/cjs/common/gltf/GltfParser.js.map +1 -1
- package/lib/cjs/internal/tile/MeshoptCompression.js +1 -1
- package/lib/cjs/internal/tile/MeshoptCompression.js.map +1 -1
- package/lib/cjs/internal/tile/PntsReader.js +1 -1
- package/lib/cjs/internal/tile/PntsReader.js.map +1 -1
- package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/internal/tile/RealityTileLoader.js +26 -5
- package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/internal/tile/map/WmtsCapabilities.js +1 -1
- package/lib/cjs/internal/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +4 -2
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +55 -5
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +7 -7
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/CategorySelectorState.d.ts +8 -0
- package/lib/esm/CategorySelectorState.d.ts.map +1 -1
- package/lib/esm/CategorySelectorState.js +12 -0
- package/lib/esm/CategorySelectorState.js.map +1 -1
- package/lib/esm/GeoServices.js +1 -1
- package/lib/esm/GeoServices.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +0 -2
- package/lib/esm/IModelConnection.d.ts.map +1 -1
- package/lib/esm/IModelConnection.js +110 -105
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +2 -0
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +2 -1
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +10 -3
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/common/gltf/GltfParser.js +1 -1
- package/lib/esm/common/gltf/GltfParser.js.map +1 -1
- package/lib/esm/internal/tile/MeshoptCompression.js +1 -1
- package/lib/esm/internal/tile/MeshoptCompression.js.map +1 -1
- package/lib/esm/internal/tile/PntsReader.js +1 -1
- package/lib/esm/internal/tile/PntsReader.js.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.js +26 -5
- package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/internal/tile/map/WmtsCapabilities.js +1 -1
- package/lib/esm/internal/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +4 -2
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +55 -5
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +8 -8
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
|
@@ -628,72 +628,7 @@ export class SnapshotConnection extends IModelConnection {
|
|
|
628
628
|
/** The collection of loaded ModelState objects for an [[IModelConnection]]. */
|
|
629
629
|
class Models {
|
|
630
630
|
_iModel;
|
|
631
|
-
|
|
632
|
-
SELECT
|
|
633
|
-
Model.Id AS ECInstanceId,
|
|
634
|
-
iModel_bbox_union(
|
|
635
|
-
iModel_placement_aabb(
|
|
636
|
-
iModel_placement(
|
|
637
|
-
iModel_point(Origin.X, Origin.Y, 0),
|
|
638
|
-
iModel_angles(Rotation, 0, 0),
|
|
639
|
-
iModel_bbox(
|
|
640
|
-
BBoxLow.X, BBoxLow.Y, -1,
|
|
641
|
-
BBoxHigh.X, BBoxHigh.Y, 1
|
|
642
|
-
)
|
|
643
|
-
)
|
|
644
|
-
)
|
|
645
|
-
) AS bbox
|
|
646
|
-
FROM bis.GeometricElement2d
|
|
647
|
-
WHERE InVirtualSet(:ids64, Model.Id) AND Origin.X IS NOT NULL
|
|
648
|
-
GROUP BY Model.Id
|
|
649
|
-
UNION
|
|
650
|
-
SELECT
|
|
651
|
-
ge.Model.Id AS ECInstanceId,
|
|
652
|
-
iModel_bbox(
|
|
653
|
-
min(i.MinX), min(i.MinY), min(i.MinZ),
|
|
654
|
-
max(i.MaxX), max(i.MaxY), max(i.MaxZ)
|
|
655
|
-
) AS bbox
|
|
656
|
-
FROM bis.SpatialIndex AS i, bis.GeometricElement3d AS ge, bis.GeometricModel3d AS gm
|
|
657
|
-
WHERE InVirtualSet(:ids64, ge.Model.Id) AND ge.ECInstanceId=i.ECInstanceId AND InVirtualSet(:ids64, gm.ECInstanceId) AND (gm.$->isNotSpatiallyLocated?=false OR gm.$->isNotSpatiallyLocated? IS NULL)
|
|
658
|
-
GROUP BY ge.Model.Id
|
|
659
|
-
UNION
|
|
660
|
-
SELECT
|
|
661
|
-
ge.Model.Id AS ECInstanceId,
|
|
662
|
-
iModel_bbox_union(
|
|
663
|
-
iModel_placement_aabb(
|
|
664
|
-
iModel_placement(
|
|
665
|
-
iModel_point(ge.Origin.X, ge.Origin.Y, ge.Origin.Z),
|
|
666
|
-
iModel_angles(ge.Yaw, ge.Pitch, ge.Roll),
|
|
667
|
-
iModel_bbox(
|
|
668
|
-
ge.BBoxLow.X, ge.BBoxLow.Y, ge.BBoxLow.Z,
|
|
669
|
-
ge.BBoxHigh.X, ge.BBoxHigh.Y, ge.BBoxHigh.Z
|
|
670
|
-
)
|
|
671
|
-
)
|
|
672
|
-
)
|
|
673
|
-
) AS bbox
|
|
674
|
-
FROM bis.GeometricElement3d AS ge, bis.GeometricModel3d as gm
|
|
675
|
-
WHERE InVirtualSet(:ids64, ge.Model.Id) AND ge.Origin.X IS NOT NULL AND InVirtualSet(:ids64, gm.ECInstanceId) AND gm.$->isNotSpatiallyLocated?=true
|
|
676
|
-
GROUP BY ge.Model.Id`;
|
|
677
|
-
_modelExistenceQuery = `
|
|
678
|
-
WITH
|
|
679
|
-
GeometricModels AS(
|
|
680
|
-
SELECT
|
|
681
|
-
ECInstanceId
|
|
682
|
-
FROM bis.GeometricModel
|
|
683
|
-
WHERE InVirtualSet(: ids64, ECInstanceId)
|
|
684
|
-
)
|
|
685
|
-
SELECT
|
|
686
|
-
ECInstanceId,
|
|
687
|
-
true AS isGeometricModel
|
|
688
|
-
FROM GeometricModels
|
|
689
|
-
UNION ALL
|
|
690
|
-
SELECT
|
|
691
|
-
ECInstanceId,
|
|
692
|
-
false AS isGeometricModel
|
|
693
|
-
FROM bis.Model
|
|
694
|
-
WHERE InVirtualSet(: ids64, ECInstanceId)
|
|
695
|
-
AND ECInstanceId NOT IN(SELECT ECInstanceId FROM GeometricModels)`;
|
|
696
|
-
_loadedExtents = [];
|
|
631
|
+
_loadedExtents = new Map();
|
|
697
632
|
_geometryChangedListener;
|
|
698
633
|
_loaded = new Map();
|
|
699
634
|
/** @internal */
|
|
@@ -708,7 +643,9 @@ export class SnapshotConnection extends IModelConnection {
|
|
|
708
643
|
IModelConnection.onOpen.addListener(() => {
|
|
709
644
|
if (this._iModel.isBriefcaseConnection()) {
|
|
710
645
|
this._geometryChangedListener = (changes) => {
|
|
711
|
-
|
|
646
|
+
changes.forEach((change) => {
|
|
647
|
+
this._loadedExtents.delete(change.id);
|
|
648
|
+
});
|
|
712
649
|
};
|
|
713
650
|
this._iModel.txns.onModelGeometryChanged.addListener(this._geometryChangedListener);
|
|
714
651
|
}
|
|
@@ -812,64 +749,132 @@ export class SnapshotConnection extends IModelConnection {
|
|
|
812
749
|
return [];
|
|
813
750
|
if (typeof modelIds === "string")
|
|
814
751
|
modelIds = [modelIds];
|
|
815
|
-
const
|
|
752
|
+
const resolvedExtents = new Map();
|
|
753
|
+
const uncachedModelIds = [];
|
|
754
|
+
// Add the cached model ids and the invalid ids
|
|
816
755
|
for (const modelId of modelIds) {
|
|
817
|
-
if (
|
|
818
|
-
|
|
756
|
+
if (this._loadedExtents.has(modelId)) {
|
|
757
|
+
resolvedExtents.set(modelId, this._loadedExtents.get(modelId));
|
|
819
758
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
if (modelExtent) {
|
|
826
|
-
modelExtents.push(modelExtent);
|
|
759
|
+
else if (!Id64.isValidId64(modelId)) {
|
|
760
|
+
resolvedExtents.set(modelId, { id: modelId, extents: Range3d.createNull(), status: IModelStatus.InvalidId });
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
uncachedModelIds.push(modelId);
|
|
827
764
|
}
|
|
828
765
|
}
|
|
829
|
-
|
|
830
|
-
if (
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
const
|
|
766
|
+
// Run the ECSql to get uncached model extents
|
|
767
|
+
if (uncachedModelIds.length > 0) {
|
|
768
|
+
const modelList = uncachedModelIds.join(",");
|
|
769
|
+
const useSingleModelQuery = uncachedModelIds.length === 1;
|
|
770
|
+
const modelExtentsQuery = `
|
|
771
|
+
SELECT
|
|
772
|
+
Model.Id AS ECInstanceId,
|
|
773
|
+
iModel_bbox_union(
|
|
774
|
+
iModel_placement_aabb(
|
|
775
|
+
iModel_placement(
|
|
776
|
+
iModel_point(Origin.X, Origin.Y, 0),
|
|
777
|
+
iModel_angles(Rotation, 0, 0),
|
|
778
|
+
iModel_bbox(
|
|
779
|
+
BBoxLow.X, BBoxLow.Y, -1,
|
|
780
|
+
BBoxHigh.X, BBoxHigh.Y, 1
|
|
781
|
+
)
|
|
782
|
+
)
|
|
783
|
+
)
|
|
784
|
+
) AS bbox
|
|
785
|
+
FROM bis.GeometricElement2d
|
|
786
|
+
WHERE Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
|
|
787
|
+
AND Origin.X IS NOT NULL
|
|
788
|
+
GROUP BY Model.Id
|
|
789
|
+
|
|
790
|
+
UNION
|
|
791
|
+
|
|
792
|
+
SELECT
|
|
793
|
+
ge.Model.Id AS ECInstanceId,
|
|
794
|
+
iModel_bbox(
|
|
795
|
+
min(i.MinX), min(i.MinY), min(i.MinZ),
|
|
796
|
+
max(i.MaxX), max(i.MaxY), max(i.MaxZ)
|
|
797
|
+
) AS bbox
|
|
798
|
+
FROM bis.SpatialIndex AS i
|
|
799
|
+
INNER JOIN bis.GeometricElement3d AS ge
|
|
800
|
+
ON ge.ECInstanceId = i.ECInstanceId
|
|
801
|
+
INNER JOIN bis.GeometricModel3d AS gm
|
|
802
|
+
ON ge.Model.Id = gm.ECInstanceId
|
|
803
|
+
WHERE ge.Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
|
|
804
|
+
AND (gm.$->IsNotSpatiallyLocated? IS NULL OR gm.$->IsNotSpatiallyLocated? IS FALSE)
|
|
805
|
+
GROUP BY ge.Model.Id
|
|
806
|
+
|
|
807
|
+
UNION
|
|
808
|
+
|
|
809
|
+
SELECT
|
|
810
|
+
ge.Model.Id AS ECInstanceId,
|
|
811
|
+
iModel_bbox_union(
|
|
812
|
+
iModel_placement_aabb(
|
|
813
|
+
iModel_placement(
|
|
814
|
+
iModel_point(ge.Origin.X, ge.Origin.Y, ge.Origin.Z),
|
|
815
|
+
iModel_angles(ge.Yaw, ge.Pitch, ge.Roll),
|
|
816
|
+
iModel_bbox(
|
|
817
|
+
ge.BBoxLow.X, ge.BBoxLow.Y, ge.BBoxLow.Z,
|
|
818
|
+
ge.BBoxHigh.X, ge.BBoxHigh.Y, ge.BBoxHigh.Z
|
|
819
|
+
)
|
|
820
|
+
)
|
|
821
|
+
)
|
|
822
|
+
) AS bbox
|
|
823
|
+
FROM bis.GeometricElement3d ge
|
|
824
|
+
INNER JOIN bis.GeometricModel3d gm
|
|
825
|
+
ON ge.Model.Id = gm.ECInstanceId
|
|
826
|
+
WHERE ge.Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
|
|
827
|
+
AND gm.$->IsNotSpatiallyLocated? IS TRUE
|
|
828
|
+
AND ge.Origin.X IS NOT NULL
|
|
829
|
+
GROUP BY ge.Model.Id
|
|
830
|
+
`;
|
|
831
|
+
const extentsQueryReader = this._iModel.createQueryReader(modelExtentsQuery, undefined, {
|
|
834
832
|
rowFormat: QueryRowFormat.UseECSqlPropertyNames,
|
|
835
833
|
});
|
|
836
834
|
for await (const row of extentsQueryReader) {
|
|
837
835
|
const byteArray = new Uint8Array(Object.values(row.bbox));
|
|
838
836
|
const extents = Range3d.fromArrayBuffer(byteArray.buffer);
|
|
839
837
|
const extent = { id: row.ECInstanceId, extents, status: IModelStatus.Success };
|
|
840
|
-
|
|
841
|
-
this._loadedExtents.
|
|
838
|
+
resolvedExtents.set(extent.id, extent);
|
|
839
|
+
this._loadedExtents.set(extent.id, extent);
|
|
842
840
|
}
|
|
843
841
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const
|
|
842
|
+
// Check if there still are any unresolved model IDs
|
|
843
|
+
const unresolvedModelIds = uncachedModelIds.filter((id) => !resolvedExtents.has(id));
|
|
844
|
+
if (unresolvedModelIds.length > 0) {
|
|
845
|
+
const modelList = unresolvedModelIds.join(",");
|
|
846
|
+
const modelExistenceQuery = `
|
|
847
|
+
SELECT
|
|
848
|
+
m.ECInstanceId,
|
|
849
|
+
CASE WHEN g.ECInstanceId IS NOT NULL THEN 1 ELSE 0 END AS isGeometricModel
|
|
850
|
+
FROM bis.Model m
|
|
851
|
+
LEFT JOIN bis.GeometricModel g
|
|
852
|
+
ON m.ECInstanceId = g.ECInstanceId
|
|
853
|
+
WHERE m.ECInstanceId ${unresolvedModelIds.length === 1 ? `= ${unresolvedModelIds[0]}` : `IN (${modelList})`}
|
|
854
|
+
`;
|
|
855
|
+
const modelExistenceQueryReader = this._iModel.createQueryReader(modelExistenceQuery, undefined, {
|
|
849
856
|
rowFormat: QueryRowFormat.UseECSqlPropertyNames,
|
|
850
857
|
});
|
|
851
858
|
for await (const row of modelExistenceQueryReader) {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
modelExtents.push(extent);
|
|
860
|
-
this._loadedExtents.push(extent);
|
|
859
|
+
const extent = {
|
|
860
|
+
id: row.ECInstanceId,
|
|
861
|
+
extents: Range3d.createNull(),
|
|
862
|
+
status: row.isGeometricModel ? IModelStatus.Success : IModelStatus.WrongModel,
|
|
863
|
+
};
|
|
864
|
+
resolvedExtents.set(extent.id, extent);
|
|
865
|
+
this._loadedExtents.set(extent.id, extent);
|
|
861
866
|
}
|
|
862
867
|
}
|
|
868
|
+
// Return the results while maintaining the same order
|
|
863
869
|
return modelIds.map((modelId) => {
|
|
864
|
-
|
|
870
|
+
const extent = resolvedExtents.get(modelId);
|
|
865
871
|
if (extent === undefined) {
|
|
866
|
-
|
|
867
|
-
this._loadedExtents.
|
|
868
|
-
return
|
|
872
|
+
const notFound = { id: modelId, extents: Range3d.createNull(), status: IModelStatus.NotFound };
|
|
873
|
+
this._loadedExtents.set(notFound.id, notFound);
|
|
874
|
+
return notFound;
|
|
869
875
|
}
|
|
870
|
-
|
|
871
|
-
extent
|
|
872
|
-
return extent;
|
|
876
|
+
if (extent.status === IModelStatus.InvalidId) {
|
|
877
|
+
return { ...extent, id: "0" };
|
|
873
878
|
}
|
|
874
879
|
return extent;
|
|
875
880
|
});
|