@itwin/hypermodeling-frontend 4.0.0-dev.7 → 4.0.0-dev.72

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 (61) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/lib/cjs/HyperModeling.d.ts +114 -114
  3. package/lib/cjs/HyperModeling.d.ts.map +1 -1
  4. package/lib/cjs/HyperModeling.js +238 -239
  5. package/lib/cjs/HyperModeling.js.map +1 -1
  6. package/lib/cjs/HyperModelingConfig.d.ts +54 -54
  7. package/lib/cjs/HyperModelingConfig.js +9 -9
  8. package/lib/cjs/HyperModelingDecorator.d.ts +110 -110
  9. package/lib/cjs/HyperModelingDecorator.js +335 -337
  10. package/lib/cjs/HyperModelingDecorator.js.map +1 -1
  11. package/lib/cjs/PopupToolbar.d.ts +24 -24
  12. package/lib/cjs/PopupToolbar.js +57 -57
  13. package/lib/cjs/PopupToolbar.js.map +1 -1
  14. package/lib/cjs/SectionDrawingLocationState.d.ts +90 -90
  15. package/lib/cjs/SectionDrawingLocationState.d.ts.map +1 -1
  16. package/lib/cjs/SectionDrawingLocationState.js +107 -107
  17. package/lib/cjs/SectionDrawingLocationState.js.map +1 -1
  18. package/lib/cjs/SectionGraphicsProvider.d.ts +13 -13
  19. package/lib/cjs/SectionGraphicsProvider.js +272 -273
  20. package/lib/cjs/SectionGraphicsProvider.js.map +1 -1
  21. package/lib/cjs/SectionMarkerHandler.d.ts +52 -52
  22. package/lib/cjs/SectionMarkerHandler.js +111 -112
  23. package/lib/cjs/SectionMarkerHandler.js.map +1 -1
  24. package/lib/cjs/SectionMarkers.d.ts +82 -82
  25. package/lib/cjs/SectionMarkers.js +174 -174
  26. package/lib/cjs/Tools.d.ts +5 -5
  27. package/lib/cjs/Tools.js +170 -170
  28. package/lib/cjs/Tools.js.map +1 -1
  29. package/lib/cjs/hypermodeling-frontend.d.ts +13 -13
  30. package/lib/cjs/hypermodeling-frontend.js +33 -29
  31. package/lib/cjs/hypermodeling-frontend.js.map +1 -1
  32. package/lib/esm/HyperModeling.d.ts +114 -114
  33. package/lib/esm/HyperModeling.d.ts.map +1 -1
  34. package/lib/esm/HyperModeling.js +235 -235
  35. package/lib/esm/HyperModeling.js.map +1 -1
  36. package/lib/esm/HyperModelingConfig.d.ts +54 -54
  37. package/lib/esm/HyperModelingConfig.js +8 -8
  38. package/lib/esm/HyperModelingDecorator.d.ts +110 -110
  39. package/lib/esm/HyperModelingDecorator.js +331 -333
  40. package/lib/esm/HyperModelingDecorator.js.map +1 -1
  41. package/lib/esm/PopupToolbar.d.ts +24 -24
  42. package/lib/esm/PopupToolbar.js +54 -53
  43. package/lib/esm/PopupToolbar.js.map +1 -1
  44. package/lib/esm/SectionDrawingLocationState.d.ts +90 -90
  45. package/lib/esm/SectionDrawingLocationState.d.ts.map +1 -1
  46. package/lib/esm/SectionDrawingLocationState.js +103 -103
  47. package/lib/esm/SectionDrawingLocationState.js.map +1 -1
  48. package/lib/esm/SectionGraphicsProvider.d.ts +13 -13
  49. package/lib/esm/SectionGraphicsProvider.js +268 -269
  50. package/lib/esm/SectionGraphicsProvider.js.map +1 -1
  51. package/lib/esm/SectionMarkerHandler.d.ts +52 -52
  52. package/lib/esm/SectionMarkerHandler.js +107 -108
  53. package/lib/esm/SectionMarkerHandler.js.map +1 -1
  54. package/lib/esm/SectionMarkers.d.ts +82 -82
  55. package/lib/esm/SectionMarkers.js +168 -168
  56. package/lib/esm/Tools.d.ts +5 -5
  57. package/lib/esm/Tools.js +166 -166
  58. package/lib/esm/Tools.js.map +1 -1
  59. package/lib/esm/hypermodeling-frontend.d.ts +13 -13
  60. package/lib/esm/hypermodeling-frontend.js +17 -17
  61. package/package.json +20 -20
@@ -1,16 +1,16 @@
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");
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
14
  const selectSectionDrawingLocationStatesECSql = `
15
15
  SELECT
16
16
  bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,
@@ -40,98 +40,98 @@ const selectSectionDrawingLocationStatesECSql = `
40
40
  LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id
41
41
  LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id
