1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2011, Purdue Research Foundation |
---|
4 | * |
---|
5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef __RAPPTURE_VTKVIS_RENDERER_H__ |
---|
9 | #define __RAPPTURE_VTKVIS_RENDERER_H__ |
---|
10 | |
---|
11 | #include <string> |
---|
12 | #include <vector> |
---|
13 | #include <tr1/unordered_map> |
---|
14 | #include <typeinfo> |
---|
15 | |
---|
16 | #include <vtkSmartPointer.h> |
---|
17 | #include <vtkCubeAxesActor.h> |
---|
18 | #ifdef USE_CUSTOM_AXES |
---|
19 | #include "vtkRpCubeAxesActor2D.h" |
---|
20 | #else |
---|
21 | #include <vtkCubeAxesActor2D.h> |
---|
22 | #endif |
---|
23 | #include <vtkScalarBarActor.h> |
---|
24 | #include <vtkRenderer.h> |
---|
25 | #include <vtkRenderWindow.h> |
---|
26 | #include <vtkUnsignedCharArray.h> |
---|
27 | |
---|
28 | #include "ColorMap.h" |
---|
29 | #include "RpTypes.h" |
---|
30 | #include "RpVtkDataSet.h" |
---|
31 | #include "RpContour2D.h" |
---|
32 | #include "RpContour3D.h" |
---|
33 | #include "RpCutplane.h" |
---|
34 | #include "RpGlyphs.h" |
---|
35 | #include "RpHeightMap.h" |
---|
36 | #include "RpLIC.h" |
---|
37 | #include "RpMolecule.h" |
---|
38 | #include "RpPolyData.h" |
---|
39 | #include "RpPseudoColor.h" |
---|
40 | #include "RpStreamlines.h" |
---|
41 | #include "RpVolume.h" |
---|
42 | #include "Trace.h" |
---|
43 | |
---|
44 | // Controls if TGA format is sent to client |
---|
45 | //#define RENDER_TARGA |
---|
46 | #define TARGA_BYTES_PER_PIXEL 3 |
---|
47 | |
---|
48 | namespace Rappture { |
---|
49 | namespace VtkVis { |
---|
50 | |
---|
51 | /** |
---|
52 | * \brief VTK Renderer |
---|
53 | */ |
---|
54 | class Renderer |
---|
55 | { |
---|
56 | public: |
---|
57 | Renderer(); |
---|
58 | virtual ~Renderer(); |
---|
59 | |
---|
60 | enum AxesFlyMode { |
---|
61 | FLY_OUTER_EDGES = 0, |
---|
62 | FLY_CLOSEST_TRIAD, |
---|
63 | FLY_FURTHEST_TRIAD, |
---|
64 | FLY_STATIC_EDGES, |
---|
65 | FLY_STATIC_TRIAD |
---|
66 | }; |
---|
67 | |
---|
68 | enum AxesTickPosition { |
---|
69 | TICKS_INSIDE, |
---|
70 | TICKS_OUTSIDE, |
---|
71 | TICKS_BOTH |
---|
72 | }; |
---|
73 | |
---|
74 | enum CameraMode { |
---|
75 | PERSPECTIVE, |
---|
76 | ORTHO, |
---|
77 | IMAGE |
---|
78 | }; |
---|
79 | |
---|
80 | enum LegendType { |
---|
81 | LEGEND_SCALAR, |
---|
82 | LEGEND_VECTOR_MAGNITUDE, |
---|
83 | LEGEND_VECTOR_X, |
---|
84 | LEGEND_VECTOR_Y, |
---|
85 | LEGEND_VECTOR_Z |
---|
86 | }; |
---|
87 | |
---|
88 | typedef std::string DataSetId; |
---|
89 | typedef std::string ColorMapId; |
---|
90 | typedef std::string FieldId; |
---|
91 | typedef std::tr1::unordered_map<DataSetId, DataSet *> DataSetHashmap; |
---|
92 | typedef std::tr1::unordered_map<FieldId, double *> FieldRangeHashmap; |
---|
93 | typedef std::tr1::unordered_map<ColorMapId, ColorMap *> ColorMapHashmap; |
---|
94 | typedef std::tr1::unordered_map<DataSetId, Contour2D *> Contour2DHashmap; |
---|
95 | typedef std::tr1::unordered_map<DataSetId, Contour3D *> Contour3DHashmap; |
---|
96 | typedef std::tr1::unordered_map<DataSetId, Cutplane *> CutplaneHashmap; |
---|
97 | typedef std::tr1::unordered_map<DataSetId, Glyphs *> GlyphsHashmap; |
---|
98 | typedef std::tr1::unordered_map<DataSetId, HeightMap *> HeightMapHashmap; |
---|
99 | typedef std::tr1::unordered_map<DataSetId, LIC *> LICHashmap; |
---|
100 | typedef std::tr1::unordered_map<DataSetId, Molecule *> MoleculeHashmap; |
---|
101 | typedef std::tr1::unordered_map<DataSetId, PolyData *> PolyDataHashmap; |
---|
102 | typedef std::tr1::unordered_map<DataSetId, PseudoColor *> PseudoColorHashmap; |
---|
103 | typedef std::tr1::unordered_map<DataSetId, Streamlines *> StreamlinesHashmap; |
---|
104 | typedef std::tr1::unordered_map<DataSetId, Volume *> VolumeHashmap; |
---|
105 | |
---|
106 | // Data sets |
---|
107 | |
---|
108 | void addDataSet(const DataSetId& id); |
---|
109 | |
---|
110 | void deleteDataSet(const DataSetId& id); |
---|
111 | |
---|
112 | DataSet *getDataSet(const DataSetId& id); |
---|
113 | |
---|
114 | void getDataSetNames(std::vector<std::string>& names); |
---|
115 | |
---|
116 | bool setData(const DataSetId& id, char *data, int nbytes); |
---|
117 | |
---|
118 | bool setDataFile(const DataSetId& id, const char *filename); |
---|
119 | |
---|
120 | bool setDataSetActiveScalars(const DataSetId& id, const char *scalarName); |
---|
121 | |
---|
122 | bool setDataSetActiveVectors(const DataSetId& id, const char *vectorName); |
---|
123 | |
---|
124 | bool getScalarValueAtPixel(const DataSetId& id, int x, int y, double *value); |
---|
125 | |
---|
126 | bool getScalarValue(const DataSetId& id, double x, double y, double z, double *value); |
---|
127 | |
---|
128 | bool getVectorValueAtPixel(const DataSetId& id, int x, int y, double vector[3]); |
---|
129 | |
---|
130 | bool getVectorValue(const DataSetId& id, double x, double y, double z, double vector[3]); |
---|
131 | |
---|
132 | void setDataSetShowBounds(const DataSetId& id, bool state); |
---|
133 | |
---|
134 | void setDataSetOutlineColor(const DataSetId& id, float color[3]); |
---|
135 | |
---|
136 | void setDataSetOpacity(const DataSetId& id, double opacity); |
---|
137 | |
---|
138 | void setDataSetVisibility(const DataSetId& id, bool state); |
---|
139 | |
---|
140 | void setUseCumulativeDataRange(bool state, bool onlyVisible = false); |
---|
141 | |
---|
142 | bool getUseCumulativeRange(); |
---|
143 | |
---|
144 | bool getCumulativeDataRange(double *range, const char *name, |
---|
145 | int numComponents, |
---|
146 | int component = -1); |
---|
147 | |
---|
148 | bool getCumulativeDataRange(double *range, const char *name, |
---|
149 | DataSet::DataAttributeType type, |
---|
150 | int numComponents, |
---|
151 | int component = -1); |
---|
152 | |
---|
153 | // Render window |
---|
154 | |
---|
155 | /// Get the VTK render window object this Renderer uses |
---|
156 | vtkRenderWindow *getRenderWindow() |
---|
157 | { |
---|
158 | return _renderWindow; |
---|
159 | } |
---|
160 | |
---|
161 | void setWindowSize(int width, int height); |
---|
162 | |
---|
163 | int getWindowWidth() const; |
---|
164 | |
---|
165 | int getWindowHeight() const; |
---|
166 | |
---|
167 | // Camera controls |
---|
168 | |
---|
169 | void setViewAngle(int height); |
---|
170 | |
---|
171 | vtkCamera *getVtkCamera() |
---|
172 | { |
---|
173 | if (_renderer != NULL) |
---|
174 | return _renderer->GetActiveCamera(); |
---|
175 | else |
---|
176 | return NULL; |
---|
177 | } |
---|
178 | |
---|
179 | void setCameraMode(CameraMode mode); |
---|
180 | |
---|
181 | CameraMode getCameraMode() const; |
---|
182 | |
---|
183 | void resetCamera(bool resetOrientation = true); |
---|
184 | |
---|
185 | void resetCameraClippingRange(); |
---|
186 | |
---|
187 | void setCameraZoomRegionPixels(int x, int y, int width, int height); |
---|
188 | |
---|
189 | void setCameraZoomRegion(double x, double y, double width, double height); |
---|
190 | |
---|
191 | void getCameraZoomRegion(double xywh[4]) const; |
---|
192 | |
---|
193 | void getScreenWorldCoords(double xywh[4]) const; |
---|
194 | |
---|
195 | void rotateCamera(double yaw, double pitch, double roll); |
---|
196 | |
---|
197 | void setCameraOrientation(const double quat[4], bool absolute = true); |
---|
198 | |
---|
199 | void panCamera(double x, double y, bool absolute = true); |
---|
200 | |
---|
201 | void zoomCamera(double z, bool absolute = true); |
---|
202 | |
---|
203 | void setCameraOrientationAndPosition(const double position[3], |
---|
204 | const double focalPoint[3], |
---|
205 | const double viewUp[3]); |
---|
206 | |
---|
207 | void getCameraOrientationAndPosition(double position[3], |
---|
208 | double focalPoint[3], |
---|
209 | double viewUp[3]); |
---|
210 | |
---|
211 | // Rendering an image |
---|
212 | |
---|
213 | void setBackgroundColor(float color[3]); |
---|
214 | |
---|
215 | void setClipPlane(Axis axis, double ratio, int direction); |
---|
216 | |
---|
217 | void setUseTwoSidedLighting(bool state); |
---|
218 | |
---|
219 | void setUseDepthPeeling(bool state); |
---|
220 | |
---|
221 | void eventuallyRender(); |
---|
222 | |
---|
223 | bool render(); |
---|
224 | |
---|
225 | void getRenderedFrame(vtkUnsignedCharArray *imgData); |
---|
226 | |
---|
227 | // Axes |
---|
228 | |
---|
229 | void setAxesFlyMode(AxesFlyMode mode); |
---|
230 | |
---|
231 | void setAxesVisibility(bool state); |
---|
232 | |
---|
233 | void setAxesGridVisibility(bool state); |
---|
234 | |
---|
235 | void setAxesLabelVisibility(bool state); |
---|
236 | |
---|
237 | void setAxesTickVisibility(bool state); |
---|
238 | |
---|
239 | void setAxesTickPosition(AxesTickPosition pos); |
---|
240 | |
---|
241 | void setAxesColor(double color[3]); |
---|
242 | |
---|
243 | void setAxisVisibility(Axis axis, bool state); |
---|
244 | |
---|
245 | void setAxisGridVisibility(Axis axis, bool state); |
---|
246 | |
---|
247 | void setAxisLabelVisibility(Axis axis, bool state); |
---|
248 | |
---|
249 | void setAxisTickVisibility(Axis axis, bool state); |
---|
250 | |
---|
251 | void setAxisTitle(Axis axis, const char *title); |
---|
252 | |
---|
253 | void setAxisUnits(Axis axis, const char *units); |
---|
254 | |
---|
255 | // Colormaps |
---|
256 | |
---|
257 | void addColorMap(const ColorMapId& id, ColorMap *colorMap); |
---|
258 | |
---|
259 | void deleteColorMap(const ColorMapId& id); |
---|
260 | |
---|
261 | ColorMap *getColorMap(const ColorMapId& id); |
---|
262 | |
---|
263 | bool renderColorMap(const ColorMapId& id, |
---|
264 | const DataSetId& dataSetID, |
---|
265 | LegendType legendType, |
---|
266 | const char *fieldName, |
---|
267 | DataSet::DataAttributeType type, |
---|
268 | std::string& title, |
---|
269 | double range[2], |
---|
270 | int width, int height, |
---|
271 | bool opaque, |
---|
272 | int numLabels, |
---|
273 | vtkUnsignedCharArray *imgData); |
---|
274 | |
---|
275 | bool renderColorMap(const ColorMapId& id, |
---|
276 | const DataSetId& dataSetID, |
---|
277 | LegendType legendType, |
---|
278 | const char *fieldName, |
---|
279 | std::string& title, |
---|
280 | double range[2], |
---|
281 | int width, int height, |
---|
282 | bool opaque, |
---|
283 | int numLabels, |
---|
284 | vtkUnsignedCharArray *imgData); |
---|
285 | |
---|
286 | bool renderColorMap(const ColorMapId& id, |
---|
287 | const DataSetId& dataSetID, |
---|
288 | LegendType legendType, |
---|
289 | std::string& title, |
---|
290 | double range[2], |
---|
291 | int width, int height, |
---|
292 | bool opaque, |
---|
293 | int numLabels, |
---|
294 | vtkUnsignedCharArray *imgData); |
---|
295 | |
---|
296 | // Generic VtkGraphicsObject methods |
---|
297 | |
---|
298 | template<class GraphicsObject> |
---|
299 | GraphicsObject *getGraphicsObject(const DataSetId& id); |
---|
300 | |
---|
301 | template<class GraphicsObject> |
---|
302 | bool addGraphicsObject(const DataSetId& id); |
---|
303 | |
---|
304 | template<class GraphicsObject> |
---|
305 | void deleteGraphicsObject(const DataSetId& id); |
---|
306 | |
---|
307 | template<class GraphicsObject> |
---|
308 | void setGraphicsObjectColorMap(const DataSetId& id, const ColorMapId& colorMapId); |
---|
309 | |
---|
310 | template<class GraphicsObject> |
---|
311 | void setGraphicsObjectVolumeSlice(const DataSetId& id, Axis axis, double ratio); |
---|
312 | |
---|
313 | // Prop/Prop3D properties |
---|
314 | |
---|
315 | template<class GraphicsObject> |
---|
316 | void setGraphicsObjectOrientation(const DataSetId& id, double quat[4]); |
---|
317 | |
---|
318 | template<class GraphicsObject> |
---|
319 | void setGraphicsObjectOrientation(const DataSetId& id, double angle, double axis[3]); |
---|
320 | |
---|
321 | template<class GraphicsObject> |
---|
322 | void setGraphicsObjectPosition(const DataSetId& id, double pos[3]); |
---|
323 | |
---|
324 | template<class GraphicsObject> |
---|
325 | void setGraphicsObjectScale(const DataSetId& id, double scale[3]); |
---|
326 | |
---|
327 | template<class GraphicsObject> |
---|
328 | void setGraphicsObjectTransform(const DataSetId& id, vtkMatrix4x4 *trans); |
---|
329 | |
---|
330 | template<class GraphicsObject> |
---|
331 | void setGraphicsObjectVisibility(const DataSetId& id, bool state); |
---|
332 | |
---|
333 | // Actor properties |
---|
334 | |
---|
335 | template<class GraphicsObject> |
---|
336 | void setGraphicsObjectColor(const DataSetId& id, float color[3]); |
---|
337 | |
---|
338 | template<class GraphicsObject> |
---|
339 | void setGraphicsObjectEdgeVisibility(const DataSetId& id, bool state); |
---|
340 | |
---|
341 | template<class GraphicsObject> |
---|
342 | void setGraphicsObjectEdgeColor(const DataSetId& id, float color[3]); |
---|
343 | |
---|
344 | template<class GraphicsObject> |
---|
345 | void setGraphicsObjectEdgeWidth(const DataSetId& id, float edgeWidth); |
---|
346 | |
---|
347 | template<class GraphicsObject> |
---|
348 | void setGraphicsObjectAmbient(const DataSetId& id, double coeff); |
---|
349 | |
---|
350 | template<class GraphicsObject> |
---|
351 | void setGraphicsObjectDiffuse(const DataSetId& id, double coeff); |
---|
352 | |
---|
353 | template<class GraphicsObject> |
---|
354 | void setGraphicsObjectSpecular(const DataSetId& id, double coeff, double power); |
---|
355 | |
---|
356 | template<class GraphicsObject> |
---|
357 | void setGraphicsObjectLighting(const DataSetId& id, bool state); |
---|
358 | |
---|
359 | template<class GraphicsObject> |
---|
360 | void setGraphicsObjectOpacity(const DataSetId& id, double opacity); |
---|
361 | |
---|
362 | template<class GraphicsObject> |
---|
363 | void setGraphicsObjectPointSize(const DataSetId& id, float size); |
---|
364 | |
---|
365 | template<class GraphicsObject> |
---|
366 | void setGraphicsObjectWireframe(const DataSetId& id, bool state); |
---|
367 | |
---|
368 | // 2D Contour plots |
---|
369 | |
---|
370 | bool addContour2D(const DataSetId& id, int numContours); |
---|
371 | |
---|
372 | bool addContour2D(const DataSetId& id, const std::vector<double>& contours); |
---|
373 | |
---|
374 | void setContour2DContours(const DataSetId& id, int numContours); |
---|
375 | |
---|
376 | void setContour2DContourList(const DataSetId& id, const std::vector<double>& contours); |
---|
377 | |
---|
378 | // 3D Contour (isosurface) plots |
---|
379 | |
---|
380 | bool addContour3D(const DataSetId& id, int numContours); |
---|
381 | |
---|
382 | bool addContour3D(const DataSetId& id, const std::vector<double>& contours); |
---|
383 | |
---|
384 | void setContour3DContours(const DataSetId& id, int numContours); |
---|
385 | |
---|
386 | void setContour3DContourList(const DataSetId& id, const std::vector<double>& contours); |
---|
387 | |
---|
388 | // Cutplanes |
---|
389 | |
---|
390 | void setCutplaneSliceVisibility(const DataSetId& id, Axis axis, bool state); |
---|
391 | |
---|
392 | void setCutplaneColorMode(const DataSetId& id, |
---|
393 | Cutplane::ColorMode mode, |
---|
394 | const char *name, double range[2] = NULL); |
---|
395 | |
---|
396 | void setCutplaneColorMode(const DataSetId& id, |
---|
397 | Cutplane::ColorMode mode, |
---|
398 | DataSet::DataAttributeType type, |
---|
399 | const char *name, double range[2] = NULL); |
---|
400 | |
---|
401 | // Glyphs |
---|
402 | |
---|
403 | bool addGlyphs(const DataSetId& id, Glyphs::GlyphShape shape); |
---|
404 | |
---|
405 | void setGlyphsShape(const DataSetId& id, Glyphs::GlyphShape shape); |
---|
406 | |
---|
407 | void setGlyphsColorMode(const DataSetId& id, |
---|
408 | Glyphs::ColorMode mode, |
---|
409 | const char *name, |
---|
410 | double range[2] = NULL); |
---|
411 | |
---|
412 | void setGlyphsScalingMode(const DataSetId& id, |
---|
413 | Glyphs::ScalingMode mode, |
---|
414 | const char *name, |
---|
415 | double range[2] = NULL); |
---|
416 | |
---|
417 | void setGlyphsNormalizeScale(const DataSetId& id, bool normalize); |
---|
418 | |
---|
419 | void setGlyphsScaleFactor(const DataSetId& id, double scale); |
---|
420 | |
---|
421 | // Height maps |
---|
422 | |
---|
423 | bool addHeightMap(const DataSetId& id, int numContours, double heightScale); |
---|
424 | |
---|
425 | bool addHeightMap(const DataSetId& id, const std::vector<double>& contours, double heightScale); |
---|
426 | |
---|
427 | void setHeightMapHeightScale(const DataSetId& id, double scale); |
---|
428 | |
---|
429 | void setHeightMapNumContours(const DataSetId& id, int numContours); |
---|
430 | |
---|
431 | void setHeightMapContourList(const DataSetId& id, const std::vector<double>& contours); |
---|
432 | |
---|
433 | void setHeightMapContourSurfaceVisibility(const DataSetId& id, bool state); |
---|
434 | |
---|
435 | void setHeightMapContourLineVisibility(const DataSetId& id, bool state); |
---|
436 | |
---|
437 | void setHeightMapContourEdgeColor(const DataSetId& id, float color[3]); |
---|
438 | |
---|
439 | void setHeightMapContourEdgeWidth(const DataSetId& id, float edgeWidth); |
---|
440 | |
---|
441 | // Molecules |
---|
442 | |
---|
443 | void setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling); |
---|
444 | |
---|
445 | void setMoleculeAtomVisibility(const DataSetId& id, bool state); |
---|
446 | |
---|
447 | void setMoleculeBondVisibility(const DataSetId& id, bool state); |
---|
448 | |
---|
449 | // Color-mapped surfaces |
---|
450 | |
---|
451 | void setPseudoColorColorMode(const DataSetId& id, |
---|
452 | PseudoColor::ColorMode mode, |
---|
453 | const char *name, double range[2] = NULL); |
---|
454 | |
---|
455 | void setPseudoColorColorMode(const DataSetId& id, |
---|
456 | PseudoColor::ColorMode mode, |
---|
457 | DataSet::DataAttributeType type, |
---|
458 | const char *name, double range[2] = NULL); |
---|
459 | |
---|
460 | // Streamlines |
---|
461 | |
---|
462 | void setStreamlinesNumberOfSeedPoints(const DataSetId& id, int numPoints); |
---|
463 | |
---|
464 | void setStreamlinesSeedToMeshPoints(const DataSetId& id); |
---|
465 | |
---|
466 | void setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints); |
---|
467 | |
---|
468 | bool setStreamlinesSeedToMeshPoints(const DataSetId& id, |
---|
469 | char *data, size_t nbytes); |
---|
470 | |
---|
471 | bool setStreamlinesSeedToFilledMesh(const DataSetId& id, |
---|
472 | char *data, size_t nbytes, |
---|
473 | int numPoints); |
---|
474 | |
---|
475 | void setStreamlinesSeedToRake(const DataSetId& id, |
---|
476 | double start[3], double end[3], |
---|
477 | int numPoints); |
---|
478 | |
---|
479 | void setStreamlinesSeedToDisk(const DataSetId& id, |
---|
480 | double center[3], double normal[3], |
---|
481 | double radius, double innerRadius, |
---|
482 | int numPoints); |
---|
483 | |
---|
484 | void setStreamlinesSeedToPolygon(const DataSetId& id, |
---|
485 | double center[3], double normal[3], |
---|
486 | double angle, double radius, |
---|
487 | int numSides); |
---|
488 | |
---|
489 | void setStreamlinesSeedToFilledPolygon(const DataSetId& id, |
---|
490 | double center[3], double normal[3], |
---|
491 | double angle, double radius, |
---|
492 | int numSides, int numPoints); |
---|
493 | |
---|
494 | void setStreamlinesLength(const DataSetId& id, double length); |
---|
495 | |
---|
496 | void setStreamlinesTypeToLines(const DataSetId& id); |
---|
497 | |
---|
498 | void setStreamlinesTypeToTubes(const DataSetId& id, int numSides, double radius); |
---|
499 | |
---|
500 | void setStreamlinesTypeToRibbons(const DataSetId& id, double width, double angle); |
---|
501 | |
---|
502 | void setStreamlinesSeedVisibility(const DataSetId& id, bool state); |
---|
503 | |
---|
504 | void setStreamlinesColorMode(const DataSetId& id, |
---|
505 | Streamlines::ColorMode mode, |
---|
506 | const char *name, double range[2] = NULL); |
---|
507 | |
---|
508 | void setStreamlinesColorMode(const DataSetId& id, |
---|
509 | Streamlines::ColorMode mode, |
---|
510 | DataSet::DataAttributeType type, |
---|
511 | const char *name, double range[2] = NULL); |
---|
512 | |
---|
513 | void setStreamlinesSeedColor(const DataSetId& id, float color[3]); |
---|
514 | |
---|
515 | private: |
---|
516 | static void printCameraInfo(vtkCamera *camera); |
---|
517 | |
---|
518 | static void setCameraFromMatrix(vtkCamera *camera, vtkMatrix4x4 &mat); |
---|
519 | |
---|
520 | static void mergeBounds(double *boundsDest, const double *bounds1, const double *bounds2); |
---|
521 | |
---|
522 | template<class GraphicsObject> |
---|
523 | std::tr1::unordered_map<DataSetId, GraphicsObject *>&getGraphicsObjectHashmap(); |
---|
524 | |
---|
525 | void collectBounds(double *bounds, bool onlyVisible); |
---|
526 | |
---|
527 | void collectDataRanges(); |
---|
528 | |
---|
529 | void collectDataRanges(double *range, const char *name, |
---|
530 | DataSet::DataAttributeType type, |
---|
531 | int component, bool onlyVisible); |
---|
532 | |
---|
533 | void clearFieldRanges(); |
---|
534 | |
---|
535 | void initFieldRanges(); |
---|
536 | |
---|
537 | void updateFieldRanges(); |
---|
538 | |
---|
539 | void updateColorMap(ColorMap *cmap); |
---|
540 | |
---|
541 | bool colorMapUsed(ColorMap *cmap); |
---|
542 | |
---|
543 | void computeDisplayToWorld(double x, double y, double z, double worldPt[4]); |
---|
544 | |
---|
545 | void computeWorldToDisplay(double x, double y, double z, double displayPt[3]); |
---|
546 | |
---|
547 | void computeScreenWorldCoords(); |
---|
548 | |
---|
549 | bool is2D(const double bounds[6], |
---|
550 | PrincipalPlane *plane, |
---|
551 | double *offset) const; |
---|
552 | void initCamera(); |
---|
553 | void initAxes(); |
---|
554 | void resetAxes(double bounds[6] = NULL); |
---|
555 | void setCameraClippingPlanes(); |
---|
556 | |
---|
557 | bool _needsRedraw; |
---|
558 | int _windowWidth, _windowHeight; |
---|
559 | double _imgWorldOrigin[2]; |
---|
560 | double _imgWorldDims[2]; |
---|
561 | PrincipalPlane _imgCameraPlane; |
---|
562 | double _imgCameraOffset; |
---|
563 | double _screenWorldCoords[4]; |
---|
564 | double _cameraOrientation[4]; |
---|
565 | double _cameraZoomRatio; |
---|
566 | double _cameraPan[2]; |
---|
567 | float _bgColor[3]; |
---|
568 | bool _useCumulativeRange; |
---|
569 | bool _cumulativeRangeOnlyVisible; |
---|
570 | |
---|
571 | FieldRangeHashmap _scalarPointDataRange; |
---|
572 | FieldRangeHashmap _vectorPointDataRange; |
---|
573 | FieldRangeHashmap _vectorCompPointDataRange[3]; |
---|
574 | FieldRangeHashmap _scalarCellDataRange; |
---|
575 | FieldRangeHashmap _vectorCellDataRange; |
---|
576 | FieldRangeHashmap _vectorCompCellDataRange[3]; |
---|
577 | |
---|
578 | ColorMapHashmap _colorMaps; |
---|
579 | DataSetHashmap _dataSets; |
---|
580 | Contour2DHashmap _contour2Ds; |
---|
581 | Contour3DHashmap _contour3Ds; |
---|
582 | CutplaneHashmap _cutplanes; |
---|
583 | GlyphsHashmap _glyphs; |
---|
584 | HeightMapHashmap _heightMaps; |
---|
585 | LICHashmap _lics; |
---|
586 | MoleculeHashmap _molecules; |
---|
587 | PolyDataHashmap _polyDatas; |
---|
588 | PseudoColorHashmap _pseudoColors; |
---|
589 | StreamlinesHashmap _streamlines; |
---|
590 | VolumeHashmap _volumes; |
---|
591 | |
---|
592 | CameraMode _cameraMode; |
---|
593 | |
---|
594 | vtkSmartPointer<vtkPlane> _cameraClipPlanes[4]; |
---|
595 | vtkSmartPointer<vtkPlane> _userClipPlanes[6]; |
---|
596 | vtkSmartPointer<vtkPlaneCollection> _activeClipPlanes; |
---|
597 | vtkSmartPointer<vtkCubeAxesActor> _cubeAxesActor; // For 3D view |
---|
598 | #ifdef USE_CUSTOM_AXES |
---|
599 | vtkSmartPointer<vtkRpCubeAxesActor2D> _cubeAxesActor2D; // For 2D view |
---|
600 | #else |
---|
601 | vtkSmartPointer<vtkCubeAxesActor2D> _cubeAxesActor2D; // For 2D view |
---|
602 | #endif |
---|
603 | vtkSmartPointer<vtkScalarBarActor> _scalarBarActor; |
---|
604 | vtkSmartPointer<vtkRenderer> _renderer; |
---|
605 | vtkSmartPointer<vtkRenderer> _legendRenderer; |
---|
606 | vtkSmartPointer<vtkRenderWindow> _renderWindow; |
---|
607 | vtkSmartPointer<vtkRenderWindow> _legendRenderWindow; |
---|
608 | }; |
---|
609 | |
---|
610 | } |
---|
611 | } |
---|
612 | |
---|
613 | #endif |
---|