vtkGeometryRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkGeometryRepresentation_h
17 #define vtkGeometryRepresentation_h
18 
20 #include "vtkParaViewDeprecation.h" // for PV_DEPRECATED
21 #include "vtkProperty.h" // needed for VTK_POINTS etc.
22 #include "vtkRemotingViewsModule.h" // needed for exports
23 #include "vtkVector.h" // for vtkVector.
24 
25 #include <set> // needed for std::set
26 #include <string> // needed for std::string
27 #include <unordered_map> // needed for std::unordered_map
28 #include <vector> // needed for std::vector
29 
31 class vtkGeometryFilterDispatcher;
32 class vtkMapper;
34 class vtkPVLODActor;
35 class vtkScalarsToColors;
36 class vtkTexture;
37 class vtkTransform;
38 
40 {
41 // This is defined to either vtkQuadricClustering or vtkmLevelOfDetail in the
42 // implementation file:
44 }
45 
46 class VTKREMOTINGVIEWS_EXPORT vtkGeometryRepresentation : public vtkPVDataRepresentation
47 {
48 
49 public:
50  static vtkGeometryRepresentation* New();
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
60  int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
61  vtkInformation* outInfo) override;
62 
67  void SetVisibility(bool val) override;
68 
70 
74  void SetBlockColorsDistinctValues(int distinctValues);
75  int GetBlockColorsDistinctValues();
77 
81  virtual void SetSuppressLOD(bool suppress) { this->SuppressLOD = suppress; }
82 
84 
89  vtkBooleanMacro(DisableLighting, bool);
90  vtkSetMacro(DisableLighting, bool);
91  vtkGetMacro(DisableLighting, bool);
94 
101  vtkSetMacro(Ambient, double);
102  vtkSetMacro(Diffuse, double);
103  vtkSetMacro(Specular, double);
104  vtkGetMacro(Ambient, double);
105  vtkGetMacro(Diffuse, double);
106  vtkGetMacro(Specular, double);
108 
110  {
111  POINTS = VTK_POINTS,
112  WIREFRAME = VTK_WIREFRAME,
113  SURFACE = VTK_SURFACE,
114  SURFACE_WITH_EDGES = 3
115  };
116 
118 
122  void SetCoordinateShiftScaleMethod(int val);
123  int GetCoordinateShiftScaleMethod();
125 
127 
131  vtkSetClampMacro(Representation, int, POINTS, SURFACE_WITH_EDGES);
132  vtkGetMacro(Representation, int);
134 
139  virtual void SetRepresentation(const char*);
140 
144  vtkDataObject* GetRenderedDataObject(int port) override;
145 
147 
152  vtkSetMacro(RequestGhostCellsIfNeeded, bool);
153  vtkGetMacro(RequestGhostCellsIfNeeded, bool);
154  vtkBooleanMacro(RequestGhostCellsIfNeeded, bool);
156 
161  virtual void SetNormalArray(const char* val);
162 
167  virtual void SetTCoordArray(const char* val);
168 
173  virtual void SetTangentArray(const char* val);
174 
175  //***************************************************************************
176  // Forwarded to vtkGeometryFilterDispatcher
177  virtual void SetUseOutline(int);
178  void SetTriangulate(int);
179  void SetNonlinearSubdivisionLevel(int);
180  void SetMatchBoundariesIgnoringCellOrder(int);
181  virtual void SetGenerateFeatureEdges(bool);
182  void SetComputePointNormals(bool);
183  void SetSplitting(bool);
184  void SetFeatureAngle(double);
185 
186  //***************************************************************************
187  // Forwarded to vtkProperty.
188  virtual void SetAmbientColor(double r, double g, double b);
189  virtual void SetColor(double r, double g, double b);
190  virtual void SetDiffuseColor(double r, double g, double b);
191  virtual void SetLighting(bool lighting);
192  virtual void SetEdgeColor(double r, double g, double b);
193  virtual void SetInteractiveSelectionColor(double r, double g, double b);
194  virtual void SetInterpolation(int val);
195  virtual void SetLineWidth(double val);
196  virtual void SetOpacity(double val);
197  virtual void SetEdgeOpacity(double val);
198  virtual void SetPointSize(double val);
199  virtual void SetSpecularColor(double r, double g, double b);
200  virtual void SetSpecularPower(double val);
201  virtual void SetLuminosity(double val);
202  virtual void SetRenderPointsAsSpheres(bool);
203  virtual void SetRenderLinesAsTubes(bool);
204  virtual void SetRoughness(double val);
205  virtual void SetMetallic(double val);
206  virtual void SetEdgeTint(double r, double g, double b);
207  virtual void SetAnisotropy(double val);
208  virtual void SetAnisotropyRotation(double val);
209  virtual void SetBaseIOR(double val);
210  virtual void SetCoatIOR(double val);
211  virtual void SetCoatStrength(double val);
212  virtual void SetCoatRoughness(double val);
213  virtual void SetCoatNormalScale(double val);
214  virtual void SetCoatColor(double r, double g, double b);
215  virtual void SetBaseColorTexture(vtkTexture* tex);
216  virtual void SetMaterialTexture(vtkTexture* tex);
217  virtual void SetAnisotropyTexture(vtkTexture* tex);
218  virtual void SetNormalTexture(vtkTexture* tex);
219  virtual void SetCoatNormalTexture(vtkTexture* tex);
220  virtual void SetEmissiveTexture(vtkTexture* tex);
221  virtual void SetNormalScale(double val);
222  virtual void SetOcclusionStrength(double val);
223  virtual void SetEmissiveFactor(double rval, double gval, double bval);
224  virtual void SetShowTexturesOnBackface(bool);
225 
226  //***************************************************************************
227  // Forwarded to Actor.
228  virtual void SetOrientation(double, double, double);
229  virtual void SetOrigin(double, double, double);
230  virtual void SetPickable(int val);
231  virtual void SetPosition(double, double, double);
232  virtual void SetScale(double, double, double);
233  virtual void SetTexture(vtkTexture*);
234  virtual void SetUserTransform(const double[16]);
235  virtual void SetCoordinateSystem(int);
236 
237  //***************************************************************************
238  // Forwarded to all textures
239  virtual void SetTextureTransform(vtkTransform*);
240  vtkGetObjectMacro(TextureTransform, vtkTransform);
241  virtual void SetRepeatTextures(bool);
242  vtkGetMacro(RepeatTextures, bool);
243  virtual void SetInterpolateTextures(bool);
244  vtkGetMacro(InterpolateTextures, bool);
245  virtual void SetUseMipmapTextures(bool);
246  vtkGetMacro(UseMipmapTextures, bool);
247 
248  //***************************************************************************
249  // Forwarded to Mapper and LODMapper.
250  virtual void SetInterpolateScalarsBeforeMapping(int val);
251  virtual void SetLookupTable(vtkScalarsToColors* val);
252  virtual void SetColorMissingArraysWithNanColor(bool val);
253  virtual void SetSeamlessU(bool);
254  virtual void SetSeamlessV(bool);
256 
263  virtual void SetMapScalars(int val);
264  virtual void SetStatic(int val);
266 
273  virtual void SetRelativeCoincidentTopologyPolygonOffsetParameters(double factor, double units);
274 
285  virtual void SetUserRelativeCoincidentTopologyPolygonOffsetParameters(
286  double factor, double units);
287 
294  virtual void SetSelectionCoincidentTopologyPolygonOffsetParameters(double factor, double units);
295 
299  virtual void SetSelection(vtkSelection* selection);
300 
304  vtkPVLODActor* GetActor() { return this->GetRenderedProp(); }
305 
307 
313  vtkSetStringMacro(ActiveAssembly);
314  vtkGetStringMacro(ActiveAssembly);
316 
318 
321  void AddBlockSelector(const char* selector);
322  void RemoveAllBlockSelectors();
324 
326 
329  void SetBlockColor(const char* selector, double r, double g, double b);
330  void RemoveAllBlockColors();
332 
334 
337  void SetBlockOpacity(const char* selector, double opacity);
338  void RemoveAllBlockOpacities();
340 
342 
345  void SetBlockInterpolateScalarsBeforeMapping(const char* selector, bool interpolate);
346  void RemoveAllBlockInterpolateScalarsBeforeMappings();
348 
350 
355  void SetBlockMapScalars(const char* selector, int val);
356  void RemoveAllBlockMapScalars();
358 
360 
363  void SetBlockArrayName(const char* selector, int assoc, const char* arrayName);
364  void RemoveAllBlockArrayNames();
366 
368 
374  void SetBlockLookupTable(vtkScalarsToColors* lut);
375  void RemoveAllBlockLookupTables();
377 
381  const char* GetColorArrayName();
382 
390  static bool GetBounds(
391  vtkDataObject* dataObject, double bounds[6], vtkCompositeDataDisplayAttributes* cdAttributes);
392 
394 
398  virtual void SetEnableScaling(int v);
399  virtual void SetScalingArrayName(const char*);
400  virtual void SetScalingFunction(vtkPiecewiseFunction* pwf);
402 
406  virtual void SetMaterial(const char*);
407 
409 
415  vtkSetMacro(UseDataPartitions, bool);
416  vtkGetMacro(UseDataPartitions, bool);
418 
420 
423  virtual void SetUseShaderReplacements(bool);
424  vtkGetMacro(UseShaderReplacements, bool);
426 
432  virtual void SetShaderReplacements(const char*);
433 
438  void SetArrayIdNames(const char* pointArray, const char* cellArray) override;
439 
441 
453  void SetPlaceHolderDataType(int datatype);
454  vtkGetMacro(PlaceHolderDataType, int);
456 
457 protected:
459  ~vtkGeometryRepresentation() override;
460 
467  virtual void SetupDefaults();
468 
472  int FillInputPortInformation(int port, vtkInformation* info) override;
473 
484  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
485 
489  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
490  vtkInformationVector* outputVector) override;
491 
497  bool AddToView(vtkView* view) override;
498 
504  bool RemoveFromView(vtkView* view) override;
505 
509  virtual void UpdateColoringParameters();
510 
514  virtual vtkPVLODActor* GetRenderedProp() { return this->Actor; }
515 
516  // Progress Callback
517  void HandleGeometryRepresentationProgress(vtkObject* caller, unsigned long, void*);
518 
526  void PopulateBlockAttributes(vtkCompositeDataDisplayAttributes* attrs, vtkDataObject* outputData);
527 
532  void ComputeVisibleDataBounds();
533 
537  void UpdateShaderReplacements();
538 
545  virtual bool NeedsOrderedCompositing();
546 
550  virtual void SetPointArrayToProcess(int p, const char* val);
551 
555  void UpdateGeneralTextureTransform();
556 
560  vtkGeometryFilterDispatcher* LODOutlineFilter;
561 
566 
567  char* ActiveAssembly = nullptr;
572  double Ambient;
573  double Specular;
574  double Diffuse;
578  double VisibleDataBounds[6];
579 
581 
583 
585 
586  double UserCoincidentTopologyPolygonOffsetFactor = 0.0;
587  double UserCoincidentTopologyPolygonOffsetUnits = 0.0;
588  double SelectionCoincidentTopologyPolygonOffsetFactor = 0.0;
589  double SelectionCoincidentTopologyPolygonOffsetUnits = 0.0;
590 
593 
594  bool BlockAttrChanged = false;
596  bool UpdateBlockAttrLOD = false;
597 
598  // This is used to be able to create the correct placeHolder in RequestData for the client
599  int PlaceHolderDataType = VTK_PARTITIONED_DATA_SET_COLLECTION;
600 
601  // These block variables are similar to the ones in vtkCompositeDataDisplayAttributes
602  // Some of them are exposed and some others are not because, as of now, they are not needed.
603 
605 
608  std::vector<std::string> BlockSelectors;
609  std::vector<std::pair<std::string, vtkVector3d>> BlockColors;
610  std::vector<std::pair<std::string, double>> BlockOpacities;
611  std::vector<std::pair<std::string, bool>> BlockInterpolateScalarsBeforeMapping;
612  std::vector<std::pair<std::string, int>> BlockColorModes;
613  std::vector<std::pair<std::string, std::pair<int /*assoc*/, std::string>>> BlockArrayNames;
614  std::vector<vtkScalarsToColors*> BlockLookupTables;
617 
620  std::vector<std::pair<std::string, bool>> BlockScalarVisibilities;
621  std::vector<std::pair<std::string, bool>> BlockUseLookupTableScalarRanges;
622  std::vector<std::pair<vtkDataObject*, vtkIdType>> BlockFieldDataTupleIds;
624 private:
625  bool DisableLighting = false;
627  void operator=(const vtkGeometryRepresentation&) = delete;
628 };
629 
630 #endif
vtkGeometryRepresentation_detail::DecimationFilterType * Decimator
std::vector< std::pair< vtkDataObject *, vtkIdType > > BlockFieldDataTupleIds
Configured internally in vtkGeometryRepresentation.
virtual vtkPVLODActor * GetRenderedProp()
Used in ConvertSelection to locate the prop used for actual rendering.
std::vector< std::pair< std::string, vtkVector3d > > BlockColors
Configurable through vtkGeometryRepresentation API.
vtkPVDataRepresentation adds some ParaView specific API to data representations.
#define VTK_SURFACE
vtkPVLODActor * GetActor()
Provides access to the actor used by this representation.
info
std::vector< std::pair< std::string, double > > BlockOpacities
Configurable through vtkGeometryRepresentation API.
representation for showing any datasets as external shell of polygons.
std::vector< std::pair< std::string, std::pair< int, std::string > > > BlockArrayNames
Configurable through vtkGeometryRepresentation API.
std::vector< std::pair< std::string, int > > BlockColorModes
Configurable through vtkGeometryRepresentation API.
#define VTK_POINTS
std::vector< std::pair< std::string, bool > > BlockInterpolateScalarsBeforeMapping
Configurable through vtkGeometryRepresentation API.
std::vector< vtkScalarsToColors * > BlockLookupTables
Configurable through vtkGeometryRepresentation API.
std::vector< std::pair< std::string, bool > > BlockScalarVisibilities
Configured internally in vtkGeometryRepresentation.
an actor that supports multiple levels of detail
Definition: vtkPVLODActor.h:25
std::vector< std::string > BlockSelectors
Configurable through vtkGeometryRepresentation API.
std::vector< std::pair< std::string, bool > > BlockUseLookupTableScalarRanges
Configured internally in vtkGeometryRepresentation.
vtkGeometryFilterDispatcher * LODOutlineFilter
port
#define VTK_WIREFRAME
virtual void SetSuppressLOD(bool suppress)
Enable/Disable LOD;.