@xeokit/xeokit-sdk 2.2.4 → 2.2.5-beta-2

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 (107) hide show
  1. package/dist/xeokit-sdk.cjs.js +77 -40
  2. package/dist/xeokit-sdk.es.js +77 -40
  3. package/dist/xeokit-sdk.min.cjs.js +1 -1
  4. package/dist/xeokit-sdk.min.es.js +1 -1
  5. package/package.json +4 -2
  6. package/types/extras/ContextMenu/ContextMenu.d.ts +125 -0
  7. package/types/extras/ContextMenu/index.d.ts +1 -0
  8. package/types/extras/index.d.ts +1 -0
  9. package/types/index.d.ts +3 -0
  10. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +144 -0
  11. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +42 -0
  12. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +85 -0
  13. package/types/plugins/AngleMeasurementsPlugin/index.d.ts +1 -0
  14. package/types/plugins/AnnotationsPlugin/Annotation.d.ts +134 -0
  15. package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +117 -0
  16. package/types/plugins/AnnotationsPlugin/index.d.ts +1 -0
  17. package/types/plugins/AxisGizmoPlugin/AxisGizmoPlugin.d.ts +28 -0
  18. package/types/plugins/AxisGizmoPlugin/index.d.ts +1 -0
  19. package/types/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.d.ts +146 -0
  20. package/types/plugins/BCFViewpointsPlugin/index.d.ts +1 -0
  21. package/types/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.d.ts +81 -0
  22. package/types/plugins/CityJSONLoaderPlugin/index.d.ts +1 -0
  23. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +137 -0
  24. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +40 -0
  25. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +120 -0
  26. package/types/plugins/DistanceMeasurementsPlugin/index.d.ts +1 -0
  27. package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +203 -0
  28. package/types/plugins/FastNavPlugin/index.d.ts +1 -0
  29. package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +140 -0
  30. package/types/plugins/GLTFLoaderPlugin/index.d.ts +1 -0
  31. package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +146 -0
  32. package/types/plugins/LASLoaderPlugin/index.d.ts +1 -0
  33. package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +160 -0
  34. package/types/plugins/NavCubePlugin/index.d.ts +1 -0
  35. package/types/plugins/OBJLoaderPlugin/OBJLoaderPlugin.d.ts +44 -0
  36. package/types/plugins/OBJLoaderPlugin/index.d.ts +1 -0
  37. package/types/plugins/STLLoaderPlugin/STLLoaderPlugin.d.ts +88 -0
  38. package/types/plugins/STLLoaderPlugin/index.d.ts +2 -0
  39. package/types/plugins/SectionPlanesPlugin/SectionPlanesPlugin.d.ts +103 -0
  40. package/types/plugins/SectionPlanesPlugin/index.d.ts +1 -0
  41. package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +34 -0
  42. package/types/plugins/SkyboxesPlugin/index.d.ts +1 -0
  43. package/types/plugins/StoreyViewsPlugin/Storey.d.ts +47 -0
  44. package/types/plugins/StoreyViewsPlugin/StoreyMap.d.ts +41 -0
  45. package/types/plugins/StoreyViewsPlugin/StoreyViewsPlugin.d.ts +173 -0
  46. package/types/plugins/StoreyViewsPlugin/index.d.ts +1 -0
  47. package/types/plugins/TreeViewPlugin/ModelTreeView.d.ts +24 -0
  48. package/types/plugins/TreeViewPlugin/TreeViewNode.d.ts +66 -0
  49. package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +136 -0
  50. package/types/plugins/TreeViewPlugin/index.d.ts +1 -0
  51. package/types/plugins/ViewCullPlugin/ViewCullPlugin.d.ts +34 -0
  52. package/types/plugins/ViewCullPlugin/index.d.ts +1 -0
  53. package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +230 -0
  54. package/types/plugins/WebIFCLoaderPlugin/index.d.ts +1 -0
  55. package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +277 -0
  56. package/types/plugins/XKTLoaderPlugin/index.d.ts +1 -0
  57. package/types/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.d.ts +65 -0
  58. package/types/plugins/XML3DLoaderPlugin/index.d.ts +1 -0
  59. package/types/plugins/index.d.ts +34 -0
  60. package/types/viewer/Configs.d.ts +20 -0
  61. package/types/viewer/Plugin.d.ts +69 -0
  62. package/types/viewer/Viewer.d.ts +212 -0
  63. package/types/viewer/index.d.ts +6 -0
  64. package/types/viewer/localization/LocaleService.d.ts +176 -0
  65. package/types/viewer/metadata/IFCObjectDefaults.d.ts +9 -0
  66. package/types/viewer/metadata/MetaModel.d.ts +65 -0
  67. package/types/viewer/metadata/MetaObject.d.ts +74 -0
  68. package/types/viewer/metadata/MetaScene.d.ts +135 -0
  69. package/types/viewer/metadata/Property.d.ts +29 -0
  70. package/types/viewer/metadata/PropertySet.d.ts +31 -0
  71. package/types/viewer/metadata/index.d.ts +6 -0
  72. package/types/viewer/scene/CameraControl/CameraControl.d.ts +591 -0
  73. package/types/viewer/scene/Component.d.ts +155 -0
  74. package/types/viewer/scene/Entity.d.ts +394 -0
  75. package/types/viewer/scene/PerformanceModel/PerformanceModel.d.ts +605 -0
  76. package/types/viewer/scene/PerformanceModel/PerformanceNode.d.ts +302 -0
  77. package/types/viewer/scene/camera/Camera.d.ts +364 -0
  78. package/types/viewer/scene/camera/CameraFlightAnimation.d.ts +167 -0
  79. package/types/viewer/scene/camera/CameraPath.d.ts +28 -0
  80. package/types/viewer/scene/camera/CameraPathAnimation.d.ts +95 -0
  81. package/types/viewer/scene/camera/CustomProjection.d.ts +57 -0
  82. package/types/viewer/scene/camera/Frustum.d.ts +166 -0
  83. package/types/viewer/scene/camera/Ortho.d.ts +115 -0
  84. package/types/viewer/scene/camera/Perspective.d.ts +136 -0
  85. package/types/viewer/scene/camera/index.d.ts +4 -0
  86. package/types/viewer/scene/geometry/Geometry.d.ts +7 -0
  87. package/types/viewer/scene/geometry/ReadableGeometry.d.ts +95 -0
  88. package/types/viewer/scene/geometry/index.d.ts +1 -0
  89. package/types/viewer/scene/index.d.ts +6 -0
  90. package/types/viewer/scene/marker/Marker.d.ts +136 -0
  91. package/types/viewer/scene/marker/index.d.ts +1 -0
  92. package/types/viewer/scene/materials/EdgeMaterial.d.ts +83 -0
  93. package/types/viewer/scene/materials/EmphasisMaterial.d.ts +241 -0
  94. package/types/viewer/scene/materials/Fresnel.d.ts +149 -0
  95. package/types/viewer/scene/materials/LinesMaterial.d.ts +71 -0
  96. package/types/viewer/scene/materials/Material.d.ts +3 -0
  97. package/types/viewer/scene/materials/PhongMaterial.d.ts +468 -0
  98. package/types/viewer/scene/materials/PointsMaterial.d.ts +206 -0
  99. package/types/viewer/scene/materials/Texture.d.ts +261 -0
  100. package/types/viewer/scene/materials/index.d.ts +5 -0
  101. package/types/viewer/scene/math/math.d.ts +36 -0
  102. package/types/viewer/scene/postfx/SAO.d.ts +209 -0
  103. package/types/viewer/scene/scene/Scene.d.ts +727 -0
  104. package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +93 -0
  105. package/types/viewer/scene/sectionPlane/index.d.ts +1 -0
  106. package/types/viewer/scene/viewport/Viewport.d.ts +23 -0
  107. package/types/viewer/scene/webgl/PickResult.d.ts +103 -0
