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 setCutplaneOutlineVisibility(const DataSetId& id, bool state); |
---|
391 | |
---|
392 | void setCutplaneSliceVisibility(const DataSetId& id, Axis axis, bool state); |
---|
393 | |
---|
394 | void setCutplaneColorMode(const DataSetId& id, |
---|
395 | Cutplane::ColorMode mode, |
---|
396 | const char *name, double range[2] = NULL); |
---|
397 | |
---|
398 | void setCutplaneColorMode(const DataSetId& id, |
---|
399 | Cutplane::ColorMode mode, |
---|
400 | DataSet::DataAttributeType type, |
---|
401 | const char *name, double range[2] = NULL); |
---|
402 | |
---|
403 | // Glyphs |
---|
404 | |
---|
405 | bool addGlyphs(const DataSetId& id, Glyphs::GlyphShape shape); |
---|
406 | |
---|
407 | void setGlyphsShape(const DataSetId& id, Glyphs::GlyphShape shape); |
---|
408 | |
---|
409 | void setGlyphsColorMode(const DataSetId& id, |
---|
410 | Glyphs::ColorMode mode, |
---|
411 | const char *name, |
---|
412 | double range[2] = NULL); |
---|
413 | |
---|
414 | void setGlyphsScalingMode(const DataSetId& id, |
---|
415 | Glyphs::ScalingMode mode, |
---|
416 | const char *name, |
---|
417 | double range[2] = NULL); |
---|
418 | |
---|
419 | void setGlyphsNormalizeScale(const DataSetId& id, bool normalize); |
---|
420 | |
---|
421 | void setGlyphsScaleFactor(const DataSetId& id, double scale); |
---|
422 | |
---|
423 | // Height maps |
---|
424 | |
---|
425 | bool addHeightMap(const DataSetId& id, int numContours, double heightScale); |
---|
426 | |
---|
427 | bool addHeightMap(const DataSetId& id, const std::vector<double>& contours, double heightScale); |
---|
428 | |
---|
429 | void setHeightMapHeightScale(const DataSetId& id, double scale); |
---|
430 | |
---|
431 | void setHeightMapNumContours(const DataSetId& id, int numContours); |
---|
432 | |
---|
433 | void setHeightMapContourList(const DataSetId& id, const std::vector<double>& contours); |
---|
434 | |
---|
435 | void setHeightMapContourSurfaceVisibility(const DataSetId& id, bool state); |
---|
436 | |
---|
437 | void setHeightMapContourLineVisibility(const DataSetId& id, bool state); |
---|
438 | |
---|
439 | void setHeightMapContourEdgeColor(const DataSetId& id, float color[3]); |
---|
440 | |
---|
441 | void setHeightMapContourEdgeWidth(const DataSetId& id, float edgeWidth); |
---|
442 | |
---|
443 | // Molecules |
---|
444 | |
---|
445 | void setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling); |
---|
446 | |
---|
447 | void setMoleculeAtomVisibility(const DataSetId& id, bool state); |
---|
448 | |
---|
449 | void setMoleculeBondVisibility(const DataSetId& id, bool state); |
---|
450 | |
---|
451 | // Color-mapped surfaces |
---|
452 | |
---|
453 | void setPseudoColorColorMode(const DataSetId& id, |
---|
454 | PseudoColor::ColorMode mode, |
---|
455 | const char *name, double range[2] = NULL); |
---|
456 | |
---|
457 | void setPseudoColorColorMode(const DataSetId& id, |
---|
458 | PseudoColor::ColorMode mode, |
---|
459 | DataSet::DataAttributeType type, |
---|
460 | const char *name, double range[2] = NULL); |
---|
461 | |
---|
462 | // Streamlines |
---|
463 | |
---|
464 | void setStreamlinesNumberOfSeedPoints(const DataSetId& id, int numPoints); |
---|
465 | |
---|
466 | void setStreamlinesSeedToMeshPoints(const DataSetId& id); |
---|
467 | |
---|
468 | void setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints); |
---|
469 | |
---|
470 | bool setStreamlinesSeedToMeshPoints(const DataSetId& id, |
---|
471 | char *data, size_t nbytes); |
---|
472 | |
---|
473 | bool setStreamlinesSeedToFilledMesh(const DataSetId& id, |
---|
474 | char *data, size_t nbytes, |
---|
475 | int numPoints); |
---|
476 | |
---|
477 | void setStreamlinesSeedToRake(const DataSetId& id, |
---|
478 | double start[3], double end[3], |
---|
479 | int numPoints); |
---|
480 | |
---|
481 | void setStreamlinesSeedToDisk(const DataSetId& id, |
---|
482 | double center[3], double normal[3], |
---|
483 | double radius, double innerRadius, |
---|
484 | int numPoints); |
---|
485 | |
---|
486 | void setStreamlinesSeedToPolygon(const DataSetId& id, |
---|
487 | double center[3], double normal[3], |
---|
488 | double angle, double radius, |
---|
489 | int numSides); |
---|
490 | |
---|
491 | void setStreamlinesSeedToFilledPolygon(const DataSetId& id, |
---|
492 | double center[3], double normal[3], |
---|
493 | double angle, double radius, |
---|
494 | int numSides, int numPoints); |
---|
495 | |
---|
496 | void setStreamlinesLength(const DataSetId& id, double length); |
---|
497 | |
---|
498 | void setStreamlinesTypeToLines(const DataSetId& id); |
---|
499 | |
---|
500 | void setStreamlinesTypeToTubes(const DataSetId& id, int numSides, double radius); |
---|
501 | |
---|
502 | void setStreamlinesTypeToRibbons(const DataSetId& id, double width, double angle); |
---|
503 | |
---|
504 | void setStreamlinesSeedVisibility(const DataSetId& id, bool state); |
---|
505 | |
---|
506 | void setStreamlinesColorMode(const DataSetId& id, |
---|
507 | Streamlines::ColorMode mode, |
---|
508 | const char *name, double range[2] = NULL); |
---|
509 | |
---|
510 | void setStreamlinesColorMode(const DataSetId& id, |
---|
511 | Streamlines::ColorMode mode, |
---|
512 | DataSet::DataAttributeType type, |
---|
513 | const char *name, double range[2] = NULL); |
---|
514 | |
---|
515 | void setStreamlinesSeedColor(const DataSetId& id, float color[3]); |
---|
516 | |
---|
517 | private: |
---|
518 | static void printCameraInfo(vtkCamera *camera); |
---|
519 | |
---|
520 | static void setCameraFromMatrix(vtkCamera *camera, vtkMatrix4x4 &mat); |
---|
521 | |
---|
522 | static void mergeBounds(double *boundsDest, const double *bounds1, const double *bounds2); |
---|
523 | |
---|
524 | template<class GraphicsObject> |
---|
525 | std::tr1::unordered_map<DataSetId, GraphicsObject *>&getGraphicsObjectHashmap(); |
---|
526 | |
---|
527 | void collectBounds(double *bounds, bool onlyVisible); |
---|
528 | |
---|
529 | void collectDataRanges(); |
---|
530 | |
---|
531 | void collectDataRanges(double *range, const char *name, |
---|
532 | DataSet::DataAttributeType type, |
---|
533 | int component, bool onlyVisible); |
---|
534 | |
---|
535 | void clearFieldRanges(); |
---|
536 | |
---|
537 | void initFieldRanges(); |
---|
538 | |
---|
539 | void updateFieldRanges(); |
---|
540 | |
---|
541 | void updateColorMap(ColorMap *cmap); |
---|
542 | |
---|
543 | bool colorMapUsed(ColorMap *cmap); |
---|
544 | |
---|
545 | void computeDisplayToWorld(double x, double y, double z, double worldPt[4]); |
---|
546 | |
---|
547 | void computeWorldToDisplay(double x, double y, double z, double displayPt[3]); |
---|
548 | |
---|
549 | void computeScreenWorldCoords(); |
---|
550 | |
---|
551 | bool is2D(const double bounds[6], |
---|
552 | PrincipalPlane *plane, |
---|
553 | double *offset) const; |
---|
554 | void initCamera(); |
---|
555 | void initAxes(); |
---|
556 | void resetAxes(double bounds[6] = NULL); |
---|
557 | void setCameraClippingPlanes(); |
---|
558 | |
---|
559 | bool _needsRedraw; |
---|
560 | int _windowWidth, _windowHeight; |
---|
561 | double _imgWorldOrigin[2]; |
---|
562 | double _imgWorldDims[2]; |
---|
563 | PrincipalPlane _imgCameraPlane; |
---|
564 | double _imgCameraOffset; |
---|
565 | double _screenWorldCoords[4]; |
---|
566 | double _cameraOrientation[4]; |
---|
567 | double _cameraZoomRatio; |
---|
568 | double _cameraPan[2]; |
---|
569 | float _bgColor[3]; |
---|
570 | bool _useCumulativeRange; |
---|
571 | bool _cumulativeRangeOnlyVisible; |
---|
572 | |
---|
573 | FieldRangeHashmap _scalarPointDataRange; |
---|
574 | FieldRangeHashmap _vectorPointDataRange; |
---|
575 | FieldRangeHashmap _vectorCompPointDataRange[3]; |
---|
576 | FieldRangeHashmap _scalarCellDataRange; |
---|
577 | FieldRangeHashmap _vectorCellDataRange; |
---|
578 | FieldRangeHashmap _vectorCompCellDataRange[3]; |
---|
579 | |
---|
580 | ColorMapHashmap _colorMaps; |
---|
581 | DataSetHashmap _dataSets; |
---|
582 | Contour2DHashmap _contour2Ds; |
---|
583 | Contour3DHashmap _contour3Ds; |
---|
584 | CutplaneHashmap _cutplanes; |
---|
585 | GlyphsHashmap _glyphs; |
---|
586 | HeightMapHashmap _heightMaps; |
---|
587 | LICHashmap _lics; |
---|
588 | MoleculeHashmap _molecules; |
---|
589 | PolyDataHashmap _polyDatas; |
---|
590 | PseudoColorHashmap _pseudoColors; |
---|
591 | StreamlinesHashmap _streamlines; |
---|
592 | VolumeHashmap _volumes; |
---|
593 | |
---|
594 | CameraMode _cameraMode; |
---|
595 | |
---|
596 | vtkSmartPointer<vtkPlane> _cameraClipPlanes[4]; |
---|
597 | vtkSmartPointer<vtkPlane> _userClipPlanes[6]; |
---|
598 | vtkSmartPointer<vtkPlaneCollection> _activeClipPlanes; |
---|
599 | vtkSmartPointer<vtkCubeAxesActor> _cubeAxesActor; // For 3D view |
---|
600 | #ifdef USE_CUSTOM_AXES |
---|
601 | vtkSmartPointer<vtkRpCubeAxesActor2D> _cubeAxesActor2D; // For 2D view |
---|
602 | #else |
---|
603 | vtkSmartPointer<vtkCubeAxesActor2D> _cubeAxesActor2D; // For 2D view |
---|
604 | #endif |
---|
605 | vtkSmartPointer<vtkScalarBarActor> _scalarBarActor; |
---|
606 | vtkSmartPointer<vtkRenderer> _renderer; |
---|
607 | vtkSmartPointer<vtkRenderer> _legendRenderer; |
---|
608 | vtkSmartPointer<vtkRenderWindow> _renderWindow; |
---|
609 | vtkSmartPointer<vtkRenderWindow> _legendRenderWindow; |
---|
610 | }; |
---|
611 | |
---|
612 | } |
---|
613 | } |
---|
614 | |
---|
615 | #endif |
---|