@itwin/hypermodeling-frontend 4.0.0-dev.52 → 4.0.0-dev.55

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 (48) hide show
  1. package/lib/cjs/HyperModeling.d.ts +114 -114
  2. package/lib/cjs/HyperModeling.js +238 -238
  3. package/lib/cjs/HyperModeling.js.map +1 -1
  4. package/lib/cjs/HyperModelingConfig.d.ts +54 -54
  5. package/lib/cjs/HyperModelingConfig.js +9 -9
  6. package/lib/cjs/HyperModelingDecorator.d.ts +110 -110
  7. package/lib/cjs/HyperModelingDecorator.js +335 -335
  8. package/lib/cjs/HyperModelingDecorator.js.map +1 -1
  9. package/lib/cjs/PopupToolbar.d.ts +24 -24
  10. package/lib/cjs/PopupToolbar.js +57 -57
  11. package/lib/cjs/PopupToolbar.js.map +1 -1
  12. package/lib/cjs/SectionDrawingLocationState.d.ts +90 -90
  13. package/lib/cjs/SectionDrawingLocationState.js +107 -107
  14. package/lib/cjs/SectionGraphicsProvider.d.ts +13 -13
  15. package/lib/cjs/SectionGraphicsProvider.js +272 -272
  16. package/lib/cjs/SectionMarkerHandler.d.ts +52 -52
  17. package/lib/cjs/SectionMarkerHandler.js +111 -111
  18. package/lib/cjs/SectionMarkers.d.ts +82 -82
  19. package/lib/cjs/SectionMarkers.js +174 -174
  20. package/lib/cjs/Tools.d.ts +5 -5
  21. package/lib/cjs/Tools.js +170 -170
  22. package/lib/cjs/hypermodeling-frontend.d.ts +13 -13
  23. package/lib/cjs/hypermodeling-frontend.js +33 -29
  24. package/lib/cjs/hypermodeling-frontend.js.map +1 -1
  25. package/lib/esm/HyperModeling.d.ts +114 -114
  26. package/lib/esm/HyperModeling.js +235 -234
  27. package/lib/esm/HyperModeling.js.map +1 -1
  28. package/lib/esm/HyperModelingConfig.d.ts +54 -54
  29. package/lib/esm/HyperModelingConfig.js +8 -8
  30. package/lib/esm/HyperModelingDecorator.d.ts +110 -110
  31. package/lib/esm/HyperModelingDecorator.js +331 -331
  32. package/lib/esm/HyperModelingDecorator.js.map +1 -1
  33. package/lib/esm/PopupToolbar.d.ts +24 -24
  34. package/lib/esm/PopupToolbar.js +54 -53
  35. package/lib/esm/PopupToolbar.js.map +1 -1
  36. package/lib/esm/SectionDrawingLocationState.d.ts +90 -90
  37. package/lib/esm/SectionDrawingLocationState.js +103 -103
  38. package/lib/esm/SectionGraphicsProvider.d.ts +13 -13
  39. package/lib/esm/SectionGraphicsProvider.js +268 -268
  40. package/lib/esm/SectionMarkerHandler.d.ts +52 -52
  41. package/lib/esm/SectionMarkerHandler.js +107 -107
  42. package/lib/esm/SectionMarkers.d.ts +82 -82
  43. package/lib/esm/SectionMarkers.js +168 -168
  44. package/lib/esm/Tools.d.ts +5 -5
  45. package/lib/esm/Tools.js +166 -166
  46. package/lib/esm/hypermodeling-frontend.d.ts +13 -13
  47. package/lib/esm/hypermodeling-frontend.js +17 -17
  48. package/package.json +14 -14
@@ -1,13 +1,13 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module HyperModeling
7
- */
8
- import { Placement3d, QueryRowFormat } from "@itwin/core-common";
9
- import { DrawingViewState, SheetViewState, SpatialViewState } from "@itwin/core-frontend";
10
- import { ClipVector, Transform } from "@itwin/core-geometry";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module HyperModeling
7
+ */
8
+ import { Placement3d, QueryRowFormat } from "@itwin/core-common";
9
+ import { DrawingViewState, SheetViewState, SpatialViewState } from "@itwin/core-frontend";
10
+ import { ClipVector, Transform } from "@itwin/core-geometry";
11
11
  const selectSectionDrawingLocationStatesECSql = `
12
12
  SELECT
13
13
  bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,
@@ -37,97 +37,97 @@ const selectSectionDrawingLocationStatesECSql = `
37
37
  LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id
38
38
  LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id
39
39
  INNER JOIN bis.SpatialViewDefinition on bis.SpatialViewDefinition.ECInstanceId = bis.SectionDrawing.SpatialView.Id
