@kitware/vtk.js 26.8.1 → 26.8.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.
|
@@ -19,6 +19,16 @@ function centerDataSet(ds) {
|
|
|
19
19
|
var center = [-(bounds[0] + bounds[1]) * 0.5, -(bounds[2] + bounds[3]) * 0.5, -(bounds[4] + bounds[5]) * 0.5];
|
|
20
20
|
|
|
21
21
|
(_vtkMatrixBuilder$bui = vtkMatrixBuilder.buildFromDegree()).translate.apply(_vtkMatrixBuilder$bui, center).apply(ds.getPoints().getData());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function shiftDataset(ds, axis) {
|
|
25
|
+
var _vtkMatrixBuilder$bui2;
|
|
26
|
+
|
|
27
|
+
var bounds = ds.getPoints().getBounds();
|
|
28
|
+
var center = [0, 0, 0];
|
|
29
|
+
center[axis] = -bounds[axis * 2];
|
|
30
|
+
|
|
31
|
+
(_vtkMatrixBuilder$bui2 = vtkMatrixBuilder.buildFromDegree()).translate.apply(_vtkMatrixBuilder$bui2, center).apply(ds.getPoints().getData());
|
|
22
32
|
} // ----------------------------------------------------------------------------
|
|
23
33
|
|
|
24
34
|
|
|
@@ -47,33 +57,100 @@ function vtkAxesActor(publicAPI, model) {
|
|
|
47
57
|
// Set our className
|
|
48
58
|
model.classHierarchy.push('vtkAxesActor');
|
|
49
59
|
|
|
60
|
+
var _mapper = vtkMapper.newInstance();
|
|
61
|
+
|
|
62
|
+
publicAPI.setMapper(_mapper);
|
|
63
|
+
|
|
50
64
|
publicAPI.update = function () {
|
|
51
65
|
var xAxis = vtkArrowSource.newInstance(_objectSpread({
|
|
52
66
|
direction: [1, 0, 0]
|
|
53
67
|
}, model.config)).getOutputData();
|
|
54
|
-
|
|
68
|
+
|
|
69
|
+
if (model.config.recenter) {
|
|
70
|
+
centerDataSet(xAxis);
|
|
71
|
+
} else {
|
|
72
|
+
shiftDataset(xAxis, 0);
|
|
73
|
+
}
|
|
74
|
+
|
|
55
75
|
addColor.apply(void 0, [xAxis].concat(_toConsumableArray(model.xAxisColor)));
|
|
56
76
|
var yAxis = vtkArrowSource.newInstance(_objectSpread({
|
|
57
77
|
direction: [0, 1, 0]
|
|
58
78
|
}, model.config)).getOutputData();
|
|
59
|
-
|
|
79
|
+
|
|
80
|
+
if (model.config.recenter) {
|
|
81
|
+
centerDataSet(yAxis);
|
|
82
|
+
} else {
|
|
83
|
+
shiftDataset(yAxis, 1);
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
addColor.apply(void 0, [yAxis].concat(_toConsumableArray(model.yAxisColor)));
|
|
61
87
|
var zAxis = vtkArrowSource.newInstance(_objectSpread({
|
|
62
88
|
direction: [0, 0, 1]
|
|
63
89
|
}, model.config)).getOutputData();
|
|
64
|
-
|
|
90
|
+
|
|
91
|
+
if (model.config.recenter) {
|
|
92
|
+
centerDataSet(zAxis);
|
|
93
|
+
} else {
|
|
94
|
+
shiftDataset(zAxis, 2);
|
|
95
|
+
}
|
|
96
|
+
|
|
65
97
|
addColor.apply(void 0, [zAxis].concat(_toConsumableArray(model.zAxisColor)));
|
|
66
98
|
var source = vtkAppendPolyData.newInstance();
|
|
67
99
|
source.setInputData(xAxis);
|
|
68
100
|
source.addInputData(yAxis);
|
|
69
|
-
source.addInputData(zAxis);
|
|
101
|
+
source.addInputData(zAxis);
|
|
70
102
|
|
|
71
|
-
|
|
72
|
-
mapper.setInputConnection(source.getOutputPort());
|
|
73
|
-
publicAPI.setMapper(mapper);
|
|
103
|
+
_mapper.setInputConnection(source.getOutputPort());
|
|
74
104
|
};
|
|
75
105
|
|
|
76
106
|
publicAPI.update();
|
|
107
|
+
|
|
108
|
+
var _debouncedUpdate = macro.debounce(publicAPI.update, 0);
|
|
109
|
+
|
|
110
|
+
var setConfig = publicAPI.setConfig,
|
|
111
|
+
setXAxisColor = publicAPI.setXAxisColor,
|
|
112
|
+
setYAxisColor = publicAPI.setYAxisColor,
|
|
113
|
+
setZAxisColor = publicAPI.setZAxisColor;
|
|
114
|
+
|
|
115
|
+
publicAPI.setConfig = function (c) {
|
|
116
|
+
if (setConfig(c)) {
|
|
117
|
+
_debouncedUpdate();
|
|
118
|
+
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
publicAPI.setXAxisColor = function (c) {
|
|
126
|
+
if (setXAxisColor(c)) {
|
|
127
|
+
_debouncedUpdate();
|
|
128
|
+
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return false;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
publicAPI.setYAxisColor = function (c) {
|
|
136
|
+
if (setYAxisColor(c)) {
|
|
137
|
+
_debouncedUpdate();
|
|
138
|
+
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return false;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
publicAPI.setZAxisColor = function (c) {
|
|
146
|
+
if (setZAxisColor(c)) {
|
|
147
|
+
_debouncedUpdate();
|
|
148
|
+
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return false;
|
|
153
|
+
};
|
|
77
154
|
} // ----------------------------------------------------------------------------
|
|
78
155
|
// Object factory
|
|
79
156
|
// ----------------------------------------------------------------------------
|
|
@@ -81,6 +158,7 @@ function vtkAxesActor(publicAPI, model) {
|
|
|
81
158
|
|
|
82
159
|
var DEFAULT_VALUES = {
|
|
83
160
|
config: {
|
|
161
|
+
recenter: true,
|
|
84
162
|
tipResolution: 60,
|
|
85
163
|
tipRadius: 0.1,
|
|
86
164
|
tipLength: 0.2,
|
|
@@ -27,6 +27,7 @@ import vtkImageProperty from '../../Core/ImageProperty.js';
|
|
|
27
27
|
import vtkPiecewiseFunction from '../../../Common/DataModel/PiecewiseFunction.js';
|
|
28
28
|
import vtkCubeAxesActor from '../../Core/CubeAxesActor.js';
|
|
29
29
|
import vtkScalarBarActor from '../../Core/ScalarBarActor.js';
|
|
30
|
+
import vtkAxesActor from '../../Core/AxesActor.js';
|
|
30
31
|
|
|
31
32
|
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; }
|
|
32
33
|
|
|
@@ -583,6 +584,10 @@ var DEFAULT_ALIASES = {
|
|
|
583
584
|
}; // ----------------------------------------------------------------------------
|
|
584
585
|
|
|
585
586
|
var DEFAULT_MAPPING = {
|
|
587
|
+
vtkAxesActor: {
|
|
588
|
+
build: vtkAxesActor.newInstance,
|
|
589
|
+
update: genericUpdater
|
|
590
|
+
},
|
|
586
591
|
vtkRenderWindow: {
|
|
587
592
|
build: vtkRenderWindow.newInstance,
|
|
588
593
|
update: vtkRenderWindowUpdater
|
|
@@ -54,42 +54,42 @@ export interface IViewState {
|
|
|
54
54
|
export interface vtkSynchronizableRenderWindow extends vtkRenderWindow {
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
*
|
|
58
58
|
*/
|
|
59
59
|
getSynchronizerContext(): ISynchronizerContext;
|
|
60
60
|
|
|
61
61
|
// methods added by createSyncFunction
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param {IViewState} state
|
|
64
|
+
*
|
|
65
|
+
* @param {IViewState} state
|
|
66
66
|
*/
|
|
67
67
|
synchronize(state: IViewState): Promise<boolean>;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @param {String} viewId
|
|
70
|
+
*
|
|
71
|
+
* @param {String} viewId
|
|
72
72
|
*/
|
|
73
73
|
setSynchronizedViewId(viewId: string): void;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
*
|
|
77
77
|
*/
|
|
78
78
|
getSynchronizedViewId(): string;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param {Number} v
|
|
81
|
+
*
|
|
82
|
+
* @param {Number} v
|
|
83
83
|
*/
|
|
84
84
|
updateGarbageCollectorThreshold(v: number): void;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
*
|
|
88
88
|
*/
|
|
89
89
|
getManagedInstanceIds(): string[];
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
*
|
|
93
93
|
*/
|
|
94
94
|
clearOneTimeUpdaters(): void;
|
|
95
95
|
}
|
|
@@ -110,52 +110,60 @@ export function extend(publicAPI: object, model: object, initialValues?: ISynchr
|
|
|
110
110
|
export function newInstance(initialValues?: ISynchronizableRenderWindowInitialValues): vtkSynchronizableRenderWindow;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
114
|
-
* @param {String} [name]
|
|
113
|
+
*
|
|
114
|
+
* @param {String} [name]
|
|
115
115
|
*/
|
|
116
116
|
export function getSynchronizerContext(name?: string): ISynchronizerContext;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @param {String} name
|
|
121
|
-
* @param {ISynchronizerContext} ctx
|
|
119
|
+
*
|
|
120
|
+
* @param {String} name
|
|
121
|
+
* @param {Nullable<ISynchronizerContext>} ctx
|
|
122
122
|
*/
|
|
123
|
-
export function setSynchronizerContext(name: string, ctx: ISynchronizerContext)
|
|
123
|
+
export function setSynchronizerContext(name: string, ctx: Nullable<ISynchronizerContext>);
|
|
124
|
+
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @param
|
|
128
|
-
|
|
127
|
+
*
|
|
128
|
+
* @param name of the context to remove and if nothing provided clear them all.
|
|
129
|
+
*/
|
|
130
|
+
export function clearSynchronizerContext(name: Nullable<string>);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param {vtkRenderWindow} renderWindow
|
|
135
|
+
* @param {String} [name]
|
|
129
136
|
*/
|
|
130
137
|
export function decorate(renderWindow: vtkRenderWindow, name?: string): object;
|
|
131
138
|
|
|
132
139
|
/**
|
|
133
|
-
*
|
|
140
|
+
*
|
|
134
141
|
*/
|
|
135
142
|
export function createInstanceMap(): object;
|
|
136
143
|
|
|
137
144
|
/**
|
|
138
|
-
*
|
|
145
|
+
*
|
|
139
146
|
*/
|
|
140
147
|
export function createArrayHandler(): object;
|
|
141
148
|
|
|
142
149
|
/**
|
|
143
|
-
*
|
|
150
|
+
*
|
|
144
151
|
*/
|
|
145
152
|
export function createProgressHandler(): object;
|
|
146
153
|
|
|
147
154
|
/**
|
|
148
|
-
*
|
|
155
|
+
*
|
|
149
156
|
*/
|
|
150
157
|
export function createSceneMtimeHandler(): object;
|
|
151
158
|
|
|
152
159
|
/**
|
|
153
|
-
*
|
|
160
|
+
*
|
|
154
161
|
*/
|
|
155
162
|
export declare const vtkSynchronizableRenderWindow: {
|
|
156
163
|
newInstance: typeof newInstance;
|
|
157
164
|
getSynchronizerContext: typeof getSynchronizerContext;
|
|
158
165
|
setSynchronizerContext: typeof setSynchronizerContext;
|
|
166
|
+
clearSynchronizerContext: typeof clearSynchronizerContext;
|
|
159
167
|
decorate: typeof decorate,
|
|
160
168
|
createInstanceMap: typeof createInstanceMap,
|
|
161
169
|
createArrayHandler: typeof createArrayHandler,
|
|
@@ -220,6 +220,20 @@ function getSynchronizerContext() {
|
|
|
220
220
|
|
|
221
221
|
function setSynchronizerContext(name, ctx) {
|
|
222
222
|
SYNCHRONIZER_CONTEXTS[name] = ctx;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function clearSynchronizerContext(name) {
|
|
226
|
+
if (name && SYNCHRONIZER_CONTEXTS[name]) {
|
|
227
|
+
delete SYNCHRONIZER_CONTEXTS[name];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!name) {
|
|
231
|
+
var keys = Object.keys(SYNCHRONIZER_CONTEXTS);
|
|
232
|
+
|
|
233
|
+
for (var i = 0; i < keys.length; i++) {
|
|
234
|
+
delete SYNCHRONIZER_CONTEXTS[keys[i]];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
223
237
|
} // ----------------------------------------------------------------------------
|
|
224
238
|
|
|
225
239
|
|
|
@@ -346,6 +360,7 @@ var vtkSynchronizableRenderWindow$1 = {
|
|
|
346
360
|
extend: extend,
|
|
347
361
|
getSynchronizerContext: getSynchronizerContext,
|
|
348
362
|
setSynchronizerContext: setSynchronizerContext,
|
|
363
|
+
clearSynchronizerContext: clearSynchronizerContext,
|
|
349
364
|
decorate: decorate,
|
|
350
365
|
createInstanceMap: createInstanceMap,
|
|
351
366
|
createArrayHandler: createArrayHandler,
|