source: trunk/packages/vizservers/vtkvis/Cutplane.h @ 4364

Last change on this file since 4364 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: 3.1 KB
RevLine 
[2514]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
[3177]3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
[2514]4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
[3615]8#ifndef VTKVIS_CUTPLANE_H
9#define VTKVIS_CUTPLANE_H
[2514]10
11#include <vtkSmartPointer.h>
12#include <vtkLookupTable.h>
[3680]13#include <vtkPolyDataMapper.h>
[2514]14#include <vtkActor.h>
15#include <vtkPlaneCollection.h>
[2575]16#include <vtkCutter.h>
[2514]17#include <vtkPlane.h>
[2752]18#include <vtkOutlineFilter.h>
[3330]19#include <vtkOutlineSource.h>
[2761]20#include <vtkGaussianSplatter.h>
[2514]21
22#include "ColorMap.h"
[3616]23#include "Types.h"
[3621]24#include "GraphicsObject.h"
[2514]25
26namespace VtkVis {
27
[3330]28//#define CUTPLANE_TIGHT_OUTLINE
29
[2514]30/**
31 * \brief Color-mapped plot of slice through a data set
32 *
33 * Currently the DataSet must be image data (2D uniform grid)
34 */
[3621]35class Cutplane : public GraphicsObject {
[2514]36public:
[3680]37    enum CloudStyle {
38        CLOUD_MESH,
39        CLOUD_SPLAT
40    };
[2514]41    enum ColorMode {
42        COLOR_BY_SCALAR,
43        COLOR_BY_VECTOR_MAGNITUDE,
44        COLOR_BY_VECTOR_X,
45        COLOR_BY_VECTOR_Y,
46        COLOR_BY_VECTOR_Z
47    };
48
49    Cutplane();
50    virtual ~Cutplane();
51
52    virtual const char *getClassName() const
53    {
54        return "Cutplane";
55    }
56
57    virtual void setDataSet(DataSet *dataSet,
[2612]58                            Renderer *renderer);
[2514]59
[2760]60    virtual void setColor(float color[3]);
61
[2752]62    virtual void setLighting(bool state);
63
64    virtual void setEdgeVisibility(bool state);
65
[2514]66    virtual void setClippingPlanes(vtkPlaneCollection *planes);
67
[3680]68    void setCloudStyle(CloudStyle style);
69
[2752]70    void setOutlineVisibility(bool state);
71
[2514]72    void selectVolumeSlice(Axis axis, double ratio);
73
[2575]74    void setSliceVisibility(Axis axis, bool state);
75
[3330]76    void setInterpolateBeforeMapping(bool state);
77
[2612]78    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
79                      const char *name, double range[2] = NULL);
80
81    void setColorMode(ColorMode mode,
82                      const char *name, double range[2] = NULL);
83
[2514]84    void setColorMode(ColorMode mode);
85
86    void setColorMap(ColorMap *colorMap);
87
88    /**
89     * \brief Return the ColorMap in use
90     */
91    ColorMap *getColorMap()
92    {
93        return _colorMap;
94    }
95
96    void updateColorMap();
97
[2612]98    virtual void updateRanges(Renderer *renderer);
[2514]99
100private:
[2575]101    virtual void initProp();
[2514]102    virtual void update();
103
[3499]104    bool _pipelineInitialized;
105
[3680]106    CloudStyle _cloudStyle;
[2612]107    ColorMap *_colorMap;
[2514]108    ColorMode _colorMode;
[2612]109    std::string _colorFieldName;
110    DataSet::DataAttributeType _colorFieldType;
111    double _colorFieldRange[2];
[2514]112    double _vectorMagnitudeRange[2];
113    double _vectorComponentRange[3][2];
[2612]114    Renderer *_renderer;
[2514]115
116    vtkSmartPointer<vtkLookupTable> _lut;
[2575]117    vtkSmartPointer<vtkActor> _actor[3];
[2752]118    vtkSmartPointer<vtkActor> _borderActor[3];
[3680]119    vtkSmartPointer<vtkPolyDataMapper> _mapper[3];
[2752]120    vtkSmartPointer<vtkPolyDataMapper> _borderMapper[3];
[2575]121    vtkSmartPointer<vtkCutter> _cutter[3];
122    vtkSmartPointer<vtkPlane> _cutPlane[3];
[3330]123#ifdef CUTPLANE_TIGHT_OUTLINE
[2752]124    vtkSmartPointer<vtkOutlineFilter> _outlineFilter[3];
[3330]125#else
126    vtkSmartPointer<vtkOutlineSource> _outlineSource[3];
127#endif
[2761]128    vtkSmartPointer<vtkGaussianSplatter> _splatter;
[2514]129};
130
131}
132
133#endif
Note: See TracBrowser for help on using the repository browser.