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 
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  void SetCoordinateShiftScaleMethod(int val);
121  int GetCoordinateShiftScaleMethod();
123 
125 
129  vtkSetClampMacro(Representation, int, POINTS, SURFACE_WITH_EDGES);
130  vtkGetMacro(Representation, int);
132 
137  virtual void SetRepresentation(const char*);
138 
142  vtkDataObject* GetRenderedDataObject(int port) override;
143 
145 
150  vtkSetMacro(RequestGhostCellsIfNeeded, bool);
151  vtkGetMacro(RequestGhostCellsIfNeeded, bool);
152  vtkBooleanMacro(RequestGhostCellsIfNeeded, bool);
154 
159  virtual void SetNormalArray(const char* val);
160 
165  virtual void SetTCoordArray(const char* val);
166 
171  virtual void SetTangentArray(const char* val);
172 
173  //***************************************************************************
174  // Forwarded to vtkPVGeometryFilter
175  virtual void SetUseOutline(int);
176  void SetTriangulate(int);
177  void SetNonlinearSubdivisionLevel(int);
178  virtual void SetGenerateFeatureEdges(bool);
179 
180  //***************************************************************************
181  // Forwarded to vtkProperty.
182  virtual void SetAmbientColor(double r, double g, double b);
183  virtual void SetColor(double r, double g, double b);
184  virtual void SetDiffuseColor(double r, double g, double b);
185  virtual void SetEdgeColor(double r, double g, double b);
186  virtual void SetInteractiveSelectionColor(double r, double g, double b);
187  virtual void SetInterpolation(int val);
188  virtual void SetLineWidth(double val);
189  virtual void SetOpacity(double val);
190  virtual void SetPointSize(double val);
191  virtual void SetSpecularColor(double r, double g, double b);
192  virtual void SetSpecularPower(double val);
193  virtual void SetLuminosity(double val);
194  virtual void SetRenderPointsAsSpheres(bool);
195  virtual void SetRenderLinesAsTubes(bool);
196  virtual void SetRoughness(double val);
197  virtual void SetMetallic(double val);
198  virtual void SetEdgeTint(double r, double g, double b);
199  virtual void SetBaseColorTexture(vtkTexture* tex);
200  virtual void SetMaterialTexture(vtkTexture* tex);
201  virtual void SetNormalTexture(vtkTexture* tex);
202  virtual void SetEmissiveTexture(vtkTexture* tex);
203  virtual void SetNormalScale(double val);
204  virtual void SetOcclusionStrength(double val);
205  virtual void SetEmissiveFactor(double rval, double gval, double bval);
206 
207  //***************************************************************************
208  // Forwarded to Actor.
209  virtual void SetOrientation(double, double, double);
210  virtual void SetOrigin(double, double, double);
211  virtual void SetPickable(int val);
212  virtual void SetPosition(double, double, double);
213  virtual void SetScale(double, double, double);
214  virtual void SetTexture(vtkTexture*);
215  virtual void SetUserTransform(const double[16]);
216  virtual void SetFlipTextures(bool);
217 
218  //***************************************************************************
219  // Forwarded to all textures
220  virtual void SetRepeatTextures(bool);
221  vtkGetMacro(RepeatTextures, bool);
222  virtual void SetInterpolateTextures(bool);
223  vtkGetMacro(InterpolateTextures, bool);
224  virtual void SetUseMipmapTextures(bool);
225  vtkGetMacro(UseMipmapTextures, bool);
226 
227  //***************************************************************************
228  // Forwarded to Mapper and LODMapper.
229  virtual void SetInterpolateScalarsBeforeMapping(int val);
230  virtual void SetLookupTable(vtkScalarsToColors* val);
231  virtual void SetSeamlessU(bool);
232  virtual void SetSeamlessV(bool);
234 
241  virtual void SetMapScalars(int val);
242  virtual void SetStatic(int val);
244 
248  virtual void SetSelection(vtkSelection* selection);
249 
253  vtkPVLODActor* GetActor() { return this->GetRenderedProp(); }
254 
256 
259  virtual void SetBlockVisibility(unsigned int index, bool visible);
260  virtual bool GetBlockVisibility(unsigned int index) const;
261  virtual void RemoveBlockVisibility(unsigned int index, bool = true);
262  virtual void RemoveBlockVisibilities();
264 
266 
269  virtual void SetBlockColor(unsigned int index, double r, double g, double b);
270  virtual void SetBlockColor(unsigned int index, double* color);
271  virtual double* GetBlockColor(unsigned int index);
272  virtual void RemoveBlockColor(unsigned int index);
273  virtual void RemoveBlockColors();
275 
277 
280  virtual void SetBlockOpacity(unsigned int index, double opacity);
281  virtual void SetBlockOpacity(unsigned int index, double* opacity);
282  virtual double GetBlockOpacity(unsigned int index);
283  virtual void RemoveBlockOpacity(unsigned int index);
284  virtual void RemoveBlockOpacities();
286 
290  const char* GetColorArrayName();
291 
299  static bool GetBounds(
300  vtkDataObject* dataObject, double bounds[6], vtkCompositeDataDisplayAttributes* cdAttributes);
301 
303 
307  virtual void SetEnableScaling(int v);
308  virtual void SetScalingArrayName(const char*);
309  virtual void SetScalingFunction(vtkPiecewiseFunction* pwf);
311 
315  virtual void SetMaterial(const char*);
316 
318 
324  vtkSetMacro(UseDataPartitions, bool);
325  vtkGetMacro(UseDataPartitions, bool);
327 
329 
332  virtual void SetUseShaderReplacements(bool);
333  vtkGetMacro(UseShaderReplacements, bool);
335 
341  virtual void SetShaderReplacements(const char*);
342 
347  virtual void SetArrayIdNames(const char* pointArray, const char* cellArray);
348 
349 protected:
351  ~vtkGeometryRepresentation() override;
352 
359  virtual void SetupDefaults();
360 
364  int FillInputPortInformation(int port, vtkInformation* info) override;
365 
376  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
377 
381  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
382  vtkInformationVector* outputVector) override;
383 
389  bool AddToView(vtkView* view) override;
390 
396  bool RemoveFromView(vtkView* view) override;
397 
401  virtual void UpdateColoringParameters();
402 
406  virtual vtkPVLODActor* GetRenderedProp() { return this->Actor; }
407 
408  // Progress Callback
409  void HandleGeometryRepresentationProgress(vtkObject* caller, unsigned long, void*);
410 
418  void UpdateBlockAttributes(vtkMapper* mapper);
419 
424  void ComputeVisibleDataBounds();
425 
429  void UpdateShaderReplacements();
430 
437  virtual bool NeedsOrderedCompositing();
438 
442  virtual void SetPointArrayToProcess(int p, const char* val);
443 
448 
453 
457  double Ambient;
458  double Specular;
459  double Diffuse;
463  double VisibleDataBounds[6];
464 
466 
468 
470 
473 
474  bool BlockAttrChanged = false;
476  bool UpdateBlockAttrLOD = false;
477  std::unordered_map<unsigned int, bool> BlockVisibilities;
478  std::unordered_map<unsigned int, double> BlockOpacities;
479  std::unordered_map<unsigned int, std::array<double, 3> > BlockColors;
480 
481 private:
483  void operator=(const vtkGeometryRepresentation&) = delete;
484 };
485 
486 #endif
vtkGeometryRepresentation_detail::DecimationFilterType * Decimator
color
virtual vtkPVLODActor * GetRenderedProp()
Used in ConvertSelection to locate the prop used for actual rendering.
#define VTKREMOTINGVIEWS_EXPORT
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;.