source: trunk/packages/vizservers/vtkvis/RpWarp.h @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:eol-style set to native
File size: 2.4 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_WARP_H__
9#define __RAPPTURE_VTKVIS_WARP_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkAlgorithmOutput.h>
13#include <vtkLookupTable.h>
14#include <vtkDataSet.h>
15#include <vtkDataSetMapper.h>
16#include <vtkActor.h>
17#include <vtkPlaneCollection.h>
18#include <vtkWarpVector.h>
19
20#include "ColorMap.h"
21#include "RpVtkGraphicsObject.h"
22
23namespace Rappture {
24namespace VtkVis {
25
26/**
27 * \brief Warp a mesh based on point data vectors
28 *
29 * This class can be used to visualize mechanical deformation or
30 * to create flow profiles/surfaces
31 */
32class Warp : 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        COLOR_CONSTANT
41    };
42
43    Warp();
44    virtual ~Warp();
45
46    virtual const char *getClassName() const
47    {
48        return "Warp";
49    }
50
51    virtual void setDataSet(DataSet *dataSet,
52                            Renderer *renderer);
53
54    virtual void setClippingPlanes(vtkPlaneCollection *planes);
55
56    void setWarpScale(double scale);
57
58    double getWarpScale()
59    {
60        return _warpScale;
61    }
62
63    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
64                      const char *name, double range[2] = NULL);
65
66    void setColorMode(ColorMode mode,
67                      const char *name, double range[2] = NULL);
68
69    void setColorMode(ColorMode mode);
70
71    void setColorMap(ColorMap *colorMap);
72
73    /**
74     * \brief Return the ColorMap in use
75     */
76    ColorMap *getColorMap()
77    {
78        return _colorMap;
79    }
80
81    void updateColorMap();
82
83    virtual void updateRanges(Renderer *renderer);
84
85private:
86    virtual void update();
87
88    vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input);
89    vtkAlgorithmOutput *initWarp(vtkDataSet *input);
90
91    double _warpScale;
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<vtkWarpVector> _warp;
104    vtkSmartPointer<vtkDataSetMapper> _dsMapper;
105};
106
107}
108}
109
110#endif
Note: See TracBrowser for help on using the repository browser.