source: branches/nanovis2/packages/vizservers/vtkvis/RpGlyphs.h @ 3305

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

sync with trunk

  • Property svn:eol-style set to native
File size: 3.0 KB
RevLine 
[2269]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
[3305]3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
[2269]4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef __RAPPTURE_VTKVIS_GLYPHS_H__
9#define __RAPPTURE_VTKVIS_GLYPHS_H__
10
11#include <vector>
12
13#include <vtkSmartPointer.h>
14#include <vtkProp.h>
15#include <vtkActor.h>
[2533]16#include <vtkVersion.h>
[2467]17#include <vtkGlyph3DMapper.h>
[2269]18#include <vtkLookupTable.h>
19#include <vtkPlaneCollection.h>
20
[2328]21#include "RpVtkGraphicsObject.h"
[2269]22#include "ColorMap.h"
23
24namespace Rappture {
25namespace VtkVis {
26
27/**
[2319]28 * \brief Oriented and scaled 3D glyph shapes
[2328]29 *
[2423]30 * The DataSet must have vectors and/or scalars
[2269]31 */
[2328]32class Glyphs : public VtkGraphicsObject {
[2269]33public:
34    enum GlyphShape {
35        ARROW,
36        CONE,
37        CUBE,
38        CYLINDER,
39        DODECAHEDRON,
40        ICOSAHEDRON,
[2402]41        LINE,
[2269]42        OCTAHEDRON,
43        SPHERE,
44        TETRAHEDRON
45    };
[2335]46    enum ScalingMode {
47        SCALE_BY_SCALAR,
[2402]48        SCALE_BY_VECTOR_MAGNITUDE,
[2335]49        SCALE_BY_VECTOR_COMPONENTS,
50        SCALING_OFF
51    };
52    enum ColorMode {
53        COLOR_BY_SCALAR,
[2402]54        COLOR_BY_VECTOR_MAGNITUDE,
[2641]55        COLOR_BY_VECTOR_X,
56        COLOR_BY_VECTOR_Y,
57        COLOR_BY_VECTOR_Z,
[2393]58        COLOR_CONSTANT
[2335]59    };
[2269]60
[2402]61    Glyphs(GlyphShape shape);
[2269]62    virtual ~Glyphs();
63
[2328]64    virtual const char *getClassName() const
65    {
66        return "Glyphs";
67    }
[2269]68
[2402]69    virtual void setDataSet(DataSet *dataSet,
[2612]70                            Renderer *renderer);
[2402]71
[2328]72    virtual void setClippingPlanes(vtkPlaneCollection *planes);
[2269]73
[3175]74    void setQuality(double quality);
75
76    void setOrient(bool state);
77
78    void setOrientMode(bool mode, const char *name);
79
[2641]80    void setScalingMode(ScalingMode mode, const char *name, double range[2]);
81
82    void setColorMode(ColorMode mode, const char *name, double range[2]);
83
[2335]84    void setScalingMode(ScalingMode mode);
85
[2492]86    void setNormalizeScale(bool normalize);
87
[2335]88    void setColorMode(ColorMode mode);
89
[2269]90    void setGlyphShape(GlyphShape shape);
91
92    void setScaleFactor(double scale);
93
[2402]94    void setColorMap(ColorMap *colorMap);
[2269]95
[2402]96    /**
97     * \brief Return the ColorMap in use
98     */
99    ColorMap *getColorMap()
100    {
101        return _colorMap;
102    }
[2269]103
[2402]104    void updateColorMap();
105
[2612]106    virtual void updateRanges(Renderer *renderer);
[2402]107
[2269]108private:
[2402]109    Glyphs();
[2328]110    virtual void update();
[2402]111    static inline double min2(double a, double b)
112    {
113        return ((a < b) ? a : b);
114    }
115    static inline double max2(double a, double b)
116    {
117        return ((a > b) ? a : b);
118    }
[2269]119
120    GlyphShape _glyphShape;
[2402]121    ScalingMode _scalingMode;
[2641]122    std::string _scalingFieldName;
123    double _scalingFieldRange[2];
[2402]124    double _dataScale;
[2269]125    double _scaleFactor;
[2492]126    bool _normalizeScale;
[2641]127    ColorMap *_colorMap;
[2393]128    ColorMode _colorMode;
[2641]129    std::string _colorFieldName;
130    double _colorFieldRange[2];
[2402]131    double _vectorMagnitudeRange[2];
132    double _vectorComponentRange[3][2];
[2641]133    Renderer *_renderer;
[2269]134
135    vtkSmartPointer<vtkLookupTable> _lut;
[2467]136    vtkSmartPointer<vtkPolyDataAlgorithm> _glyphSource;
137    vtkSmartPointer<vtkGlyph3DMapper> _glyphMapper;
[2269]138};
139
140}
141}
142
143#endif
Note: See TracBrowser for help on using the repository browser.