@itwin/hypermodeling-frontend 3.7.0-dev.8 → 3.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/HyperModeling.d.ts +114 -114
  3. package/lib/cjs/HyperModeling.js +240 -240
  4. package/lib/cjs/HyperModelingConfig.d.ts +54 -54
  5. package/lib/cjs/HyperModelingConfig.js +9 -9
  6. package/lib/cjs/HyperModelingConfig.js.map +1 -1
  7. package/lib/cjs/HyperModelingDecorator.d.ts +110 -110
  8. package/lib/cjs/HyperModelingDecorator.js +337 -337
  9. package/lib/cjs/HyperModelingDecorator.js.map +1 -1
  10. package/lib/cjs/PopupToolbar.d.ts +24 -24
  11. package/lib/cjs/PopupToolbar.js +57 -57
  12. package/lib/cjs/PopupToolbar.js.map +1 -1
  13. package/lib/cjs/SectionDrawingLocationState.d.ts +90 -90
  14. package/lib/cjs/SectionDrawingLocationState.js +137 -137
  15. package/lib/cjs/SectionDrawingLocationState.js.map +1 -1
  16. package/lib/cjs/SectionGraphicsProvider.d.ts +13 -13
  17. package/lib/cjs/SectionGraphicsProvider.js +273 -273
  18. package/lib/cjs/SectionGraphicsProvider.js.map +1 -1
  19. package/lib/cjs/SectionMarkerHandler.d.ts +52 -52
  20. package/lib/cjs/SectionMarkerHandler.js +112 -112
  21. package/lib/cjs/SectionMarkerHandler.js.map +1 -1
  22. package/lib/cjs/SectionMarkers.d.ts +82 -82
  23. package/lib/cjs/SectionMarkers.js +174 -174
  24. package/lib/cjs/SectionMarkers.js.map +1 -1
  25. package/lib/cjs/Tools.d.ts +5 -5
  26. package/lib/cjs/Tools.js +170 -170
  27. package/lib/cjs/hypermodeling-frontend.d.ts +13 -13
  28. package/lib/cjs/hypermodeling-frontend.js +29 -29
  29. package/lib/cjs/hypermodeling-frontend.js.map +1 -1
  30. package/lib/esm/HyperModeling.d.ts +114 -114
  31. package/lib/esm/HyperModeling.js +236 -236
  32. package/lib/esm/HyperModelingConfig.d.ts +54 -54
  33. package/lib/esm/HyperModelingConfig.js +8 -8
  34. package/lib/esm/HyperModelingConfig.js.map +1 -1
  35. package/lib/esm/HyperModelingDecorator.d.ts +110 -110
  36. package/lib/esm/HyperModelingDecorator.js +333 -333
  37. package/lib/esm/HyperModelingDecorator.js.map +1 -1
  38. package/lib/esm/PopupToolbar.d.ts +24 -24
  39. package/lib/esm/PopupToolbar.js +53 -53
  40. package/lib/esm/PopupToolbar.js.map +1 -1
  41. package/lib/esm/SectionDrawingLocationState.d.ts +90 -90
  42. package/lib/esm/SectionDrawingLocationState.js +133 -133
  43. package/lib/esm/SectionDrawingLocationState.js.map +1 -1
  44. package/lib/esm/SectionGraphicsProvider.d.ts +13 -13
  45. package/lib/esm/SectionGraphicsProvider.js +269 -269
  46. package/lib/esm/SectionGraphicsProvider.js.map +1 -1
  47. package/lib/esm/SectionMarkerHandler.d.ts +52 -52
  48. package/lib/esm/SectionMarkerHandler.js +108 -108
  49. package/lib/esm/SectionMarkerHandler.js.map +1 -1
  50. package/lib/esm/SectionMarkers.d.ts +82 -82
  51. package/lib/esm/SectionMarkers.js +168 -168
  52. package/lib/esm/SectionMarkers.js.map +1 -1
  53. package/lib/esm/Tools.d.ts +5 -5
  54. package/lib/esm/Tools.js +166 -166
  55. package/lib/esm/hypermodeling-frontend.d.ts +13 -13
  56. package/lib/esm/hypermodeling-frontend.js +17 -17
  57. package/lib/esm/hypermodeling-frontend.js.map +1 -1
  58. package/lib/public/locales/en/HyperModeling.json +32 -32
  59. package/package.json +13 -13
