source: vtkvis/trunk/Warp.h @ 4810

Last change on this file since 4810 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: 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 VTKVIS_WARP_H
9#define VTKVIS_WARP_H
10
11#include <vtkSmartPointer.h>
12#include <vtkAlgorithmOutput.h>
13#include <vtkLookupTable.h>
14#include <vtkDataSet.h>
15#include <vtkPolyDataMapper.h>
16#include <vtkActor.h>
17#include <vtkPlaneCollection.h>
18#include <vtkWarpVector.h>
19
20#include "ColorMap.h"
21#include "GraphicsObject.h"
22
23namespace VtkVis {
24
25/**
26 * \brief Warp a mesh based on point data vectors
27 *
28 * This class can be used to visualize mechanical deformation or
29 * to create flow profiles/surfaces
30 */
31class Warp : public GraphicsObject {
32public:
33    enum CloudStyle {
34        CLOUD_MESH,
35        CLOUD_POINTS
36    };
37    enum ColorMode {
38        COLOR_BY_SCALAR,
39        COLOR_BY_VECTOR_MAGNITUDE,
40        COLOR_BY_VECTOR_X,
41        COLOR_BY_VECTOR_Y,
42        COLOR_BY_VECTOR_Z,
43        COLOR_CONSTANT
44    };
45
46    Warp();
47    virtual ~Warp();
48
49    virtual const char *getClassName() const
50    {
51        return "Warp";
52    }
53
54    virtual void setDataSet(DataSet *dataSet,
55                            Renderer *renderer);
56
57    virtual void setClippingPlanes(vtkPlaneCollection *planes);
58
59    void setWarpScale(double scale);
60
61    double getWarpScale()
62    {
63        return _warpScale;
64    }
65   
66    void setCloudStyle(CloudStyle style);
67
68    void setInterpolateBeforeMapping(bool state);
69
70    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
71                      const char *name, double range[2] = NULL);
72
73    void setColorMode(ColorMode mode,
74                      const char *name, double range[2] = NULL);
75
76    void setColorMode(ColorMode mode);
77
78    void setColorMap(ColorMap *colorMap);
79
80    /**
81     * \brief Return the ColorMap in use
82     */
83    ColorMap *getColorMap()
84    {
85        return _colorMap;
86    }
87
88    void updateColorMap();
89
90    virtual void updateRanges(Renderer *renderer);
91
92private:
93    virtual void update();
94
95    vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input);
96    vtkAlgorithmOutput *initWarp(vtkDataSet *input);
97
98    double _warpScale;
99
100    CloudStyle _cloudStyle;
101    ColorMap *_colorMap;
102    ColorMode _colorMode;
103    std::string _colorFieldName;
104    DataSet::DataAttributeType _colorFieldType;
105    double _colorFieldRange[2];
106    double _vectorMagnitudeRange[2];
107    double _vectorComponentRange[3][2];
108    Renderer *_renderer;
109
110    vtkSmartPointer<vtkLookupTable> _lut;
111    vtkSmartPointer<vtkWarpVector> _warp;
112    vtkSmartPointer<vtkPolyDataMapper> _mapper;
113};
114
115}
116
117#endif
Note: See TracBrowser for help on using the repository browser.