@@ -0,0 +1,28 @@
1
+ import { Plugin, Viewer } from "../../viewer";
2
+
3
+ export declare type AxisGizmoPluginConfiguration = {
4
+ /** Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}. */
5
+ id?: string;
6
+ /** ID of an existing HTML canvas to display the AxisGizmo - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID. */
7
+ canvasId?: string;
8
+ /** Reference of an existing HTML canvas to display the AxisGizmo - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID. */
9
+ canvasElement?: HTMLCanvasElement;
10
+ }
11
+
12
+ /**
13
+ * {@link Viewer} plugin that shows the axii of the World-space coordinate system.
14
+ */
15
+ export declare class AxisGizmoPlugin extends Plugin {
16
+ /**
17
+ * @constructor
18
+ * @param {Viewer} viewer The Viewer.
19
+ * @param {AxisGizmoPluginConfiguration} cfg Plugin configuration.
20
+ */
21
+ constructor(viewer: Viewer, cfg:AxisGizmoPluginConfiguration );
22
+
23
+ /** Shows or hides this AxisGizmoPlugin.
24
+ *
25
+ * @param visible
26
+ */
27
+ setVisible(visible: boolean): void;
28
+ }
@@ -0,0 +1 @@
1
+ export * from "./AxisGizmoPlugin";
@@ -0,0 +1,146 @@
1
+ import { Plugin, Viewer } from "../../viewer";
2
+
3
+ export declare type BCFViewpointsPluginConfiguration = {
4
+ /** Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}. */
5
+ id?: string;
6
+ /** Identifies the originating system for BCF records. */
7
+ originatingSystem?: string;
8
+ /** Identifies the authoring tool for BCF records. */
9
+ authoringTool?: string;
10
+ };
11
+
12
+ /**
13
+ * {@link Viewer} plugin that saves and loads BCF viewpoints as JSON objects.
14
+ */
15
+ export class BCFViewpointsPlugin extends Plugin {
16
+ /**
17
+ * @constructor
18
+ * @param {Viewer} viewer The Viewer.
19
+ * @param {BCFViewpointsPluginConfiguration} cfg Plugin configuration.
20
+ */
21
+ constructor(viewer: Viewer, cfg?:BCFViewpointsPluginConfiguration );
22
+
23
+ /**
24
+ * Identifies the originating system to include in BCF viewpoints saved by this plugin.
25
+ * @type {string}
26
+ */
27
+ originatingSystem: string;
28
+
29
+ /**
30
+ * Identifies the authoring tool to include in BCF viewpoints saved by this plugin.
31
+ * @type {string}
32
+ */
33
+ authoringTool: string;
34
+
35
+ /**
36
+ * Saves viewer state to a BCF viewpoint.
37
+ *
38
+ * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
39
+ * direction vector. Therefore, we save ````camera_direction```` as the vector from {@link Camera#eye} to {@link Camera#look}.
40
+ *
41
+ * @param {*} [options] Options for getting the viewpoint.
42
+ * @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.
43
+ * @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.
44
+ * @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.
45
+ * @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.
46
+ * @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects
47
+ * as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that
48
+ * were not saved in the viewpoint, those models will be hidden when we load the viewpoint, and that only the
49
+ * objects in the viewpoint will be visible.
50
+ * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
51
+ * @returns {*} BCF JSON viewpoint object
52
+ * @example
53
+ *
54
+ * const viewer = new Viewer();
55
+ *
56
+ * const bcfPlugin = new BCFPlugin(viewer, {
57
+ * //...
58
+ * });
59
+ *
60
+ * const viewpoint = bcfPlugin.getViewpoint({ // Options - see constructor
61
+ * spacesVisible: false, // Default
62
+ * spaceBoundariesVisible: false, // Default
63
+ * openingsVisible: false // Default
64
+ * });
65
+ *
66
+ * // viewpoint will resemble the following:
67
+ *
68
+ * {
69
+ * perspective_camera: {
70
+ * camera_view_point: {
71
+ * x: 0.0,
72
+ * y: 0.0,
73
+ * z: 0.0
74
+ * },
75
+ * camera_direction: {
76
+ * x: 1.0,
77
+ * y: 1.0,
78
+ * z: 2.0
79
+ * },
80
+ * camera_up_vector: {
81
+ * x: 0.0,
82
+ * y: 0.0,
83
+ * z: 1.0
84
+ * },
85
+ * field_of_view: 90.0
86
+ * },
87
+ * lines: [],
88
+ * clipping_planes: [{
89
+ * location: {
90
+ * x: 0.5,
91
+ * y: 0.5,
92
+ * z: 0.5
93
+ * },
94
+ * direction: {
95
+ * x: 1.0,
96
+ * y: 0.0,
97
+ * z: 0.0
98
+ * }
99
+ * }],
100
+ * bitmaps: [],
101
+ * snapshot: {
102
+ * snapshot_type: png,
103
+ * snapshot_data: "data:image/png;base64,......"
104
+ * },
105
+ * components: {
106
+ * visibility: {
107
+ * default_visibility: false,
108
+ * exceptions: [{
109
+ * ifc_guid: 4$cshxZO9AJBebsni$z9Yk,
110
+ * originating_system: xeokit.io,
111
+ * authoring_tool_id: xeokit/v1.0
112
+ * }]
113
+ * },
114
+ * selection: [{
115
+ * ifc_guid: "4$cshxZO9AJBebsni$z9Yk",
116
+ * }]
117
+ * }
118
+ * }
119
+ */
120
+ getViewpoint(options?: any): any;
121
+
122
+ /**
123
+ * Sets viewer state to the given BCF viewpoint.
124
+ *
125
+ * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
126
+ * direction vector. Therefore, when loading a BCF viewpoint, we set {@link Camera#look} to the absolute position
127
+ * obtained by offsetting the BCF ````camera_view_point```` along ````camera_direction````.
128
+ *
129
+ * When loading a viewpoint, we also have the option to find {@link Camera#look} as the closest point of intersection
130
+ * (on the surface of any visible and pickable {@link Entity}) with a 3D ray fired from ````camera_view_point```` in
131
+ * the direction of ````camera_direction````.
132
+ *
133
+ * @param {*} bcfViewpoint BCF JSON viewpoint object,
134
+ * shows default visible entities and restores camera to initial default position.
135
+ * @param {*} [options] Options for setting the viewpoint.
136
+ * @param {Boolean} [options.rayCast=true] When ````true```` (default), will attempt to set {@link Camera#look} to the closest
137
+ * point of surface intersection with a ray fired from the BCF ````camera_view_point```` in the direction of ````camera_direction````.
138
+ * @param {Boolean} [options.immediate=true] When ````true```` (default), immediately set camera position.
139
+ * @param {Boolean} [options.duration] Flight duration in seconds. Overrides {@link CameraFlightAnimation#duration}. Only applies when ````immediate```` is ````false````.
140
+ * @param {Boolean} [options.reset=true] When ````true```` (default), set {@link Entity#xrayed} and {@link Entity#highlighted} ````false```` on all scene objects.
141
+ * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
142
+ * @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
143
+ * then this method will apply the updates to objects within those composites.
144
+ */
145
+ setViewpoint(bcfViewpoint: any, options?: any): void;
146
+ }
@@ -0,0 +1 @@
1
+ export * from "./BCFViewpointsPlugin";
@@ -0,0 +1,81 @@
1
+ import { Plugin, Viewer, PerformanceModel } from "../../viewer";
2
+ import { ModelStats } from "../index";
3
+
4
+ export declare interface ICityJSONDefaultDataSource {
5
+ /**
6
+ * Gets the contents of the given CityJSON file.
7
+ *
8
+ * @param {String|Number} src Path or ID of an CityJSON file.
9
+ * @param {Function} ok Callback fired on success, argument is the CityJSON JSON.
10
+ * @param {Function} error Callback fired on error.
11
+ */
12
+ getCityJSON(src: string | number, ok: (json: any)=> void, error: (e: Error)=> void): void;
13
+ }
14
+
15
+ export declare type CityJSONLoaderPluginConfiguration = {
16
+ /** Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}. */
17
+ id?: string;
18
+ /** A custom data source through which the CityJSONLoaderPlugin can load model and metadata files. Defaults to an instance of {@link CityJSONDefaultDataSource}, which loads over HTTP.*/
19
+ dataSource?: ICityJSONDefaultDataSource;
20
+ };
21
+
22
+ export declare type LoadCityJSONModel = {
23
+ /** ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default. */
24
+ id?: string;
25
+ /** Path to a CityJSON file, as an alternative to the ````cityJSON```` parameter. */
26
+ src?: string;
27
+ /** The CityJSON file data, as an alternative to the ````src```` parameter. */
28
+ cityJSON?: ArrayBuffer;
29
+ /** Whether to load metadata on CityJSON objects. */
30
+ loadMetadata?: boolean;
31
+ /** The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates. */
32
+ origin?: number[];
33
+ /** The model single-precision 3D position, relative to the ````origin```` parameter. */
34
+ position?: number[];
35
+ /** The model's scale. */
36
+ scale?: number[];
37
+ /** The model's orientation, given as Euler angles in degrees, for each of the X, Y and Z axis. */
38
+ rotation?: number[];
39
+ /** The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````. */
40
+ matrix?: number[];
41
+ /** Collects model statistics. */
42
+ stats?: ModelStats;
43
+ };
44
+
45
+ /**
46
+ * {@link Viewer} plugin that loads models from CityJSON files.
47
+ */
48
+ export declare class CityJSONLoaderPlugin extends Plugin {
49
+ /**
50
+ * @constructor
51
+ *
52
+ * @param {Viewer} viewer The Viewer.
53
+ * @param {CityJSONLoaderPluginConfiguration} cfg Plugin configuration.
54
+ */
55
+ constructor(viewer: Viewer, cfg?: CityJSONLoaderPluginConfiguration);
56
+
57
+ /**
58
+ * Sets a custom data source through which the CityJSONLoaderPlugin can load CityJSON files.
59
+ *
60
+ * Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.
61
+ *
62
+ * @type {Object}
63
+ */
64
+ set dataSource(arg: ICityJSONDefaultDataSource);
65
+
66
+ /**
67
+ * Gets the custom data source through which the CityJSONLoaderPlugin can load CityJSON files.
68
+ *
69
+ * Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.
70
+ *
71
+ * @type {Object}
72
+ */
73
+ get dataSource(): ICityJSONDefaultDataSource;
74
+
75
+ /**
76
+ * Loads an ````CityJSON```` model into this CityJSONLoaderPlugin's {@link Viewer}.
77
+ *
78
+ * @param {LoadCityJSONModel} params Loading parameters.
79
+ */
80
+ load(params: LoadCityJSONModel): PerformanceModel;
81
+ }
@@ -0,0 +1 @@
1
+ export * from "./CityJSONLoaderPlugin";
@@ -0,0 +1,137 @@
1
+ import { Component } from "../../viewer/scene/Component";
2
+ import { DistanceMeasurementsPlugin } from "./DistanceMeasurementsPlugin";
3
+ import { Marker } from "../../viewer/scene/marker";
4
+
5
+ /**
6
+ * @desc Measures the distance between two 3D points.
7
+ */
8
+ export class DistanceMeasurement extends Component {
9
+ /**
10
+ * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.
11
+ * @type {DistanceMeasurementsPlugin}
12
+ */
13
+ plugin: DistanceMeasurementsPlugin;
14
+
15
+ /**
16
+ * Sets whether this DistanceMeasurement indicates that its measurement is approximate.
17
+ *
18
+ * This is ````true```` by default.
19
+ *
20
+ * @type {Boolean}
21
+ */
22
+ set approximate(arg: boolean);
23
+
24
+ /**
25
+ * Gets whether this DistanceMeasurement indicates that its measurement is approximate.
26
+ *
27
+ * This is ````true```` by default.
28
+ *
29
+ * @type {Boolean}
30
+ */
31
+ get approximate(): boolean;
32
+
33
+ /**
34
+ * Sets whether this DistanceMeasurement is visible or not.
35
+ *
36
+ * @type Boolean
37
+ */
38
+ set visible(arg: boolean);
39
+
40
+ /**
41
+ * Gets whether this DistanceMeasurement is visible or not.
42
+ *
43
+ * @type Boolean
44
+ */
45
+ get visible(): boolean;
46
+
47
+ /**
48
+ * Sets if the origin {@link Marker} is visible.
49
+ *
50
+ * @type {Boolean}
51
+ */
52
+ set originVisible(arg: boolean);
53
+
54
+ /**
55
+ * Gets if the origin {@link Marker} is visible.
56
+ *
57
+ * @type {Boolean}
58
+ */
59
+ get originVisible(): boolean;
60
+
61
+ /**
62
+ * Sets if the target {@link Marker} is visible.
63
+ *
64
+ * @type {Boolean}
65
+ */
66
+ set targetVisible(arg: boolean);
67
+
68
+ /**
69
+ * Gets if the target {@link Marker} is visible.
70
+ *
71
+ * @type {Boolean}
72
+ */
73
+ get targetVisible(): boolean;
74
+
75
+ /**
76
+ * Sets if the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.
77
+ *
78
+ * @type {Boolean}
79
+ */
80
+ set wireVisible(arg: boolean);
81
+
82
+ /**
83
+ * Gets if the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.
84
+ *
85
+ * @type {Boolean}
86
+ */
87
+ get wireVisible(): boolean;
88
+
89
+ /**
90
+ * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
91
+ *
92
+ * @type {Boolean}
93
+ */
94
+ set axisVisible(arg: boolean);
95
+
96
+ /**
97
+ * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
98
+ *
99
+ * @type {Boolean}
100
+ */
101
+ get axisVisible(): boolean;
102
+
103
+ /**
104
+ * Gets the origin {@link Marker}.
105
+ *
106
+ * @type {Marker}
107
+ */
108
+ get origin(): Marker;
109
+
110
+ /**
111
+ * Gets the target {@link Marker}.
112
+ *
113
+ * @type {Marker}
114
+ */
115
+ get target(): Marker;
116
+
117
+ /**
118
+ * Gets the World-space direct point-to-point distance between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
119
+ *
120
+ * @type {Number}
121
+ */
122
+ get length(): number;
123
+
124
+ /**
125
+ * Sets the color.
126
+ *
127
+ * @type {String}
128
+ */
129
+ set color(arg: string);
130
+
131
+ /**
132
+ * Gets the color.
133
+ *
134
+ * @type {String}
135
+ */
136
+ get color(): string;
137
+ }
@@ -0,0 +1,40 @@
1
+ import { Component } from "../../viewer/scene/Component";
2
+ import { DistanceMeasurementsPlugin } from "./DistanceMeasurementsPlugin";
3
+
4
+ /**
5
+ * Creates {@link DistanceMeasurement}s from mouse and touch input.
6
+ */
7
+ export class DistanceMeasurementsControl extends Component {
8
+ /**
9
+ * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsControl.
10
+ * @type {DistanceMeasurementsPlugin}
11
+ */
12
+ plugin: DistanceMeasurementsPlugin;
13
+
14
+ /** Gets if this DistanceMeasurementsControl is currently active, where it is responding to input.
15
+ *
16
+ * @returns {boolean}
17
+ */
18
+ get active(): boolean;
19
+
20
+ /**
21
+ * Activates this DistanceMeasurementsControl, ready to respond to input.
22
+ */
23
+ activate(): void;
24
+
25
+ /**
26
+ * Deactivates this DistanceMeasurementsControl, making it unresponsive to input.
27
+ *
28
+ * Destroys any {@link DistanceMeasurement} under construction.
29
+ */
30
+ deactivate(): void;
31
+
32
+ /**
33
+ * Resets this DistanceMeasurementsControl.
34
+ *
35
+ * Destroys any {@link DistanceMeasurement} under construction.
36
+ *
37
+ * Does nothing if the DistanceMeasurementsControl is not active.
38
+ */
39
+ reset(): void;
40
+ }
@@ -0,0 +1,120 @@
1
+ import { Entity, Plugin, Viewer } from "../../viewer";
2
+ import { DistanceMeasurementsControl } from "./DistanceMeasurementsControl";
3
+ import { DistanceMeasurement } from "./DistanceMeasurement";
4
+
5
+ export declare type DistanceMeasurementsPluginConfiguration = {
6
+ /** Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}. */
7
+ id?: string;
8
+ /** The minimum length, in pixels, of an axis wire beyond which its label is shown. */
9
+ labelMinAxisLength?: number;
10
+ /** Container DOM element for markers and labels. Defaults to ````document.body````. */
11
+ container?: HTMLElement;
12
+ /** The default value of the DistanceMeasurements `visible` property. */
13
+ defaultVisible?: boolean;
14
+ /** The default value of the DistanceMeasurements `originVisible` property. */
15
+ defaultOriginVisible?: boolean;
16
+ /** The default value of the DistanceMeasurements `targetVisible` property. */
17
+ defaultTargetVisible?: boolean;
18
+ /** The default value of the DistanceMeasurements `wireVisible` property. */
19
+ defaultWireVisible?: boolean;
20
+ /** The default value of the DistanceMeasurements `axisVisible` property. */
21
+ defaultAxisVisible?: boolean;
22
+ /** The default color of the length dots, wire and label. */
23
+ defaultColor?: string;
24
+ /** If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels). */
25
+ zIndex?: number;
26
+ };
27
+
28
+ /**
29
+ * {@link Viewer} plugin for measuring point-to-point distances.
30
+ */
31
+ export class DistanceMeasurementsPlugin extends Plugin {
32
+ /**
33
+ * @constructor
34
+ * @param {Viewer} viewer The Viewer.
35
+ * @param {DistanceMeasurementsPluginConfiguration} [cfg] Plugin configuration.
36
+ */
37
+ constructor(viewer: Viewer, cfg?: DistanceMeasurementsPluginConfiguration);
38
+
39
+ /**
40
+ * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.
41
+ *
42
+ * The axis wire's label is not shown when its length is less than this value.
43
+ *
44
+ * This is ````25```` pixels by default.
45
+ *
46
+ * Must not be less than ````1````.
47
+ *
48
+ * @type {number}
49
+ */
50
+ set labelMinAxisLength(arg: number);
51
+
52
+ /**
53
+ * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.
54
+ * @returns {number}
55
+ */
56
+ get labelMinAxisLength(): number;
57
+
58
+ /**
59
+ * Gets the {@link DistanceMeasurementsControl}, which creates {@link DistanceMeasurement}s from user input.
60
+ *
61
+ * @type {DistanceMeasurementsControl}
62
+ */
63
+ get control(): DistanceMeasurementsControl;
64
+
65
+ /**
66
+ * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.
67
+ *
68
+ * @type {{String:DistanceMeasurement}}
69
+ */
70
+ get measurements(): { [key:string]: DistanceMeasurement };
71
+
72
+ /**
73
+ * Creates a {@link DistanceMeasurement}.
74
+ *
75
+ * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.
76
+ *
77
+ * @param {Object} params {@link DistanceMeasurement} configuration.
78
+ * @param {String} params.id Unique ID to assign to {@link DistanceMeasurement#id}. The DistanceMeasurement will be registered by this in {@link DistanceMeasurementsPlugin#measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
79
+ * @param {Number[]} params.origin.worldPos Origin World-space 3D position.
80
+ * @param {Entity} params.origin.entity Origin Entity.
81
+ * @param {Number[]} params.target.worldPos Target World-space 3D position.
82
+ * @param {Entity} params.target.entity Target Entity.
83
+ * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.
84
+ * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.
85
+ * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
86
+ * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
87
+ * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88
+ * @param {string} [params.color] The color of the length dot, wire and label.
89
+ * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
90
+ */
91
+ createMeasurement(params?: {
92
+ id: string;
93
+ origin: {
94
+ entity: Entity;
95
+ worldPos: number[];
96
+ };
97
+ target: {
98
+ entity: Entity;
99
+ worldPos: number[];
100
+ };
101
+ visible?: boolean;
102
+ originVisible?: boolean;
103
+ targetVisible?: boolean;
104
+ wireVisible?: boolean;
105
+ axisVisible?: boolean;
106
+ color?: string;
107
+ }): DistanceMeasurement;
108
+
109
+ /**
110
+ * Destroys a {@link DistanceMeasurement}.
111
+ *
112
+ * @param {String} id ID of DistanceMeasurement to destroy.
113
+ */
114
+ destroyMeasurement(id: string): void;
115
+
116
+ /**
117
+ * Destroys all {@link DistanceMeasurement}s.
118
+ */
119
+ clear(): void;
120
+ }
@@ -0,0 +1 @@
1
+ export * from "./DistanceMeasurementsPlugin";