@@ -1,138 +1,138 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module HyperModeling
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SectionDrawingLocationState = void 0;
11
- const core_common_1 = require("@itwin/core-common");
12
- const core_frontend_1 = require("@itwin/core-frontend");
13
- const core_geometry_1 = require("@itwin/core-geometry");
14
- const selectSectionDrawingLocationStatesECSql = `
15
- SELECT
16
- bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,
17
- bis.SectionDrawingLocation.Model.Id as sectionLocationModelId,
18
- bis.SectionDrawingLocation.SectionView.Id as sectionViewId,
19
- bis.SectionDrawingLocation.Category.Id as categoryId,
20
- bis.SectionDrawingLocation.Origin as origin,
21
- bis.SectionDrawingLocation.Yaw as yaw,
22
- bis.SectionDrawingLocation.Pitch as pitch,
23
- bis.SectionDrawingLocation.Roll as roll,
24
- bis.SectionDrawingLocation.BBoxLow as bboxLow,
25
- bis.SectionDrawingLocation.BBoxHigh as bboxHigh,
26
- bis.SectionDrawingLocation.UserLabel as userLabel,
27
-
28
- bis.SectionDrawing.SectionType as sectionType,
29
- json_extract(bis.SectionDrawing.jsonProperties, '$.drawingToSpatialTransform') as drawingToSpatialTransform,
30
- bis.SectionDrawing.SpatialView.Id as spatialViewId,
31
- json_extract(bis.SectionDrawing.jsonProperties, '$.sheetToSpatialTransform') as sheetToSpatialTransform,
32
- json_extract(bis.SectionDrawing.jsonProperties, '$.drawingBoundaryClip') as sheetClip,
33
-
34
- json_extract(bis.SpatialViewDefinition.jsonProperties, '$.viewDetails.clip') as clipJSON,
35
- bis.ViewAttachment.ECInstanceId as viewAttachmentId,
36
- bis.SheetViewDefinition.ECInstanceId as sheetViewId
37
- FROM bis.SectionDrawingLocation
38
- INNER JOIN bis.ViewDefinition2d on bis.SectionDrawingLocation.SectionView.Id = bis.ViewDefinition2d.ECInstanceId
39
- INNER JOIN bis.SectionDrawing on bis.ViewDefinition2d.BaseModel.Id = bis.SectionDrawing.ECInstanceId
40
- LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id
41
- LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id
42
- INNER JOIN bis.SpatialViewDefinition on bis.SpatialViewDefinition.ECInstanceId = bis.SectionDrawing.SpatialView.Id
43
- `;
44
- /** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.
45
- * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.
46
- * @public
47
- */
48
- class SectionDrawingLocationState {
49
- /** @internal */
50
- constructor(props, iModel) {
51
- var _a, _b;
52
- this.iModel = iModel;
53
- this.id = props.sectionLocationId;
54
- this.model = props.sectionLocationModelId;
55
- this.userLabel = props.userLabel;
56
- this.category = props.categoryId;
57
- this.sectionType = props.sectionType;
58
- this.drawingViewId = props.sectionViewId;
59
- this.spatialViewId = props.spatialViewId;
60
- this.drawingToSpatialTransform = core_geometry_1.Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
61
- const extractClip = (str) => {
62
- let clip;
63
- if (str) {
64
- try {
65
- clip = core_geometry_1.ClipVector.fromJSON(JSON.parse(str));
66
- }
67
- catch { }
68
- }
69
- return clip;
70
- };
71
- this.clip = (_a = extractClip(props.clipJSON)) !== null && _a !== void 0 ? _a : core_geometry_1.ClipVector.createEmpty();
72
- const placementProps = {
73
- origin: (_b = props.origin) !== null && _b !== void 0 ? _b : {},
74
- angles: {
75
- yaw: props.yaw,
76
- pitch: props.pitch,
77
- roll: props.roll,
78
- },
79
- placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
80
- };
81
- this.placement = core_common_1.Placement3d.fromJSON(placementProps);
82
- if (props.viewAttachmentId && props.sheetToSpatialTransform) {
83
- this.viewAttachment = {
84
- id: props.viewAttachmentId,
85
- transformToSpatial: core_geometry_1.Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
86
- clip: extractClip(props.sheetClip),
87
- viewId: props.sheetViewId,
88
- };
89
- }
90
- }
91
- /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
92
- async tryLoadDrawingView() {
93
- try {
94
- const view = await this.iModel.views.load(this.drawingViewId);
95
- if (view instanceof core_frontend_1.DrawingViewState)
96
- return view;
97
- }
98
- catch { }
99
- return undefined;
100
- }
101
- /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
102
- async tryLoadSpatialView() {
103
- try {
104
- const view = await this.iModel.views.load(this.spatialViewId);
105
- if (view instanceof core_frontend_1.SpatialViewState)
106
- return view;
107
- }
108
- catch { }
109
- return undefined;
110
- }
111
- /** Return a promise that resolves to the [SheetViewState]($frontend) corresponding to `this.viewAttachment.viewId`; or undefined if there is no corresponding [ViewAttachment]($backend) or an exception occurs. */
112
- async tryLoadSheetView() {
113
- if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
114
- return undefined;
115
- try {
116
- const view = await this.iModel.views.load(this.viewAttachment.viewId);
117
- if (view instanceof core_frontend_1.SheetViewState)
118
- return view;
119
- }
120
- catch { }
121
- return undefined;
122
- }
123
- /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
124
- static async queryAll(iModel) {
125
- const states = [];
126
- try {
127
- // eslint-disable-next-line deprecation/deprecation
128
- for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
129
- states.push(new SectionDrawingLocationState(row, iModel));
130
- }
131
- catch {
132
- // If the iModel contains a version of BisCore schema older than 1.12.0, the query will produce an exception due to missing SectionDrawingLocation class. That's fine.
133
- }
134
- return states;
135
- }
136
- }
137
- exports.SectionDrawingLocationState = SectionDrawingLocationState;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module HyperModeling
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SectionDrawingLocationState = void 0;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const core_frontend_1 = require("@itwin/core-frontend");
13
+ const core_geometry_1 = require("@itwin/core-geometry");
14
+ const selectSectionDrawingLocationStatesECSql = `
15
+ SELECT
16
+ bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,
17
+ bis.SectionDrawingLocation.Model.Id as sectionLocationModelId,
18
+ bis.SectionDrawingLocation.SectionView.Id as sectionViewId,
19
+ bis.SectionDrawingLocation.Category.Id as categoryId,
20
+ bis.SectionDrawingLocation.Origin as origin,
21
+ bis.SectionDrawingLocation.Yaw as yaw,
22
+ bis.SectionDrawingLocation.Pitch as pitch,
23
+ bis.SectionDrawingLocation.Roll as roll,
24
+ bis.SectionDrawingLocation.BBoxLow as bboxLow,
25
+ bis.SectionDrawingLocation.BBoxHigh as bboxHigh,
26
+ bis.SectionDrawingLocation.UserLabel as userLabel,
27
+
28
+ bis.SectionDrawing.SectionType as sectionType,
29
+ json_extract(bis.SectionDrawing.jsonProperties, '$.drawingToSpatialTransform') as drawingToSpatialTransform,
30
+ bis.SectionDrawing.SpatialView.Id as spatialViewId,
31
+ json_extract(bis.SectionDrawing.jsonProperties, '$.sheetToSpatialTransform') as sheetToSpatialTransform,
32
+ json_extract(bis.SectionDrawing.jsonProperties, '$.drawingBoundaryClip') as sheetClip,
33
+
34
+ json_extract(bis.SpatialViewDefinition.jsonProperties, '$.viewDetails.clip') as clipJSON,
35
+ bis.ViewAttachment.ECInstanceId as viewAttachmentId,
36
+ bis.SheetViewDefinition.ECInstanceId as sheetViewId
37
+ FROM bis.SectionDrawingLocation
38
+ INNER JOIN bis.ViewDefinition2d on bis.SectionDrawingLocation.SectionView.Id = bis.ViewDefinition2d.ECInstanceId
39
+ INNER JOIN bis.SectionDrawing on bis.ViewDefinition2d.BaseModel.Id = bis.SectionDrawing.ECInstanceId
40
+ LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id
41
+ LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id
42
+ INNER JOIN bis.SpatialViewDefinition on bis.SpatialViewDefinition.ECInstanceId = bis.SectionDrawing.SpatialView.Id
43
+ `;
44
+ /** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.
45
+ * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.
46
+ * @public
47
+ */
48
+ class SectionDrawingLocationState {
49
+ /** @internal */
50
+ constructor(props, iModel) {
51
+ var _a, _b;
52
+ this.iModel = iModel;
53
+ this.id = props.sectionLocationId;
54
+ this.model = props.sectionLocationModelId;
55
+ this.userLabel = props.userLabel;
56
+ this.category = props.categoryId;
57
+ this.sectionType = props.sectionType;
58
+ this.drawingViewId = props.sectionViewId;
59
+ this.spatialViewId = props.spatialViewId;
60
+ this.drawingToSpatialTransform = core_geometry_1.Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
61
+ const extractClip = (str) => {
62
+ let clip;
63
+ if (str) {
64
+ try {
65
+ clip = core_geometry_1.ClipVector.fromJSON(JSON.parse(str));
66
+ }
67
+ catch { }
68
+ }
69
+ return clip;
70
+ };
71
+ this.clip = (_a = extractClip(props.clipJSON)) !== null && _a !== void 0 ? _a : core_geometry_1.ClipVector.createEmpty();
72
+ const placementProps = {
73
+ origin: (_b = props.origin) !== null && _b !== void 0 ? _b : {},
74
+ angles: {
75
+ yaw: props.yaw,
76
+ pitch: props.pitch,
77
+ roll: props.roll,
78
+ },
79
+ placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
80
+ };
81
+ this.placement = core_common_1.Placement3d.fromJSON(placementProps);
82
+ if (props.viewAttachmentId && props.sheetToSpatialTransform) {
83
+ this.viewAttachment = {
84
+ id: props.viewAttachmentId,
85
+ transformToSpatial: core_geometry_1.Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
86
+ clip: extractClip(props.sheetClip),
87
+ viewId: props.sheetViewId,
88
+ };
89
+ }
90
+ }
91
+ /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
92
+ async tryLoadDrawingView() {
93
+ try {
94
+ const view = await this.iModel.views.load(this.drawingViewId);
95
+ if (view instanceof core_frontend_1.DrawingViewState)
96
+ return view;
97
+ }
98
+ catch { }
99
+ return undefined;
100
+ }
101
+ /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
102
+ async tryLoadSpatialView() {
103
+ try {
104
+ const view = await this.iModel.views.load(this.spatialViewId);
105
+ if (view instanceof core_frontend_1.SpatialViewState)
106
+ return view;
107
+ }
108
+ catch { }
109
+ return undefined;
110
+ }
111
+ /** Return a promise that resolves to the [SheetViewState]($frontend) corresponding to `this.viewAttachment.viewId`; or undefined if there is no corresponding [ViewAttachment]($backend) or an exception occurs. */
112
+ async tryLoadSheetView() {
113
+ if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
114
+ return undefined;
115
+ try {
116
+ const view = await this.iModel.views.load(this.viewAttachment.viewId);
117
+ if (view instanceof core_frontend_1.SheetViewState)
118
+ return view;
119
+ }
120
+ catch { }
121
+ return undefined;
122
+ }
123
+ /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
124
+ static async queryAll(iModel) {
125
+ const states = [];
126
+ try {
127
+ // eslint-disable-next-line deprecation/deprecation
128
+ for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
129
+ states.push(new SectionDrawingLocationState(row, iModel));
130
+ }
131
+ catch {
132
+ // If the iModel contains a version of BisCore schema older than 1.12.0, the query will produce an exception due to missing SectionDrawingLocation class. That's fine.
133
+ }
134
+ return states;
135
+ }
136
+ }
137
+ exports.SectionDrawingLocationState = SectionDrawingLocationState;
138
138
  //# sourceMappingURL=SectionDrawingLocationState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionDrawingLocationState.js","sourceRoot":"","sources":["../../src/SectionDrawingLocationState.ts"],"names":[],"mappings":"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","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 HyperModeling\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Placement3d, QueryRowFormat, SectionType } from \"@itwin/core-common\";\nimport { DrawingViewState, IModelConnection, SheetViewState, SpatialViewState } from \"@itwin/core-frontend\";\nimport { ClipVector, Transform, XYZProps } from \"@itwin/core-geometry\";\n\nconst selectSectionDrawingLocationStatesECSql = `\n SELECT\n bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,\n bis.SectionDrawingLocation.Model.Id as sectionLocationModelId,\n bis.SectionDrawingLocation.SectionView.Id as sectionViewId,\n bis.SectionDrawingLocation.Category.Id as categoryId,\n bis.SectionDrawingLocation.Origin as origin,\n bis.SectionDrawingLocation.Yaw as yaw,\n bis.SectionDrawingLocation.Pitch as pitch,\n bis.SectionDrawingLocation.Roll as roll,\n bis.SectionDrawingLocation.BBoxLow as bboxLow,\n bis.SectionDrawingLocation.BBoxHigh as bboxHigh,\n bis.SectionDrawingLocation.UserLabel as userLabel,\n\n bis.SectionDrawing.SectionType as sectionType,\n json_extract(bis.SectionDrawing.jsonProperties, '$.drawingToSpatialTransform') as drawingToSpatialTransform,\n bis.SectionDrawing.SpatialView.Id as spatialViewId,\n json_extract(bis.SectionDrawing.jsonProperties, '$.sheetToSpatialTransform') as sheetToSpatialTransform,\n json_extract(bis.SectionDrawing.jsonProperties, '$.drawingBoundaryClip') as sheetClip,\n\n json_extract(bis.SpatialViewDefinition.jsonProperties, '$.viewDetails.clip') as clipJSON,\n bis.ViewAttachment.ECInstanceId as viewAttachmentId,\n bis.SheetViewDefinition.ECInstanceId as sheetViewId\n FROM bis.SectionDrawingLocation\n INNER JOIN bis.ViewDefinition2d on bis.SectionDrawingLocation.SectionView.Id = bis.ViewDefinition2d.ECInstanceId\n INNER JOIN bis.SectionDrawing on bis.ViewDefinition2d.BaseModel.Id = bis.SectionDrawing.ECInstanceId\n LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id\n LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id\n INNER JOIN bis.SpatialViewDefinition on bis.SpatialViewDefinition.ECInstanceId = bis.SectionDrawing.SpatialView.Id\n`;\n\n/** Raw data representing a [[SectionDrawingLocationState]]. This is an amalgamation of data from several related ECClasses.\n * @internal\n */\nexport interface SectionDrawingLocationStateData {\n sectionType: SectionType;\n drawingToSpatialTransform: string; // stringified TransformProps\n spatialViewId: Id64String;\n clipJSON?: string; // stringified ClipVector json\n viewAttachmentId?: Id64String;\n sheetToSpatialTransform?: string; // stringified TransformProps\n sheetClip?: string; // stringified ClipVector json\n sheetViewId?: Id64String;\n\n sectionLocationId: Id64String;\n sectionLocationModelId: Id64String;\n sectionViewId: Id64String;\n categoryId: Id64String;\n origin?: XYZProps;\n yaw?: number;\n pitch?: number;\n roll?: number;\n bboxLow?: XYZProps;\n bboxHigh?: XYZProps;\n userLabel: string;\n}\n\n/** Represents a [ViewAttachment]($backend) that attaches a [[SectionDrawingLocationState]] to a [Sheet]($backend) model.\n * @public\n */\nexport interface SectionViewAttachment {\n /** The view attachment's element Id. */\n readonly id: Id64String;\n /** The Id of a [SheetViewDefinition]($backend) that displays this view attachment.\n * This is used when navigating from the spatial view to the view attachment.\n */\n readonly viewId?: Id64String;\n /** The transform from the [Sheet]($backend) coordinate space to the spatial coordinate space. */\n readonly transformToSpatial: Transform;\n /** Optional 2d clip vector used to clip out portions of the [Sheet]($backend) containing annotations not relevant to this section drawing. */\n readonly clip?: ClipVector;\n}\n\n/** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.\n * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.\n * @public\n */\nexport class SectionDrawingLocationState {\n /** The iModel in which this section drawing location resides. */\n public readonly iModel: IModelConnection;\n /** The element Id of the section drawing location. */\n public readonly id: Id64String;\n /** The Id of the [GeometricModel3d]($backend) in which this section drawing location resides. */\n public readonly model: Id64String;\n /** A user-friendly label for the section drawing location. */\n public readonly userLabel: string;\n /** The Id of the [SpatialCategory]($backend) to which this section drawing location belongs. */\n public readonly category: Id64String;\n /** The section drawing location's spatial placement. */\n public readonly placement: Placement3d;\n /** The type of section that generated the associated [SectionDrawing]($backend). */\n public readonly sectionType: SectionType;\n /** The Id of the [ViewDefinition]($backend) that can display the section graphics. */\n public readonly drawingViewId: Id64String;\n /** The Id of the [SpatialViewDefinition]($backend) from which the section drawing was generated. */\n public readonly spatialViewId: Id64String;\n /** The section clip from the [SpatialViewDefinition]($backend) from which the section drawing was generated. */\n public readonly clip: ClipVector;\n /** The transform from the [GeometricModel]($backend) containing the section graphics to the spatial coordinate space.\n * This is used to position the 2d graphics in the context of a spatial view.\n */\n public readonly drawingToSpatialTransform: Transform;\n /** If the section drawing is attached to a [Sheet]($backend), details about the corresponding [ViewAttachment]($backend).\n * When this section drawing location is displayed in a spatial context, annotations in the sheet model can be displayed along with the section graphics.\n */\n public readonly viewAttachment?: SectionViewAttachment;\n\n /** @internal */\n public constructor(props: SectionDrawingLocationStateData, iModel: IModelConnection) {\n this.iModel = iModel;\n this.id = props.sectionLocationId;\n this.model = props.sectionLocationModelId;\n this.userLabel = props.userLabel;\n this.category = props.categoryId;\n this.sectionType = props.sectionType;\n this.drawingViewId = props.sectionViewId;\n this.spatialViewId = props.spatialViewId;\n this.drawingToSpatialTransform = Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));\n\n const extractClip = (str: string | undefined) => {\n let clip;\n if (str) {\n try {\n clip = ClipVector.fromJSON(JSON.parse(str));\n } catch { }\n }\n\n return clip;\n };\n\n this.clip = extractClip(props.clipJSON) ?? ClipVector.createEmpty();\n\n const placementProps = {\n origin: props.origin ?? {},\n angles: {\n yaw: props.yaw,\n pitch: props.pitch,\n roll: props.roll,\n },\n placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,\n };\n this.placement = Placement3d.fromJSON(placementProps);\n\n if (props.viewAttachmentId && props.sheetToSpatialTransform) {\n this.viewAttachment = {\n id: props.viewAttachmentId,\n transformToSpatial: Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),\n clip: extractClip(props.sheetClip),\n viewId: props.sheetViewId,\n };\n }\n }\n\n /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */\n public async tryLoadDrawingView(): Promise<DrawingViewState | undefined> {\n try {\n const view = await this.iModel.views.load(this.drawingViewId);\n if (view instanceof DrawingViewState)\n return view;\n } catch { }\n\n return undefined;\n }\n\n /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */\n public async tryLoadSpatialView(): Promise<SpatialViewState | undefined> {\n try {\n const view = await this.iModel.views.load(this.spatialViewId);\n if (view instanceof SpatialViewState)\n return view;\n } catch { }\n\n return undefined;\n }\n\n /** Return a promise that resolves to the [SheetViewState]($frontend) corresponding to `this.viewAttachment.viewId`; or undefined if there is no corresponding [ViewAttachment]($backend) or an exception occurs. */\n public async tryLoadSheetView(): Promise<SheetViewState | undefined> {\n if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)\n return undefined;\n\n try {\n const view = await this.iModel.views.load(this.viewAttachment.viewId);\n if (view instanceof SheetViewState)\n return view;\n } catch { }\n\n return undefined;\n }\n\n /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */\n public static async queryAll(iModel: IModelConnection): Promise<SectionDrawingLocationState[]> {\n const states: SectionDrawingLocationState[] = [];\n try {\n // eslint-disable-next-line deprecation/deprecation\n for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\n states.push(new SectionDrawingLocationState(row as SectionDrawingLocationStateData, iModel));\n } catch {\n // If the iModel contains a version of BisCore schema older than 1.12.0, the query will produce an exception due to missing SectionDrawingLocation class. That's fine.\n }\n\n return states;\n }\n}\n"]}
