@kitware/vtk.js 23.4.2 → 24.0.0-beta.1
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/BREAKING_CHANGES.md +33 -0
- package/Common/Core/DataArray.js +4 -0
- package/Common/Core/Math/index.js +2 -2
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/BoundingBox.js +3 -8
- package/Common/DataModel/DataSetAttributes/FieldData.js +9 -5
- package/Common/DataModel/ITKHelper.js +2 -346
- package/Common/DataModel/ImageData.d.ts +23 -6
- package/Common/DataModel/ImageData.js +8 -1
- package/Common/DataModel/PolyData.d.ts +8 -1
- package/Common/DataModel/PolyData.js +5 -3
- package/Common/DataModel/Triangle.js +217 -2
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1249 -0
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/General.js +2 -0
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/PointSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/IO/Core/DataAccessHelper.d.ts +0 -6
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleImage.js +3 -3
- package/Interaction/Style/InteractorStyleMPRSlice.js +12 -6
- package/Interaction/Style/InteractorStyleManipulator.js +42 -28
- package/Interaction/Style/InteractorStyleRemoteMouse.js +32 -14
- package/Interaction/Style/InteractorStyleTrackballCamera.js +7 -7
- package/Interaction/Widgets/OrientationMarkerWidget.js +18 -13
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
- package/Interaction/Widgets.js +1 -35
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/InteractorObserver.js +11 -10
- package/Rendering/Core/InteractorStyle.js +9 -4
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Prop.js +6 -4
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +24 -17
- package/Rendering/Core/Renderer.js +24 -19
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/Viewport.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/OpenGL/Actor.js +2 -2
- package/Rendering/OpenGL/Actor2D.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +6 -5
- package/Rendering/OpenGL/Camera.js +3 -3
- package/Rendering/OpenGL/CellArrayBufferObject.js +1 -1
- package/Rendering/OpenGL/Framebuffer.js +13 -12
- package/Rendering/OpenGL/Glyph3DMapper.js +10 -8
- package/Rendering/OpenGL/HardwareSelector.js +35 -25
- package/Rendering/OpenGL/ImageMapper.js +51 -45
- package/Rendering/OpenGL/ImageSlice.js +2 -2
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +4 -2
- package/Rendering/OpenGL/PolyDataMapper.js +14 -11
- package/Rendering/OpenGL/PolyDataMapper2D.js +17 -16
- package/Rendering/OpenGL/Renderer.js +11 -7
- package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
- package/Rendering/OpenGL/ScalarBarActor.js +2 -2
- package/Rendering/OpenGL/ShaderCache.js +7 -5
- package/Rendering/OpenGL/Skybox.js +11 -9
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +2 -2
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +13 -12
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +11 -9
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +19 -12
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +9 -6
- package/Rendering/OpenGL/Texture.js +44 -31
- package/Rendering/OpenGL/VertexArrayObject.js +7 -7
- package/Rendering/OpenGL/Volume.js +3 -2
- package/Rendering/OpenGL/VolumeMapper.js +30 -26
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/ViewNode.js +8 -7
- package/Rendering/WebGPU/Renderer.js +18 -10
- package/Widgets/Core/AbstractWidget.js +5 -4
- package/Widgets/Core/AbstractWidgetFactory.js +2 -1
- package/Widgets/Core/WidgetManager.js +66 -49
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/CircleContextRepresentation.js +1 -1
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +5 -5
- package/Widgets/Representations/PolyLineRepresentation.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +7 -7
- package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +2 -2
- package/Widgets/SVG/SVGLandmarkRepresentation.js +21 -8
- package/Widgets/SVG/SVGRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/EllipseWidget.js +0 -1
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +4 -2
- package/Widgets/Widgets3D/LabelWidget/behavior.js +138 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +79 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +18 -9
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +0 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +5 -3
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +18 -8
- package/Widgets/Widgets3D/RectangleWidget.js +0 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +18 -11
- package/Widgets/Widgets3D/SplineWidget/behavior.js +33 -21
- package/index.d.ts +1 -2
- package/interfaces.d.ts +16 -3
- package/macros.d.ts +26 -1
- package/macros.js +51 -19
- package/package.json +1 -1
- package/types.d.ts +1 -0
- package/Interaction/Widgets/AbstractWidget.js +0 -104
- package/Interaction/Widgets/DistanceRepresentation.js +0 -116
- package/Interaction/Widgets/DistanceWidget.js +0 -77
- package/Interaction/Widgets/HandleRepresentation/Constants.js +0 -12
- package/Interaction/Widgets/HandleRepresentation.js +0 -100
- package/Interaction/Widgets/HandleWidget/Constants.js +0 -9
- package/Interaction/Widgets/HandleWidget.js +0 -194
- package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +0 -233
- package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +0 -16
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +0 -573
- package/Interaction/Widgets/LabelRepresentation/Constants.js +0 -17
- package/Interaction/Widgets/LabelRepresentation.js +0 -325
- package/Interaction/Widgets/LabelWidget.js +0 -65
- package/Interaction/Widgets/LineRepresentation/Constants.js +0 -21
- package/Interaction/Widgets/LineRepresentation.js +0 -498
- package/Interaction/Widgets/LineWidget/Constants.js +0 -11
- package/Interaction/Widgets/LineWidget.js +0 -296
- package/Interaction/Widgets/PointPlacer.js +0 -51
- package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +0 -269
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +0 -146
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +0 -332
- package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +0 -134
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation/Constants.js +0 -16
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +0 -371
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +0 -157
- package/Interaction/Widgets/SphereHandleRepresentation.js +0 -370
- package/Interaction/Widgets/WidgetRepresentation.js +0 -121
- package/Widgets/Representations/SphereContextRepresentation.js +0 -131
- package/Widgets/Widgets3D/SphereWidget/behavior.js +0 -177
- package/Widgets/Widgets3D/SphereWidget/state.js +0 -45
- package/Widgets/Widgets3D/SphereWidget.d.ts +0 -50
- package/Widgets/Widgets3D/SphereWidget.js +0 -62
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import macro from '../../macros.js';
|
|
4
|
-
import vtkLabelRepresentation from './LabelRepresentation.js';
|
|
5
|
-
import vtkLineRepresentation from './LineRepresentation.js';
|
|
6
|
-
import { f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
7
|
-
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
// vtkDistanceRepresentation methods
|
|
12
|
-
// ----------------------------------------------------------------------------
|
|
13
|
-
|
|
14
|
-
function vtkDistanceRepresentation(publicAPI, model) {
|
|
15
|
-
// Set our className
|
|
16
|
-
model.classHierarchy.push('vtkDistanceRepresentation');
|
|
17
|
-
|
|
18
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
19
|
-
|
|
20
|
-
publicAPI.setRenderer = function (renderer) {
|
|
21
|
-
model.labelRepresentation.setRenderer(renderer);
|
|
22
|
-
superClass.setRenderer(renderer);
|
|
23
|
-
publicAPI.modified();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
publicAPI.getContainer = function () {
|
|
27
|
-
return model.labelRepresentation.getContainer();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
publicAPI.setContainer = function (container) {
|
|
31
|
-
model.labelRepresentation.setContainer(container);
|
|
32
|
-
publicAPI.modified();
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
publicAPI.getLabelStyle = function () {
|
|
36
|
-
return model.labelRepresentation.getLabelStyle();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
publicAPI.setLabelStyle = function (labelStyle) {
|
|
40
|
-
model.labelRepresentation.setLabelStyle(labelStyle);
|
|
41
|
-
publicAPI.modified();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
publicAPI.getActors = function () {
|
|
45
|
-
var actors = superClass.getActors();
|
|
46
|
-
actors = [].concat(_toConsumableArray(actors), _toConsumableArray(model.labelRepresentation.getActors()));
|
|
47
|
-
return actors;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
publicAPI.getDistance = function () {
|
|
51
|
-
return Math.sqrt(distance2BetweenPoints(publicAPI.getPoint1WorldPosition(), publicAPI.getPoint2WorldPosition())).toFixed(model.numberOfDecimals);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
publicAPI.setPoint1WorldPosition = function (pos) {
|
|
55
|
-
superClass.setPoint1WorldPosition(pos);
|
|
56
|
-
publicAPI.updateLabelRepresentation();
|
|
57
|
-
publicAPI.modified();
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
publicAPI.setPoint2WorldPosition = function (pos) {
|
|
61
|
-
superClass.setPoint2WorldPosition(pos);
|
|
62
|
-
publicAPI.updateLabelRepresentation();
|
|
63
|
-
publicAPI.modified();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
publicAPI.updateLabelRepresentation = function () {
|
|
67
|
-
model.labelRepresentation.setLabelText(publicAPI.getDistance());
|
|
68
|
-
var p1Position = model.point1Representation.getWorldPosition();
|
|
69
|
-
var p2Position = model.point2Representation.getWorldPosition();
|
|
70
|
-
var coord = [];
|
|
71
|
-
|
|
72
|
-
for (var i = 0; i < 3; i++) {
|
|
73
|
-
coord[i] = p1Position[i] + (p2Position[i] - p1Position[i]) * model.labelPositionInLine;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
model.labelRepresentation.setWorldPosition(coord);
|
|
77
|
-
};
|
|
78
|
-
} // ----------------------------------------------------------------------------
|
|
79
|
-
// Object factory
|
|
80
|
-
// ----------------------------------------------------------------------------
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var DEFAULT_VALUES = {
|
|
84
|
-
labelStyle: {
|
|
85
|
-
fontColor: 'white',
|
|
86
|
-
fontStyle: 'normal',
|
|
87
|
-
fontSize: '15',
|
|
88
|
-
fontFamily: 'Arial',
|
|
89
|
-
strokeColor: 'black',
|
|
90
|
-
strokeSize: '1'
|
|
91
|
-
},
|
|
92
|
-
numberOfDecimals: 2,
|
|
93
|
-
labelPositionInLine: 0.5,
|
|
94
|
-
container: null
|
|
95
|
-
}; // ----------------------------------------------------------------------------
|
|
96
|
-
|
|
97
|
-
function extend(publicAPI, model) {
|
|
98
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
99
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
100
|
-
|
|
101
|
-
vtkLineRepresentation.extend(publicAPI, model, initialValues);
|
|
102
|
-
model.labelRepresentation = vtkLabelRepresentation.newInstance();
|
|
103
|
-
macro.setGet(publicAPI, model, ['numberOfDecimals', 'labelPosition']);
|
|
104
|
-
macro.get(publicAPI, model, ['labelRepresentation']); // Object methods
|
|
105
|
-
|
|
106
|
-
vtkDistanceRepresentation(publicAPI, model);
|
|
107
|
-
} // ----------------------------------------------------------------------------
|
|
108
|
-
|
|
109
|
-
var newInstance = macro.newInstance(extend, 'vtkDistanceRepresentation'); // ----------------------------------------------------------------------------
|
|
110
|
-
|
|
111
|
-
var vtkDistanceRepresentation$1 = {
|
|
112
|
-
newInstance: newInstance,
|
|
113
|
-
extend: extend
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export { vtkDistanceRepresentation$1 as default, extend, newInstance };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import macro from '../../macros.js';
|
|
3
|
-
import vtkDistanceRepresentation from './DistanceRepresentation.js';
|
|
4
|
-
import vtkLabelWidget from './LabelWidget.js';
|
|
5
|
-
import vtkLineWidget from './LineWidget.js';
|
|
6
|
-
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
-
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
// vtkDistanceWidget methods
|
|
11
|
-
// ----------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
function vtkDistanceWidget(publicAPI, model) {
|
|
14
|
-
// Set our className
|
|
15
|
-
model.classHierarchy.push('vtkDistanceWidget');
|
|
16
|
-
|
|
17
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
18
|
-
|
|
19
|
-
publicAPI.setInteractor = function (i) {
|
|
20
|
-
superClass.setInteractor(i);
|
|
21
|
-
model.labelWidget.setInteractor(model.interactor);
|
|
22
|
-
publicAPI.modified();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
publicAPI.setEnabled = function (enabling) {
|
|
26
|
-
superClass.setEnabled(enabling);
|
|
27
|
-
model.labelWidget.setEnabled(publicAPI.computeLabelWidgetVisibility());
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
publicAPI.createDefaultRepresentation = function () {
|
|
31
|
-
if (!model.widgetRep) {
|
|
32
|
-
publicAPI.setWidgetRep(vtkDistanceRepresentation.newInstance());
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
publicAPI.setWidgetRep = function (rep) {
|
|
37
|
-
superClass.setWidgetRep(rep);
|
|
38
|
-
|
|
39
|
-
if (model.widgetRep) {
|
|
40
|
-
model.labelWidget.setWidgetRep(model.widgetRep.getLabelRepresentation());
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
publicAPI.computeLabelWidgetVisibility = function () {
|
|
45
|
-
return model.currentHandle !== 0 && model.enabled;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
publicAPI.setCurrentHandle = function (value) {
|
|
49
|
-
superClass.setCurrentHandle(value);
|
|
50
|
-
model.labelWidget.setEnabled(publicAPI.computeLabelWidgetVisibility());
|
|
51
|
-
};
|
|
52
|
-
} // ----------------------------------------------------------------------------
|
|
53
|
-
// Object factory
|
|
54
|
-
// ----------------------------------------------------------------------------
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
function extend(publicAPI, model) {
|
|
60
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
61
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
62
|
-
|
|
63
|
-
vtkLineWidget.extend(publicAPI, model, initialValues);
|
|
64
|
-
model.labelWidget = vtkLabelWidget.newInstance();
|
|
65
|
-
model.labelWidget.setProcessEvents(false); // Object methods
|
|
66
|
-
|
|
67
|
-
vtkDistanceWidget(publicAPI, model);
|
|
68
|
-
} // ----------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
var newInstance = macro.newInstance(extend, 'vtkDistanceWidget'); // ----------------------------------------------------------------------------
|
|
71
|
-
|
|
72
|
-
var vtkDistanceWidget$1 = {
|
|
73
|
-
newInstance: newInstance,
|
|
74
|
-
extend: extend
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export { vtkDistanceWidget$1 as default, extend, newInstance };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import macro from '../../macros.js';
|
|
3
|
-
import HandleRepConstants from './HandleRepresentation/Constants.js';
|
|
4
|
-
import vtkCoordinate from '../../Rendering/Core/Coordinate.js';
|
|
5
|
-
import vtkPointPlacer from './PointPlacer.js';
|
|
6
|
-
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
7
|
-
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
var InteractionState = HandleRepConstants.InteractionState; // ----------------------------------------------------------------------------
|
|
12
|
-
// vtkHandleRepresentation methods
|
|
13
|
-
// ----------------------------------------------------------------------------
|
|
14
|
-
|
|
15
|
-
function vtkHandleRepresentation(publicAPI, model) {
|
|
16
|
-
// Set our className
|
|
17
|
-
model.classHierarchy.push('vtkHandleRepresentation');
|
|
18
|
-
|
|
19
|
-
publicAPI.setDisplayPosition = function (displayPos) {
|
|
20
|
-
if (model.renderer && model.pointPlacer) {
|
|
21
|
-
var worldPos = [];
|
|
22
|
-
|
|
23
|
-
if (model.pointPlacer.computeWorldPosition(model.renderer, displayPos, worldPos)) {
|
|
24
|
-
model.displayPosition.setValue(displayPos);
|
|
25
|
-
model.worldPosition.setValue(worldPos);
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
model.displayPosition.setValue(displayPos);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
publicAPI.getDisplayPosition = function (pos) {
|
|
33
|
-
if (model.renderer) {
|
|
34
|
-
var p = model.worldPosition.getComputedDisplayValue(model.renderer);
|
|
35
|
-
model.displayPosition.setValue(p[0], p[1], 0.0);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
pos[0] = model.displayPosition.getValue()[0];
|
|
39
|
-
pos[1] = model.displayPosition.getValue()[1];
|
|
40
|
-
pos[2] = model.displayPosition.getValue()[2];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
publicAPI.getDisplayPosition = function () {
|
|
44
|
-
if (model.renderer) {
|
|
45
|
-
var p = model.worldPosition.getComputedDisplayValue(model.renderer);
|
|
46
|
-
model.displayPosition.setValue(p[0], p[1], 0.0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return model.displayPosition.getValue();
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
publicAPI.setWorldPosition = function (pos) {
|
|
53
|
-
model.worldPosition.setValue(pos);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
publicAPI.getWorldPosition = function (pos) {
|
|
57
|
-
model.worldPosition.getValue(pos);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
publicAPI.getWorldPosition = function () {
|
|
61
|
-
return model.worldPosition.getValue();
|
|
62
|
-
};
|
|
63
|
-
} // ----------------------------------------------------------------------------
|
|
64
|
-
// Object factory
|
|
65
|
-
// ----------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var DEFAULT_VALUES = {
|
|
69
|
-
displayPosition: null,
|
|
70
|
-
worldPosition: null,
|
|
71
|
-
tolerance: 15,
|
|
72
|
-
activeRepresentation: 0,
|
|
73
|
-
constrained: 0,
|
|
74
|
-
pointPlacer: null
|
|
75
|
-
}; // ----------------------------------------------------------------------------
|
|
76
|
-
|
|
77
|
-
function extend(publicAPI, model) {
|
|
78
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
79
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
80
|
-
|
|
81
|
-
vtkWidgetRepresentation.extend(publicAPI, model, initialValues);
|
|
82
|
-
model.displayPosition = vtkCoordinate.newInstance();
|
|
83
|
-
model.displayPosition.setCoordinateSystemToDisplay();
|
|
84
|
-
model.worldPosition = vtkCoordinate.newInstance();
|
|
85
|
-
model.worldPosition.setCoordinateSystemToWorld();
|
|
86
|
-
model.pointPlacer = vtkPointPlacer.newInstance();
|
|
87
|
-
model.interactionState = InteractionState.OUTSIDE;
|
|
88
|
-
macro.setGet(publicAPI, model, ['activeRepresentation', 'tolerance']); // Object methods
|
|
89
|
-
|
|
90
|
-
vtkHandleRepresentation(publicAPI, model);
|
|
91
|
-
} // ----------------------------------------------------------------------------
|
|
92
|
-
|
|
93
|
-
var newInstance = macro.newInstance(extend, 'vtkHandleRepresentation'); // ----------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
var vtkHandleRepresentation$1 = _objectSpread({
|
|
96
|
-
newInstance: newInstance,
|
|
97
|
-
extend: extend
|
|
98
|
-
}, HandleRepConstants);
|
|
99
|
-
|
|
100
|
-
export { vtkHandleRepresentation$1 as default, extend, newInstance };
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import macro from '../../macros.js';
|
|
3
|
-
import vtkAbstractWidget from './AbstractWidget.js';
|
|
4
|
-
import vtkSphereHandleRepresentation from './SphereHandleRepresentation.js';
|
|
5
|
-
import vtkHandleRepresentation from './HandleRepresentation.js';
|
|
6
|
-
import Constants from './HandleWidget/Constants.js';
|
|
7
|
-
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
var VOID = macro.VOID,
|
|
12
|
-
EVENT_ABORT = macro.EVENT_ABORT;
|
|
13
|
-
var InteractionState = vtkHandleRepresentation.InteractionState;
|
|
14
|
-
var WidgetState = Constants.WidgetState; // ----------------------------------------------------------------------------
|
|
15
|
-
// vtkHandleWidget methods
|
|
16
|
-
// ----------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
function vtkHandleWidget(publicAPI, model) {
|
|
19
|
-
// Set our className
|
|
20
|
-
model.classHierarchy.push('vtkHandleWidget');
|
|
21
|
-
|
|
22
|
-
function genericAction() {
|
|
23
|
-
publicAPI.setCursor(model.widgetRep.getInteractionState());
|
|
24
|
-
model.widgetRep.highlight(1); // publicAPI.startInteraction();
|
|
25
|
-
|
|
26
|
-
publicAPI.invokeStartInteractionEvent();
|
|
27
|
-
publicAPI.render();
|
|
28
|
-
} // Overridden method
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
publicAPI.createDefaultRepresentation = function () {
|
|
32
|
-
if (!model.widgetRep) {
|
|
33
|
-
model.widgetRep = vtkSphereHandleRepresentation.newInstance();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
publicAPI.handleMouseMove = function (callData) {
|
|
38
|
-
return publicAPI.moveAction(callData);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
publicAPI.handleLeftButtonPress = function (callData) {
|
|
42
|
-
return publicAPI.selectAction(callData);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
publicAPI.handleLeftButtonRelease = function (callData) {
|
|
46
|
-
return publicAPI.endSelectAction(callData);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
publicAPI.handleMiddleButtonPress = function (callData) {
|
|
50
|
-
return publicAPI.translateAction(callData);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
publicAPI.handleMiddleButtonRelease = function (callData) {
|
|
54
|
-
return publicAPI.endSelectAction(callData);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
publicAPI.handleRightButtonPress = function (callData) {
|
|
58
|
-
return publicAPI.scaleAction(callData);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
publicAPI.handleRightButtonRelease = function (callData) {
|
|
62
|
-
return publicAPI.endSelectAction(callData);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
publicAPI.setCursor = function (state) {
|
|
66
|
-
switch (state) {
|
|
67
|
-
case InteractionState.OUTSIDE:
|
|
68
|
-
{
|
|
69
|
-
model.interactor.getView().setCursor('default');
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
default:
|
|
74
|
-
{
|
|
75
|
-
model.interactor.getView().setCursor('pointer');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
publicAPI.selectAction = function (callData) {
|
|
81
|
-
var position = [callData.position.x, callData.position.y];
|
|
82
|
-
model.widgetRep.computeInteractionState(position);
|
|
83
|
-
|
|
84
|
-
if (model.widgetRep.getInteractionState() === InteractionState.OUTSIDE) {
|
|
85
|
-
return VOID;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
89
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
90
|
-
model.widgetRep.setInteractionState(InteractionState.SELECTING);
|
|
91
|
-
genericAction();
|
|
92
|
-
return EVENT_ABORT;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
publicAPI.translateAction = function (callData) {
|
|
96
|
-
var position = [callData.position.x, callData.position.y];
|
|
97
|
-
model.widgetRep.computeInteractionState(position);
|
|
98
|
-
|
|
99
|
-
if (model.widgetRep.getInteractionState() === InteractionState.OUTSIDE) {
|
|
100
|
-
return VOID;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
104
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
105
|
-
model.widgetRep.setInteractionState(InteractionState.TRANSLATING);
|
|
106
|
-
genericAction();
|
|
107
|
-
return EVENT_ABORT;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
publicAPI.scaleAction = function (callData) {
|
|
111
|
-
if (!model.allowHandleResize) {
|
|
112
|
-
return VOID;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var position = [callData.position.x, callData.position.y];
|
|
116
|
-
model.widgetRep.computeInteractionState(position);
|
|
117
|
-
|
|
118
|
-
if (model.widgetRep.getInteractionState() === InteractionState.OUTSIDE) {
|
|
119
|
-
return VOID;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
123
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
124
|
-
model.widgetRep.setInteractionState(InteractionState.SCALING);
|
|
125
|
-
genericAction();
|
|
126
|
-
return EVENT_ABORT;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
publicAPI.endSelectAction = function () {
|
|
130
|
-
if (model.widgetState !== WidgetState.ACTIVE) {
|
|
131
|
-
return VOID;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
model.widgetState = WidgetState.START;
|
|
135
|
-
model.widgetRep.highlight(0);
|
|
136
|
-
publicAPI.invokeEndInteractionEvent();
|
|
137
|
-
publicAPI.render();
|
|
138
|
-
return EVENT_ABORT;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
publicAPI.moveAction = function (callData) {
|
|
142
|
-
var position = [callData.position.x, callData.position.y];
|
|
143
|
-
var state = model.widgetRep.getInteractionState();
|
|
144
|
-
|
|
145
|
-
if (model.widgetState === WidgetState.START) {
|
|
146
|
-
model.widgetRep.computeInteractionState(position);
|
|
147
|
-
state = model.widgetRep.getInteractionState();
|
|
148
|
-
publicAPI.setCursor(state);
|
|
149
|
-
|
|
150
|
-
if (model.widgetRep.getActiveRepresentation() && state !== model.widgetRep.getInteractionState()) {
|
|
151
|
-
publicAPI.render();
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return state === InteractionState.OUTSIDE ? VOID : EVENT_ABORT;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (!publicAPI.isDragable()) {
|
|
158
|
-
return VOID;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
publicAPI.setCursor(state);
|
|
162
|
-
model.widgetRep.complexWidgetInteraction(position);
|
|
163
|
-
publicAPI.invokeInteractionEvent();
|
|
164
|
-
publicAPI.render();
|
|
165
|
-
return EVENT_ABORT;
|
|
166
|
-
};
|
|
167
|
-
} // ----------------------------------------------------------------------------
|
|
168
|
-
// Object factory
|
|
169
|
-
// ----------------------------------------------------------------------------
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
var DEFAULT_VALUES = {
|
|
173
|
-
allowHandleResize: 1,
|
|
174
|
-
widgetState: WidgetState.START
|
|
175
|
-
}; // ----------------------------------------------------------------------------
|
|
176
|
-
|
|
177
|
-
function extend(publicAPI, model) {
|
|
178
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
179
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
180
|
-
|
|
181
|
-
vtkAbstractWidget.extend(publicAPI, model, initialValues);
|
|
182
|
-
macro.setGet(publicAPI, model, ['allowHandleResize']); // Object methods
|
|
183
|
-
|
|
184
|
-
vtkHandleWidget(publicAPI, model);
|
|
185
|
-
} // ----------------------------------------------------------------------------
|
|
186
|
-
|
|
187
|
-
var newInstance = macro.newInstance(extend, 'vtkHandleWidget'); // ----------------------------------------------------------------------------
|
|
188
|
-
|
|
189
|
-
var vtkHandleWidget$1 = _objectSpread({
|
|
190
|
-
newInstance: newInstance,
|
|
191
|
-
extend: extend
|
|
192
|
-
}, Constants);
|
|
193
|
-
|
|
194
|
-
export { vtkHandleWidget$1 as default, extend, newInstance };
|