@kitware/vtk.js 26.9.11 → 26.9.13
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/DataModel/DataSetAttributes/FieldData.js +16 -13
- package/Common/DataModel/DataSetAttributes.js +16 -27
- package/Filters/Core/PolyDataNormals.js +3 -3
- package/Interaction/Widgets/OrientationMarkerWidget.js +4 -10
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +24 -11
- package/Rendering/OpenGL/Texture.js +18 -33
- package/Widgets/Manipulators/AbstractManipulator.d.ts +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +2 -2
- package/Widgets/Representations/WidgetRepresentation.js +28 -33
- package/Widgets/Widgets3D/AngleWidget.js +8 -12
- package/macros.js +21 -0
- package/package.json +1 -1
|
@@ -78,15 +78,20 @@ function vtkFieldData(publicAPI, model) {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
publicAPI.removeArray = function (arrayName) {
|
|
81
|
-
|
|
82
|
-
return
|
|
81
|
+
var index = model.arrays.findIndex(function (array) {
|
|
82
|
+
return array.getName() === arrayName;
|
|
83
83
|
});
|
|
84
|
+
return publicAPI.removeArrayByIndex(index);
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
publicAPI.removeArrayByIndex = function (arrayIdx) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (arrayIdx !== -1 && arrayIdx < model.arrays.length) {
|
|
89
|
+
model.arrays.splice(arrayIdx, 1); // TBD modified() ?
|
|
90
|
+
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false;
|
|
90
95
|
};
|
|
91
96
|
|
|
92
97
|
publicAPI.getArrays = function () {
|
|
@@ -106,15 +111,13 @@ function vtkFieldData(publicAPI, model) {
|
|
|
106
111
|
};
|
|
107
112
|
|
|
108
113
|
publicAPI.getArrayWithIndex = function (arrayName) {
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
array: b.data,
|
|
112
|
-
index: i
|
|
113
|
-
} : a;
|
|
114
|
-
}, {
|
|
115
|
-
array: null,
|
|
116
|
-
index: -1
|
|
114
|
+
var index = model.arrays.findIndex(function (array) {
|
|
115
|
+
return array.data.getName() === arrayName;
|
|
117
116
|
});
|
|
117
|
+
return {
|
|
118
|
+
array: index !== -1 ? model.arrays[index].data : null,
|
|
119
|
+
index: index
|
|
120
|
+
};
|
|
118
121
|
};
|
|
119
122
|
|
|
120
123
|
publicAPI.getArrayByIndex = function (idx) {
|
|
@@ -34,6 +34,8 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
34
34
|
|
|
35
35
|
model.classHierarchy.push('vtkDataSetAttributes');
|
|
36
36
|
|
|
37
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
38
|
+
|
|
37
39
|
publicAPI.checkNumberOfComponents = function (x) {
|
|
38
40
|
return true;
|
|
39
41
|
}; // TODO
|
|
@@ -57,7 +59,8 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
57
59
|
if (currentAttribute >= 0 && currentAttribute < model.arrays.length) {
|
|
58
60
|
if (model.arrays[currentAttribute] === arr) {
|
|
59
61
|
return currentAttribute;
|
|
60
|
-
}
|
|
62
|
+
} // FIXME setting an array actually changes its index
|
|
63
|
+
|
|
61
64
|
|
|
62
65
|
publicAPI.removeArrayByIndex(currentAttribute);
|
|
63
66
|
}
|
|
@@ -123,39 +126,25 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
123
126
|
|
|
124
127
|
|
|
125
128
|
publicAPI.removeAllArrays = function () {
|
|
126
|
-
model.arrays = [];
|
|
127
129
|
attrTypes.forEach(function (attType) {
|
|
128
130
|
model["active".concat(attType)] = -1;
|
|
129
131
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
publicAPI.removeArray = function (arrayName) {
|
|
134
|
-
model.arrays = model.arrays.filter(function (entry, idx) {
|
|
135
|
-
if (arrayName === entry.data.getName()) {
|
|
136
|
-
// Found the array to remove, but is it an active attribute?
|
|
137
|
-
attrTypes.forEach(function (attType) {
|
|
138
|
-
if (idx === model["active".concat(attType)]) {
|
|
139
|
-
model["active".concat(attType)] = -1;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return true;
|
|
146
|
-
});
|
|
132
|
+
superClass.removeAllArrays();
|
|
147
133
|
}; // Override to allow proper handling of active attributes
|
|
148
134
|
|
|
149
135
|
|
|
150
136
|
publicAPI.removeArrayByIndex = function (arrayIdx) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
137
|
+
if (arrayIdx !== -1) {
|
|
138
|
+
attrTypes.forEach(function (attType) {
|
|
139
|
+
if (arrayIdx === model["active".concat(attType)]) {
|
|
140
|
+
model["active".concat(attType)] = -1;
|
|
141
|
+
} else if (arrayIdx < model["active".concat(attType)]) {
|
|
142
|
+
model["active".concat(attType)] -= 1;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return superClass.removeArrayByIndex(arrayIdx);
|
|
159
148
|
};
|
|
160
149
|
|
|
161
150
|
attrTypes.forEach(function (value) {
|
|
@@ -79,14 +79,14 @@ function vtkPolyDataNormals(publicAPI, model) {
|
|
|
79
79
|
numberOfComponents: 3,
|
|
80
80
|
values: outputNormalsData
|
|
81
81
|
});
|
|
82
|
-
output.setPointData(input.getPointData());
|
|
83
|
-
output.setCellData(input.getCellData());
|
|
84
|
-
output.setFieldData(input.getFieldData());
|
|
85
82
|
output.setPoints(input.getPoints());
|
|
86
83
|
output.setVerts(input.getVerts());
|
|
87
84
|
output.setLines(input.getLines());
|
|
88
85
|
output.setPolys(input.getPolys());
|
|
89
86
|
output.setStrips(input.getStrips());
|
|
87
|
+
output.getPointData().passData(input.getPointData());
|
|
88
|
+
output.getCellData().passData(input.getCellData());
|
|
89
|
+
output.getFieldData().passData(input.getFieldData());
|
|
90
90
|
output.getPointData().setNormals(outputNormals);
|
|
91
91
|
outData[0] = output;
|
|
92
92
|
};
|
|
@@ -38,6 +38,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
model._onParentRendererChanged = function () {
|
|
42
|
+
return publicAPI.updateViewport();
|
|
43
|
+
};
|
|
44
|
+
|
|
41
45
|
publicAPI.computeViewport = function () {
|
|
42
46
|
var parentRen = model.parentRenderer || model._interactor.getCurrentRenderer();
|
|
43
47
|
|
|
@@ -237,16 +241,6 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
237
241
|
publicAPI.setEnabled(previousState);
|
|
238
242
|
};
|
|
239
243
|
|
|
240
|
-
publicAPI.setParentRenderer = function (ren) {
|
|
241
|
-
var changed = superClass.setParentRenderer(ren);
|
|
242
|
-
|
|
243
|
-
if (changed) {
|
|
244
|
-
publicAPI.updateViewport();
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return changed;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
244
|
publicAPI.getRenderer = function () {
|
|
251
245
|
return selfRenderer;
|
|
252
246
|
};
|
|
@@ -282,7 +282,7 @@ function genericUpdater(instance, state, context) {
|
|
|
282
282
|
|
|
283
283
|
if (state.arrays) {
|
|
284
284
|
var arraysToBind = [];
|
|
285
|
-
var promises = state.arrays.map(function (arrayMetadata) {
|
|
285
|
+
var promises = Object.values(state.arrays).map(function (arrayMetadata) {
|
|
286
286
|
context.start(); // -> start(arrays)
|
|
287
287
|
|
|
288
288
|
return context.getArray(arrayMetadata.hash, arrayMetadata.dataType, context).then(createNewArrayHandler(instance, arrayMetadata, arraysToBind)).catch(function (error) {
|
|
@@ -503,31 +503,41 @@ function removeUnavailableArrays(fields, availableNames) {
|
|
|
503
503
|
function createDataSetUpdate() {
|
|
504
504
|
var piecesToFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
505
505
|
return function (instance, state, context) {
|
|
506
|
-
var _state$arrays;
|
|
507
|
-
|
|
508
506
|
context.start(); // -> start(dataset-update)
|
|
509
507
|
// Make sure we provide container for std arrays
|
|
510
508
|
|
|
509
|
+
var localProperties = _objectSpread({}, state.properties);
|
|
510
|
+
|
|
511
511
|
if (!state.arrays) {
|
|
512
|
-
state.arrays =
|
|
512
|
+
state.arrays = {};
|
|
513
513
|
} // Array members
|
|
514
514
|
// => convert old format to generic state.arrays
|
|
515
515
|
|
|
516
516
|
|
|
517
|
-
piecesToFetch.
|
|
517
|
+
for (var i = 0; i < piecesToFetch.length; i++) {
|
|
518
|
+
var key = piecesToFetch[i];
|
|
519
|
+
|
|
518
520
|
if (state.properties[key]) {
|
|
519
521
|
var arrayMeta = state.properties[key];
|
|
520
522
|
arrayMeta.registration = "set".concat(capitalize(key));
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
var arrayKey = "".concat(arrayMeta.hash, "_").concat(arrayMeta.dataType);
|
|
524
|
+
state.arrays[arrayKey] = arrayMeta;
|
|
525
|
+
delete localProperties[key];
|
|
523
526
|
}
|
|
524
|
-
}
|
|
527
|
+
} // Extract dataset fields
|
|
528
|
+
|
|
525
529
|
|
|
526
530
|
var fieldsArrays = state.properties.fields || [];
|
|
527
531
|
|
|
528
|
-
(
|
|
532
|
+
for (var _i2 = 0; _i2 < fieldsArrays.length; _i2++) {
|
|
533
|
+
var _arrayMeta = fieldsArrays[_i2];
|
|
529
534
|
|
|
530
|
-
|
|
535
|
+
var _arrayKey = "".concat(_arrayMeta.hash, "_").concat(_arrayMeta.dataType);
|
|
536
|
+
|
|
537
|
+
state.arrays[_arrayKey] = _arrayMeta;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
delete localProperties.fields; // Reset any pre-existing fields array
|
|
531
541
|
|
|
532
542
|
var arrayToKeep = {
|
|
533
543
|
pointData: new Set(),
|
|
@@ -542,7 +552,10 @@ function createDataSetUpdate() {
|
|
|
542
552
|
removeUnavailableArrays(instance.getPointData(), arrayToKeep.pointData);
|
|
543
553
|
removeUnavailableArrays(instance.getCellData(), arrayToKeep.cellData); // Generic handling
|
|
544
554
|
|
|
545
|
-
var
|
|
555
|
+
var cleanState = _objectSpread({}, state);
|
|
556
|
+
|
|
557
|
+
cleanState.properties = localProperties;
|
|
558
|
+
var res = genericUpdater(instance, cleanState, context); // Finish what we started
|
|
546
559
|
|
|
547
560
|
context.end(); // -> end(dataset-update)
|
|
548
561
|
|
|
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import Constants from './Texture/Constants.js';
|
|
3
3
|
import HalfFloat from '../../Common/Core/HalfFloat.js';
|
|
4
4
|
import { newInstance as newInstance$1, obj, set, setGet, get, moveToProtected, newTypedArray, vtkDebugMacro as vtkDebugMacro$1, vtkErrorMacro as vtkErrorMacro$1, vtkWarningMacro as vtkWarningMacro$1 } from '../../macros.js';
|
|
5
|
-
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
|
+
import vtkDataArray, { STATIC } from '../../Common/Core/DataArray.js';
|
|
6
6
|
import { Q as isPowerOfTwo, M as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
8
8
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
@@ -1013,36 +1013,21 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1013
1013
|
var max = [];
|
|
1014
1014
|
|
|
1015
1015
|
for (var c = 0; c < numComps; ++c) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
var count = 0;
|
|
1021
|
-
|
|
1022
|
-
for (var i = 0; i < numPixelsIn; ++i) {
|
|
1023
|
-
for (var _c = 0; _c < numComps; ++_c) {
|
|
1024
|
-
if (data[count] < min[_c]) {
|
|
1025
|
-
min[_c] = data[count];
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
if (data[count] > max[_c]) {
|
|
1029
|
-
max[_c] = data[count];
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
count++;
|
|
1033
|
-
}
|
|
1016
|
+
var range = STATIC.fastComputeRange(data, c, numComps);
|
|
1017
|
+
min[c] = range.min;
|
|
1018
|
+
max[c] = range.max;
|
|
1034
1019
|
}
|
|
1035
1020
|
|
|
1036
1021
|
var offset = [];
|
|
1037
1022
|
var scale = [];
|
|
1038
1023
|
|
|
1039
|
-
for (var
|
|
1040
|
-
if (min[
|
|
1041
|
-
max[
|
|
1024
|
+
for (var _c = 0; _c < numComps; ++_c) {
|
|
1025
|
+
if (min[_c] === max[_c]) {
|
|
1026
|
+
max[_c] = min[_c] + 1.0;
|
|
1042
1027
|
}
|
|
1043
1028
|
|
|
1044
|
-
offset[
|
|
1045
|
-
scale[
|
|
1029
|
+
offset[_c] = min[_c];
|
|
1030
|
+
scale[_c] = max[_c] - min[_c];
|
|
1046
1031
|
}
|
|
1047
1032
|
|
|
1048
1033
|
return {
|
|
@@ -1188,16 +1173,16 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1188
1173
|
|
|
1189
1174
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1190
1175
|
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.SHORT) {
|
|
1191
|
-
for (var
|
|
1192
|
-
model.volumeInfo.scale[
|
|
1176
|
+
for (var _c2 = 0; _c2 < numComps; ++_c2) {
|
|
1177
|
+
model.volumeInfo.scale[_c2] = 32767.0;
|
|
1193
1178
|
}
|
|
1194
1179
|
|
|
1195
1180
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1196
1181
|
}
|
|
1197
1182
|
|
|
1198
1183
|
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.UNSIGNED_SHORT) {
|
|
1199
|
-
for (var
|
|
1200
|
-
model.volumeInfo.scale[
|
|
1184
|
+
for (var _c3 = 0; _c3 < numComps; ++_c3) {
|
|
1185
|
+
model.volumeInfo.scale[_c3] = 65535.0;
|
|
1201
1186
|
}
|
|
1202
1187
|
|
|
1203
1188
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
@@ -1208,8 +1193,8 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1208
1193
|
}
|
|
1209
1194
|
|
|
1210
1195
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1211
|
-
for (var
|
|
1212
|
-
model.volumeInfo.scale[
|
|
1196
|
+
for (var _c4 = 0; _c4 < numComps; ++_c4) {
|
|
1197
|
+
model.volumeInfo.scale[_c4] = 255.0;
|
|
1213
1198
|
}
|
|
1214
1199
|
|
|
1215
1200
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
@@ -1248,9 +1233,9 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1248
1233
|
var dataTypeToUse = VtkDataTypes.UNSIGNED_CHAR; // unsigned char gets used as is
|
|
1249
1234
|
|
|
1250
1235
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1251
|
-
for (var
|
|
1252
|
-
res.offset[
|
|
1253
|
-
res.scale[
|
|
1236
|
+
for (var _c5 = 0; _c5 < numComps; ++_c5) {
|
|
1237
|
+
res.offset[_c5] = 0.0;
|
|
1238
|
+
res.scale[_c5] = 255.0;
|
|
1254
1239
|
}
|
|
1255
1240
|
} else if (model.context.getExtension('OES_texture_float') && model.context.getExtension('OES_texture_float_linear')) {
|
|
1256
1241
|
// use float textures scaled to 0.0 to 1.0
|
|
@@ -58,7 +58,7 @@ export interface vtkAbstractManipulator extends vtkObject {
|
|
|
58
58
|
/* ------------------------------------------------------------------- */
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Set the user normal.
|
|
61
|
+
* Set the user normal.
|
|
62
62
|
* This normal take precedence on the handleNormal and the widgetNormal.
|
|
63
63
|
* This normal should not be set within the widget internal code.
|
|
64
64
|
* @param {Vector3} normal The normal coordinate.
|
|
@@ -201,9 +201,9 @@ function vtkGlyphRepresentation(publicAPI, model) {
|
|
|
201
201
|
publicAPI.getRepresentationStates = function () {
|
|
202
202
|
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
203
203
|
return superClass.getRepresentationStates(input).filter(function (state) {
|
|
204
|
-
var _state$getOrigin, _state$isVisible;
|
|
204
|
+
var _state$getOrigin, _state$isVisible, _state$isVisible2;
|
|
205
205
|
|
|
206
|
-
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = state.isVisible) === null || _state$
|
|
206
|
+
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = (_state$isVisible2 = state.isVisible) === null || _state$isVisible2 === void 0 ? void 0 : _state$isVisible2.call(state)) !== null && _state$isVisible !== void 0 ? _state$isVisible : true);
|
|
207
207
|
});
|
|
208
208
|
}; // --------------------------------------------------------------------------
|
|
209
209
|
|
|
@@ -16,6 +16,25 @@ var vtkErrorMacro = macro.vtkErrorMacro,
|
|
|
16
16
|
vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
var STYLE_CATEGORIES = ['active', 'inactive', 'static'];
|
|
19
|
+
|
|
20
|
+
function applyCoincidentTopologyParametersToMapper(mapper, parameters) {
|
|
21
|
+
if (mapper && mapper.setResolveCoincidentTopologyToPolygonOffset) {
|
|
22
|
+
mapper.setResolveCoincidentTopologyToPolygonOffset();
|
|
23
|
+
CATEGORIES.forEach(function (category) {
|
|
24
|
+
if (parameters[category]) {
|
|
25
|
+
var methodName = "setRelativeCoincidentTopology".concat(category, "OffsetParameters");
|
|
26
|
+
|
|
27
|
+
if (mapper[methodName]) {
|
|
28
|
+
var _parameters$category = parameters[category],
|
|
29
|
+
factor = _parameters$category.factor,
|
|
30
|
+
offset = _parameters$category.offset;
|
|
31
|
+
mapper[methodName](factor, offset);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
19
38
|
function mergeStyles(elementNames) {
|
|
20
39
|
for (var _len = arguments.length, stylesToMerge = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
21
40
|
stylesToMerge[_key - 1] = arguments[_key];
|
|
@@ -151,16 +170,20 @@ function allocateArray(polyData, name, numberOfTuples, dataType, numberOfCompone
|
|
|
151
170
|
|
|
152
171
|
function vtkWidgetRepresentation(publicAPI, model) {
|
|
153
172
|
// Set our className
|
|
154
|
-
model.classHierarchy.push('vtkWidgetRepresentation');
|
|
155
|
-
|
|
156
|
-
var superclass = _objectSpread({}, publicAPI); // Internal cache
|
|
157
|
-
|
|
173
|
+
model.classHierarchy.push('vtkWidgetRepresentation'); // Internal cache
|
|
158
174
|
|
|
159
175
|
var cache = {
|
|
160
176
|
mtimes: {},
|
|
161
177
|
states: []
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
model._onCoincidentTopologyParametersChanged = function () {
|
|
181
|
+
publicAPI.getActors().forEach(function (actor) {
|
|
182
|
+
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
183
|
+
});
|
|
162
184
|
}; // --------------------------------------------------------------------------
|
|
163
185
|
|
|
186
|
+
|
|
164
187
|
publicAPI.getActors = function () {
|
|
165
188
|
return model.actors;
|
|
166
189
|
};
|
|
@@ -245,25 +268,7 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
245
268
|
model.alwaysVisibleActors[_i].setVisibility(true);
|
|
246
269
|
}
|
|
247
270
|
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
function applyCoincidentTopologyParametersToMapper(mapper, parameters) {
|
|
251
|
-
if (mapper && mapper.setResolveCoincidentTopologyToPolygonOffset) {
|
|
252
|
-
mapper.setResolveCoincidentTopologyToPolygonOffset();
|
|
253
|
-
CATEGORIES.forEach(function (category) {
|
|
254
|
-
if (parameters[category]) {
|
|
255
|
-
var methodName = "setRelativeCoincidentTopology".concat(category, "OffsetParameters");
|
|
256
|
-
|
|
257
|
-
if (mapper[methodName]) {
|
|
258
|
-
var _parameters$category = parameters[category],
|
|
259
|
-
factor = _parameters$category.factor,
|
|
260
|
-
offset = _parameters$category.offset;
|
|
261
|
-
mapper[methodName](factor, offset);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
} // Add warning to model.actors.push
|
|
271
|
+
}; // Add warning to model.actors.push
|
|
267
272
|
|
|
268
273
|
|
|
269
274
|
model.actors.push = function () {
|
|
@@ -281,16 +286,6 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
281
286
|
publicAPI.addActor = function (actor) {
|
|
282
287
|
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
283
288
|
Array.prototype.push.apply(model.actors, [actor]);
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
publicAPI.setCoincidentTopologyParameters = function (parameters) {
|
|
287
|
-
var modified = superclass.setCoincidentTopologyParameters(parameters);
|
|
288
|
-
|
|
289
|
-
if (modified) {
|
|
290
|
-
publicAPI.getActors().forEach(function (actor) {
|
|
291
|
-
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
289
|
}; // Make sure setting the labels at build time works with string/array...
|
|
295
290
|
|
|
296
291
|
|
|
@@ -16,13 +16,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
// ----------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
function vtkAngleWidget(publicAPI, model) {
|
|
19
|
-
model.classHierarchy.push('vtkAngleWidget');
|
|
20
|
-
|
|
21
|
-
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
22
|
-
|
|
19
|
+
model.classHierarchy.push('vtkAngleWidget'); // --- Widget Requirement ---------------------------------------------------
|
|
23
20
|
|
|
24
21
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
|
|
25
22
|
|
|
23
|
+
model._onManipulatorChanged = function () {
|
|
24
|
+
model.widgetState.getMoveHandle().setManipulator(model.manipulator);
|
|
25
|
+
model.widgetState.getHandleList().forEach(function (handle) {
|
|
26
|
+
handle.setManipulator(model.manipulator);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
27
31
|
switch (viewType) {
|
|
28
32
|
case ViewTypes.DEFAULT:
|
|
@@ -58,14 +62,6 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
58
62
|
subtract(handles[0].getOrigin(), handles[1].getOrigin(), vec1);
|
|
59
63
|
subtract(handles[2].getOrigin(), handles[1].getOrigin(), vec2);
|
|
60
64
|
return angleBetweenVectors(vec1, vec2);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
publicAPI.setManipulator = function (manipulator) {
|
|
64
|
-
superClass.setManipulator(manipulator);
|
|
65
|
-
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
66
|
-
model.widgetState.getHandleList().forEach(function (handle) {
|
|
67
|
-
handle.setManipulator(manipulator);
|
|
68
|
-
});
|
|
69
65
|
}; // --------------------------------------------------------------------------
|
|
70
66
|
// initialization
|
|
71
67
|
// --------------------------------------------------------------------------
|
package/macros.js
CHANGED
|
@@ -480,6 +480,7 @@ function get(publicAPI, model, fieldNames) {
|
|
|
480
480
|
|
|
481
481
|
var objectSetterMap = {
|
|
482
482
|
enum: function _enum(publicAPI, model, field) {
|
|
483
|
+
var onChanged = "_on".concat(_capitalize(field.name), "Changed");
|
|
483
484
|
return function (value) {
|
|
484
485
|
if (typeof value === 'string') {
|
|
485
486
|
if (field.enum[value] !== undefined) {
|
|
@@ -501,7 +502,11 @@ var objectSetterMap = {
|
|
|
501
502
|
if (Object.keys(field.enum).map(function (key) {
|
|
502
503
|
return field.enum[key];
|
|
503
504
|
}).indexOf(value) !== -1) {
|
|
505
|
+
var _model$onChanged;
|
|
506
|
+
|
|
507
|
+
var previousValue = model[field.name];
|
|
504
508
|
model[field.name] = value;
|
|
509
|
+
(_model$onChanged = model[onChanged]) === null || _model$onChanged === void 0 ? void 0 : _model$onChanged.call(model, publicAPI, model, value, previousValue);
|
|
505
510
|
publicAPI.modified();
|
|
506
511
|
return true;
|
|
507
512
|
}
|
|
@@ -518,9 +523,14 @@ var objectSetterMap = {
|
|
|
518
523
|
};
|
|
519
524
|
},
|
|
520
525
|
object: function object(publicAPI, model, field) {
|
|
526
|
+
var onChanged = "_on".concat(_capitalize(field.name), "Changed");
|
|
521
527
|
return function (value) {
|
|
522
528
|
if (!DeepEqual(model[field.name], value)) {
|
|
529
|
+
var _model$onChanged2;
|
|
530
|
+
|
|
531
|
+
var previousValue = model[field.name];
|
|
523
532
|
model[field.name] = value;
|
|
533
|
+
(_model$onChanged2 = model[onChanged]) === null || _model$onChanged2 === void 0 ? void 0 : _model$onChanged2.call(model, publicAPI, model, value, previousValue);
|
|
524
534
|
publicAPI.modified();
|
|
525
535
|
return true;
|
|
526
536
|
}
|
|
@@ -545,6 +555,7 @@ function findSetter(field) {
|
|
|
545
555
|
}
|
|
546
556
|
|
|
547
557
|
return function getSetter(publicAPI, model) {
|
|
558
|
+
var onChanged = "_on".concat(_capitalize(field), "Changed");
|
|
548
559
|
return function setter(value) {
|
|
549
560
|
if (model.deleted) {
|
|
550
561
|
vtkErrorMacro('instance deleted - cannot call any method');
|
|
@@ -552,7 +563,11 @@ function findSetter(field) {
|
|
|
552
563
|
}
|
|
553
564
|
|
|
554
565
|
if (model[field] !== value) {
|
|
566
|
+
var _model$onChanged3;
|
|
567
|
+
|
|
568
|
+
var previousValue = model[field.name];
|
|
555
569
|
model[field] = value;
|
|
570
|
+
(_model$onChanged3 = model[onChanged]) === null || _model$onChanged3 === void 0 ? void 0 : _model$onChanged3.call(model, publicAPI, model, value, previousValue);
|
|
556
571
|
publicAPI.modified();
|
|
557
572
|
return true;
|
|
558
573
|
}
|
|
@@ -605,6 +620,8 @@ function setArray(publicAPI, model, fieldNames, size) {
|
|
|
605
620
|
throw new RangeError("Invalid initial number of values for array (".concat(field, ")"));
|
|
606
621
|
}
|
|
607
622
|
|
|
623
|
+
var onChanged = "_on".concat(_capitalize(field), "Changed");
|
|
624
|
+
|
|
608
625
|
publicAPI["set".concat(_capitalize(field))] = function () {
|
|
609
626
|
if (model.deleted) {
|
|
610
627
|
vtkErrorMacro('instance deleted - cannot call any method');
|
|
@@ -655,7 +672,11 @@ function setArray(publicAPI, model, fieldNames, size) {
|
|
|
655
672
|
}
|
|
656
673
|
|
|
657
674
|
if (changeDetected) {
|
|
675
|
+
var _model$onChanged4;
|
|
676
|
+
|
|
677
|
+
var previousValue = model[field.name];
|
|
658
678
|
model[field] = array;
|
|
679
|
+
(_model$onChanged4 = model[onChanged]) === null || _model$onChanged4 === void 0 ? void 0 : _model$onChanged4.call(model, publicAPI, model, array, previousValue);
|
|
659
680
|
publicAPI.modified();
|
|
660
681
|
}
|
|
661
682
|
|