@kitware/vtk.js 25.0.2 → 25.1.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.
@@ -0,0 +1,9 @@
1
+ export declare enum CoordinateSystem {
2
+ WORLD = 0,
3
+ DISPLAY = 1,
4
+ }
5
+
6
+ declare const _default: {
7
+ CoordinateSystem: typeof CoordinateSystem;
8
+ };
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ var CoordinateSystem = {
2
+ DISPLAY: 0,
3
+ WORLD: 1
4
+ };
5
+ var Constants = {
6
+ CoordinateSystem: CoordinateSystem
7
+ };
8
+
9
+ export { CoordinateSystem, Constants as default };
@@ -3,6 +3,7 @@ import vtkActor from './Actor';
3
3
  import vtkActor2D from './Actor2D';
4
4
  import vtkTexture from './Texture';
5
5
  import vtkVolume from './Volume';
6
+ import { CoordinateSystem } from './Prop/Constants';
6
7
 
7
8
 
8
9
  export interface IPropInitialValues {
@@ -20,8 +21,8 @@ export interface IPropInitialValues {
20
21
  export interface vtkProp extends vtkObject {
21
22
 
22
23
  /**
23
- *
24
- * @param estimatedRenderTime
24
+ *
25
+ * @param estimatedRenderTime
25
26
  */
26
27
  addEstimatedRenderTime(estimatedRenderTime: number): void;
27
28
 
@@ -37,6 +38,11 @@ export interface vtkProp extends vtkObject {
37
38
  */
38
39
  getActors2D(): vtkActor2D[];
39
40
 
41
+ /**
42
+ * Get the coordinate system this prop is defined in.
43
+ */
44
+ getCoordinateSystem(): CoordinateSystem;
45
+
40
46
  /**
41
47
  * Get the value of the dragable instance variable.
42
48
  * @see getNestedDragable
@@ -83,32 +89,32 @@ export interface vtkProp extends vtkObject {
83
89
  getNestedPickable(): boolean;
84
90
 
85
91
  /**
86
- * Return the mtime of anything that would cause the rendered image to appear differently.
87
- * Usually this involves checking the mtime of the prop plus anything else it depends on such as properties,
92
+ * Return the mtime of anything that would cause the rendered image to appear differently.
93
+ * Usually this involves checking the mtime of the prop plus anything else it depends on such as properties,
88
94
  * textures etc.
89
95
  */
90
96
  getRedrawMTime(): number
91
97
 
92
98
  /**
93
- *
99
+ *
94
100
  */
95
101
  getRendertimemultiplier(): number;
96
102
 
97
103
  /**
98
104
  * The value is returned in seconds. For simple geometry the accuracy may not be great
99
- * due to buffering. For ray casting, which is already multi-resolution,
100
- * the current resolution of the image is factored into the time. We need the viewport
105
+ * due to buffering. For ray casting, which is already multi-resolution,
106
+ * the current resolution of the image is factored into the time. We need the viewport
101
107
  * for viewing parameters that affect timing. The no-arguments version simply returns the value of the variable with no estimation.
102
108
  */
103
109
  getEstimatedRenderTime(): number;
104
110
 
105
111
  /**
106
- *
112
+ *
107
113
  */
108
114
  getAllocatedRenderTime(): number;
109
115
 
110
116
  /**
111
- *
117
+ *
112
118
  */
113
119
  getNestedProps(): any;
114
120
 
@@ -119,47 +125,47 @@ export interface vtkProp extends vtkObject {
119
125
  getParentProp(): vtkProp;
120
126
 
121
127
  /**
122
- *
128
+ *
123
129
  * Not implemented yet
124
130
  */
125
131
  getVolumes(): vtkVolume[];
126
132
 
127
133
  /**
128
- *
134
+ *
129
135
  */
130
136
  getUseBounds(): boolean;
131
137
 
132
138
  /**
133
- *
139
+ *
134
140
  */
135
141
  getSupportsSelection(): boolean;
136
142
 
137
143
  /**
138
- *
144
+ *
139
145
  */
140
146
  getTextures(): vtkTexture[];
141
147
 
142
148
  /**
143
- *
149
+ *
144
150
  * @param {vtkTexture} texture The vtkTexture instance.
145
151
  *
146
152
  */
147
153
  hasTexture(texture: vtkTexture): boolean;
148
154
 
149
155
  /**
150
- *
156
+ *
151
157
  * @param {vtkTexture} texture The vtkTexture instance.
152
158
  */
153
159
  addTexture(texture: vtkTexture): void;
154
160
 
155
161
  /**
156
- *
162
+ *
157
163
  * @param {vtkTexture} texture The vtkTexture instance.
158
164
  */
159
165
  removeTexture(texture: vtkTexture): void;
160
166
 
161
167
  /**
162
- *
168
+ *
163
169
  */
164
170
  removeAllTextures(): void;
165
171
 
@@ -169,15 +175,43 @@ export interface vtkProp extends vtkObject {
169
175
  restoreEstimatedRenderTime(): void;
170
176
 
171
177
  /**
172
- *
173
- * @param allocatedRenderTime
178
+ *
179
+ * @param allocatedRenderTime
174
180
  */
175
181
  setAllocatedRenderTime(allocatedRenderTime: number): void;
176
182
 
183
+ /**
184
+ * Set the coordinate system that this prop's data should be in.
185
+ * Once the prop has applied any modifiers such as position, orientation
186
+ * userMatrix the resulting values will be treated as in the specified
187
+ * coordinate system.
188
+ * Not all mappers support all coordinate systems.
189
+ * @param {CoordinateSystem} coordinateSystem
190
+ */
191
+ setCoordinateSystem(coordinateSystem: CoordinateSystem): void;
192
+
193
+ /**
194
+ * Indicate that this prop's data should be in world coordinates.
195
+ * Once the prop has applied any modifiers such as position, orientation
196
+ * userMatrix the resulting values will be treated as in world coordinates.
197
+ * Not all mappers support all coordinate systems.
198
+ */
199
+ setCoordinateSystemToWorld(): void;
200
+
201
+ /**
202
+ * Indicate that this prop's data should be in display coordinates.
203
+ * Once the prop has applied any modifiers such as position, orientation
204
+ * userMatrix the resulting values will be treated as in pixel coordinates.
205
+ * That is pixel coordinate with 0,0 in the lower left of the viewport
206
+ * and a z range of -1 at the near plane and 1 at the far.
207
+ * Not all mappers support all coordinate systems.
208
+ */
209
+ setCoordinateSystemToDisplay(): void;
210
+
177
211
  /**
178
212
  * Set whether prop is dragable.
179
213
  * Even if true, prop may not be dragable if an ancestor prop is not dragable.
180
- * @param dragable
214
+ * @param dragable
181
215
  * @default true
182
216
  * @see getDragable
183
217
  * @see combineDragable
@@ -185,8 +219,8 @@ export interface vtkProp extends vtkObject {
185
219
  setDragable(dragable: boolean): boolean;
186
220
 
187
221
  /**
188
- *
189
- * @param estimatedRenderTime
222
+ *
223
+ * @param estimatedRenderTime
190
224
  */
191
225
  setEstimatedRenderTime(estimatedRenderTime: number): void;
192
226
 
@@ -198,7 +232,7 @@ export interface vtkProp extends vtkObject {
198
232
  * @see combineDragable
199
233
  * @default null
200
234
  */
201
- setParentProp(parentProp: vtkProp): void;
235
+ setParentProp(parentProp: vtkProp): void;
202
236
 
203
237
  /**
204
238
  * Set whether prop is pickable.
@@ -208,20 +242,20 @@ export interface vtkProp extends vtkObject {
208
242
  * @see getPickable
209
243
  * @see combinePickable
210
244
  */
211
- setPickable(pickable: boolean): boolean;
245
+ setPickable(pickable: boolean): boolean;
212
246
 
213
- /**
214
- * Set whether prop is visible.
215
- * Even if true, prop may not be visible if an ancestor prop is not visible.
216
- * @param visibility
217
- * @default true
218
- * @see getVisibility
219
- * @see combineVisibility
220
- */
247
+ /**
248
+ * Set whether prop is visible.
249
+ * Even if true, prop may not be visible if an ancestor prop is not visible.
250
+ * @param visibility
251
+ * @default true
252
+ * @see getVisibility
253
+ * @see combineVisibility
254
+ */
221
255
  setVisibility(visibility: boolean): boolean;
222
256
 
223
257
  /**
224
- * In case the Visibility flag is true, tell if the bounds of this prop should be taken into
258
+ * In case the Visibility flag is true, tell if the bounds of this prop should be taken into
225
259
  * account or ignored during the computation of other bounding boxes, like in vtkRenderer::ResetCamera().
226
260
  * @param useBounds
227
261
  * @default true
@@ -230,7 +264,7 @@ export interface vtkProp extends vtkObject {
230
264
 
231
265
  /**
232
266
  * This is used for culling and is a number between 0 and 1. It is used to create the allocated render time value.
233
- * @param {Number} renderTimeMultiplier
267
+ * @param {Number} renderTimeMultiplier
234
268
  */
235
269
  setRenderTimeMultiplier(renderTimeMultiplier: number): boolean;
236
270
 
@@ -263,7 +297,7 @@ export function extend(publicAPI: object, model: object, initialValues?: IPropIn
263
297
  export function newInstance(initialValues?: IPropInitialValues): vtkProp;
264
298
 
265
299
 
266
- /**
300
+ /**
267
301
  * vtkProp is an abstract superclass for any objects that can exist in a
268
302
  * rendered scene (either 2D or 3D). Instances of vtkProp may respond to
269
303
  * various render methods (e.g., RenderOpaqueGeometry()). vtkProp also
@@ -1,4 +1,11 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import macro from '../../macros.js';
3
+ import Constants from './Prop/Constants.js';
4
+
5
+ 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; }
6
+
7
+ 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; }
8
+ var CoordinateSystem = Constants.CoordinateSystem;
2
9
 
3
10
  function notImplemented(method) {
4
11
  return function () {
@@ -116,6 +123,15 @@ function vtkProp(publicAPI, model) {
116
123
  publicAPI.removeAllTextures = function () {
117
124
  model.textures = [];
118
125
  publicAPI.modified();
126
+ }; // not all mappers support all coordinate systems
127
+
128
+
129
+ publicAPI.setCoordinateSystemToWorld = function () {
130
+ return publicAPI.setCoordinateSystem(CoordinateSystem.WORLD);
131
+ };
132
+
133
+ publicAPI.setCoordinateSystemToDisplay = function () {
134
+ return publicAPI.setCoordinateSystem(CoordinateSystem.DISPLAY);
119
135
  };
120
136
  } // ----------------------------------------------------------------------------
121
137
  // Object factory
@@ -124,16 +140,17 @@ function vtkProp(publicAPI, model) {
124
140
 
125
141
  var DEFAULT_VALUES = {
126
142
  // _parentProp: null,
127
- visibility: true,
128
- pickable: true,
129
- dragable: true,
130
- useBounds: true,
131
143
  allocatedRenderTime: 10,
144
+ coordinateSystem: CoordinateSystem.WORLD,
145
+ dragable: true,
132
146
  estimatedRenderTime: 0,
133
- savedEstimatedRenderTime: 0,
134
- renderTimeMultiplier: 1,
135
147
  paths: null,
136
- textures: []
148
+ pickable: true,
149
+ renderTimeMultiplier: 1,
150
+ savedEstimatedRenderTime: 0,
151
+ textures: [],
152
+ useBounds: true,
153
+ visibility: true
137
154
  }; // ----------------------------------------------------------------------------
138
155
 
139
156
  function extend(publicAPI, model) {
@@ -142,7 +159,7 @@ function extend(publicAPI, model) {
142
159
 
143
160
  macro.obj(publicAPI, model);
144
161
  macro.get(publicAPI, model, ['estimatedRenderTime', 'allocatedRenderTime']);
145
- macro.setGet(publicAPI, model, ['visibility', 'pickable', 'dragable', 'useBounds', 'renderTimeMultiplier', '_parentProp']);
162
+ macro.setGet(publicAPI, model, ['_parentProp', 'coordinateSystem', 'dragable', 'pickable', 'renderTimeMultiplier', 'useBounds', 'visibility']);
146
163
  macro.moveToProtected(publicAPI, model, ['parentProp']); // Object methods
147
164
 
148
165
  vtkProp(publicAPI, model);
@@ -150,9 +167,9 @@ function extend(publicAPI, model) {
150
167
 
151
168
  var newInstance = macro.newInstance(extend, 'vtkProp'); // ----------------------------------------------------------------------------
152
169
 
153
- var vtkProp$1 = {
170
+ var vtkProp$1 = _objectSpread({
154
171
  newInstance: newInstance,
155
172
  extend: extend
156
- };
173
+ }, Constants);
157
174
 
158
175
  export { vtkProp$1 as default, extend, newInstance };
@@ -1,7 +1,11 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import macro from '../../macros.js';
2
3
  import Constants from './Property2D/Constants.js';
3
4
  import { Representation } from './Property/Constants.js';
4
5
 
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; }
7
+
8
+ 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; }
5
9
  var DisplayLocation = Constants.DisplayLocation; // ----------------------------------------------------------------------------
6
10
  // vtkProperty2D methods
7
11
  // ----------------------------------------------------------------------------
@@ -60,9 +64,9 @@ function extend(publicAPI, model) {
60
64
 
61
65
  var newInstance = macro.newInstance(extend, 'vtkProperty2D'); // ----------------------------------------------------------------------------
62
66
 
63
- var vtkProperty2D$1 = {
67
+ var vtkProperty2D$1 = _objectSpread({
64
68
  newInstance: newInstance,
65
69
  extend: extend
66
- };
70
+ }, Constants);
67
71
 
68
72
  export { vtkProperty2D$1 as default, extend, newInstance };