1
+ {"version":3,"file":"SectionDrawingLocationState.js","sourceRoot":"","sources":["../../src/SectionDrawingLocationState.ts"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Placement3d, QueryRowFormat, SectionType } from \"@itwin/core-common\";\r\nimport { DrawingViewState, IModelConnection, SheetViewState, SpatialViewState } from \"@itwin/core-frontend\";\r\nimport { ClipVector, Transform, XYZProps } from \"@itwin/core-geometry\";\r\n\r\nconst selectSectionDrawingLocationStatesECSql = `\r\n SELECT\r\n bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,\r\n bis.SectionDrawingLocation.Model.Id as sectionLocationModelId,\r\n bis.SectionDrawingLocation.SectionView.Id as sectionViewId,\r\n bis.SectionDrawingLocation.Category.Id as categoryId,\r\n bis.SectionDrawingLocation.Origin as origin,\r\n bis.SectionDrawingLocation.Yaw as yaw,\r\n bis.SectionDrawingLocation.Pitch as pitch,\r\n bis.SectionDrawingLocation.Roll as roll,\r\n bis.SectionDrawingLocation.BBoxLow as bboxLow,\r\n bis.SectionDrawingLocation.BBoxHigh as bboxHigh,\r\n bis.SectionDrawingLocation.UserLabel as userLabel,\r\n\r\n bis.SectionDrawing.SectionType as sectionType,\r\n json_extract(bis.SectionDrawing.jsonProperties, '$.drawingToSpatialTransform') as drawingToSpatialTransform,\r\n bis.SectionDrawing.SpatialView.Id as spatialViewId,\r\n json_extract(bis.SectionDrawing.jsonProperties, '$.sheetToSpatialTransform') as sheetToSpatialTransform,\r\n json_extract(bis.SectionDrawing.jsonProperties, '$.drawingBoundaryClip') as sheetClip,\r\n\r\n json_extract(bis.SpatialViewDefinition.jsonProperties, '$.viewDetails.clip') as clipJSON,\r\n bis.ViewAttachment.ECInstanceId as viewAttachmentId,\r\n bis.SheetViewDefinition.ECInstanceId as sheetViewId\r\n FROM bis.SectionDrawingLocation\r\n INNER JOIN bis.ViewDefinition2d on bis.SectionDrawingLocation.SectionView.Id = bis.ViewDefinition2d.ECInstanceId\r\n INNER JOIN bis.SectionDrawing on bis.ViewDefinition2d.BaseModel.Id = bis.SectionDrawing.ECInstanceId\r\n LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id\r\n LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id\r\n INNER JOIN bis.SpatialViewDefinition on bis.SpatialViewDefinition.ECInstanceId = bis.SectionDrawing.SpatialView.Id\r\n`;\r\n\r\n/** Raw data representing a [[SectionDrawingLocationState]]. This is an amalgamation of data from several related ECClasses.\r\n * @internal\r\n */\r\nexport interface SectionDrawingLocationStateData {\r\n sectionType: SectionType;\r\n drawingToSpatialTransform: string; // stringified TransformProps\r\n spatialViewId: Id64String;\r\n clipJSON?: string; // stringified ClipVector json\r\n viewAttachmentId?: Id64String;\r\n sheetToSpatialTransform?: string; // stringified TransformProps\r\n sheetClip?: string; // stringified ClipVector json\r\n sheetViewId?: Id64String;\r\n\r\n sectionLocationId: Id64String;\r\n sectionLocationModelId: Id64String;\r\n sectionViewId: Id64String;\r\n categoryId: Id64String;\r\n origin?: XYZProps;\r\n yaw?: number;\r\n pitch?: number;\r\n roll?: number;\r\n bboxLow?: XYZProps;\r\n bboxHigh?: XYZProps;\r\n userLabel: string;\r\n}\r\n\r\n/** Represents a [ViewAttachment]($backend) that attaches a [[SectionDrawingLocationState]] to a [Sheet]($backend) model.\r\n * @public\r\n */\r\nexport interface SectionViewAttachment {\r\n /** The view attachment's element Id. */\r\n readonly id: Id64String;\r\n /** The Id of a [SheetViewDefinition]($backend) that displays this view attachment.\r\n * This is used when navigating from the spatial view to the view attachment.\r\n */\r\n readonly viewId?: Id64String;\r\n /** The transform from the [Sheet]($backend) coordinate space to the spatial coordinate space. */\r\n readonly transformToSpatial: Transform;\r\n /** Optional 2d clip vector used to clip out portions of the [Sheet]($backend) containing annotations not relevant to this section drawing. */\r\n readonly clip?: ClipVector;\r\n}\r\n\r\n/** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.\r\n * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.\r\n * @public\r\n */\r\nexport class SectionDrawingLocationState {\r\n /** The iModel in which this section drawing location resides. */\r\n public readonly iModel: IModelConnection;\r\n /** The element Id of the section drawing location. */\r\n public readonly id: Id64String;\r\n /** The Id of the [GeometricModel3d]($backend) in which this section drawing location resides. */\r\n public readonly model: Id64String;\r\n /** A user-friendly label for the section drawing location. */\r\n public readonly userLabel: string;\r\n /** The Id of the [SpatialCategory]($backend) to which this section drawing location belongs. */\r\n public readonly category: Id64String;\r\n /** The section drawing location's spatial placement. */\r\n public readonly placement: Placement3d;\r\n /** The type of section that generated the associated [SectionDrawing]($backend). */\r\n public readonly sectionType: SectionType;\r\n /** The Id of the [ViewDefinition]($backend) that can display the section graphics. */\r\n public readonly drawingViewId: Id64String;\r\n /** The Id of the [SpatialViewDefinition]($backend) from which the section drawing was generated. */\r\n public readonly spatialViewId: Id64String;\r\n /** The section clip from the [SpatialViewDefinition]($backend) from which the section drawing was generated. */\r\n public readonly clip: ClipVector;\r\n /** The transform from the [GeometricModel]($backend) containing the section graphics to the spatial coordinate space.\r\n * This is used to position the 2d graphics in the context of a spatial view.\r\n */\r\n public readonly drawingToSpatialTransform: Transform;\r\n /** If the section drawing is attached to a [Sheet]($backend), details about the corresponding [ViewAttachment]($backend).\r\n * When this section drawing location is displayed in a spatial context, annotations in the sheet model can be displayed along with the section graphics.\r\n */\r\n public readonly viewAttachment?: SectionViewAttachment;\r\n\r\n /** @internal */\r\n public constructor(props: SectionDrawingLocationStateData, iModel: IModelConnection) {\r\n this.iModel = iModel;\r\n this.id = props.sectionLocationId;\r\n this.model = props.sectionLocationModelId;\r\n this.userLabel = props.userLabel;\r\n this.category = props.categoryId;\r\n this.sectionType = props.sectionType;\r\n this.drawingViewId = props.sectionViewId;\r\n this.spatialViewId = props.spatialViewId;\r\n this.drawingToSpatialTransform = Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));\r\n\r\n const extractClip = (str: string | undefined) => {\r\n let clip;\r\n if (str) {\r\n try {\r\n clip = ClipVector.fromJSON(JSON.parse(str));\r\n } catch { }\r\n }\r\n\r\n return clip;\r\n };\r\n\r\n this.clip = extractClip(props.clipJSON) ?? ClipVector.createEmpty();\r\n\r\n const placementProps = {\r\n origin: props.origin ?? {},\r\n angles: {\r\n yaw: props.yaw,\r\n pitch: props.pitch,\r\n roll: props.roll,\r\n },\r\n placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,\r\n };\r\n this.placement = Placement3d.fromJSON(placementProps);\r\n\r\n if (props.viewAttachmentId && props.sheetToSpatialTransform) {\r\n this.viewAttachment = {\r\n id: props.viewAttachmentId,\r\n transformToSpatial: Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),\r\n clip: extractClip(props.sheetClip),\r\n viewId: props.sheetViewId,\r\n };\r\n }\r\n }\r\n\r\n /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */\r\n public async tryLoadDrawingView(): Promise<DrawingViewState | undefined> {\r\n try {\r\n const view = await this.iModel.views.load(this.drawingViewId);\r\n if (view instanceof DrawingViewState)\r\n return view;\r\n } catch { }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */\r\n public async tryLoadSpatialView(): Promise<SpatialViewState | undefined> {\r\n try {\r\n const view = await this.iModel.views.load(this.spatialViewId);\r\n if (view instanceof SpatialViewState)\r\n return view;\r\n } catch { }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Return a promise that resolves to the [SheetViewState]($frontend) corresponding to `this.viewAttachment.viewId`; or undefined if there is no corresponding [ViewAttachment]($backend) or an exception occurs. */\r\n public async tryLoadSheetView(): Promise<SheetViewState | undefined> {\r\n if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)\r\n return undefined;\r\n\r\n try {\r\n const view = await this.iModel.views.load(this.viewAttachment.viewId);\r\n if (view instanceof SheetViewState)\r\n return view;\r\n } catch { }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */\r\n public static async queryAll(iModel: IModelConnection): Promise<SectionDrawingLocationState[]> {\r\n const states: SectionDrawingLocationState[] = [];\r\n try {\r\n // eslint-disable-next-line deprecation/deprecation\r\n for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\r\n states.push(new SectionDrawingLocationState(row as SectionDrawingLocationStateData, iModel));\r\n } catch {\r\n // If the iModel contains a version of BisCore schema older than 1.12.0, the query will produce an exception due to missing SectionDrawingLocation class. That's fine.\r\n }\r\n\r\n return states;\r\n }\r\n}\r\n"]}
@@ -1,14 +1,14 @@
1
- /** @packageDocumentation
2
- * @module HyperModeling
3
- */
4
- import { TiledGraphicsProvider } from "@itwin/core-frontend";
5
- import { SectionDrawingLocationState } from "./SectionDrawingLocationState";
6
- /** Creates a TiledGraphicsProvider that can be associated with a [Viewport]($frontend) to display 2d section graphics and annotations in the context of a [SpatialViewState]($frontend).
7
- * Typically used indirectly via [[HyperModelingDecorator]].
8
- * @param state The section drawing location specifying which section drawing to display.
9
- * @returns A provider suitable for passing to [Viewport.addTiledGraphicsProvider]($frontend).
10
- * @see [[HyperModelingDecorator.toggleAttachment]] to activate section graphics for a given [[SectionMarker]].
11
- * @public
12
- */
13
- export declare function createSectionGraphicsProvider(state: SectionDrawingLocationState): Promise<TiledGraphicsProvider>;
1
+ /** @packageDocumentation
2
+ * @module HyperModeling
3
+ */
4
+ import { TiledGraphicsProvider } from "@itwin/core-frontend";
5
+ import { SectionDrawingLocationState } from "./SectionDrawingLocationState";
6
+ /** Creates a TiledGraphicsProvider that can be associated with a [Viewport]($frontend) to display 2d section graphics and annotations in the context of a [SpatialViewState]($frontend).
7
+ * Typically used indirectly via [[HyperModelingDecorator]].
8
+ * @param state The section drawing location specifying which section drawing to display.
9
+ * @returns A provider suitable for passing to [Viewport.addTiledGraphicsProvider]($frontend).
10
+ * @see [[HyperModelingDecorator.toggleAttachment]] to activate section graphics for a given [[SectionMarker]].
11
+ * @public
12
+ */
13
+ export declare function createSectionGraphicsProvider(state: SectionDrawingLocationState): Promise<TiledGraphicsProvider>;
14
14
  //# sourceMappingURL=SectionGraphicsProvider.d.ts.map