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

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

Constant color of cutplane should only change border color

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