42
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
- for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
128
- states.push(new SectionDrawingLocationState(row, iModel));
129
- }
130
- catch {
131
- // 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.
132
- }
133
- return states;
134
- }
135
- }
136
- exports.SectionDrawingLocationState = SectionDrawingLocationState;
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
+ this.iModel = iModel;
52
+ this.id = props.sectionLocationId;
53
+ this.model = props.sectionLocationModelId;
54
+ this.userLabel = props.userLabel;
55
+ this.category = props.categoryId;
56
+ this.sectionType = props.sectionType;
57
+ this.drawingViewId = props.sectionViewId;
58
+ this.spatialViewId = props.spatialViewId;
59
+ this.drawingToSpatialTransform = core_geometry_1.Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
60
+ const extractClip = (str) => {
61
+ let clip;
62
+ if (str) {
63
+ try {
64
+ clip = core_geometry_1.ClipVector.fromJSON(JSON.parse(str));
65
+ }
66
+ catch { }
67
+ }
68
+ return clip;
69
+ };
70
+ this.clip = extractClip(props.clipJSON) ?? core_geometry_1.ClipVector.createEmpty();
71
+ const placementProps = {
72
+ origin: props.origin ?? {},
73
+ angles: {
74
+ yaw: props.yaw,
75
+ pitch: props.pitch,
76
+ roll: props.roll,
77
+ },
78
+ placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
79
+ };
80
+ this.placement = core_common_1.Placement3d.fromJSON(placementProps);
81
+ if (props.viewAttachmentId && props.sheetToSpatialTransform) {
82
+ this.viewAttachment = {
83
+ id: props.viewAttachmentId,
84
+ transformToSpatial: core_geometry_1.Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
85
+ clip: extractClip(props.sheetClip),
86
+ viewId: props.sheetViewId,
87
+ };
88
+ }
89
+ }
90
+ /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
91
+ async tryLoadDrawingView() {
92
+ try {
93
+ const view = await this.iModel.views.load(this.drawingViewId);
94
+ if (view instanceof core_frontend_1.DrawingViewState)
95
+ return view;
96
+ }
97
+ catch { }
98
+ return undefined;
99
+ }
100
+ /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
101
+ async tryLoadSpatialView() {
102
+ try {
103
+ const view = await this.iModel.views.load(this.spatialViewId);
104
+ if (view instanceof core_frontend_1.SpatialViewState)
105
+ return view;
106
+ }
107
+ catch { }
108
+ return undefined;
109
+ }
110
+ /** 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. */
111
+ async tryLoadSheetView() {
112
+ if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
113
+ return undefined;
114
+ try {
115
+ const view = await this.iModel.views.load(this.viewAttachment.viewId);
116
+ if (view instanceof core_frontend_1.SheetViewState)
117
+ return view;
118
+ }
119
+ catch { }
120
+ return undefined;
121
+ }
122
+ /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
123
+ static async queryAll(iModel) {
124
+ const states = [];
125
+ try {
126
+ // eslint-disable-next-line deprecation/deprecation
127
+ for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
128
+ states.push(new SectionDrawingLocationState(row, iModel));
129
+ }
130
+ catch {
131
+ // 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.
132
+ }
133
+ return states;
134
+ }
135
+ }
136
+ exports.SectionDrawingLocationState = SectionDrawingLocationState;
137
137
  //# sourceMappingURL=SectionDrawingLocationState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionDrawingLocationState.js","sourceRoot":"","sources":["../../src/SectionDrawingLocationState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAA8E;AAC9E,wDAA4G;AAC5G,wDAAuE;AAEvE,MAAM,uCAAuC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B/C,CAAC;AA4CF;;;GAGG;AACH,MAAa,2BAA2B;IA8BtC,gBAAgB;IAChB,YAAmB,KAAsC,EAAE,MAAwB;;QACjF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,iBAAiB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,sBAAsB,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,yBAAyB,GAAG,yBAAS,CAAC,QAAQ,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AuC,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC;gBACxI,MAAM,CAAC,IAAI,CAAC,IAAI,2BAA2B,CAAC,GAAsC,EAAE,MAAM,CAAC,CAAC,CAAC;SAChG;QAAC,MAAM;YACN,sKAAsK;SACvK;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5HD,kEA4HC","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 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
+ {"version":3,"file":"SectionDrawingLocationState.js","sourceRoot":"","sources":["../../src/SectionDrawingLocationState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAA8E;AAC9E,wDAA4G;AAC5G,wDAAuE;AAEvE,MAAM,uCAAuC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B/C,CAAC;AA4CF;;;GAGG;AACH,MAAa,2BAA2B;IA8BtC,gBAAgB;IAChB,YAAmB,KAAsC,EAAE,MAAwB;QACjF,IAAI,CAAC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E,OAAO,SAAS,CAAC;QAEnB,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACtE,IAAI,IAAI,YAAY,8BAAc;gBAChC,OAAO,IAAI,CAAC;SACf;QAAC,MAAM,GAAG;QAEX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,8IAA8I;IACvI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAwB;QACnD,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,IAAI;YACF,mDAAmD;YACnD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC;gBACxI,MAAM,CAAC,IAAI,CAAC,IAAI,2BAA2B,CAAC,GAAsC,EAAE,MAAM,CAAC,CAAC,CAAC;SAChG;QAAC,MAAM;YACN,sKAAsK;SACvK;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA7HD,kEA6HC","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