Skip to content

Commit 328af12

Browse files
authored
Merge pull request #2157 from daker/more-ts-defs
docs(ts): Add typescript definitions
2 parents 2e43a9a + a626193 commit 328af12

File tree

9 files changed

+796
-135
lines changed

9 files changed

+796
-135
lines changed

Sources/Common/Core/ScalarsToColors/api.md

Whitespace-only changes.
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
import { vtkObject } from "../../../interfaces" ;
2+
import { Range } from "../../../types";
3+
4+
export interface IPiecewiseFunctionInitialValues {
5+
range?: Range,
6+
clamping?: boolean,
7+
allowDuplicateScalars?: boolean,
8+
}
9+
10+
export interface vtkPiecewiseFunction extends vtkObject {
11+
12+
/**
13+
* Add points to the function.
14+
* @param {Number} x The x coordinate.
15+
* @param {Number} y The y coordinate.
16+
*/
17+
addPoint(x: number, y: number): void;
18+
19+
/**
20+
* Add points to the function.
21+
* @param {Number} x The x coordinate.
22+
* @param {Number} y The y coordinate.
23+
* @param {Number} midpoint
24+
* @param {Number} sharpness
25+
*/
26+
addPointLong(x: number, y: number, midpoint: number, sharpness: number): number;
27+
28+
/**
29+
* Add a line segment to the function.
30+
* @param {Number} x1 The first point x coordinate.
31+
* @param {Number} y1 The first point y coordinate.
32+
* @param {Number} x2 The second point x coordinate.
33+
* @param {Number} y2 The second point y coordinate.
34+
*/
35+
addSegment(x1: number, y1: number, x2: number, y2: number): void;
36+
37+
/**
38+
* Remove all points out of the new range, and make sure there is a point at
39+
* each end of that range.
40+
* @param {Range} range
41+
*/
42+
adjustRange(range: Range): number;
43+
44+
/**
45+
* Estimates the minimum size of a table such that it would correctly sample
46+
* this function.
47+
*/
48+
estimateMinNumberOfSamples(): number;
49+
50+
/**
51+
* Traverses the nodes to find the minimum distance.
52+
*/
53+
findMinimumXDistance(): number;
54+
55+
/**
56+
* Toggle whether to allow duplicate scalar values in the piecewise function
57+
* (off by default).
58+
*/
59+
getAllowDuplicateScalars(): boolean;
60+
61+
/**
62+
* When zero range clamping is Off, GetValue() returns 0.0 when a value is
63+
* requested outside of the points specified.
64+
*
65+
* When zero range clamping is On, GetValue() returns the value at the value
66+
* at the lowest point for a request below all points specified and returns
67+
* the value at the highest point for a request above all points specified.
68+
* On is the default.
69+
*/
70+
getClamping(): boolean;
71+
72+
/**
73+
* Returns a pointer to the data stored in the table.
74+
*/
75+
getDataPointer(): any[];
76+
77+
/**
78+
* Returns the first point location which precedes a non-zero segment of the
79+
* function.
80+
*/
81+
getFirstNonZeroValue(): number;
82+
83+
/**
84+
* For the node specified by index, set/get the location (X), value (Y),
85+
* midpoint, and sharpness values at the node.
86+
* @param {Number} index
87+
* @param val
88+
*/
89+
getNodeValue(index: number, val: any[]): void;
90+
91+
/**
92+
* Returns the min and max node locations of the function.
93+
*/
94+
getRange(): Range;
95+
96+
/**
97+
* Returns the min and max node locations of the function.
98+
*/
99+
getRangeByReference(): Range;
100+
101+
/**
102+
* Get the number of points used to specify the function.
103+
*/
104+
getSize(): number;
105+
106+
/**
107+
* Fills in an array of function values evaluated at regular intervals.
108+
* @param {Number} xStart
109+
* @param {Number} xEnd
110+
* @param {Number} size
111+
* @param table
112+
* @param {Number} [stride]
113+
*/
114+
getTable(xStart: number, xEnd: number, size: number, table: any, stride?: number): void;
115+
116+
/**
117+
* Return the type of function: Function Types:
118+
* * 0 : Constant (No change in slope between end points)
119+
* * 1 : NonDecreasing (Always increasing or zero slope)
120+
* * 2 : NonIncreasing (Always decreasing or zero slope)
121+
* * 3 : Varied (Contains both decreasing and increasing slopes)
122+
*/
123+
getType(): 'Constant' | 'NonDecreasing' | 'NonIncreasing' | 'Varied';
124+
125+
/**
126+
* Returns the value of the function at the specified location using the
127+
* specified interpolation.
128+
*/
129+
getValue(): any;
130+
131+
/**
132+
* Removes all points from the function.
133+
*/
134+
removeAllPoints(): void;
135+
136+
/**
137+
* Remove the first point found at the given x location Return the index of
138+
* the remove point if any, -1 otherwise.
139+
* @param {Number} x
140+
*/
141+
removePoint(x: number): number;
142+
143+
/**
144+
*
145+
* @param {Boolean} allowDuplicateScalars
146+
*/
147+
setAllowDuplicateScalars(allowDuplicateScalars: boolean): boolean;
148+
149+
/**
150+
* When zero range clamping is Off, GetValue() returns 0.0 when a value is
151+
* requested outside of the points specified.
152+
*
153+
* When zero range clamping is On, GetValue() returns the value at the value
154+
* at the lowest point for a request below all points specified and returns
155+
* the value at the highest point for a request above all points specified.
156+
* On is the default.
157+
* @param {Boolean} clamping
158+
*/
159+
setClamping(clamping: boolean): boolean;
160+
161+
/**
162+
*
163+
* @param {Number} index
164+
* @param val
165+
*/
166+
setNodeValue(index: number, val: any[]): number;
167+
168+
/**
169+
*
170+
* @param nodes
171+
*/
172+
setNodes(nodes: any[]): void;
173+
174+
/**
175+
*
176+
* @param {Range} range
177+
*/
178+
setRange(range: Range): boolean;
179+
180+
/**
181+
*
182+
* @param {Number} min
183+
* @param {Number} max
184+
*/
185+
setRange(min: number, max: number): boolean;
186+
187+
/**
188+
*
189+
* @param {Range} range
190+
*/
191+
setRangeFrom(range: Range): boolean;
192+
193+
/**
194+
* Internal method to sort the vector and update the Range whenever a node
195+
* is added, edited or removed.
196+
197+
*/
198+
sortAndUpdateRange(): void;
199+
200+
/**
201+
* Returns true if the range has been updated and Modified() has been
202+
* called.
203+
*/
204+
updateRange(): boolean;
205+
}
206+
207+
/**
208+
* Method used to decorate a given object (publicAPI+model) with vtkPiecewiseFunction characteristics.
209+
*
210+
* @param publicAPI object on which methods will be bounds (public)
211+
* @param model object on which data structure will be bounds (protected)
212+
* @param {IPiecewiseFunctionInitialValues} [initialValues] (default: {})
213+
*/
214+
export function extend(publicAPI: object, model: object, initialValues?: IPiecewiseFunctionInitialValues): void;
215+
216+
/**
217+
* Method used to create a new instance of vtkPiecewiseFunction.
218+
* @param {IPiecewiseFunctionInitialValues} [initialValues] for pre-setting some of its content
219+
*/
220+
export function newInstance(initialValues?: IPiecewiseFunctionInitialValues): vtkPiecewiseFunction;
221+
222+
/**
223+
* vtkPiecewiseFunction Defines a piecewise function mapping. This mapping
224+
* allows the addition of control points, and allows the user to control the
225+
* function between the control points. A piecewise hermite curve is used
226+
* between control points, based on the sharpness and midpoint parameters. A
227+
* sharpness of 0 yields a piecewise linear function and a sharpness of 1 yields
228+
* a piecewise constant function. The midpoint is the normalized distance
229+
* between control points at which the curve reaches the median Y value.
230+
*
231+
* The midpoint and sharpness values specified when adding a node are used to
232+
* control the transition to the next node (the last node's values are ignored)
233+
* Outside the range of nodes, the values are 0 if Clamping is off, or the
234+
* nearest node point if Clamping is on. Using the legacy methods for adding
235+
* points (which do not have Sharpness and Midpoint parameters) will default to
236+
* Midpoint = 0.5 (halfway between the control points) and Sharpness = 0.0
237+
* (linear).
238+
*
239+
* @example
240+
* ```js
241+
* const ofun = vtkPiecewiseFunction.newInstance();
242+
* ofun.addPoint(200.0, 0.0);
243+
* ofun.addPoint(1200.0, 0.2);
244+
* ofun.addPoint(4000.0, 0.4);
245+
* ```
246+
*
247+
* @see [vtkColorTransferFunction](./Rendering_Core_ColorTransferFunction.html)
248+
*/
249+
export declare const vtkPiecewiseFunction: {
250+
newInstance: typeof newInstance,
251+
extend: typeof extend;
252+
};
253+
export default vtkPiecewiseFunction;
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { vtkObject } from "../../../interfaces";
2+
import { Size } from "../../../types";
3+
4+
5+
/**
6+
*
7+
*/
8+
export interface IImageStreamInitialValues {
9+
viewStreams?: any[],
10+
serverAnimationFPS?: number,
11+
}
12+
13+
14+
export interface vtkImageStream extends vtkObject {
15+
16+
/**
17+
*
18+
*/
19+
connect(): void;
20+
21+
/**
22+
*
23+
* @param {Number} [viewId] The ID of the view.
24+
* @param {Size} [size] The size of the view.
25+
*/
26+
createViewStream(viewId?: number, size?: Size): any;
27+
28+
/**
29+
*
30+
*/
31+
delete(): void;
32+
33+
/**
34+
*
35+
*/
36+
disconnect(): void;
37+
38+
/**
39+
*
40+
*/
41+
getProtocol(): any;
42+
43+
/**
44+
*
45+
*/
46+
getServerAnimationFPS(): number;
47+
48+
/**
49+
*
50+
*/
51+
registerViewStream(): void;
52+
53+
/**
54+
*
55+
* @param serverAnimationFPS
56+
*/
57+
setServerAnimationFPS(serverAnimationFPS: number): boolean;
58+
59+
/**
60+
*
61+
*/
62+
unregisterViewStream(): void;
63+
}
64+
65+
/**
66+
* Method used to decorate a given object (publicAPI+model) with vtkImageStream characteristics.
67+
*
68+
* @param publicAPI object on which methods will be bounds (public)
69+
* @param model object on which data structure will be bounds (protected)
70+
* @param {IImageStreamInitialValues} [initialValues] (default: {})
71+
*/
72+
export function extend(publicAPI: object, model: object, initialValues?: IImageStreamInitialValues): void;
73+
74+
/**
75+
* Method used to create a new instance of vtkImageStream
76+
* @param {IImageStreamInitialValues} [initialValues] for pre-setting some of its content
77+
*/
78+
export function newInstance(initialValues?: IImageStreamInitialValues): vtkImageStream;
79+
80+
/**
81+
* vtkImageStream.
82+
*/
83+
export declare const vtkImageStream: {
84+
newInstance: typeof newInstance;
85+
extend: typeof extend;
86+
}
87+
export default vtkImageStream;

Sources/Rendering/Core/Prop/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export interface vtkProp extends vtkObject {
110110
/**
111111
*
112112
*/
113-
getNestedProps(): null;
113+
getNestedProps(): any;
114114

115115
/**
116116
* Return parent prop set by setParentProp

Sources/Rendering/Core/Prop3D/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export interface vtkProp3D extends vtkProp {
5252
getOrientationWXYZ(): number[];
5353

5454
/**
55-
* Get the origin of the Prop3D. This is the point about which all rotations take place.
55+
* Get the origin of the Prop3D. This is the point about which all rotations
56+
* take place.
5657
*/
5758
getOrigin(): number[];
5859

0 commit comments

Comments
 (0)