source: trunk/packages/vizservers/vtkvis/RpCutplane.h @ 2617

Last change on this file since 2617 was 2612, checked in by ldelgass, 13 years ago

Refactor vtkvis to support setting colormap fields by name/attribute type
rather than always using active scalars/vectors. Also convert common
graphics objects set methods in Renderer to template methods and separate
core and graphics object related methods to separate files.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
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_CUTPLANE_H__
9#define __RAPPTURE_VTKVIS_CUTPLANE_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkLookupTable.h>
13#include <vtkDataSetMapper.h>
14#include <vtkActor.h>
15#include <vtkPlaneCollection.h>
16#include <vtkCutter.h>
17#include <vtkPlane.h>
18
19#include "ColorMap.h"
20#include "RpTypes.h"
21#include "RpVtkGraphicsObject.h"
22
23namespace Rappture {
24namespace VtkVis {
25
26/**
27 * \brief Color-mapped plot of slice through a data set
28 *
29 * Currently the DataSet must be image data (2D uniform grid)
30 */
31class Cutplane : public VtkGraphicsObject {
32public:
33    enum ColorMode {
34        COLOR_BY_SCALAR,
35        COLOR_BY_VECTOR_MAGNITUDE,
36        COLOR_BY_VECTOR_X,
37        COLOR_BY_VECTOR_Y,
38        COLOR_BY_VECTOR_Z
39    };
40
41    Cutplane();
42    virtual ~Cutplane();
43
44    virtual const char *getClassName() const
45    {
46        return "Cutplane";
47    }
48
49    virtual void setDataSet(DataSet *dataSet,
50                            Renderer *renderer);
51
52    virtual void setClippingPlanes(vtkPlaneCollection *planes);
53
54    void selectVolumeSlice(Axis axis, double ratio);
55
56    void setSliceVisibility(Axis axis, bool state);
57
58    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
59                      const char *name, double range[2] = NULL);
60
61    void setColorMode(ColorMode mode,
62                      const char *name, double range[2] = NULL);
63
64    void setColorMode(ColorMode mode);
65
66    void setColorMap(ColorMap *colorMap);
67
68    /**
69     * \brief Return the ColorMap in use
70     */
71    ColorMap *getColorMap()
72    {
73        return _colorMap;
74    }
75
76    void updateColorMap();
77
78    virtual void updateRanges(Renderer *renderer);
79
80private:
81    virtual void initProp();
82    virtual void update();
83
84    ColorMap *_colorMap;
85    ColorMode _colorMode;
86    std::string _colorFieldName;
87    DataSet::DataAttributeType _colorFieldType;
88    double _colorFieldRange[2];
89    double _vectorMagnitudeRange[2];
90    double _vectorComponentRange[3][2];
91    Renderer *_renderer;
92
93    vtkSmartPointer<vtkLookupTable> _lut;
94    vtkSmartPointer<vtkActor> _actor[3];
95    vtkSmartPointer<vtkDataSetMapper> _mapper[3];
96    vtkSmartPointer<vtkCutter> _cutter[3];
97    vtkSmartPointer<vtkPlane> _cutPlane[3];
98};
99
100}
101}
102
103#endif
Note: See TracBrowser for help on using the repository browser.