source: branches/1.2/packages/vizservers/vtkvis/RpContour3D.h @ 5036

Last change on this file since 5036 was 3490, checked in by ldelgass, 12 years ago

Bring contour2d/3d code in vtkvis more in line with heightmap, make setting
number of contours/contour list faster.

  • Property svn:eol-style set to native
File size: 2.5 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 __RAPPTURE_VTKVIS_CONTOUR3D_H__
9#define __RAPPTURE_VTKVIS_CONTOUR3D_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkContourFilter.h>
13#include <vtkPolyDataNormals.h>
14#include <vtkLookupTable.h>
15#include <vtkPolyDataMapper.h>
16#include <vtkActor.h>
17#include <vtkPlaneCollection.h>
18
19#include <vector>
20
21#include "ColorMap.h"
22#include "RpVtkGraphicsObject.h"
23
24namespace Rappture {
25namespace VtkVis {
26
27/**
28 * \brief 3D Contour isosurfaces (geometry)
29 */
30class Contour3D : public VtkGraphicsObject {
31public:
32    enum ColorMode {
33        COLOR_BY_SCALAR,
34        COLOR_BY_VECTOR_MAGNITUDE,
35        COLOR_BY_VECTOR_X,
36        COLOR_BY_VECTOR_Y,
37        COLOR_BY_VECTOR_Z,
38        COLOR_CONSTANT
39    };
40
41    Contour3D(int numContours);
42
43    Contour3D(const std::vector<double>& contours);
44
45    virtual ~Contour3D();
46
47    virtual const char *getClassName() const
48    {
49        return "Contour3D";
50    }
51
52    virtual void setDataSet(DataSet *dataSet,
53                            Renderer *renderer);
54
55    virtual void setClippingPlanes(vtkPlaneCollection *planes);
56
57    void setNumContours(int numContours);
58
59    void setContourList(const std::vector<double>& contours);
60
61    int getNumContours() const;
62
63    const std::vector<double>& getContourList() const;
64
65    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
66                      const char *name, double range[2] = NULL);
67
68    void setColorMode(ColorMode mode,
69                      const char *name, double range[2] = NULL);
70
71    void setColorMode(ColorMode mode);
72
73    void setColorMap(ColorMap *colorMap);
74
75    /**
76     * \brief Return the ColorMap in use
77     */
78    ColorMap *getColorMap()
79    {
80        return _colorMap;
81    }
82
83    void updateColorMap();
84
85    virtual void updateRanges(Renderer *renderer);
86
87private:
88    Contour3D();
89
90    virtual void update();
91
92    int _numContours;
93    std::vector<double> _contours;
94
95    bool _pipelineInitialized;
96
97    ColorMap *_colorMap;
98    ColorMode _colorMode;
99    std::string _colorFieldName;
100    DataSet::DataAttributeType _colorFieldType;
101    double _colorFieldRange[2];
102    double _vectorMagnitudeRange[2];
103    double _vectorComponentRange[3][2];
104    Renderer *_renderer;
105
106    vtkSmartPointer<vtkLookupTable> _lut;
107    vtkSmartPointer<vtkContourFilter> _contourFilter;
108    vtkSmartPointer<vtkPolyDataNormals> _normalsGenerator;
109    vtkSmartPointer<vtkPolyDataMapper> _dsMapper;
110};
111
112}
113}
114
115#endif
Note: See TracBrowser for help on using the repository browser.