@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,175 +1,175 @@
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.SectionMarkerSet = exports.SectionMarkerCluster = exports.SectionMarker = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const core_geometry_1 = require("@itwin/core-geometry");
13
- const core_common_1 = require("@itwin/core-common");
14
- const core_frontend_1 = require("@itwin/core-frontend");
15
- const HyperModeling_1 = require("./HyperModeling");
16
- const markerSize = core_geometry_1.Point2d.create(40, 40);
17
- /** A [Marker]($frontend) associated with a [[SectionDrawingLocationState]], displayed as a canvas decoration at the location of the section.
18
- * Clicking on the marker toggles display of the section graphics. Mousing over the marker produces a toolbar with additional interactions.
19
- * @see [[HyperModelingDecorator]] for a [Decorator]($frontend) capable of displaying section markers for each section drawing location.
20
- * @see [[SectionMarkerHandler]] to customize the marker interactions.
21
- * @public
22
- */
23
- class SectionMarker extends core_frontend_1.Marker {
24
- /** Constructor, typically invoked indirectly via [[HyperModelingDecorator]].
25
- * @param state The section drawing location state this marker will represent.
26
- * @param pos The world coordinates at which to display the marker.
27
- * @param description A brief description of this marker, used as part of the tooltip when this marker is part of a cluster.
28
- * @param icon The icon displayed by the marker.
29
- * @param tooltip Optional detailed tooltip displayed on mouse hover. If undefined, the `description` is used instead.
30
- */
31
- constructor(state) {
32
- super(state.placement.origin.clone(), markerSize);
33
- /** @internal */
34
- this.onMouseEnterEvent = new core_bentley_1.BeEvent();
35
- /** @internal */
36
- this.onMouseButtonEvent = new core_bentley_1.BeEvent();
37
- /** @internal */
38
- this._isActive = false;
39
- this.state = state;
40
- const data = HyperModeling_1.HyperModeling.getMarkerData(state.sectionType);
41
- this.description = data.label;
42
- if (data.image)
43
- this.setImage(data.image);
44
- this.setScaleFactor({ low: .2, high: 1.4 }); // make size 20% at back of frustum and 140% at front of frustum (if camera is on)
45
- }
46
- /** @internal */
47
- get isHilited() { return this._isHilited; }
48
- /** Returns true if this is the "active" section marker. At most one marker is active at a given time.
49
- * @see [[HyperModelingDecorator.activeMarker]].
50
- * @see [[HyperModelingDecorator.setActiveMarker]].
51
- * @see [[SectionMarkerHandler.toggleMarker]].
52
- */
53
- get isActive() {
54
- return this._isActive;
55
- }
56
- /** @internal */
57
- setActive(active) {
58
- this._isActive = active;
59
- }
60
- /** @internal */
61
- drawActive(ctx) {
62
- ctx.shadowBlur = 30;
63
- ctx.shadowColor = "gold";
64
- return false;
65
- }
66
- /** @internal */
67
- drawDecoration(ctx) {
68
- if (!this.isActive || !this.drawActive(ctx))
69
- super.drawDecoration(ctx);
70
- }
71
- /** @internal */
72
- onMouseEnter(ev) {
73
- // Lazily load the tooltip.
74
- if (undefined === this.title) {
75
- core_common_1.IModelReadRpcInterface.getClientForRouting(this.state.iModel.routingContext.token).getToolTipMessage(this.state.iModel.getRpcProps(), this.state.id).then((tooltipMsg) => {
76
- this.title = core_frontend_1.IModelApp.formatElementToolTip(tooltipMsg);
77
- }).catch((_) => {
78
- this.title = this.description;
79
- });
80
- }
81
- super.onMouseEnter(ev);
82
- this.onMouseEnterEvent.raiseEvent(this);
83
- }
84
- /** @internal */
85
- onMouseButton(ev) {
86
- if (core_frontend_1.InputSource.Mouse === ev.inputSource && core_frontend_1.BeButton.Data === ev.button && ev.isDown && ev.viewport)
87
- this.onMouseButtonEvent.raiseEvent(this);
88
- return true; // Don't allow clicks to be sent to active tool...
89
- }
90
- /** @internal */
91
- addMarker(context) {
92
- super.addMarker(context);
93
- if (this.isHilited)
94
- core_frontend_1.ViewClipTool.drawClip(context, this.state.clip, undefined, { fillClipPlanes: true, hasPrimaryPlane: true });
95
- }
96
- }
97
- exports.SectionMarker = SectionMarker;
98
- /** A Marker used to show a cluster of section locations.
99
- * @internal
100
- */
101
- class SectionMarkerCluster extends core_frontend_1.Marker {
102
- /** Create a new cluster marker */
103
- constructor(location, size, cluster, image) {
104
- super(location, size);
105
- this.imageOffset = new core_geometry_1.Point3d(0, 30);
106
- this.label = cluster.markers.length.toLocaleString();
107
- this.labelColor = "black";
108
- this.labelFont = "bold 14px sans-serif";
109
- const maxLen = 10;
110
- let title = "";
111
- cluster.markers.forEach((marker, index) => {
112
- if (index < maxLen) {
113
- if (title !== "")
114
- title += "<br>";
115
- title += marker.description;
116
- }
117
- });
118
- if (cluster.markers.length > maxLen)
119
- title += "<br>...";
120
- const div = document.createElement("div");
121
- div.innerHTML = title;
122
- this.title = div;
123
- if (image)
124
- this.setImage(image);
125
- }
126
- /** Show the cluster as a white circle with an outline */
127
- drawFunc(ctx) {
128
- ctx.beginPath();
129
- ctx.strokeStyle = "#372528";
130
- ctx.fillStyle = "white";
131
- ctx.lineWidth = 5;
132
- ctx.arc(0, 0, 13, 0, Math.PI * 2);
133
- ctx.fill();
134
- ctx.stroke();
135
- }
136
- onMouseButton(_ev) { return true; } // Don't allow clicks to be sent to active tool...
137
- }
138
- exports.SectionMarkerCluster = SectionMarkerCluster;
139
- /** A [MarkerSet]($frontend) containing [[SectionMarker]]s identifying [SectionDrawingLocation]($backend)s within a spatial view.
140
- * Typically used indirectly via [[HyperModelingDecorator]].
141
- * @public
142
- */
143
- class SectionMarkerSet extends core_frontend_1.MarkerSet {
144
- /** Constructor
145
- * @param viewport The viewport in which the markers are to be displayed.
146
- * @param markers The markers to be displayed.
147
- * @note Each marker's [[SectionDrawingLocationState]] must be associated with the same [IModelConnection]($frontend) as the viewport; any markers from other iModels will be omitted.
148
- */
149
- constructor(viewport, markers) {
150
- super(viewport);
151
- this.minimumClusterSize = 5;
152
- for (const marker of markers) {
153
- if (marker.state.iModel === viewport.iModel)
154
- this.markers.add(marker);
155
- }
156
- }
157
- /** The viewport in which the markers are to be displayed. */
158
- get viewport() {
159
- (0, core_bentley_1.assert)(undefined !== super.viewport);
160
- return super.viewport;
161
- }
162
- /** @internal */
163
- getClusterMarker(cluster) {
164
- return new SectionMarkerCluster(cluster.getClusterLocation(), cluster.markers[0].size, cluster, cluster.markers[0].image);
165
- }
166
- /** Find the SectionMarker corresponding to the specified [SectionDrawingLocation]($backend) Id. */
167
- findMarkerById(sectionDrawingLocationId) {
168
- for (const marker of this.markers)
169
- if (marker.state.id === sectionDrawingLocationId)
170
- return marker;
171
- return undefined;
172
- }
173
- }
174
- exports.SectionMarkerSet = SectionMarkerSet;
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.SectionMarkerSet = exports.SectionMarkerCluster = exports.SectionMarker = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_geometry_1 = require("@itwin/core-geometry");
13
+ const core_common_1 = require("@itwin/core-common");
14
+ const core_frontend_1 = require("@itwin/core-frontend");
15
+ const HyperModeling_1 = require("./HyperModeling");
16
+ const markerSize = core_geometry_1.Point2d.create(40, 40);
17
+ /** A [Marker]($frontend) associated with a [[SectionDrawingLocationState]], displayed as a canvas decoration at the location of the section.
18
+ * Clicking on the marker toggles display of the section graphics. Mousing over the marker produces a toolbar with additional interactions.
19
+ * @see [[HyperModelingDecorator]] for a [Decorator]($frontend) capable of displaying section markers for each section drawing location.
20
+ * @see [[SectionMarkerHandler]] to customize the marker interactions.
21
+ * @public
22
+ */
23
+ class SectionMarker extends core_frontend_1.Marker {
24
+ /** Constructor, typically invoked indirectly via [[HyperModelingDecorator]].
25
+ * @param state The section drawing location state this marker will represent.
26
+ * @param pos The world coordinates at which to display the marker.
27
+ * @param description A brief description of this marker, used as part of the tooltip when this marker is part of a cluster.
28
+ * @param icon The icon displayed by the marker.
29
+ * @param tooltip Optional detailed tooltip displayed on mouse hover. If undefined, the `description` is used instead.
30
+ */
31
+ constructor(state) {
32
+ super(state.placement.origin.clone(), markerSize);
33
+ /** @internal */
34
+ this.onMouseEnterEvent = new core_bentley_1.BeEvent();
35
+ /** @internal */
36
+ this.onMouseButtonEvent = new core_bentley_1.BeEvent();
37
+ /** @internal */
38
+ this._isActive = false;
39
+ this.state = state;
40
+ const data = HyperModeling_1.HyperModeling.getMarkerData(state.sectionType);
41
+ this.description = data.label;
42
+ if (data.image)
43
+ this.setImage(data.image);
44
+ this.setScaleFactor({ low: .2, high: 1.4 }); // make size 20% at back of frustum and 140% at front of frustum (if camera is on)
45
+ }
46
+ /** @internal */
47
+ get isHilited() { return this._isHilited; }
48
+ /** Returns true if this is the "active" section marker. At most one marker is active at a given time.
49
+ * @see [[HyperModelingDecorator.activeMarker]].
50
+ * @see [[HyperModelingDecorator.setActiveMarker]].
51
+ * @see [[SectionMarkerHandler.toggleMarker]].
52
+ */
53
+ get isActive() {
54
+ return this._isActive;
55
+ }
56
+ /** @internal */
57
+ setActive(active) {
58
+ this._isActive = active;
59
+ }
60
+ /** @internal */
61
+ drawActive(ctx) {
62
+ ctx.shadowBlur = 30;
63
+ ctx.shadowColor = "gold";
64
+ return false;
65
+ }
66
+ /** @internal */
67
+ drawDecoration(ctx) {
68
+ if (!this.isActive || !this.drawActive(ctx))
69
+ super.drawDecoration(ctx);
70
+ }
71
+ /** @internal */
72
+ onMouseEnter(ev) {
73
+ // Lazily load the tooltip.
74
+ if (undefined === this.title) {
75
+ core_common_1.IModelReadRpcInterface.getClientForRouting(this.state.iModel.routingContext.token).getToolTipMessage(this.state.iModel.getRpcProps(), this.state.id).then((tooltipMsg) => {
76
+ this.title = core_frontend_1.IModelApp.formatElementToolTip(tooltipMsg);
77
+ }).catch((_) => {
78
+ this.title = this.description;
79
+ });
80
+ }
81
+ super.onMouseEnter(ev);
82
+ this.onMouseEnterEvent.raiseEvent(this);
83
+ }
84
+ /** @internal */
85
+ onMouseButton(ev) {
86
+ if (core_frontend_1.InputSource.Mouse === ev.inputSource && core_frontend_1.BeButton.Data === ev.button && ev.isDown && ev.viewport)
87
+ this.onMouseButtonEvent.raiseEvent(this);
88
+ return true; // Don't allow clicks to be sent to active tool...
89
+ }
90
+ /** @internal */
91
+ addMarker(context) {
92
+ super.addMarker(context);
93
+ if (this.isHilited)
94
+ core_frontend_1.ViewClipTool.drawClip(context, this.state.clip, undefined, { fillClipPlanes: true, hasPrimaryPlane: true });
95
+ }
96
+ }
97
+ exports.SectionMarker = SectionMarker;
98
+ /** A Marker used to show a cluster of section locations.
99
+ * @internal
100
+ */
101
+ class SectionMarkerCluster extends core_frontend_1.Marker {
102
+ /** Create a new cluster marker */
103
+ constructor(location, size, cluster, image) {
104
+ super(location, size);
105
+ this.imageOffset = new core_geometry_1.Point3d(0, 30);
106
+ this.label = cluster.markers.length.toLocaleString();
107
+ this.labelColor = "black";
108
+ this.labelFont = "bold 14px sans-serif";
109
+ const maxLen = 10;
110
+ let title = "";
111
+ cluster.markers.forEach((marker, index) => {
112
+ if (index < maxLen) {
113
+ if (title !== "")
114
+ title += "<br>";
115
+ title += marker.description;
116
+ }
117
+ });
118
+ if (cluster.markers.length > maxLen)
119
+ title += "<br>...";
120
+ const div = document.createElement("div");
121
+ div.innerHTML = title;
122
+ this.title = div;
123
+ if (image)
124
+ this.setImage(image);
125
+ }
126
+ /** Show the cluster as a white circle with an outline */
127
+ drawFunc(ctx) {
128
+ ctx.beginPath();
129
+ ctx.strokeStyle = "#372528";
130
+ ctx.fillStyle = "white";
131
+ ctx.lineWidth = 5;
132
+ ctx.arc(0, 0, 13, 0, Math.PI * 2);
133
+ ctx.fill();
134
+ ctx.stroke();
135
+ }
136
+ onMouseButton(_ev) { return true; } // Don't allow clicks to be sent to active tool...
137
+ }
138
+ exports.SectionMarkerCluster = SectionMarkerCluster;
139
+ /** A [MarkerSet]($frontend) containing [[SectionMarker]]s identifying [SectionDrawingLocation]($backend)s within a spatial view.
140
+ * Typically used indirectly via [[HyperModelingDecorator]].
141
+ * @public
142
+ */
143
+ class SectionMarkerSet extends core_frontend_1.MarkerSet {
144
+ /** Constructor
145
+ * @param viewport The viewport in which the markers are to be displayed.
146
+ * @param markers The markers to be displayed.
147
+ * @note Each marker's [[SectionDrawingLocationState]] must be associated with the same [IModelConnection]($frontend) as the viewport; any markers from other iModels will be omitted.
148
+ */
149
+ constructor(viewport, markers) {
150
+ super(viewport);
151
+ this.minimumClusterSize = 5;
152
+ for (const marker of markers) {
153
+ if (marker.state.iModel === viewport.iModel)
154
+ this.markers.add(marker);
155
+ }
156
+ }
157
+ /** The viewport in which the markers are to be displayed. */
158
+ get viewport() {
159
+ (0, core_bentley_1.assert)(undefined !== super.viewport);
160
+ return super.viewport;
161
+ }
162
+ /** @internal */
163
+ getClusterMarker(cluster) {
164
+ return new SectionMarkerCluster(cluster.getClusterLocation(), cluster.markers[0].size, cluster, cluster.markers[0].image);
165
+ }
166
+ /** Find the SectionMarker corresponding to the specified [SectionDrawingLocation]($backend) Id. */
167
+ findMarkerById(sectionDrawingLocationId) {
168
+ for (const marker of this.markers)
169
+ if (marker.state.id === sectionDrawingLocationId)
170
+ return marker;
171
+ return undefined;
172
+ }
173
+ }
174
+ exports.SectionMarkerSet = SectionMarkerSet;
175
175
  //# sourceMappingURL=SectionMarkers.js.map
@@ -1,6 +1,6 @@
1
- /** @packageDocumentation
2
- * @module HyperModeling
3
- */
4
- /** @internal */
5
- export declare function registerTools(namespace: string): void;
1
+ /** @packageDocumentation
2
+ * @module HyperModeling
3
+ */
4
+ /** @internal */
5
+ export declare function registerTools(namespace: string): void;
6
6
  //# sourceMappingURL=Tools.d.ts.map