source: trunk/packages/vizservers/vtkvis/RpHeightMap.h @ 2626

Last change on this file since 2626 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: 3.1 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_HEIGHTMAP_H__
9#define __RAPPTURE_VTKVIS_HEIGHTMAP_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkAlgorithmOutput.h>
13#include <vtkContourFilter.h>
14#include <vtkLookupTable.h>
15#include <vtkDataSetMapper.h>
16#include <vtkActor.h>
17#include <vtkPlaneCollection.h>
18#include <vtkGaussianSplatter.h>
19#include <vtkExtractVOI.h>
20#include <vtkWarpScalar.h>
21#include <vtkAssembly.h>
22#include <vtkPolyData.h>
23#include <vtkPlane.h>
24
25#include <vector>
26
27#include "ColorMap.h"
28#include "RpTypes.h"
29#include "RpVtkGraphicsObject.h"
30
31namespace Rappture {
32namespace VtkVis {
33
34/**
35 * \brief Color-mapped plot of data set
36 */
37class HeightMap : public VtkGraphicsObject {
38public:
39    HeightMap(int numContours, double heightScale = 1.0);
40
41    HeightMap(const std::vector<double>& contours, double heightScale = 1.0);
42
43    virtual ~HeightMap();
44
45    virtual const char *getClassName() const
46    {
47        return "HeightMap";
48    }
49
50    virtual void setDataSet(DataSet *dataSet,
51                            Renderer *renderer);
52
53    virtual void setLighting(bool state);
54
55    virtual void setEdgeVisibility(bool state);
56
57    virtual void setEdgeColor(float color[3]);
58
59    virtual void setEdgeWidth(float edgeWidth);
60
61    virtual void setClippingPlanes(vtkPlaneCollection *planes);
62
63    void selectVolumeSlice(Axis axis, double ratio);
64
65    void setHeightScale(double scale);
66
67    double getHeightScale()
68    {
69        return _warpScale;
70    }
71
72    void setNumContours(int numContours);
73
74    void setContourList(const std::vector<double>& contours);
75
76    int getNumContours() const;
77
78    const std::vector<double>& getContourList() const;
79
80    void setColorMap(ColorMap *colorMap);
81
82    /**
83     * \brief Return the ColorMap in use
84     */
85    ColorMap *getColorMap()
86    {
87        return _colorMap;
88    }
89
90    void updateColorMap();
91
92    virtual void updateRanges(Renderer *renderer);
93
94    void setContourLineVisibility(bool state);
95
96    void setContourSurfaceVisibility(bool state);
97
98    void setContourEdgeColor(float color[3]);
99
100    void setContourEdgeWidth(float edgeWidth);
101
102private:
103    HeightMap();
104
105    virtual void initProp();
106    virtual void update();
107
108    vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input);
109    vtkAlgorithmOutput *initWarp(vtkPolyData *input);
110
111    int _numContours;
112    std::vector<double> _contours;
113    ColorMap *_colorMap;
114
115    float _contourEdgeColor[3];
116    float _contourEdgeWidth;
117    double _warpScale;
118    double _dataScale;
119    Axis _sliceAxis;
120    bool _pipelineInitialized;
121
122    vtkSmartPointer<vtkLookupTable> _lut;
123    vtkSmartPointer<vtkDataSetMapper> _dsMapper;
124    vtkSmartPointer<vtkContourFilter> _contourFilter;
125    vtkSmartPointer<vtkPolyDataMapper> _contourMapper;
126    vtkSmartPointer<vtkGaussianSplatter> _pointSplatter;
127    vtkSmartPointer<vtkExtractVOI> _volumeSlicer;
128    vtkSmartPointer<vtkPlane> _cutPlane;
129    vtkSmartPointer<vtkWarpScalar> _warp;
130    vtkSmartPointer<vtkActor> _dsActor;
131    vtkSmartPointer<vtkActor> _contourActor;
132};
133
134}
135}
136
137#endif
Note: See TracBrowser for help on using the repository browser.