@itwin/hypermodeling-frontend 3.0.0-dev.76 → 3.0.0-dev.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{HyperModeling.d.ts → cjs/HyperModeling.d.ts} +0 -0
- package/lib/cjs/HyperModeling.d.ts.map +1 -0
- package/lib/{HyperModeling.js → cjs/HyperModeling.js} +3 -3
- package/lib/cjs/HyperModeling.js.map +1 -0
- package/lib/{HyperModelingConfig.d.ts → cjs/HyperModelingConfig.d.ts} +0 -0
- package/lib/cjs/HyperModelingConfig.d.ts.map +1 -0
- package/lib/{HyperModelingConfig.js → cjs/HyperModelingConfig.js} +0 -0
- package/lib/cjs/HyperModelingConfig.js.map +1 -0
- package/lib/{HyperModelingDecorator.d.ts → cjs/HyperModelingDecorator.d.ts} +0 -0
- package/lib/cjs/HyperModelingDecorator.d.ts.map +1 -0
- package/lib/{HyperModelingDecorator.js → cjs/HyperModelingDecorator.js} +2 -2
- package/lib/cjs/HyperModelingDecorator.js.map +1 -0
- package/lib/{PopupToolbar.d.ts → cjs/PopupToolbar.d.ts} +0 -0
- package/lib/cjs/PopupToolbar.d.ts.map +1 -0
- package/lib/{PopupToolbar.js → cjs/PopupToolbar.js} +0 -0
- package/lib/cjs/PopupToolbar.js.map +1 -0
- package/lib/{SectionDrawingLocationState.d.ts → cjs/SectionDrawingLocationState.d.ts} +0 -0
- package/lib/cjs/SectionDrawingLocationState.d.ts.map +1 -0
- package/lib/{SectionDrawingLocationState.js → cjs/SectionDrawingLocationState.js} +7 -28
- package/lib/cjs/SectionDrawingLocationState.js.map +1 -0
- package/lib/{SectionGraphicsProvider.d.ts → cjs/SectionGraphicsProvider.d.ts} +0 -0
- package/lib/cjs/SectionGraphicsProvider.d.ts.map +1 -0
- package/lib/{SectionGraphicsProvider.js → cjs/SectionGraphicsProvider.js} +10 -7
- package/lib/cjs/SectionGraphicsProvider.js.map +1 -0
- package/lib/{SectionMarkerHandler.d.ts → cjs/SectionMarkerHandler.d.ts} +0 -0
- package/lib/cjs/SectionMarkerHandler.d.ts.map +1 -0
- package/lib/{SectionMarkerHandler.js → cjs/SectionMarkerHandler.js} +0 -0
- package/lib/cjs/SectionMarkerHandler.js.map +1 -0
- package/lib/{SectionMarkers.d.ts → cjs/SectionMarkers.d.ts} +0 -0
- package/lib/cjs/SectionMarkers.d.ts.map +1 -0
- package/lib/{SectionMarkers.js → cjs/SectionMarkers.js} +0 -0
- package/lib/cjs/SectionMarkers.js.map +1 -0
- package/lib/{Tools.d.ts → cjs/Tools.d.ts} +0 -0
- package/lib/cjs/Tools.d.ts.map +1 -0
- package/lib/{Tools.js → cjs/Tools.js} +0 -0
- package/lib/cjs/Tools.js.map +1 -0
- package/lib/{hypermodeling-frontend.d.ts → cjs/hypermodeling-frontend.d.ts} +0 -0
- package/lib/cjs/hypermodeling-frontend.d.ts.map +1 -0
- package/lib/{hypermodeling-frontend.js → cjs/hypermodeling-frontend.js} +0 -0
- package/lib/cjs/hypermodeling-frontend.js.map +1 -0
- package/lib/esm/HyperModeling.d.ts +109 -0
- package/lib/esm/HyperModeling.d.ts.map +1 -0
- package/lib/esm/HyperModeling.js +221 -0
- package/lib/esm/HyperModeling.js.map +1 -0
- package/lib/esm/HyperModelingConfig.d.ts +55 -0
- package/lib/esm/HyperModelingConfig.d.ts.map +1 -0
- package/lib/esm/HyperModelingConfig.js +9 -0
- package/lib/esm/HyperModelingConfig.js.map +1 -0
- package/lib/esm/HyperModelingDecorator.d.ts +111 -0
- package/lib/esm/HyperModelingDecorator.d.ts.map +1 -0
- package/lib/esm/HyperModelingDecorator.js +334 -0
- package/lib/esm/HyperModelingDecorator.js.map +1 -0
- package/lib/esm/PopupToolbar.d.ts +25 -0
- package/lib/esm/PopupToolbar.d.ts.map +1 -0
- package/lib/esm/PopupToolbar.js +53 -0
- package/lib/esm/PopupToolbar.js.map +1 -0
- package/lib/esm/SectionDrawingLocationState.d.ts +91 -0
- package/lib/esm/SectionDrawingLocationState.d.ts.map +1 -0
- package/lib/esm/SectionDrawingLocationState.js +133 -0
- package/lib/esm/SectionDrawingLocationState.js.map +1 -0
- package/lib/esm/SectionGraphicsProvider.d.ts +14 -0
- package/lib/esm/SectionGraphicsProvider.d.ts.map +1 -0
- package/lib/esm/SectionGraphicsProvider.js +270 -0
- package/lib/esm/SectionGraphicsProvider.js.map +1 -0
- package/lib/esm/SectionMarkerHandler.d.ts +53 -0
- package/lib/esm/SectionMarkerHandler.d.ts.map +1 -0
- package/lib/esm/SectionMarkerHandler.js +109 -0
- package/lib/esm/SectionMarkerHandler.js.map +1 -0
- package/lib/esm/SectionMarkers.d.ts +83 -0
- package/lib/esm/SectionMarkers.d.ts.map +1 -0
- package/lib/esm/SectionMarkers.js +168 -0
- package/lib/esm/SectionMarkers.js.map +1 -0
- package/lib/esm/Tools.d.ts +7 -0
- package/lib/esm/Tools.d.ts.map +1 -0
- package/lib/esm/Tools.js +167 -0
- package/lib/esm/Tools.js.map +1 -0
- package/lib/esm/hypermodeling-frontend.d.ts +14 -0
- package/lib/esm/hypermodeling-frontend.d.ts.map +1 -0
- package/lib/esm/hypermodeling-frontend.js +18 -0
- package/lib/esm/hypermodeling-frontend.js.map +1 -0
- package/package.json +25 -22
- package/lib/HyperModeling.d.ts.map +0 -1
- package/lib/HyperModeling.js.map +0 -1
- package/lib/HyperModelingConfig.d.ts.map +0 -1
- package/lib/HyperModelingConfig.js.map +0 -1
- package/lib/HyperModelingDecorator.d.ts.map +0 -1
- package/lib/HyperModelingDecorator.js.map +0 -1
- package/lib/PopupToolbar.d.ts.map +0 -1
- package/lib/PopupToolbar.js.map +0 -1
- package/lib/SectionDrawingLocationState.d.ts.map +0 -1
- package/lib/SectionDrawingLocationState.js.map +0 -1
- package/lib/SectionGraphicsProvider.d.ts.map +0 -1
- package/lib/SectionGraphicsProvider.js.map +0 -1
- package/lib/SectionMarkerHandler.d.ts.map +0 -1
- package/lib/SectionMarkerHandler.js.map +0 -1
- package/lib/SectionMarkers.d.ts.map +0 -1
- package/lib/SectionMarkers.js.map +0 -1
- package/lib/Tools.d.ts.map +0 -1
- package/lib/Tools.js.map +0 -1
- package/lib/hypermodeling-frontend.d.ts.map +0 -1
- package/lib/hypermodeling-frontend.js.map +0 -1
- package/lib/public/locales/en-PSEUDO/HyperModeling.json +0 -32
|
@@ -0,0 +1,133 @@
|
|
|
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 { ClipVector, Transform, } from "@itwin/core-geometry";
|
|
9
|
+
import { Placement3d, } from "@itwin/core-common";
|
|
10
|
+
import { DrawingViewState, SheetViewState, SpatialViewState, } from "@itwin/core-frontend";
|
|
11
|
+
const selectSectionDrawingLocationStatesECSql = `
|
|
12
|
+
SELECT
|
|
13
|
+
bis.SectionDrawingLocation.ECInstanceId as sectionLocationId,
|
|
14
|
+
bis.SectionDrawingLocation.Model.Id as sectionLocationModelId,
|
|
15
|
+
bis.SectionDrawingLocation.SectionView.Id as sectionViewId,
|
|
16
|
+
bis.SectionDrawingLocation.Category.Id as categoryId,
|
|
17
|
+
bis.SectionDrawingLocation.Origin as origin,
|
|
18
|
+
bis.SectionDrawingLocation.Yaw as yaw,
|
|
19
|
+
bis.SectionDrawingLocation.Pitch as pitch,
|
|
20
|
+
bis.SectionDrawingLocation.Roll as roll,
|
|
21
|
+
bis.SectionDrawingLocation.BBoxLow as bboxLow,
|
|
22
|
+
bis.SectionDrawingLocation.BBoxHigh as bboxHigh,
|
|
23
|
+
bis.SectionDrawingLocation.UserLabel as userLabel,
|
|
24
|
+
|
|
25
|
+
bis.SectionDrawing.SectionType as sectionType,
|
|
26
|
+
json_extract(bis.SectionDrawing.jsonProperties, '$.drawingToSpatialTransform') as drawingToSpatialTransform,
|
|
27
|
+
bis.SectionDrawing.SpatialView.Id as spatialViewId,
|
|
28
|
+
json_extract(bis.SectionDrawing.jsonProperties, '$.sheetToSpatialTransform') as sheetToSpatialTransform,
|
|
29
|
+
json_extract(bis.SectionDrawing.jsonProperties, '$.drawingBoundaryClip') as sheetClip,
|
|
30
|
+
|
|
31
|
+
json_extract(bis.SpatialViewDefinition.jsonProperties, '$.viewDetails.clip') as clipJSON,
|
|
32
|
+
bis.ViewAttachment.ECInstanceId as viewAttachmentId,
|
|
33
|
+
bis.SheetViewDefinition.ECInstanceId as sheetViewId
|
|
34
|
+
FROM bis.SectionDrawingLocation
|
|
35
|
+
INNER JOIN bis.ViewDefinition2d on bis.SectionDrawingLocation.SectionView.Id = bis.ViewDefinition2d.ECInstanceId
|
|
36
|
+
INNER JOIN bis.SectionDrawing on bis.ViewDefinition2d.BaseModel.Id = bis.SectionDrawing.ECInstanceId
|
|
37
|
+
LEFT JOIN bis.ViewAttachment on bis.ViewDefinition2d.ECInstanceId = bis.ViewAttachment.View.Id
|
|
38
|
+
LEFT JOIN bis.SheetViewDefinition on bis.SheetViewDefinition.BaseModel.Id = bis.ViewAttachment.Model.Id
|
|
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
|
+
var _a, _b;
|
|
49
|
+
this.iModel = iModel;
|
|
50
|
+
this.id = props.sectionLocationId;
|
|
51
|
+
this.model = props.sectionLocationModelId;
|
|
52
|
+
this.userLabel = props.userLabel;
|
|
53
|
+
this.category = props.categoryId;
|
|
54
|
+
this.sectionType = props.sectionType;
|
|
55
|
+
this.drawingViewId = props.sectionViewId;
|
|
56
|
+
this.spatialViewId = props.spatialViewId;
|
|
57
|
+
this.drawingToSpatialTransform = Transform.fromJSON(JSON.parse(props.drawingToSpatialTransform));
|
|
58
|
+
const extractClip = (str) => {
|
|
59
|
+
let clip;
|
|
60
|
+
if (str) {
|
|
61
|
+
try {
|
|
62
|
+
clip = ClipVector.fromJSON(JSON.parse(str));
|
|
63
|
+
}
|
|
64
|
+
catch { }
|
|
65
|
+
}
|
|
66
|
+
return clip;
|
|
67
|
+
};
|
|
68
|
+
this.clip = (_a = extractClip(props.clipJSON)) !== null && _a !== void 0 ? _a : ClipVector.createEmpty();
|
|
69
|
+
const placementProps = {
|
|
70
|
+
origin: (_b = props.origin) !== null && _b !== void 0 ? _b : {},
|
|
71
|
+
angles: {
|
|
72
|
+
yaw: props.yaw,
|
|
73
|
+
pitch: props.pitch,
|
|
74
|
+
roll: props.roll,
|
|
75
|
+
},
|
|
76
|
+
placement: (props.bboxLow && props.bboxHigh) ? { low: props.bboxLow, high: props.bboxHigh } : undefined,
|
|
77
|
+
};
|
|
78
|
+
this.placement = Placement3d.fromJSON(placementProps);
|
|
79
|
+
if (props.viewAttachmentId && props.sheetToSpatialTransform) {
|
|
80
|
+
this.viewAttachment = {
|
|
81
|
+
id: props.viewAttachmentId,
|
|
82
|
+
transformToSpatial: Transform.fromJSON(JSON.parse(props.sheetToSpatialTransform)),
|
|
83
|
+
clip: extractClip(props.sheetClip),
|
|
84
|
+
viewId: props.sheetViewId,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Return a promise that resolves to the [DrawingViewState]($frontend) corresponding to `this.drawingViewId`, or undefined if an exception occurs. */
|
|
89
|
+
async tryLoadDrawingView() {
|
|
90
|
+
try {
|
|
91
|
+
const view = await this.iModel.views.load(this.drawingViewId);
|
|
92
|
+
if (view instanceof DrawingViewState)
|
|
93
|
+
return view;
|
|
94
|
+
}
|
|
95
|
+
catch { }
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
/** Return a promise that resolves to the [SpatialViewState]($frontend) corresponding to `this.spatialViewId`, or undefined if an exception occurs. */
|
|
99
|
+
async tryLoadSpatialView() {
|
|
100
|
+
try {
|
|
101
|
+
const view = await this.iModel.views.load(this.spatialViewId);
|
|
102
|
+
if (view instanceof SpatialViewState)
|
|
103
|
+
return view;
|
|
104
|
+
}
|
|
105
|
+
catch { }
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
/** 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. */
|
|
109
|
+
async tryLoadSheetView() {
|
|
110
|
+
if (undefined === this.viewAttachment || undefined === this.viewAttachment.viewId)
|
|
111
|
+
return undefined;
|
|
112
|
+
try {
|
|
113
|
+
const view = await this.iModel.views.load(this.viewAttachment.viewId);
|
|
114
|
+
if (view instanceof SheetViewState)
|
|
115
|
+
return view;
|
|
116
|
+
}
|
|
117
|
+
catch { }
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/** Query the specified iModel for [SectionDrawingLocation]($backend)s and return a list of corresponding [[SectionDrawingLocationState]]s. */
|
|
121
|
+
static async queryAll(iModel) {
|
|
122
|
+
const states = [];
|
|
123
|
+
try {
|
|
124
|
+
for await (const row of iModel.query(selectSectionDrawingLocationStatesECSql))
|
|
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
|
+
//# sourceMappingURL=SectionDrawingLocationState.js.map
|
|
@@ -0,0 +1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,YAAY,gBAAgB;gBAClC,OAAO,IAAI,CAAC;SACf;QAAC,MAAM,GAAG;QAEX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sJAAsJ;IAC/I,KAAK,CAAC,kBAAkB;QAC7B,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC9D,IAAI,IAAI,YAAY,gBAAgB;gBAClC,OAAO,IAAI,CAAC;SACf;QAAC,MAAM,GAAG;QAEX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,oNAAoN;IAC7M,KAAK,CAAC,gBAAgB;QAC3B,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,MAAM;YAC/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,cAAc;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,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC;gBAC3E,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","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 {\r\n ClipVector, Transform, XYZProps,\r\n} from \"@itwin/core-geometry\";\r\nimport {\r\n Placement3d, SectionType,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n DrawingViewState, IModelConnection, SheetViewState, SpatialViewState,\r\n} from \"@itwin/core-frontend\";\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))\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"]}
|
|
@@ -0,0 +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>;
|
|
14
|
+
//# sourceMappingURL=SectionGraphicsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionGraphicsProvider.d.ts","sourceRoot":"","sources":["../../src/SectionGraphicsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAE+J,qBAAqB,EAE1L,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AA+T5E;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAStH"}
|
|
@@ -0,0 +1,270 @@
|
|
|
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 { assert, compareBooleans, compareStrings, Id64 } from "@itwin/core-bentley";
|
|
9
|
+
import { ClipShape, ClipVector, Point3d, Transform } from "@itwin/core-geometry";
|
|
10
|
+
import { ColorDef, Placement2d } from "@itwin/core-common";
|
|
11
|
+
import { CategorySelectorState, DisplayStyle2dState, DrawingViewState, FeatureSymbology, GeometricModel2dState, GraphicBranch, IModelApp, SheetModelState, Tile, TileDrawArgs, TileLoadPriority, TileTree, TileTreeReference, } from "@itwin/core-frontend";
|
|
12
|
+
import { HyperModeling } from "./HyperModeling";
|
|
13
|
+
class ProxyTreeSupplier {
|
|
14
|
+
compareTileTreeIds(lhs, rhs) {
|
|
15
|
+
let cmp = compareBooleans(lhs.isSheet, rhs.isSheet);
|
|
16
|
+
if (0 === cmp)
|
|
17
|
+
cmp = compareStrings(lhs.state.id, rhs.state.id);
|
|
18
|
+
return cmp;
|
|
19
|
+
}
|
|
20
|
+
async createTileTree(id, iModel) {
|
|
21
|
+
let view;
|
|
22
|
+
if (id.isSheet) {
|
|
23
|
+
assert(undefined !== id.attachment);
|
|
24
|
+
view = await this.createSheetViewState(id.state, id.attachment);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
view = await id.state.tryLoadDrawingView();
|
|
28
|
+
}
|
|
29
|
+
if (undefined === view)
|
|
30
|
+
return undefined;
|
|
31
|
+
try {
|
|
32
|
+
await iModel.models.load(view.baseModelId);
|
|
33
|
+
const model = iModel.models.getLoaded(view.baseModelId);
|
|
34
|
+
if (undefined === model || !(model instanceof GeometricModel2dState))
|
|
35
|
+
return undefined;
|
|
36
|
+
const treeRef = model.createTileTreeReference(view);
|
|
37
|
+
const tree = await treeRef.treeOwner.loadTree();
|
|
38
|
+
if (undefined === tree)
|
|
39
|
+
return undefined;
|
|
40
|
+
const ctor = id.isSheet ? SheetProxyTree : DrawingProxyTree;
|
|
41
|
+
return new ctor({ tree, ref: treeRef, view, state: id.state, attachment: id.attachment });
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async createSheetViewState(state, attachment) {
|
|
48
|
+
assert(undefined !== state.viewAttachment);
|
|
49
|
+
try {
|
|
50
|
+
// A persistent view of the sheet doesn't necessarily exist, and we don't want a SheetViewState anyway.
|
|
51
|
+
// All we want is to draw all the elements in the sheet (sans view attachments) clipped by the drawing boundary.
|
|
52
|
+
// However, ModelState.createTileTreeReference() requires a ViewState.
|
|
53
|
+
await state.iModel.models.load(attachment.model);
|
|
54
|
+
const sheet = state.iModel.models.getLoaded(attachment.model);
|
|
55
|
+
if (undefined === sheet || !(sheet instanceof SheetModelState))
|
|
56
|
+
return undefined;
|
|
57
|
+
const sheetExtents = await sheet.queryModelRange();
|
|
58
|
+
const viewProps = {
|
|
59
|
+
baseModelId: attachment.model,
|
|
60
|
+
origin: { x: 0, y: 0 },
|
|
61
|
+
delta: { x: sheetExtents.high.x, y: sheetExtents.high.y },
|
|
62
|
+
angle: 0,
|
|
63
|
+
categorySelectorId: Id64.invalid,
|
|
64
|
+
displayStyleId: Id64.invalid,
|
|
65
|
+
model: Id64.invalid,
|
|
66
|
+
code: {
|
|
67
|
+
spec: Id64.invalid,
|
|
68
|
+
scope: Id64.invalid,
|
|
69
|
+
},
|
|
70
|
+
classFullName: DrawingViewState.classFullName,
|
|
71
|
+
};
|
|
72
|
+
const displayStyle = new DisplayStyle2dState({}, state.iModel);
|
|
73
|
+
const categorySelector = new CategorySelectorState({}, state.iModel);
|
|
74
|
+
return new DrawingViewState(viewProps, state.iModel, categorySelector, displayStyle, sheetExtents);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const proxyTreeSupplier = new ProxyTreeSupplier();
|
|
82
|
+
/** A proxy for a 2d tile tree to be drawn in the context of a spatial view. */
|
|
83
|
+
class ProxyTreeReference extends TileTreeReference {
|
|
84
|
+
constructor(id) {
|
|
85
|
+
super();
|
|
86
|
+
this._owner = id.state.iModel.tiles.getTileTreeOwner(id, proxyTreeSupplier);
|
|
87
|
+
}
|
|
88
|
+
get castsShadows() {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
getClipVolume(tree) {
|
|
92
|
+
return true !== HyperModeling.graphicsConfig.ignoreClip ? super.getClipVolume(tree) : undefined;
|
|
93
|
+
}
|
|
94
|
+
get treeOwner() { return this._owner; }
|
|
95
|
+
get _proxiedRef() {
|
|
96
|
+
const proxiedTree = this.treeOwner.tileTree;
|
|
97
|
+
return undefined !== proxiedTree ? proxiedTree.ref : undefined;
|
|
98
|
+
}
|
|
99
|
+
discloseTileTrees(trees) {
|
|
100
|
+
super.discloseTileTrees(trees);
|
|
101
|
+
const ref = this._proxiedRef;
|
|
102
|
+
if (undefined !== ref)
|
|
103
|
+
ref.discloseTileTrees(trees);
|
|
104
|
+
}
|
|
105
|
+
async getToolTip(hit) {
|
|
106
|
+
const ref = this._proxiedRef;
|
|
107
|
+
return undefined !== ref ? ref.getToolTip(hit) : super.getToolTip(hit);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** A proxy for a 2d tile tree to be drawn in the context of a spatial view. */
|
|
111
|
+
class ProxyTree extends TileTree {
|
|
112
|
+
constructor(params, location, clipVolume) {
|
|
113
|
+
const { tree, ref, view } = { ...params };
|
|
114
|
+
super({
|
|
115
|
+
id: params.state.id,
|
|
116
|
+
modelId: tree.modelId,
|
|
117
|
+
iModel: tree.iModel,
|
|
118
|
+
location,
|
|
119
|
+
priority: TileLoadPriority.Primary,
|
|
120
|
+
clipVolume,
|
|
121
|
+
});
|
|
122
|
+
this.tree = tree;
|
|
123
|
+
this.ref = ref;
|
|
124
|
+
this.symbologyOverrides = new FeatureSymbology.Overrides(view);
|
|
125
|
+
const range = tree.iModelTransform.multiplyRange(tree.rootTile.range);
|
|
126
|
+
const inverse = location.inverse();
|
|
127
|
+
if (undefined !== inverse)
|
|
128
|
+
inverse.multiplyRange(range, range);
|
|
129
|
+
this._viewFlagOverrides = {
|
|
130
|
+
...view.viewFlags,
|
|
131
|
+
lighting: false,
|
|
132
|
+
// View clip (section clip) should not apply to 2d graphics.
|
|
133
|
+
clipVolume: false,
|
|
134
|
+
};
|
|
135
|
+
this._rootTile = new ProxyTile(this, range);
|
|
136
|
+
}
|
|
137
|
+
get rootTile() { return this._rootTile; }
|
|
138
|
+
get viewFlagOverrides() { return this._viewFlagOverrides; }
|
|
139
|
+
get is3d() { return false; }
|
|
140
|
+
get isContentUnbounded() { return false; }
|
|
141
|
+
get maxDepth() { return 1; }
|
|
142
|
+
draw(args) {
|
|
143
|
+
if (!this.isDisplayed)
|
|
144
|
+
return;
|
|
145
|
+
const tiles = this.selectTiles(args);
|
|
146
|
+
for (const tile of tiles)
|
|
147
|
+
tile.drawGraphics(args);
|
|
148
|
+
args.drawGraphics();
|
|
149
|
+
}
|
|
150
|
+
_selectTiles(_args) {
|
|
151
|
+
return this.isDisplayed ? [this.rootTile] : [];
|
|
152
|
+
}
|
|
153
|
+
prune() {
|
|
154
|
+
// Our single tile is only a proxy. Our proxied tree(s) will be pruned separately
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
class DrawingProxyTree extends ProxyTree {
|
|
158
|
+
constructor(params) {
|
|
159
|
+
var _a;
|
|
160
|
+
const { state, attachment } = { ...params };
|
|
161
|
+
const location = state.drawingToSpatialTransform.clone();
|
|
162
|
+
let clipVolume;
|
|
163
|
+
if (attachment) {
|
|
164
|
+
assert(undefined !== state.viewAttachment);
|
|
165
|
+
const clipJSON = (_a = attachment.jsonProperties) === null || _a === void 0 ? void 0 : _a.clip;
|
|
166
|
+
const clip = clipJSON ? ClipVector.fromJSON(clipJSON) : ClipVector.createEmpty();
|
|
167
|
+
if (!clipJSON) {
|
|
168
|
+
const placement = Placement2d.fromJSON(attachment.placement);
|
|
169
|
+
const range = placement.calculateRange();
|
|
170
|
+
clip.appendShape([
|
|
171
|
+
Point3d.create(range.low.x, range.low.y),
|
|
172
|
+
Point3d.create(range.high.x, range.low.y),
|
|
173
|
+
Point3d.create(range.high.x, range.high.y),
|
|
174
|
+
Point3d.create(range.low.x, range.high.y),
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
if (clip.isValid) {
|
|
178
|
+
const sheetToWorld = state.viewAttachment.transformToSpatial.clone();
|
|
179
|
+
clip.transformInPlace(sheetToWorld);
|
|
180
|
+
clipVolume = IModelApp.renderSystem.createClipVolume(clip);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
super(params, location, clipVolume);
|
|
184
|
+
}
|
|
185
|
+
get isDisplayed() { return true !== HyperModeling.graphicsConfig.hideSectionGraphics; }
|
|
186
|
+
}
|
|
187
|
+
class SheetProxyTree extends ProxyTree {
|
|
188
|
+
constructor(params) {
|
|
189
|
+
const { state, attachment } = { ...params };
|
|
190
|
+
assert(undefined !== state.viewAttachment);
|
|
191
|
+
assert(undefined !== attachment);
|
|
192
|
+
const location = state.viewAttachment.transformToSpatial.clone();
|
|
193
|
+
let clipVolume;
|
|
194
|
+
if (state.viewAttachment.clip)
|
|
195
|
+
clipVolume = IModelApp.renderSystem.createClipVolume(state.viewAttachment.clip);
|
|
196
|
+
super(params, location, clipVolume);
|
|
197
|
+
// Our view is manufactured. It draws everything regardless of subcategory.
|
|
198
|
+
this.symbologyOverrides.ignoreSubCategory = true;
|
|
199
|
+
}
|
|
200
|
+
get isDisplayed() { return true !== HyperModeling.graphicsConfig.hideSheetAnnotations; }
|
|
201
|
+
}
|
|
202
|
+
/** The single Tile belonging to a ProxyTree, serving as a proxy for all of the proxied tree's tiles. */
|
|
203
|
+
class ProxyTile extends Tile {
|
|
204
|
+
constructor(tree, range) {
|
|
205
|
+
super({ contentId: "", range, maximumSize: 512, isLeaf: true }, tree);
|
|
206
|
+
this.setIsReady();
|
|
207
|
+
}
|
|
208
|
+
get hasChildren() { return false; }
|
|
209
|
+
get hasGraphics() { return true; }
|
|
210
|
+
get channel() { throw new Error("Proxy tile has no content"); }
|
|
211
|
+
async requestContent(_isCanceled) { return undefined; }
|
|
212
|
+
async readContent(_data, _system, _isCanceled) { return {}; }
|
|
213
|
+
_loadChildren(_resolve, _reject) { }
|
|
214
|
+
drawGraphics(args) {
|
|
215
|
+
const proxyTree = this.tree;
|
|
216
|
+
const sectionTree = proxyTree.tree;
|
|
217
|
+
const location = proxyTree.iModelTransform.multiplyTransformTransform(sectionTree.iModelTransform);
|
|
218
|
+
const clipVolume = true === proxyTree.viewFlagOverrides.clipVolume ? proxyTree.clipVolume : undefined;
|
|
219
|
+
args = new TileDrawArgs({ context: args.context, location, tree: sectionTree, now: args.now, viewFlagOverrides: proxyTree.viewFlagOverrides, clipVolume, parentsAndChildrenExclusive: args.parentsAndChildrenExclusive, symbologyOverrides: proxyTree.symbologyOverrides });
|
|
220
|
+
sectionTree.draw(args);
|
|
221
|
+
const rangeGfx = this.getRangeGraphic(args.context);
|
|
222
|
+
if (undefined !== rangeGfx)
|
|
223
|
+
args.graphics.add(rangeGfx);
|
|
224
|
+
if (true !== HyperModeling.graphicsConfig.debugClipVolumes || undefined === proxyTree.clipVolume)
|
|
225
|
+
return;
|
|
226
|
+
const builder = args.context.createSceneGraphicBuilder();
|
|
227
|
+
builder.setSymbology(ColorDef.red, ColorDef.red, 2);
|
|
228
|
+
for (const prim of proxyTree.clipVolume.clipVector.clips) {
|
|
229
|
+
if (!(prim instanceof ClipShape))
|
|
230
|
+
continue;
|
|
231
|
+
const tf = prim.transformFromClip;
|
|
232
|
+
const pts = prim.polygon.map((pt) => tf ? tf.multiplyPoint3d(pt) : pt.clone());
|
|
233
|
+
builder.addLineString(pts);
|
|
234
|
+
}
|
|
235
|
+
const branch = new GraphicBranch();
|
|
236
|
+
branch.entries.push(builder.finish());
|
|
237
|
+
branch.setViewFlagOverrides({ clipVolume: false });
|
|
238
|
+
args.context.outputGraphic(args.context.createGraphicBranch(branch, Transform.createIdentity()));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/** Draws the 2d section graphics into the 3d view. */
|
|
242
|
+
class SectionGraphicsProvider {
|
|
243
|
+
constructor(state, attachment) {
|
|
244
|
+
this._drawingRef = new ProxyTreeReference({ state, attachment, isSheet: false });
|
|
245
|
+
if (attachment)
|
|
246
|
+
this._sheetRef = new ProxyTreeReference({ state, attachment, isSheet: true });
|
|
247
|
+
}
|
|
248
|
+
forEachTileTreeRef(_viewport, func) {
|
|
249
|
+
func(this._drawingRef);
|
|
250
|
+
if (undefined !== this._sheetRef)
|
|
251
|
+
func(this._sheetRef);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/** 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).
|
|
255
|
+
* Typically used indirectly via [[HyperModelingDecorator]].
|
|
256
|
+
* @param state The section drawing location specifying which section drawing to display.
|
|
257
|
+
* @returns A provider suitable for passing to [Viewport.addTiledGraphicsProvider]($frontend).
|
|
258
|
+
* @see [[HyperModelingDecorator.toggleAttachment]] to activate section graphics for a given [[SectionMarker]].
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
261
|
+
export async function createSectionGraphicsProvider(state) {
|
|
262
|
+
let attachment;
|
|
263
|
+
if (undefined !== state.viewAttachment) {
|
|
264
|
+
const attachments = await state.iModel.elements.getProps(state.viewAttachment.id);
|
|
265
|
+
if (1 === attachments.length)
|
|
266
|
+
attachment = attachments[0];
|
|
267
|
+
}
|
|
268
|
+
return new SectionGraphicsProvider(state, attachment);
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=SectionGraphicsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionGraphicsProvider.js","sourceRoot":"","sources":["../../src/SectionGraphicsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAW,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAiE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EACL,qBAAqB,EAAwB,mBAAmB,EAAE,gBAAgB,EAClF,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAa,SAAS,EAAoD,eAAe,EAAE,IAAI,EAAsC,YAAY,EACvM,gBAAgB,EAAmC,QAAQ,EAAiB,iBAAiB,GAC9F,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAgBhD,MAAM,iBAAiB;IACd,kBAAkB,CAAC,GAAgB,EAAE,GAAgB;QAC1D,IAAI,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK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kBAAkB,CAAC,SAAmB,EAAE,IAAsC;QACnF,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvB,IAAI,SAAS,KAAK,IAAI,CAAC,SAAS;YAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,KAAkC;IACpF,IAAI,UAAU,CAAC;IACf,IAAI,SAAS,KAAK,KAAK,CAAC,cAAc,EAAE;QACtC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAA0B,CAAC;QAC3G,IAAI,CAAC,KAAK,WAAW,CAAC,MAAM;YAC1B,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;KAC/B;IAED,OAAO,IAAI,uBAAuB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC","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 { assert, compareBooleans, compareStrings, Id64 } from \"@itwin/core-bentley\";\r\nimport { ClipShape, ClipVector, Point3d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ColorDef, Placement2d, ViewAttachmentProps, ViewDefinition2dProps, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport {\r\n CategorySelectorState, DisclosedTileTreeSet, DisplayStyle2dState, DrawingViewState,\r\n FeatureSymbology, GeometricModel2dState, GraphicBranch, HitDetail, IModelApp, IModelConnection, RenderClipVolume, RenderSystem, SheetModelState, Tile, TileContent, TiledGraphicsProvider, TileDrawArgs,\r\n TileLoadPriority, TileRequest, TileRequestChannel, TileTree, TileTreeOwner, TileTreeReference, TileTreeSupplier, Viewport, ViewState2d,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\n\r\ninterface ProxyTreeId {\r\n state: SectionDrawingLocationState;\r\n isSheet: boolean;\r\n attachment?: ViewAttachmentProps;\r\n}\r\n\r\ninterface ProxyTreeParams {\r\n tree: TileTree;\r\n ref: TileTreeReference;\r\n view: ViewState2d;\r\n state: SectionDrawingLocationState;\r\n attachment?: ViewAttachmentProps;\r\n}\r\n\r\nclass ProxyTreeSupplier implements TileTreeSupplier {\r\n public compareTileTreeIds(lhs: ProxyTreeId, rhs: ProxyTreeId): number {\r\n let cmp = compareBooleans(lhs.isSheet, rhs.isSheet);\r\n if (0 === cmp)\r\n cmp = compareStrings(lhs.state.id, rhs.state.id);\r\n\r\n return cmp;\r\n }\r\n\r\n public async createTileTree(id: ProxyTreeId, iModel: IModelConnection): Promise<TileTree | undefined> {\r\n let view;\r\n if (id.isSheet) {\r\n assert(undefined !== id.attachment);\r\n view = await this.createSheetViewState(id.state, id.attachment);\r\n } else {\r\n view = await id.state.tryLoadDrawingView();\r\n }\r\n\r\n if (undefined === view)\r\n return undefined;\r\n\r\n try {\r\n await iModel.models.load(view.baseModelId);\r\n const model = iModel.models.getLoaded(view.baseModelId);\r\n if (undefined === model || !(model instanceof GeometricModel2dState))\r\n return undefined;\r\n\r\n const treeRef = model.createTileTreeReference(view);\r\n const tree = await treeRef.treeOwner.loadTree();\r\n if (undefined === tree)\r\n return undefined;\r\n\r\n const ctor = id.isSheet ? SheetProxyTree : DrawingProxyTree;\r\n return new ctor({ tree, ref: treeRef, view, state: id.state, attachment: id.attachment });\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n private async createSheetViewState(state: SectionDrawingLocationState, attachment: ViewAttachmentProps): Promise<DrawingViewState | undefined> {\r\n assert(undefined !== state.viewAttachment);\r\n try {\r\n // A persistent view of the sheet doesn't necessarily exist, and we don't want a SheetViewState anyway.\r\n // All we want is to draw all the elements in the sheet (sans view attachments) clipped by the drawing boundary.\r\n // However, ModelState.createTileTreeReference() requires a ViewState.\r\n await state.iModel.models.load(attachment.model);\r\n const sheet = state.iModel.models.getLoaded(attachment.model);\r\n if (undefined === sheet || !(sheet instanceof SheetModelState))\r\n return undefined;\r\n\r\n const sheetExtents = await sheet.queryModelRange();\r\n const viewProps: ViewDefinition2dProps = {\r\n baseModelId: attachment.model,\r\n origin: { x: 0, y: 0 },\r\n delta: { x: sheetExtents.high.x, y: sheetExtents.high.y },\r\n angle: 0,\r\n categorySelectorId: Id64.invalid,\r\n displayStyleId: Id64.invalid,\r\n model: Id64.invalid,\r\n code: {\r\n spec: Id64.invalid,\r\n scope: Id64.invalid,\r\n },\r\n classFullName: DrawingViewState.classFullName,\r\n };\r\n\r\n const displayStyle = new DisplayStyle2dState({} as any, state.iModel);\r\n const categorySelector = new CategorySelectorState({} as any, state.iModel);\r\n\r\n return new DrawingViewState(viewProps, state.iModel, categorySelector, displayStyle, sheetExtents);\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n}\r\n\r\nconst proxyTreeSupplier = new ProxyTreeSupplier();\r\n\r\n/** A proxy for a 2d tile tree to be drawn in the context of a spatial view. */\r\nclass ProxyTreeReference extends TileTreeReference {\r\n private readonly _owner: TileTreeOwner;\r\n\r\n public constructor(id: ProxyTreeId) {\r\n super();\r\n this._owner = id.state.iModel.tiles.getTileTreeOwner(id, proxyTreeSupplier);\r\n }\r\n\r\n public override get castsShadows() {\r\n return false;\r\n }\r\n\r\n public override getClipVolume(tree: TileTree) {\r\n return true !== HyperModeling.graphicsConfig.ignoreClip ? super.getClipVolume(tree) : undefined;\r\n }\r\n\r\n public get treeOwner() { return this._owner; }\r\n\r\n private get _proxiedRef(): TileTreeReference | undefined {\r\n const proxiedTree = this.treeOwner.tileTree as ProxyTree;\r\n return undefined !== proxiedTree ? proxiedTree.ref : undefined;\r\n }\r\n\r\n public override discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n super.discloseTileTrees(trees);\r\n const ref = this._proxiedRef;\r\n if (undefined !== ref)\r\n ref.discloseTileTrees(trees);\r\n }\r\n\r\n public override async getToolTip(hit: HitDetail) {\r\n const ref = this._proxiedRef;\r\n return undefined !== ref ? ref.getToolTip(hit) : super.getToolTip(hit);\r\n }\r\n}\r\n\r\n/** A proxy for a 2d tile tree to be drawn in the context of a spatial view. */\r\nabstract class ProxyTree extends TileTree {\r\n private readonly _rootTile: ProxyTile;\r\n private readonly _viewFlagOverrides: ViewFlagOverrides;\r\n public readonly tree: TileTree;\r\n public readonly ref: TileTreeReference;\r\n public readonly symbologyOverrides: FeatureSymbology.Overrides;\r\n\r\n protected constructor(params: ProxyTreeParams, location: Transform, clipVolume: RenderClipVolume | undefined) {\r\n const { tree, ref, view } = { ...params };\r\n super({\r\n id: params.state.id,\r\n modelId: tree.modelId,\r\n iModel: tree.iModel,\r\n location,\r\n priority: TileLoadPriority.Primary,\r\n clipVolume,\r\n });\r\n\r\n this.tree = tree;\r\n this.ref = ref;\r\n this.symbologyOverrides = new FeatureSymbology.Overrides(view);\r\n\r\n const range = tree.iModelTransform.multiplyRange(tree.rootTile.range);\r\n const inverse = location.inverse();\r\n if (undefined !== inverse)\r\n inverse.multiplyRange(range, range);\r\n\r\n this._viewFlagOverrides = {\r\n ...view.viewFlags,\r\n lighting: false,\r\n // View clip (section clip) should not apply to 2d graphics.\r\n clipVolume: false,\r\n };\r\n\r\n this._rootTile = new ProxyTile(this, range);\r\n }\r\n\r\n public get rootTile(): ProxyTile { return this._rootTile; }\r\n public get viewFlagOverrides() { return this._viewFlagOverrides; }\r\n public get is3d() { return false; }\r\n public override get isContentUnbounded() { return false; }\r\n public get maxDepth() { return 1; }\r\n\r\n protected abstract get isDisplayed(): boolean;\r\n\r\n public draw(args: TileDrawArgs): void {\r\n if (!this.isDisplayed)\r\n return;\r\n\r\n const tiles = this.selectTiles(args);\r\n for (const tile of tiles)\r\n tile.drawGraphics(args);\r\n\r\n args.drawGraphics();\r\n }\r\n\r\n protected _selectTiles(_args: TileDrawArgs): Tile[] {\r\n return this.isDisplayed ? [this.rootTile] : [];\r\n }\r\n\r\n public prune(): void {\r\n // Our single tile is only a proxy. Our proxied tree(s) will be pruned separately\r\n }\r\n}\r\n\r\nclass DrawingProxyTree extends ProxyTree {\r\n public constructor(params: ProxyTreeParams) {\r\n const { state, attachment } = { ...params };\r\n const location = state.drawingToSpatialTransform.clone();\r\n\r\n let clipVolume;\r\n if (attachment) {\r\n assert(undefined !== state.viewAttachment);\r\n const clipJSON = attachment.jsonProperties?.clip;\r\n const clip = clipJSON ? ClipVector.fromJSON(clipJSON) : ClipVector.createEmpty();\r\n if (!clipJSON) {\r\n const placement = Placement2d.fromJSON(attachment.placement);\r\n const range = placement.calculateRange();\r\n clip.appendShape([\r\n Point3d.create(range.low.x, range.low.y),\r\n Point3d.create(range.high.x, range.low.y),\r\n Point3d.create(range.high.x, range.high.y),\r\n Point3d.create(range.low.x, range.high.y),\r\n ]);\r\n }\r\n\r\n if (clip.isValid) {\r\n const sheetToWorld = state.viewAttachment.transformToSpatial.clone();\r\n clip.transformInPlace(sheetToWorld);\r\n clipVolume = IModelApp.renderSystem.createClipVolume(clip);\r\n }\r\n }\r\n\r\n super(params, location, clipVolume);\r\n }\r\n\r\n protected get isDisplayed() { return true !== HyperModeling.graphicsConfig.hideSectionGraphics; }\r\n}\r\n\r\nclass SheetProxyTree extends ProxyTree {\r\n public constructor(params: ProxyTreeParams) {\r\n const { state, attachment } = { ...params };\r\n assert(undefined !== state.viewAttachment);\r\n assert(undefined !== attachment);\r\n const location = state.viewAttachment.transformToSpatial.clone();\r\n\r\n let clipVolume;\r\n if (state.viewAttachment.clip)\r\n clipVolume = IModelApp.renderSystem.createClipVolume(state.viewAttachment.clip);\r\n\r\n super(params, location, clipVolume);\r\n\r\n // Our view is manufactured. It draws everything regardless of subcategory.\r\n this.symbologyOverrides.ignoreSubCategory = true;\r\n }\r\n\r\n protected get isDisplayed() { return true !== HyperModeling.graphicsConfig.hideSheetAnnotations; }\r\n}\r\n\r\n/** The single Tile belonging to a ProxyTree, serving as a proxy for all of the proxied tree's tiles. */\r\nclass ProxyTile extends Tile {\r\n public constructor(tree: ProxyTree, range: Range3d) {\r\n super({ contentId: \"\", range, maximumSize: 512, isLeaf: true }, tree);\r\n this.setIsReady();\r\n }\r\n\r\n public get hasChildren() { return false; }\r\n public override get hasGraphics() { return true; }\r\n\r\n public get channel(): TileRequestChannel { throw new Error(\"Proxy tile has no content\"); }\r\n public async requestContent(_isCanceled: () => boolean): Promise<TileRequest.Response> { return undefined; }\r\n public async readContent(_data: TileRequest.ResponseData, _system: RenderSystem, _isCanceled?: () => boolean): Promise<TileContent> { return {}; }\r\n protected _loadChildren(_resolve: (children: Tile[]) => void, _reject: (error: Error) => void): void { }\r\n\r\n public override drawGraphics(args: TileDrawArgs) {\r\n const proxyTree = this.tree as ProxyTree;\r\n const sectionTree = proxyTree.tree;\r\n\r\n const location = proxyTree.iModelTransform.multiplyTransformTransform(sectionTree.iModelTransform);\r\n const clipVolume = true === proxyTree.viewFlagOverrides.clipVolume ? proxyTree.clipVolume : undefined;\r\n args = new TileDrawArgs({ context: args.context, location, tree: sectionTree, now: args.now, viewFlagOverrides: proxyTree.viewFlagOverrides, clipVolume, parentsAndChildrenExclusive: args.parentsAndChildrenExclusive, symbologyOverrides: proxyTree.symbologyOverrides });\r\n sectionTree.draw(args);\r\n\r\n const rangeGfx = this.getRangeGraphic(args.context);\r\n if (undefined !== rangeGfx)\r\n args.graphics.add(rangeGfx);\r\n\r\n if (true !== HyperModeling.graphicsConfig.debugClipVolumes || undefined === proxyTree.clipVolume)\r\n return;\r\n\r\n const builder = args.context.createSceneGraphicBuilder();\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\r\n for (const prim of proxyTree.clipVolume.clipVector.clips) {\r\n if (!(prim instanceof ClipShape))\r\n continue;\r\n\r\n const tf = prim.transformFromClip;\r\n const pts = prim.polygon.map((pt) => tf ? tf.multiplyPoint3d(pt) : pt.clone());\r\n builder.addLineString(pts);\r\n }\r\n\r\n const branch = new GraphicBranch();\r\n branch.entries.push(builder.finish());\r\n branch.setViewFlagOverrides({ clipVolume: false });\r\n args.context.outputGraphic(args.context.createGraphicBranch(branch, Transform.createIdentity()));\r\n }\r\n}\r\n\r\n/** Draws the 2d section graphics into the 3d view. */\r\nclass SectionGraphicsProvider implements TiledGraphicsProvider {\r\n private readonly _drawingRef: TileTreeReference;\r\n private readonly _sheetRef?: TileTreeReference;\r\n\r\n public constructor(state: SectionDrawingLocationState, attachment: ViewAttachmentProps | undefined) {\r\n this._drawingRef = new ProxyTreeReference({ state, attachment, isSheet: false });\r\n if (attachment)\r\n this._sheetRef = new ProxyTreeReference({ state, attachment, isSheet: true });\r\n }\r\n\r\n public forEachTileTreeRef(_viewport: Viewport, func: (ref: TileTreeReference) => void): void {\r\n func(this._drawingRef);\r\n if (undefined !== this._sheetRef)\r\n func(this._sheetRef);\r\n }\r\n}\r\n\r\n/** 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).\r\n * Typically used indirectly via [[HyperModelingDecorator]].\r\n * @param state The section drawing location specifying which section drawing to display.\r\n * @returns A provider suitable for passing to [Viewport.addTiledGraphicsProvider]($frontend).\r\n * @see [[HyperModelingDecorator.toggleAttachment]] to activate section graphics for a given [[SectionMarker]].\r\n * @public\r\n */\r\nexport async function createSectionGraphicsProvider(state: SectionDrawingLocationState): Promise<TiledGraphicsProvider> {\r\n let attachment;\r\n if (undefined !== state.viewAttachment) {\r\n const attachments = await state.iModel.elements.getProps(state.viewAttachment.id) as ViewAttachmentProps[];\r\n if (1 === attachments.length)\r\n attachment = attachments[0];\r\n }\r\n\r\n return new SectionGraphicsProvider(state, attachment);\r\n}\r\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module HyperModeling
|
|
3
|
+
*/
|
|
4
|
+
import { AbstractToolbarProps } from "@itwin/appui-abstract";
|
|
5
|
+
import { SectionMarker } from "./SectionMarkers";
|
|
6
|
+
import { SectionMarkerConfig } from "./HyperModelingConfig";
|
|
7
|
+
import { HyperModelingDecorator } from "./HyperModelingDecorator";
|
|
8
|
+
/** Supplies interactions with [[SectionMarker]]s, including a mini-toolbar displayed when the mouse hovers over a marker and what action occurs when the user clicks a marker.
|
|
9
|
+
* The base implementation supplies the following interactions:
|
|
10
|
+
* * Click: Toggle display of the section graphics and clip volume; apply the section's spatial view if toggling on.
|
|
11
|
+
* * Toolbar:
|
|
12
|
+
* * Apply Section: Applies the section location's spatial view to the viewport and displays the 2d section graphics.
|
|
13
|
+
* * Open Drawing: Navigates to the section drawing view. By default, this applies the section drawing view to the viewport.
|
|
14
|
+
* * Open Sheet: Navigates to the [ViewAttachment]($backend) of the section drawing on a [Sheet]($backend). Disabled if no such attachment exists.
|
|
15
|
+
* @see [[HyperModelingConfig]] to override the default handler by supplying a subclass of `SectionMarkerHandler`.
|
|
16
|
+
* @see [[HyperModelingDecorator]] for various methods that might be usefully wired up to marker click or toolbar actions.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class SectionMarkerHandler {
|
|
20
|
+
/** Respond to activation of the specified marker. Return true if the marker should become the active marker - i.e., if the marker was successfully activated.
|
|
21
|
+
* @see [[SectionMarkerHandler.deactivateMarker]].
|
|
22
|
+
*/
|
|
23
|
+
activateMarker(marker: SectionMarker, decorator: HyperModelingDecorator): Promise<boolean>;
|
|
24
|
+
/** Respond to deactivation of the specified marker. Invoked when the user clicks on the marker while it is the active marker.
|
|
25
|
+
* This should perform the inverse of [[SectionMarkerHandler.activateMarker]]. The marker becomes inactive as a result.
|
|
26
|
+
*/
|
|
27
|
+
deactivateMarker(marker: SectionMarker, decorator: HyperModelingDecorator): Promise<void>;
|
|
28
|
+
/** Return toolbar items for the specified marker. If the array of toolbar items is empty, no toolbar will be displayed.
|
|
29
|
+
* @see [[executeCommand]] to implement each toolbar command.
|
|
30
|
+
*/
|
|
31
|
+
getToolbarProps(marker: SectionMarker, _decorator: HyperModelingDecorator): AbstractToolbarProps;
|
|
32
|
+
/** Execute the command associated with the specified tool bar item.
|
|
33
|
+
* @see [[getToolbarProps]] to define the set of commands.
|
|
34
|
+
*/
|
|
35
|
+
executeCommand(commandId: string, marker: SectionMarker, decorator: HyperModelingDecorator): Promise<void>;
|
|
36
|
+
/** Customize which markers are visible. [[HyperModelingDecorator]] determines marker visibility as follows:
|
|
37
|
+
* - If a marker is currently active (selected), only that marker is visible.
|
|
38
|
+
* - Otherwise, the marker is visible if this method returns `true`.
|
|
39
|
+
* The default implementation of this method determines visibility based on the [[SectionMarkerConfig]] as follows.
|
|
40
|
+
* - If the marker is of a type included in the config's `hiddenSectionTypes`, it is invisible.
|
|
41
|
+
* - If the marker belongs to a model not currently displayed in the viewport and the config's `ignoreModelSelector` is false, it is invisible.
|
|
42
|
+
* - If the marker belongs to a category not currently displayed in the viewport and the config's `ignoreCategorySelector` is false, it is invisible,
|
|
43
|
+
* - Otherwise, the marker is visible, unless this method returns `false`.
|
|
44
|
+
* The default implementation of this method always returns `true`
|
|
45
|
+
* @param marker The marker whose visibility is to be determined.
|
|
46
|
+
* @param decorator The hypermodeling decorator to which the marker belongs.
|
|
47
|
+
* @param config The configuration controlling marker visibility based on [SectionType]($common), [ModelSelectorState]($frontend), and [CategorySelectorState]($frontend).
|
|
48
|
+
* @returns true if the marker should be displayed; false to make it invisible.
|
|
49
|
+
* @see [[HyperModelingDecorator.requestSync]] to force the decorator to reevaluate marker visibility when the criterion used by your implementation of this method changes.
|
|
50
|
+
*/
|
|
51
|
+
isMarkerVisible(marker: SectionMarker, decorator: HyperModelingDecorator, config: SectionMarkerConfig): boolean;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=SectionMarkerHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionMarkerHandler.d.ts","sourceRoot":"","sources":["../../src/SectionMarkerHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;GAUG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACU,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvG;;OAEG;IACU,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItG;;OAEG;IACI,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,sBAAsB,GAAG,oBAAoB;IAgCvG;;OAEG;IACU,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvH;;;;;;;;;;;;;;OAcG;IACI,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO;CAYvH"}
|