40
- `;
41
- /** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.
42
- * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.
43
- * @public
44
- */
45
- export class SectionDrawingLocationState {
46
- /** @internal */
47
- constructor(props, iModel) {
48
- this.iModel = iModel;
49
- this.id = props.sectionLocationId;
50
- this.model = props.sectionLocationModelId;
51
- this.userLabel = props.userLabel;
52
- this.category = props.categoryId;
53
- this.sectionType = props.sectionType;
54
- this.drawingViewId = props.sectionViewId;
55
- this.spatialViewId = props.spatialViewId;
56
- this.drawingToSpatialTransform = Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
57
- const extractClip = (str) => {
58
- let clip;
59
- if (str) {
60
- try {
61
- clip = ClipVector.fromJSON(JSON.parse(str));
62
- }
63
- catch { }
64
- }
65
- return clip;
66
- };
67
- this.clip = extractClip(props.clipJSON) ?? ClipVector.createEmpty();
68
- const placementProps = {
69
- origin: props.origin ?? {},
70
- angles: {
71
- yaw: props.yaw,
72
- pitch: props.pitch,
73
- roll: props.roll,
74
- },
75
- placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
76
- };
77
- this.placement = Placement3d.fromJSON(placementProps);
78
- if (props.viewAttachmentId && props.sheetToSpatialTransform) {
79
- this.viewAttachment = {
80
- id: props.viewAttachmentId,
81
- transformToSpatial: Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
82
- clip: extractClip(props.sheetClip),
83
- viewId: props.sheetViewId,
84
- };
85
- }
86
- }
87
- /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
88
- async tryLoadDrawingView() {
89
- try {
90
- const view = await this.iModel.views.load(this.drawingViewId);
91
- if (view instanceof DrawingViewState)
92
- return view;
93
- }
94
- catch { }
95
- return undefined;
96
- }
97
- /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
98
- async tryLoadSpatialView() {
99
- try {
100
- const view = await this.iModel.views.load(this.spatialViewId);
101
- if (view instanceof SpatialViewState)
102
- return view;
103
- }
104
- catch { }
105
- return undefined;
106
- }
107
- /** 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. */
108
- async tryLoadSheetView() {
109
- if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
110
- return undefined;
111
- try {
112
- const view = await this.iModel.views.load(this.viewAttachment.viewId);
113
- if (view instanceof SheetViewState)
114
- return view;
115
- }
116
- catch { }
117
- return undefined;
118
- }
119
- /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
120
- static async queryAll(iModel) {
121
- const states = [];
122
- try {
123
- // eslint-disable-next-line deprecation/deprecation
124
- for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))
125
- states.push(new SectionDrawingLocationState(row, iModel));
126
- }
127
- catch {
128
- // 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.
129
- }
130
- return states;
131
- }
132
- }
40
+ `;
41
+ /** Represents a [SectionDrawingLocation]($backend), including data from related elements like [SectionDrawing]($backend) used in a hyper-modeling context.
42
+ * @see [[SectionMarker]] for a widget that allows the user to interact with a section drawing location.
43
+ * @public
44
+ */
45
+ export class SectionDrawingLocationState {
46
+ /** @internal */
47
+ constructor(props, iModel) {
48
+ this.iModel = iModel;
49
+ this.id = props.sectionLocationId;
50
+ this.model = props.sectionLocationModelId;
51
+ this.userLabel = props.userLabel;
52
+ this.category = props.categoryId;
53
+ this.sectionType = props.sectionType;
54
+ this.drawingViewId = props.sectionViewId;
55
+ this.spatialViewId = props.spatialViewId;
56
+ this.drawingToSpatialTransform = Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
57
+ const extractClip = (str) => {
58
+ let clip;
59
+ if (str) {
60
+ try {
61
+ clip = ClipVector.fromJSON(JSON.parse(str));
62
+ }
63
+ catch { }
64
+ }
65
+ return clip;
66
+ };
67
+ this.clip = extractClip(props.clipJSON) ?? ClipVector.createEmpty();
68
+ const placementProps = {
69
+ origin: props.origin ?? {},
70
+ angles: {
71
+ yaw: props.yaw,
72
+ pitch: props.pitch,
73
+ roll: props.roll,
74
+ },
75
+ placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
76
+ };
77
+ this.placement = Placement3d.fromJSON(placementProps);
78
+ if (props.viewAttachmentId && props.sheetToSpatialTransform) {
79
+ this.viewAttachment = {
80
+ id: props.viewAttachmentId,
81
+ transformToSpatial: Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
82
+ clip: extractClip(props.sheetClip),
83
+ viewId: props.sheetViewId,
84
+ };
85
+ }
86
+ }
87
+ /** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
88
+ async tryLoadDrawingView() {
89
+ try {
90
+ const view = await this.iModel.views.load(this.drawingViewId);
91
+ if (view instanceof DrawingViewState)
92
+ return view;
93
+ }
94
+ catch { }
95
+ return undefined;
96
+ }
97
+ /** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
98
+ async tryLoadSpatialView() {
99
+ try {
100
+ const view = await this.iModel.views.load(this.spatialViewId);
101
+ if (view instanceof SpatialViewState)
102
+ return view;
103
+ }
104
+ catch { }
105
+ return undefined;
106
+ }
107
+ /** 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. */
108
+ async tryLoadSheetView() {
109
+ if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
110
+ return undefined;
111
+ try {
112
+ const view = await this.iModel.views.load(this.viewAttachment.viewId);
113
+ if (view instanceof SheetViewState)
114
+ return view;
115
+ }
116
+ catch { }
117
+ return undefined;
118
+ }
119
+ /** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
120
+ static async queryAll(iModel) {
121
+ const states = [];
122
+ try {
123
+ // eslint-disable-next-line deprecation/deprecation
124
+ for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))
125
+ states.push(new SectionDrawingLocationState(row, iModel));
126
+ }
127
+ catch {
128
+ // 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.
129
+ }
130
+ return states;
131
+ }
132
+ }
133
133
  //# sourceMappingURL=SectionDrawingLocationState.js.map
@@ -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