source: vtkvis/tags/1.7.1/PolyData.h @ 4625

Last change on this file since 4625 was 3818, checked in by ldelgass, 11 years ago

Add colormode for PolyData?, by default color map if an active scalar field with
multiple components is present (color scalars). Add protocol for image/text3d
drawing components. Make 'color' synonym for 'ccolor' in protocol commands,
also accept 'ccolor' or 'constant' as colormode. Add experimental commands for
simple legend (no field info required), extended colormode for heightmap with
explicit range. Add fontconfig support (needs testing). Added code to remove
duplicate points from unstructured grids. Should probably be optional. Stack
trace on error (if WANT_TRACE is on) using VTK.

  • Property svn:eol-style set to native
File size: 2.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_POLYDATA_H
9#define VTKVIS_POLYDATA_H
10
11#include <vtkSmartPointer.h>
12#include <vtkPolyDataMapper.h>
13#include <vtkActor.h>
14#include <vtkLookupTable.h>
15
16#include "ColorMap.h"
17#include "GraphicsObject.h"
18
19namespace VtkVis {
20
21/**
22 * \brief VTK Mesh (Polygon data)
23 *
24 * This class creates a boundary mesh of a DataSet
25 */
26class PolyData : public GraphicsObject {
27public:
28    enum CloudStyle {
29        CLOUD_MESH,
30        CLOUD_POINTS
31    };
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    PolyData();
42    virtual ~PolyData();
43
44    virtual const char *getClassName() const
45    {
46        return "PolyData";
47    }
48
49    virtual void setDataSet(DataSet *dataSet,
50                            Renderer *renderer);
51
52    virtual void setClippingPlanes(vtkPlaneCollection *planes);
53
54    void setCloudStyle(CloudStyle style);
55
56    void setInterpolateBeforeMapping(bool state);
57
58    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
59                      const char *name, double range[2] = NULL);
60
61    void setColorMode(ColorMode mode,
62                      const char *name, double range[2] = NULL);
63
64    void setColorMode(ColorMode mode);
65
66    void setColorMap(ColorMap *colorMap);
67
68    /**
69     * \brief Return the ColorMap in use
70     */
71    ColorMap *getColorMap()
72    {
73        return _colorMap;
74    }
75
76    void updateColorMap();
77
78    virtual void updateRanges(Renderer *renderer);
79
80private:
81    virtual void update();
82
83    ColorMap *_colorMap;
84    ColorMode _colorMode;
85    std::string _colorFieldName;
86    DataSet::DataAttributeType _colorFieldType;
87    double _colorFieldRange[2];
88    double _vectorMagnitudeRange[2];
89    double _vectorComponentRange[3][2];
90    Renderer *_renderer;
91
92    CloudStyle _cloudStyle;
93    vtkSmartPointer<vtkLookupTable> _lut;
94    vtkSmartPointer<vtkPolyDataMapper> _mapper;
95};
96
97}
98
99#endif
Note: See TracBrowser for help on using the repository browser.