@kitware/vtk.js 24.9.0 → 24.12.0
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/Common/Core/LookupTable.d.ts +6 -6
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/Core/ScalarsToColors.d.ts +6 -16
- package/Common/DataModel/Box.d.ts +4 -4
- package/Common/DataModel/CardinalSpline1D.d.ts +8 -4
- package/Common/DataModel/CardinalSpline1D.js +133 -4
- package/Common/DataModel/Cell.js +3 -1
- package/Common/DataModel/CellTypes.js +6 -1
- package/Common/DataModel/ITKHelper.d.ts +3 -3
- package/Common/DataModel/KochanekSpline1D.d.ts +8 -4
- package/Common/DataModel/KochanekSpline1D.js +103 -2
- package/Common/DataModel/Line.d.ts +8 -3
- package/Common/DataModel/Line.js +16 -11
- package/Common/DataModel/PiecewiseFunction.js +8 -8
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +77 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline1D.d.ts +20 -2
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/DataModel/Spline3D.d.ts +4 -9
- package/Common/DataModel/Spline3D.js +20 -15
- package/Filters/General/ImageCropFilter.d.ts +9 -6
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +2 -6
- package/Rendering/Core/CellPicker.js +53 -32
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.d.ts +5 -21
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property.d.ts +6 -20
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/RenderWindowInteractor.d.ts +223 -121
- package/Rendering/Core/ScalarBarActor.d.ts +37 -15
- package/Rendering/Core/ScalarBarActor.js +39 -14
- package/Rendering/Core/Viewport.d.ts +2 -4
- package/Rendering/Core/VolumeMapper/Constants.d.ts +19 -0
- package/Rendering/Core/VolumeMapper.d.ts +5 -9
- package/Rendering/Core/VolumeProperty.d.ts +5 -13
- package/Rendering/Misc/FullScreenRenderWindow.d.ts +3 -2
- package/Rendering/OpenGL/RenderWindow.d.ts +28 -10
- package/Widgets/Core/StateBuilder.js +6 -2
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/SplineContextRepresentation.js +27 -9
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +10 -5
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +11 -5
- package/Widgets/Widgets3D/LabelWidget/behavior.js +10 -4
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +7 -5
- 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 +9 -1
- package/Widgets/Widgets3D/SplineWidget/state.js +10 -0
- package/Widgets/Widgets3D/SplineWidget.js +1 -1
- package/index.d.ts +16 -7
- package/package.json +43 -43
|
@@ -27,21 +27,22 @@ export interface IStyle {
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
export interface IScalarBarActorInitialValues extends IActorInitialValues {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
automated?: boolean,
|
|
31
|
+
autoLayout?: (publicAPI: object, model: object) => void,
|
|
32
|
+
axisLabel?: string,
|
|
33
|
+
barPosition?: Vector2,
|
|
34
|
+
barSize?: Size,
|
|
35
|
+
boxPosition?: Vector2,
|
|
36
|
+
boxSize?: Size,
|
|
37
|
+
scalarToColors?: null,
|
|
38
|
+
axisTitlePixelOffset?: number,
|
|
39
|
+
axisTextStyle?: IStyle,
|
|
40
|
+
tickLabelPixelOffset?: number,
|
|
41
|
+
tickTextStyle?: IStyle,
|
|
42
|
+
generateTicks?: (helper: any) => void,
|
|
43
|
+
drawBelowRangeSwatch?: boolean,
|
|
44
|
+
drawAboveRangeSwatch?: boolean,
|
|
45
|
+
drawNanAnnotation?: boolean,
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export interface vtkScalarBarActor extends vtkActor {
|
|
@@ -87,6 +88,10 @@ export interface vtkScalarBarActor extends vtkActor {
|
|
|
87
88
|
*/
|
|
88
89
|
getAutoLayout(): any;
|
|
89
90
|
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
getGenerateTicks(): any;
|
|
90
95
|
/**
|
|
91
96
|
*
|
|
92
97
|
*/
|
|
@@ -175,6 +180,23 @@ export interface vtkScalarBarActor extends vtkActor {
|
|
|
175
180
|
*/
|
|
176
181
|
setAutoLayout(autoLayout: any): boolean;
|
|
177
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Sets the function used to generate legend ticks.
|
|
185
|
+
*
|
|
186
|
+
* This function takes a vtkScalarBarActorHelper and returns true on success.
|
|
187
|
+
* To have the desired effect, the function must call: `helper.setTicks(ticks: num[])` and `helper.setTickStrings(tickStrings: string[])`.
|
|
188
|
+
*
|
|
189
|
+
* After setting the generateTicks function you must regenerate the vtkScalarBarActor for your changes to take effect.
|
|
190
|
+
* One way to do that is:
|
|
191
|
+
* ```
|
|
192
|
+
* const mapper = scalarBarActor.getMapper()
|
|
193
|
+
* if (mapper) {
|
|
194
|
+
* mapper.getLookupTable().resetAnnotations()
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
* @param {(helper: any) => void} generateTicks
|
|
198
|
+
*/
|
|
199
|
+
setGenerateTicks(generateTicks: (helper: any) => void): boolean;
|
|
178
200
|
/**
|
|
179
201
|
*
|
|
180
202
|
* @param {Boolean} automated
|
|
@@ -129,6 +129,25 @@ function defaultAutoLayout(publicAPI, model) {
|
|
|
129
129
|
|
|
130
130
|
helper.recomputeBarSegments(textSizes);
|
|
131
131
|
};
|
|
132
|
+
} // ----------------------------------------------------------------------------
|
|
133
|
+
// Default generateTicks function
|
|
134
|
+
// ----------------------------------------------------------------------------
|
|
135
|
+
// This function returns the default function used to generate vtkScalarBarActor ticks.
|
|
136
|
+
// The default function makes use of d3.scaleLinear() to generate 5 tick marks between
|
|
137
|
+
// the minimum and maximum values of the scalar bar. Customize this behavior by passing
|
|
138
|
+
// a function to vtkScalarBarActor.newInstance({ generateTicks: customGenerateTicks })
|
|
139
|
+
// or by calling scalarBarActor.setGenerateTicks(customGenerateTicks).
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
function defaultGenerateTicks(publicApi, model) {
|
|
143
|
+
return function (helper) {
|
|
144
|
+
var lastTickBounds = helper.getLastTickBounds();
|
|
145
|
+
var scale = d3.scaleLinear().domain([lastTickBounds[0], lastTickBounds[1]]);
|
|
146
|
+
var ticks = scale.ticks(5);
|
|
147
|
+
var format = scale.tickFormat(5);
|
|
148
|
+
helper.setTicks(ticks);
|
|
149
|
+
helper.setTickStrings(ticks.map(format));
|
|
150
|
+
};
|
|
132
151
|
} // many properties of this actor depend on the API specific view The main
|
|
133
152
|
// dependency being the resolution as that drives what font sizes to use.
|
|
134
153
|
// Bacause of this we need to do some of the calculations in a API specific
|
|
@@ -152,6 +171,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
152
171
|
model.barActor.setParentProp(renderable);
|
|
153
172
|
model.tmActor.setProperty(renderable.getProperty());
|
|
154
173
|
model.tmActor.setParentProp(renderable);
|
|
174
|
+
model.generateTicks = renderable.generateTicks;
|
|
155
175
|
model.axisTextStyle = _objectSpread({}, renderable.getAxisTextStyle());
|
|
156
176
|
model.tickTextStyle = _objectSpread({}, renderable.getTickTextStyle());
|
|
157
177
|
publicAPI.modified();
|
|
@@ -182,10 +202,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
182
202
|
var range = scalarsToColors.getMappingRange();
|
|
183
203
|
model.lastTickBounds = _toConsumableArray(range); // compute tick marks for axes (update for log scale)
|
|
184
204
|
|
|
185
|
-
|
|
186
|
-
model.ticks = scale.ticks(5);
|
|
187
|
-
var format = scale.tickFormat(5);
|
|
188
|
-
model.tickstrings = model.ticks.map(format);
|
|
205
|
+
model.renderable.getGenerateTicks()(publicAPI);
|
|
189
206
|
|
|
190
207
|
if (model.renderable.getAutomated()) {
|
|
191
208
|
model.renderable.getAutoLayout()(publicAPI);
|
|
@@ -253,7 +270,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
253
270
|
results.tickWidth = 0;
|
|
254
271
|
results.tickHeight = 0;
|
|
255
272
|
applyTextStyle(model.tmContext, model.tickTextStyle);
|
|
256
|
-
var strings = [].concat(_toConsumableArray(
|
|
273
|
+
var strings = [].concat(_toConsumableArray(publicAPI.getTickStrings()), ['NaN', 'Below', 'Above']);
|
|
257
274
|
|
|
258
275
|
for (var t = 0; t < strings.length; t++) {
|
|
259
276
|
if (!newTmAtlas.has(strings[t])) {
|
|
@@ -501,7 +518,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
501
518
|
} // update the polydata
|
|
502
519
|
|
|
503
520
|
|
|
504
|
-
var numLabels =
|
|
521
|
+
var numLabels = publicAPI.getTickStrings().length + model.barSegments.length;
|
|
505
522
|
var numPts = numLabels * 4;
|
|
506
523
|
var numTris = numLabels * 2;
|
|
507
524
|
var points = new Float64Array(numPts * 3);
|
|
@@ -568,12 +585,14 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
568
585
|
|
|
569
586
|
var tickSegmentStart = model.barPosition[spacedAxis] + model.barSize[spacedAxis] * tickSeg.corners[0][spacedAxis];
|
|
570
587
|
var tickSegmentSize = model.barSize[spacedAxis] * (tickSeg.corners[2][spacedAxis] - tickSeg.corners[0][spacedAxis]);
|
|
588
|
+
var ticks = publicAPI.getTicks();
|
|
589
|
+
var tickStrings = publicAPI.getTickStrings();
|
|
571
590
|
|
|
572
|
-
for (var t = 0; t <
|
|
573
|
-
var tickPos = (
|
|
591
|
+
for (var t = 0; t < ticks.length; t++) {
|
|
592
|
+
var tickPos = (ticks[t] - model.lastTickBounds[0]) / (model.lastTickBounds[1] - model.lastTickBounds[0]);
|
|
574
593
|
tmp2v3[spacedAxis] = tickSegmentStart + tickSegmentSize * tickPos;
|
|
575
594
|
vec3.transformMat4(ptv3, tmp2v3, invmat);
|
|
576
|
-
publicAPI.createPolyDataForOneLabel(
|
|
595
|
+
publicAPI.createPolyDataForOneLabel(tickStrings[t], ptv3, xDir, yDir, dir, model.tickLabelPixelOffset, results);
|
|
577
596
|
}
|
|
578
597
|
|
|
579
598
|
var tcoordDA = vtkDataArray.newInstance({
|
|
@@ -675,8 +694,8 @@ var newScalarBarActorHelper = macro.newInstance(function (publicAPI, model) {
|
|
|
675
694
|
Object.assign(model, {}, initialValues); // Inheritance
|
|
676
695
|
|
|
677
696
|
macro.obj(publicAPI, model);
|
|
678
|
-
macro.setGet(publicAPI, model, ['axisTitlePixelOffset', 'tickLabelPixelOffset', 'renderable', 'topTitle']);
|
|
679
|
-
macro.get(publicAPI, model, ['lastSize', 'lastAspectRatio', 'axisTextStyle', 'tickTextStyle', 'barActor', 'tmActor'
|
|
697
|
+
macro.setGet(publicAPI, model, ['axisTitlePixelOffset', 'tickLabelPixelOffset', 'renderable', 'topTitle', 'ticks', 'tickStrings']);
|
|
698
|
+
macro.get(publicAPI, model, ['lastSize', 'lastAspectRatio', 'lastTickBounds', 'axisTextStyle', 'tickTextStyle', 'barActor', 'tmActor']);
|
|
680
699
|
macro.getArray(publicAPI, model, ['boxPosition', 'boxSize']);
|
|
681
700
|
macro.setArray(publicAPI, model, ['boxPosition', 'boxSize'], 2);
|
|
682
701
|
model.forceUpdate = false;
|
|
@@ -739,7 +758,11 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
739
758
|
};
|
|
740
759
|
|
|
741
760
|
publicAPI.resetAutoLayoutToDefault = function () {
|
|
742
|
-
|
|
761
|
+
publicAPI.setAutoLayout(defaultAutoLayout(publicAPI, model));
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
publicAPI.resetGenerateTicksToDefault = function () {
|
|
765
|
+
publicAPI.setGenerateTicks(defaultGenerateTicks());
|
|
743
766
|
};
|
|
744
767
|
} // ----------------------------------------------------------------------------
|
|
745
768
|
// Object factory
|
|
@@ -770,6 +793,7 @@ function defaultValues(initialValues) {
|
|
|
770
793
|
fontSize: 14,
|
|
771
794
|
fontFamily: 'serif'
|
|
772
795
|
},
|
|
796
|
+
generateTicks: null,
|
|
773
797
|
drawNanAnnotation: true,
|
|
774
798
|
drawBelowRangeSwatch: true,
|
|
775
799
|
drawAboveRangeSwatch: true
|
|
@@ -780,12 +804,13 @@ function defaultValues(initialValues) {
|
|
|
780
804
|
function extend(publicAPI, model) {
|
|
781
805
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
782
806
|
Object.assign(model, defaultValues(initialValues));
|
|
783
|
-
if (!model.autoLayout) model.autoLayout = defaultAutoLayout(publicAPI, model);
|
|
807
|
+
if (!model.autoLayout) model.autoLayout = defaultAutoLayout(publicAPI, model);
|
|
808
|
+
if (!model.generateTicks) model.generateTicks = defaultGenerateTicks(); // Inheritance
|
|
784
809
|
|
|
785
810
|
vtkActor.extend(publicAPI, model, initialValues);
|
|
786
811
|
publicAPI.getProperty().setDiffuse(0.0);
|
|
787
812
|
publicAPI.getProperty().setAmbient(1.0);
|
|
788
|
-
macro.setGet(publicAPI, model, ['automated', 'autoLayout', 'axisTitlePixelOffset', 'axisLabel', 'scalarsToColors', 'tickLabelPixelOffset', 'drawNanAnnotation', 'drawBelowRangeSwatch', 'drawAboveRangeSwatch']);
|
|
813
|
+
macro.setGet(publicAPI, model, ['automated', 'autoLayout', 'axisTitlePixelOffset', 'axisLabel', 'scalarsToColors', 'tickLabelPixelOffset', 'generateTicks', 'drawNanAnnotation', 'drawBelowRangeSwatch', 'drawAboveRangeSwatch']);
|
|
789
814
|
macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle']);
|
|
790
815
|
macro.getArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize']);
|
|
791
816
|
macro.setArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize'], 2); // Object methods
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { vtkObject } from './../../interfaces';
|
|
3
|
-
import { RGBColor } from './../../types';
|
|
3
|
+
import { RGBColor, Size } from './../../types';
|
|
4
4
|
import vtkActor2D from './Actor2D';
|
|
5
5
|
import vtkProp from './Prop';
|
|
6
6
|
|
|
@@ -58,12 +58,10 @@ export interface vtkViewport extends vtkObject {
|
|
|
58
58
|
*/
|
|
59
59
|
getBackgroundByReference(): number[];
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
61
|
/**
|
|
64
62
|
*
|
|
65
63
|
*/
|
|
66
|
-
getSize():
|
|
64
|
+
getSize(): Size;
|
|
67
65
|
|
|
68
66
|
/**
|
|
69
67
|
*
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum BlendMode {
|
|
2
|
+
COMPOSITE_BLEND = 0,
|
|
3
|
+
MAXIMUM_INTENSITY_BLEND = 1,
|
|
4
|
+
MINIMUM_INTENSITY_BLEND = 2,
|
|
5
|
+
AVERAGE_INTENSITY_BLEND = 3,
|
|
6
|
+
ADDITIVE_INTENSITY_BLEND = 4,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare enum FilterMode {
|
|
10
|
+
OFF = 0,
|
|
11
|
+
NORMALIZED = 1,
|
|
12
|
+
RAW = 2,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const _default: {
|
|
16
|
+
BlendMode: typeof BlendMode;
|
|
17
|
+
FilterMode: typeof FilterMode;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { Bounds, Range } from './../../types';
|
|
2
2
|
import vtkAbstractMapper, { IAbstractMapperInitialValues } from './AbstractMapper';
|
|
3
|
-
|
|
4
|
-
export enum BlendMode {
|
|
5
|
-
COMPOSITE_BLEND,
|
|
6
|
-
MAXIMUM_INTENSITY_BLEND,
|
|
7
|
-
MINIMUM_INTENSITY_BLEND,
|
|
8
|
-
AVERAGE_INTENSITY_BLEND,
|
|
9
|
-
}
|
|
3
|
+
import { BlendMode, FilterMode } from './VolumeMapper/Constants';
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
*
|
|
@@ -165,7 +159,9 @@ export function newInstance(initialValues?: IVolumeMapperInitialValues): vtkVolu
|
|
|
165
159
|
* A volume mapper that performs ray casting on the GPU using fragment programs.
|
|
166
160
|
*/
|
|
167
161
|
export declare const vtkVolumeMapper: {
|
|
168
|
-
newInstance: typeof newInstance
|
|
169
|
-
extend: typeof extend
|
|
162
|
+
newInstance: typeof newInstance;
|
|
163
|
+
extend: typeof extend;
|
|
164
|
+
BlendMode: typeof BlendMode;
|
|
165
|
+
FilterMode: typeof FilterMode;
|
|
170
166
|
};
|
|
171
167
|
export default vtkVolumeMapper;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
|
-
|
|
3
|
-
export enum InterpolationType {
|
|
4
|
-
NEAREST,
|
|
5
|
-
LINEAR,
|
|
6
|
-
FAST_LINEAR,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum OpacityMode {
|
|
10
|
-
FRACTIONAL,
|
|
11
|
-
PROPORTIONAL,
|
|
12
|
-
}
|
|
2
|
+
import { InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
13
3
|
|
|
14
4
|
interface IVolumePropertyInitialValues {
|
|
15
5
|
independentComponents?: boolean;
|
|
@@ -412,7 +402,9 @@ export function newInstance(initialValues?: IVolumePropertyInitialValues): vtkVo
|
|
|
412
402
|
* ```
|
|
413
403
|
*/
|
|
414
404
|
export declare const vtkVolumeProperty: {
|
|
415
|
-
newInstance: typeof newInstance
|
|
416
|
-
extend: typeof extend
|
|
405
|
+
newInstance: typeof newInstance;
|
|
406
|
+
extend: typeof extend;
|
|
407
|
+
InterpolationType: typeof InterpolationType;
|
|
408
|
+
OpacityMode: typeof OpacityMode;
|
|
417
409
|
};
|
|
418
410
|
export default vtkVolumeProperty;
|
|
@@ -13,10 +13,11 @@ import vtkRenderWindowInteractor from './../Core/RenderWindowInteractor';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface IFullScreenRenderWindowInitialValues {
|
|
15
15
|
background?: RGBColor;
|
|
16
|
+
container?: HTMLElement
|
|
16
17
|
containerStyle?: object;
|
|
17
|
-
controlPanelStyle?: object
|
|
18
|
-
listenWindowResize?: boolean;
|
|
18
|
+
controlPanelStyle?: object;
|
|
19
19
|
controllerVisibility?: boolean;
|
|
20
|
+
listenWindowResize?: boolean;
|
|
20
21
|
resizeCallback?: any;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vtkAlgorithm, vtkObject } from './../../interfaces';
|
|
2
2
|
import { Nullable, Size, Vector2, Vector3 } from './../../types';
|
|
3
|
-
import { vtkRenderer } from './../Core/Renderer';
|
|
4
3
|
import { VtkDataTypes } from './../../Common/Core/DataArray';
|
|
4
|
+
import vtkRenderer from './../Core/Renderer';
|
|
5
5
|
import vtkTexture from './../Core/Texture';
|
|
6
6
|
import vtkViewStream from './../../IO/Core/ImageStream/ViewStream';
|
|
7
7
|
|
|
@@ -9,15 +9,33 @@ import vtkViewStream from './../../IO/Core/ImageStream/ViewStream';
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
export interface IOpenGLRenderWindowInitialValues {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
cullFaceEnabled?: boolean;
|
|
13
|
+
shaderCache?: null;
|
|
14
|
+
initialized?: boolean;
|
|
15
|
+
context?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
16
|
+
canvas?: HTMLCanvasElement;
|
|
17
|
+
cursorVisibility?: boolean;
|
|
18
|
+
cursor?: string;
|
|
19
|
+
textureUnitManager?: null;
|
|
20
|
+
textureResourceIds?: null;
|
|
21
|
+
containerSize?: Size;
|
|
22
|
+
renderPasses?: any[];
|
|
23
|
+
notifyStartCaptureImage?: boolean;
|
|
24
|
+
webgl2?: boolean;
|
|
25
|
+
defaultToWebgl2?: boolean;
|
|
26
|
+
activeFramebuffer?: any;
|
|
27
|
+
xrSession?: any;
|
|
28
|
+
xrSessionIsAR?: boolean;
|
|
29
|
+
xrReferenceSpace?: any;
|
|
30
|
+
xrSupported?: boolean;
|
|
31
|
+
imageFormat?: 'image/png';
|
|
32
|
+
useOffScreen?: boolean;
|
|
33
|
+
useBackgroundImage?: boolean;
|
|
16
34
|
}
|
|
17
35
|
|
|
18
|
-
export interface
|
|
19
|
-
resetCamera: boolean
|
|
20
|
-
size: Size
|
|
36
|
+
export interface ICaptureOptions {
|
|
37
|
+
resetCamera: boolean;
|
|
38
|
+
size: Size;
|
|
21
39
|
scale: number
|
|
22
40
|
}
|
|
23
41
|
|
|
@@ -278,9 +296,9 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
278
296
|
* size is assumed. The default format is "image/png". Returns a promise
|
|
279
297
|
* that resolves to the captured screenshot.
|
|
280
298
|
* @param {String} format
|
|
281
|
-
* @param {
|
|
299
|
+
* @param {ICaptureOptions} options
|
|
282
300
|
*/
|
|
283
|
-
captureNextImage(format: string, options:
|
|
301
|
+
captureNextImage(format: string, options: ICaptureOptions): Nullable<Promise<string>>;
|
|
284
302
|
|
|
285
303
|
/**
|
|
286
304
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
3
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
4
|
import macro from '../../macros.js';
|
|
@@ -16,6 +17,9 @@ import text from './StateBuilder/textMixin.js';
|
|
|
16
17
|
import visible from './StateBuilder/visibleMixin.js';
|
|
17
18
|
import shape from './StateBuilder/shapeMixin.js';
|
|
18
19
|
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
19
23
|
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
20
24
|
// Global type lookup map
|
|
21
25
|
// ----------------------------------------------------------------------------
|
|
@@ -85,8 +89,8 @@ var Builder = /*#__PURE__*/function () {
|
|
|
85
89
|
var listName = "".concat(name, "List");
|
|
86
90
|
this.model[listName] = []; // Create new Instance method
|
|
87
91
|
|
|
88
|
-
this.publicAPI["add".concat(macro.capitalize(name))] = function () {
|
|
89
|
-
var instance = newInstance(mixins, initialValues);
|
|
92
|
+
this.publicAPI["add".concat(macro.capitalize(name))] = function (values) {
|
|
93
|
+
var instance = newInstance(mixins, _objectSpread(_objectSpread({}, initialValues), values));
|
|
90
94
|
|
|
91
95
|
_this.publicAPI.bindState(instance, labels);
|
|
92
96
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import {
|
|
3
|
+
import { s as subtract, j as cross, d as dot, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkAbstractManipulator from './AbstractManipulator.js';
|
|
5
5
|
|
|
6
6
|
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; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
|
-
import {
|
|
4
|
+
import { s as subtract, m as multiplyAccumulate, l as normalize, j as cross } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
6
6
|
import vtkCylinderSource from '../../Filters/Sources/CylinderSource.js';
|
|
7
7
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
@@ -56,6 +56,7 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
56
56
|
|
|
57
57
|
var polydata = vtkPolyData.newInstance();
|
|
58
58
|
var widgetState = inData[0];
|
|
59
|
+
var closed = widgetState.getSplineClosed();
|
|
59
60
|
var list = publicAPI.getRepresentationStates(widgetState).filter(function (state) {
|
|
60
61
|
return state.getVisible && state.getVisible() && state.getOrigin && state.getOrigin();
|
|
61
62
|
});
|
|
@@ -70,19 +71,23 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
70
71
|
|
|
71
72
|
var numVertices = inPoints.length;
|
|
72
73
|
|
|
73
|
-
if (
|
|
74
|
+
if (!closed) {
|
|
75
|
+
--numVertices;
|
|
76
|
+
} else {
|
|
74
77
|
inPoints.push(inPoints[0]);
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
var spline = vtkSpline3D.newInstance({
|
|
78
|
-
close:
|
|
81
|
+
close: widgetState.getSplineClosed(),
|
|
79
82
|
kind: widgetState.getSplineKind(),
|
|
80
83
|
tension: widgetState.getSplineTension(),
|
|
81
84
|
bias: widgetState.getSplineBias(),
|
|
82
|
-
continuity: widgetState.getSplineContinuity()
|
|
85
|
+
continuity: widgetState.getSplineContinuity(),
|
|
86
|
+
boundaryCondition: widgetState.getSplineBoundaryCondition(),
|
|
87
|
+
boundaryConditionValues: widgetState.getSplineBoundaryConditionValues()
|
|
83
88
|
});
|
|
84
89
|
spline.computeCoefficients(inPoints);
|
|
85
|
-
var outPoints = new Float32Array(3 * numVertices * model.resolution);
|
|
90
|
+
var outPoints = new Float32Array(3 * ((numVertices + !closed) * model.resolution));
|
|
86
91
|
var outCells = new Uint32Array(numVertices * model.resolution + 2);
|
|
87
92
|
outCells[0] = numVertices * model.resolution + 1;
|
|
88
93
|
outCells[numVertices * model.resolution + 1] = 0;
|
|
@@ -98,6 +103,17 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
|
|
106
|
+
if (closed) {
|
|
107
|
+
outCells[numVertices * model.resolution + 1] = 0;
|
|
108
|
+
} else {
|
|
109
|
+
var lastPointIndex = numVertices * model.resolution + 1;
|
|
110
|
+
var lastPoint = spline.getPoint(numVertices, 0);
|
|
111
|
+
outPoints[3 * lastPointIndex + 0] = lastPoint[0];
|
|
112
|
+
outPoints[3 * lastPointIndex + 1] = lastPoint[1];
|
|
113
|
+
outPoints[3 * lastPointIndex + 2] = lastPoint[2];
|
|
114
|
+
outCells[numVertices * model.resolution + 1] = lastPointIndex;
|
|
115
|
+
}
|
|
116
|
+
|
|
101
117
|
polydata.getPoints().setData(outPoints);
|
|
102
118
|
|
|
103
119
|
if (model.fill) {
|
|
@@ -115,9 +131,11 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
115
131
|
return model.state;
|
|
116
132
|
};
|
|
117
133
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
134
|
+
function updateAreaVisibility() {
|
|
135
|
+
model.pipelines.area.actor.setVisibility(model.fill);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
publicAPI.setFill = macro.chain(publicAPI.setFill, updateAreaVisibility);
|
|
121
139
|
publicAPI.setOutputBorder = macro.chain(publicAPI.setOutputBorder, function (v) {
|
|
122
140
|
return model.pipelines.border.actor.setVisibility(v);
|
|
123
141
|
});
|
|
@@ -128,8 +146,8 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
128
146
|
|
|
129
147
|
var DEFAULT_VALUES = {
|
|
130
148
|
resolution: 16,
|
|
131
|
-
close: true,
|
|
132
149
|
fill: true,
|
|
150
|
+
// boundaryCondition : BoundaryCondition.DEFAULT
|
|
133
151
|
outputBorder: false,
|
|
134
152
|
borderColor: [0.1, 1, 0.1],
|
|
135
153
|
errorBorderColor: [1, 0, 0]
|
|
@@ -140,7 +158,7 @@ function extend(publicAPI, model) {
|
|
|
140
158
|
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
141
159
|
vtkContextRepresentation.extend(publicAPI, model, initialValues);
|
|
142
160
|
macro.get(publicAPI, model, ['mapper']);
|
|
143
|
-
macro.setGet(publicAPI, model, ['resolution', '
|
|
161
|
+
macro.setGet(publicAPI, model, ['resolution', 'boundaryCondition', 'fill', 'outputBorder']);
|
|
144
162
|
macro.setGetArray(publicAPI, model, ['borderColor', 'errorBorderColor'], 3); // Object specific methods
|
|
145
163
|
|
|
146
164
|
vtkSplineContextRepresentation(publicAPI, model);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import vtkProp from '../../Rendering/Core/Prop.js';
|
|
4
|
-
import {
|
|
4
|
+
import { s as subtract, d as dot } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
6
6
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
7
7
|
import { CATEGORIES } from '../../Rendering/Core/Mapper/CoincidentTopologyHelper.js';
|
|
@@ -26,21 +26,26 @@ function widgetBehavior(publicAPI, model) {
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
publicAPI.handleLeftButtonPress = function (e) {
|
|
29
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
30
|
+
|
|
29
31
|
if (!model.activeState || !model.activeState.getActive() || !model.pickable || ignoreKey(e)) {
|
|
30
32
|
return macro.VOID;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
picker.initializePickList();
|
|
34
36
|
picker.setPickList(publicAPI.getNestedProps());
|
|
37
|
+
var manipulator = (_model$activeState$ge = (_model$activeState = model.activeState) === null || _model$activeState === void 0 ? void 0 : (_model$activeState$ge2 = _model$activeState.getManipulator) === null || _model$activeState$ge2 === void 0 ? void 0 : _model$activeState$ge2.call(_model$activeState)) !== null && _model$activeState$ge !== void 0 ? _model$activeState$ge : model.manipulator;
|
|
38
|
+
|
|
39
|
+
if (model.activeState === model.widgetState.getMoveHandle() && model.widgetState.getHandleList().length < MAX_POINTS && manipulator) {
|
|
40
|
+
var worldCoords = manipulator.handleEvent(e, model._apiSpecificRenderWindow); // Commit handle to location
|
|
35
41
|
|
|
36
|
-
if (model.activeState === model.widgetState.getMoveHandle() && model.widgetState.getHandleList().length < MAX_POINTS) {
|
|
37
|
-
// Commit handle to location
|
|
38
42
|
var moveHandle = model.widgetState.getMoveHandle();
|
|
43
|
+
moveHandle.setOrigin.apply(moveHandle, _toConsumableArray(worldCoords));
|
|
39
44
|
var newHandle = model.widgetState.addHandle();
|
|
40
45
|
newHandle.setOrigin.apply(newHandle, _toConsumableArray(moveHandle.getOrigin()));
|
|
41
46
|
newHandle.setColor(moveHandle.getColor());
|
|
42
47
|
newHandle.setScale1(moveHandle.getScale1());
|
|
43
|
-
newHandle.setManipulator(
|
|
48
|
+
newHandle.setManipulator(manipulator);
|
|
44
49
|
} else {
|
|
45
50
|
isDragging = true;
|
|
46
51
|
|
|
@@ -57,9 +62,9 @@ function widgetBehavior(publicAPI, model) {
|
|
|
57
62
|
|
|
58
63
|
|
|
59
64
|
publicAPI.handleMouseMove = function (callData) {
|
|
60
|
-
var _model$activeState$
|
|
65
|
+
var _model$activeState$ge3, _model$activeState2, _model$activeState2$g;
|
|
61
66
|
|
|
62
|
-
var manipulator = (_model$activeState$
|
|
67
|
+
var manipulator = (_model$activeState$ge3 = (_model$activeState2 = model.activeState) === null || _model$activeState2 === void 0 ? void 0 : (_model$activeState2$g = _model$activeState2.getManipulator) === null || _model$activeState2$g === void 0 ? void 0 : _model$activeState2$g.call(_model$activeState2)) !== null && _model$activeState$ge3 !== void 0 ? _model$activeState$ge3 : model.manipulator;
|
|
63
68
|
|
|
64
69
|
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
65
70
|
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
@@ -4,7 +4,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
|
4
4
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
5
5
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
6
6
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
7
|
-
import {
|
|
7
|
+
import { s as subtract, R as angleBetweenVectors } from '../../Common/Core/Math/index.js';
|
|
8
8
|
import widgetBehavior from './AngleWidget/behavior.js';
|
|
9
9
|
import generateState from './AngleWidget/state.js';
|
|
10
10
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
@@ -23,18 +23,24 @@ function widgetBehavior(publicAPI, model) {
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
publicAPI.handleLeftButtonPress = function (e) {
|
|
26
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
27
|
+
|
|
26
28
|
if (!model.activeState || !model.activeState.getActive() || !model.pickable || ignoreKey(e)) {
|
|
27
29
|
return macro.VOID;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
var manipulator = (_model$activeState$ge = (_model$activeState = model.activeState) === null || _model$activeState === void 0 ? void 0 : (_model$activeState$ge2 = _model$activeState.getManipulator) === null || _model$activeState$ge2 === void 0 ? void 0 : _model$activeState$ge2.call(_model$activeState)) !== null && _model$activeState$ge !== void 0 ? _model$activeState$ge : model.manipulator;
|
|
33
|
+
|
|
34
|
+
if (model.activeState === model.widgetState.getMoveHandle() && model.widgetState.getHandleList().length < MAX_POINTS && manipulator) {
|
|
35
|
+
var worldCoords = manipulator.handleEvent(e, model._apiSpecificRenderWindow); // Commit handle to location
|
|
36
|
+
|
|
32
37
|
var moveHandle = model.widgetState.getMoveHandle();
|
|
38
|
+
moveHandle.setOrigin.apply(moveHandle, _toConsumableArray(worldCoords));
|
|
33
39
|
var newHandle = model.widgetState.addHandle();
|
|
34
40
|
newHandle.setOrigin.apply(newHandle, _toConsumableArray(moveHandle.getOrigin()));
|
|
35
41
|
newHandle.setColor(moveHandle.getColor());
|
|
36
42
|
newHandle.setScale1(moveHandle.getScale1());
|
|
37
|
-
newHandle.setManipulator(
|
|
43
|
+
newHandle.setManipulator(manipulator);
|
|
38
44
|
} else {
|
|
39
45
|
isDragging = true;
|
|
40
46
|
|
|
@@ -51,14 +57,14 @@ function widgetBehavior(publicAPI, model) {
|
|
|
51
57
|
|
|
52
58
|
|
|
53
59
|
publicAPI.handleMouseMove = function (callData) {
|
|
54
|
-
var _model$activeState$
|
|
60
|
+
var _model$activeState$ge3, _model$activeState2, _model$activeState2$g;
|
|
55
61
|
|
|
56
62
|
if (model.hasFocus && model.widgetState.getHandleList().length === MAX_POINTS) {
|
|
57
63
|
publicAPI.loseFocus();
|
|
58
64
|
return macro.VOID;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
var manipulator = (_model$activeState$
|
|
67
|
+
var manipulator = (_model$activeState$ge3 = (_model$activeState2 = model.activeState) === null || _model$activeState2 === void 0 ? void 0 : (_model$activeState2$g = _model$activeState2.getManipulator) === null || _model$activeState2$g === void 0 ? void 0 : _model$activeState2$g.call(_model$activeState2)) !== null && _model$activeState$ge3 !== void 0 ? _model$activeState$ge3 : model.manipulator;
|
|
62
68
|
|
|
63
69
|
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
64
70
|
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|