File: vtkPointGaussianRepresentation.h

package info (click to toggle)
paraview 5.1.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 221,108 kB
  • ctags: 236,092
  • sloc: cpp: 2,416,026; ansic: 190,891; python: 99,856; xml: 81,001; tcl: 46,915; yacc: 5,039; java: 4,413; perl: 3,108; sh: 1,974; lex: 1,926; f90: 748; asm: 471; pascal: 228; makefile: 198; objc: 83; fortran: 31
file content (180 lines) | stat: -rw-r--r-- 6,960 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*=========================================================================

  Program:   ParaView
  Module:    vtkPointGaussianRepresentation.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkPointGaussianRepresentation
// .SECTION Description
// Representation for showing point data as sprites, including gaussian
// splats, spheres, or some custom shaded representation.

#ifndef vtkPointGaussianRepresentation_h
#define vtkPointGaussianRepresentation_h

#include "vtkPVDataRepresentation.h"
#include "vtkSmartPointer.h"                       // needed for smart pointer
#include "vtkPVClientServerCoreRenderingModule.h"  // needed for exports

class vtkActor;
class vtkPointGaussianMapper;
class vtkScalarsToColors;
class vtkPolyData;
class vtkPiecewiseFunction;

class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkPointGaussianRepresentation : public vtkPVDataRepresentation
{
public:
  vtkTypeMacro(vtkPointGaussianRepresentation, vtkPVDataRepresentation)
  static vtkPointGaussianRepresentation* New();
  virtual void PrintSelf(ostream &os, vtkIndent indent);

  virtual int ProcessViewRequest(vtkInformationRequestKey *request_type,
                                 vtkInformation *inInfo,
                                 vtkInformation *outInfo);

  // Description:
  // Use to set the color map for the data in this representation
  void SetLookupTable(vtkScalarsToColors* lut);

  // Description:
  // Use to set whether the data in this representation is visible or not
  virtual void SetVisibility(bool val);

  // Description:
  // Use to set whether the splat emits light
  virtual void SetEmissive(bool val);

  // Description:
  // Use to make sure scalars will be mapped through lookup table, and not
  // inadvertently used as colors by themselves.
  virtual void SetMapScalars(int val);

  //***************************************************************************
  // Forwarded to Actor.
  virtual void SetOrientation(double, double, double);
  virtual void SetOrigin(double, double, double);
  virtual void SetPickable(int val);
  virtual void SetPosition(double, double, double);
  virtual void SetScale(double, double, double);

  //***************************************************************************
  // Forwarded to Actor->GetProperty()
  virtual void SetAmbientColor(double r, double g, double b);
  virtual void SetColor(double r, double g, double b);
  virtual void SetDiffuseColor(double r, double g, double b);
  virtual void SetEdgeColor(double r, double g, double b);
  virtual void SetInterpolation(int val);
  virtual void SetLineWidth(double val);
  virtual void SetOpacity(double val);
  virtual void SetPointSize(double val);
  virtual void SetSpecularColor(double r, double g, double b);
  virtual void SetSpecularPower(double val);

  // Description:
  // Sets the radius of the gaussian splats if there is no scale array or if
  // the scale array is disabled.  Defaults to 1.
  virtual void SetSplatSize(double radius);

  // Description:
  // An enum specifying some preset fragment shaders
  enum ShaderPresets
    {
    GAUSSIAN_BLUR,           // This is the default
    SPHERE,                  // Points shaded to look (something) like a sphere lit from the view direction
    BLACK_EDGED_CIRCLE,      // Camera facing, flat circle, rimmed in black
    PLAIN_CIRCLE,            // Same as above, but without the black edge
    TRIANGLE,                // Camera facing, flat triangle
    SQUARE_OUTLINE,          // Camera facing, flat square, with empty center
    NUMBER_OF_PRESETS        // !!! THIS MUST ALWAYS BE THE LAST PRESET ENUM !!!
    };

  // Description:
  // Allows to select one of several preset options for shading the points
  void SelectShaderPreset(int preset);

  // Description:
  // Sets the snippet of fragment shader code used to color the sprites.
  void SetCustomShader(const char* shaderString);

  // Description:
  // Sets the point array to scale the guassians by.  The array should be a
  // float array.  The first four parameters are unused and only needed for
  // the ParaView GUI's signature recognition.
  void SelectScaleArray(int, int, int, int, const char* name);

  // Description:
  // Sets a vtkPiecewiseFunction to use in mapping array values to sprite
  // sizes.  Performance decreases (along with understandability) when
  // large values are used for sprite sizes.  This is only used when
  // "SetScaleArray" is also set.
  void SetScaleTransferFunction(vtkPiecewiseFunction* pwf);

  // Description:
  // Sets a vtkPiecewiseFunction to use in mapping array values to sprite
  // opacities.  Only used when "Opacity Array" is set.
  void SetOpacityTransferFunction(vtkPiecewiseFunction* pwf);

  // Description:
  // Sets the point array to use in calculating point sprite opacities.
  // The array should be a float or double array.  The first four
  // parameters are unused and only needed for the ParaView GUI's
  // signature recognition.
  void SelectOpacityArray(int, int, int, int, const char* name);

  // Description:
  // Enables or disables setting opacity by an array.  Set which array
  // should be used for opacity with SelectOpacityArray, and set an
  // opacity transfer function with SetOpacityTransferFunction.
  void SetOpacityByArray(bool newVal);
  vtkGetMacro(OpacityByArray, bool);
  vtkBooleanMacro(OpacityByArray, bool);

  // Description:
  // Enables or disables scaling by a data array vs. a constant factor.  Set
  // which data array with SelectScaleArray and SetSplatSize.
  void SetScaleByArray(bool newVal);
  vtkGetMacro(ScaleByArray, bool);
  vtkBooleanMacro(ScaleByArray, bool);

protected:
  vtkPointGaussianRepresentation();
  virtual ~vtkPointGaussianRepresentation();

  virtual bool AddToView(vtkView *view);
  virtual bool RemoveFromView(vtkView *view);

  virtual int FillInputPortInformation(int port, vtkInformation* info);
  virtual int RequestData(vtkInformation *, vtkInformationVector **,
                          vtkInformationVector *);

  vtkSmartPointer< vtkActor > Actor;
  vtkSmartPointer< vtkPointGaussianMapper > Mapper;
  vtkSmartPointer< vtkPolyData > ProcessedData;

  void UpdateColoringParameters();

  bool ScaleByArray;
  char* LastScaleArray;

  vtkSetStringMacro(LastScaleArray);

  bool OpacityByArray;
  char* LastOpacityArray;

  vtkSetStringMacro(LastOpacityArray);

private:
  vtkPointGaussianRepresentation(const vtkPointGaussianRepresentation&); // Not implemented
  void operator=(const vtkPointGaussianRepresentation&); // Not implemented
};

#endif // vtkPointGaussianRepresentation_h