source: vtkvis/trunk/Cutplane.h @ 6226

Last change on this file since 6226 was 3680, checked in by ldelgass, 11 years ago

Improved cloud support in vtkvis: handle ugrids with no cells as well as
polydata clouds, add cloudstyle options to some graphics objects.

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef VTKVIS_CUTPLANE_H
9#define VTKVIS_CUTPLANE_H
10
11#include <vtkSmartPointer.h>
12#include <vtkLookupTable.h>
13#include <vtkPolyDataMapper.h>
14#include <vtkActor.h>
15#include <vtkPlaneCollection.h>
16#include <vtkCutter.h>
17#include <vtkPlane.h>
18#include <vtkOutlineFilter.h>
19#include <vtkOutlineSource.h>
20#include <vtkGaussianSplatter.h>
21
22#include "ColorMap.h"
23#include "Types.h"
24#include "GraphicsObject.h"
25
26namespace VtkVis {
27
28//#define CUTPLANE_TIGHT_OUTLINE
29
30/**
31 * \brief Color-mapped plot of slice through a data set
32 *
33 * Currently the DataSet must be image data (2D uniform grid)
34 */
35class Cutplane : public GraphicsObject {
36public:
37    enum CloudStyle {
38        CLOUD_MESH,
39        CLOUD_SPLAT
40    };
41    enum ColorMode {
42        COLOR_BY_SCALAR,
43        COLOR_BY_VECTOR_MAGNITUDE,
44        COLOR_BY_VECTOR_X,
45        COLOR_BY_VECTOR_Y,
46        COLOR_BY_VECTOR_Z
47    };
48
49    Cutplane();
50    virtual ~Cutplane();
51
52    virtual const char *getClassName() const
53    {
54        return "Cutplane";
55    }
56
57    virtual void setDataSet(DataSet *dataSet,
58                            Renderer *renderer);
59
60    virtual void setColor(float color[3]);
61
62    virtual void setLighting(bool state);
63
64    virtual void setEdgeVisibility(bool state);
65
66    virtual void setClippingPlanes(vtkPlaneCollection *planes);
67
68    void setCloudStyle(CloudStyle style);
69
70    void setOutlineVisibility(bool state);
71
72    void selectVolumeSlice(Axis axis, double ratio);
73
74    void setSliceVisibility(Axis axis, bool state);
75
76    void setInterpolateBeforeMapping(bool state);
77
78    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
79                      const char *name, double range[2] = NULL);
80
81    void setColorMode(ColorMode mode,
82                      const char *name, double range[2] = NULL);
83
84    void setColorMode(ColorMode mode);
85
86    void setColorMap(ColorMap *colorMap);
87
88    /**
89     * \brief Return the ColorMap in use
90     */
91    ColorMap *getColorMap()
92    {
93        return _colorMap;
94    }
95
96    void updateColorMap();
97
98    virtual void updateRanges(Renderer *renderer);
99
100private:
101    virtual void initProp();
102    virtual void update();
103
104    bool _pipelineInitialized;
105
106    CloudStyle _cloudStyle;
107    ColorMap *_colorMap;
108    ColorMode _colorMode;
109    std::string _colorFieldName;
110    DataSet::DataAttributeType _colorFieldType;
111    double _colorFieldRange[2];
112    double _vectorMagnitudeRange[2];
113    double _vectorComponentRange[3][2];
114    Renderer *_renderer;
115
116    vtkSmartPointer<vtkLookupTable> _lut;
117    vtkSmartPointer<vtkActor> _actor[3];
118    vtkSmartPointer<vtkActor> _borderActor[3];
119    vtkSmartPointer<vtkPolyDataMapper> _mapper[3];
120    vtkSmartPointer<vtkPolyDataMapper> _borderMapper[3];
121    vtkSmartPointer<vtkCutter> _cutter[3];
122    vtkSmartPointer<vtkPlane> _cutPlane[3];
123#ifdef CUTPLANE_TIGHT_OUTLINE
124    vtkSmartPointer<vtkOutlineFilter> _outlineFilter[3];
125#else
126    vtkSmartPointer<vtkOutlineSource> _outlineSource[3];
127#endif
128    vtkSmartPointer<vtkGaussianSplatter> _splatter;
129};
130
131}
132
133#endif
Note: See TracBrowser for help on using the repository browser.