vtkGeometryRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkGeometryRepresentation.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkGeometryRepresentation_h
29 #define vtkGeometryRepresentation_h
30 #include <array> // needed for array
31 #include <unordered_map> // needed for unordered_map
32 
34 #include "vtkProperty.h" // needed for VTK_POINTS etc.
35 #include "vtkRemotingViewsModule.h" // needed for exports
36 
37 class vtkCallbackCommand;
40 class vtkMapper;
43 class vtkPVLODActor;
44 class vtkScalarsToColors;
45 class vtkTexture;
46 
48 {
49 // This is defined to either vtkQuadricClustering or vtkmLevelOfDetail in the
50 // implementation file:
52 }
53 
54 class VTKREMOTINGVIEWS_EXPORT vtkGeometryRepresentation : public vtkPVDataRepresentation
55 {
56 
57 public:
58  static vtkGeometryRepresentation* New();
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
68  int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
69  vtkInformation* outInfo) override;
70 
75  void SetVisibility(bool val) override;
76 
78 
82  void SetBlockColorsDistinctValues(int distinctValues);
83  int GetBlockColorsDistinctValues();
85 
89  virtual void SetSuppressLOD(bool suppress) { this->SuppressLOD = suppress; }
90 
92 
99  vtkSetMacro(Ambient, double);
100  vtkSetMacro(Diffuse, double);
101  vtkSetMacro(Specular, double);
102  vtkGetMacro(Ambient, double);
103  vtkGetMacro(Diffuse, double);
104  vtkGetMacro(Specular, double);
106 
108  {
109  POINTS = VTK_POINTS,
110  WIREFRAME = VTK_WIREFRAME,
111  SURFACE = VTK_SURFACE,
112  SURFACE_WITH_EDGES = 3
113  };
114 
116 
120  vtkSetClampMacro(Representation, int, POINTS, SURFACE_WITH_EDGES);
121  vtkGetMacro(Representation, int);
123 
128  virtual void SetRepresentation(const char*);
129 
133  vtkDataObject* GetRenderedDataObject(int port) override;
134 
136 
141  vtkSetMacro(RequestGhostCellsIfNeeded, bool);
142  vtkGetMacro(RequestGhostCellsIfNeeded, bool);
143  vtkBooleanMacro(RequestGhostCellsIfNeeded, bool);
145 
146  //***************************************************************************
147  // Forwarded to vtkPVGeometryFilter
148  virtual void SetUseOutline(int);
149  void SetTriangulate(int);
150  void SetNonlinearSubdivisionLevel(int);
151  virtual void SetGenerateFeatureEdges(bool);
152 
153  //***************************************************************************
154  // Forwarded to vtkProperty.
155  virtual void SetAmbientColor(double r, double g, double b);
156  virtual void SetColor(double r, double g, double b);
157  virtual void SetDiffuseColor(double r, double g, double b);
158  virtual void SetEdgeColor(double r, double g, double b);
159  virtual void SetInterpolation(int val);
160  virtual void SetLineWidth(double val);
161  virtual void SetOpacity(double val);
162  virtual void SetPointSize(double val);
163  virtual void SetSpecularColor(double r, double g, double b);
164  virtual void SetSpecularPower(double val);
165  virtual void SetLuminosity(double val);
166  virtual void SetRenderPointsAsSpheres(bool);
167  virtual void SetRenderLinesAsTubes(bool);
168  virtual void SetRoughness(double val);
169  virtual void SetMetallic(double val);
170  virtual void SetBaseColorTexture(vtkTexture* tex);
171  virtual void SetMaterialTexture(vtkTexture* tex);
172  virtual void SetNormalTexture(vtkTexture* tex);
173  virtual void SetEmissiveTexture(vtkTexture* tex);
174  virtual void SetNormalScale(double val);
175  virtual void SetOcclusionStrength(double val);
176  virtual void SetEmissiveFactor(double rval, double gval, double bval);
177 
178  //***************************************************************************
179  // Forwarded to Actor.
180  virtual void SetOrientation(double, double, double);
181  virtual void SetOrigin(double, double, double);
182  virtual void SetPickable(int val);
183  virtual void SetPosition(double, double, double);
184  virtual void SetScale(double, double, double);
185  virtual void SetTexture(vtkTexture*);
186  virtual void SetUserTransform(const double[16]);
187  virtual void SetFlipTextures(bool);
188 
189  //***************************************************************************
190  // Forwarded to all textures
191  virtual void SetRepeatTextures(bool);
192  vtkGetMacro(RepeatTextures, bool);
193  virtual void SetInterpolateTextures(bool);
194  vtkGetMacro(InterpolateTextures, bool);
195  virtual void SetUseMipmapTextures(bool);
196  vtkGetMacro(UseMipmapTextures, bool);
197 
198  //***************************************************************************
199  // Forwarded to Mapper and LODMapper.
200  virtual void SetInterpolateScalarsBeforeMapping(int val);
201  virtual void SetLookupTable(vtkScalarsToColors* val);
202  virtual void SetSeamlessU(bool);
203  virtual void SetSeamlessV(bool);
205 
212  virtual void SetMapScalars(int val);
213  virtual void SetStatic(int val);
215 
219  vtkPVLODActor* GetActor() { return this->GetRenderedProp(); }
220 
222 
225  virtual void SetBlockVisibility(unsigned int index, bool visible);
226  virtual bool GetBlockVisibility(unsigned int index) const;
227  virtual void RemoveBlockVisibility(unsigned int index, bool = true);
228  virtual void RemoveBlockVisibilities();
230 
232 
235  virtual void SetBlockColor(unsigned int index, double r, double g, double b);
236  virtual void SetBlockColor(unsigned int index, double* color);
237  virtual double* GetBlockColor(unsigned int index);
238  virtual void RemoveBlockColor(unsigned int index);
239  virtual void RemoveBlockColors();
241 
243 
246  virtual void SetBlockOpacity(unsigned int index, double opacity);
247  virtual void SetBlockOpacity(unsigned int index, double* opacity);
248  virtual double GetBlockOpacity(unsigned int index);
249  virtual void RemoveBlockOpacity(unsigned int index);
250  virtual void RemoveBlockOpacities();
252 
256  const char* GetColorArrayName();
257 
265  static bool GetBounds(
266  vtkDataObject* dataObject, double bounds[6], vtkCompositeDataDisplayAttributes* cdAttributes);
267 
269 
273  virtual void SetEnableScaling(int v);
274  virtual void SetScalingArrayName(const char*);
275  virtual void SetScalingFunction(vtkPiecewiseFunction* pwf);
277 
281  virtual void SetMaterial(const char*);
282 
284 
290  vtkSetMacro(UseDataPartitions, bool);
291  vtkGetMacro(UseDataPartitions, bool);
293 
295 
298  virtual void SetUseShaderReplacements(bool);
299  vtkGetMacro(UseShaderReplacements, bool);
301 
307  virtual void SetShaderReplacements(const char*);
308 
313  virtual void SetArrayIdNames(const char* pointArray, const char* cellArray);
314 
315 protected:
317  ~vtkGeometryRepresentation() override;
318 
325  virtual void SetupDefaults();
326 
330  int FillInputPortInformation(int port, vtkInformation* info) override;
331 
342  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
343 
347  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
348  vtkInformationVector* outputVector) override;
349 
355  bool AddToView(vtkView* view) override;
356 
362  bool RemoveFromView(vtkView* view) override;
363 
367  virtual void UpdateColoringParameters();
368 
372  virtual vtkPVLODActor* GetRenderedProp() { return this->Actor; }
373 
374  // Progress Callback
375  void HandleGeometryRepresentationProgress(vtkObject* caller, unsigned long, void*);
376 
384  void UpdateBlockAttributes(vtkMapper* mapper);
385 
390  void ComputeVisibleDataBounds();
391 
395  void UpdateShaderReplacements();
396 
403  virtual bool NeedsOrderedCompositing();
404 
409 
414 
418  double Ambient;
419  double Specular;
420  double Diffuse;
424  double VisibleDataBounds[6];
425 
427 
429 
431 
434 
435  bool BlockAttrChanged = false;
437  bool UpdateBlockAttrLOD = false;
438  std::unordered_map<unsigned int, bool> BlockVisibilities;
439  std::unordered_map<unsigned int, double> BlockOpacities;
440  std::unordered_map<unsigned int, std::array<double, 3> > BlockColors;
441 
442 private:
444  void operator=(const vtkGeometryRepresentation&) = delete;
445 };
446 
447 #endif
vtkGeometryRepresentation_detail::DecimationFilterType * Decimator
color
virtual vtkPVLODActor * GetRenderedProp()
Used in ConvertSelection to locate the prop used for actual rendering.
vtkPVDataRepresentation adds some ParaView specific API to data representations.
#define VTK_SURFACE
vtkPVLODActor * GetActor()
Provides access to the actor used by this representation.
info
Geometry filter that does outlines for volumes.
std::unordered_map< unsigned int, bool > BlockVisibilities
representation for showing any datasets as external shell of polygons.
std::unordered_map< unsigned int, std::array< double, 3 > > BlockColors
vtkPVGeometryFilter * LODOutlineFilter
#define VTK_POINTS
std::unordered_map< unsigned int, double > BlockOpacities
an actor that supports multiple levels of detail
Definition: vtkPVLODActor.h:37
port
index
#define VTK_WIREFRAME
virtual void SetSuppressLOD(bool suppress)
Enable/Disable LOD;.