VTK  9.7.1
vtkLabeledContourMapper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
20 #ifndef vtkLabeledContourMapper_h
21 #define vtkLabeledContourMapper_h
22 
23 #include "vtkRenderingCoreModule.h" // For export macro
24 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 #include "vtkMapper.h"
27 #include "vtkNew.h" // For vtkNew
28 #include "vtkSmartPointer.h" // For vtkSmartPointer
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkDoubleArray;
32 class vtkTextActor3D;
33 class vtkTextProperty;
35 class vtkPolyData;
36 class vtkPolyDataMapper;
37 
38 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkLabeledContourMapper : public vtkMapper
39 {
40 public:
41  static vtkLabeledContourMapper* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
45  void Render(vtkRenderer* ren, vtkActor* act) override;
46 
48 
51  void SetInputData(vtkPolyData* in);
54 
56 
60  double* GetBounds() override;
61  void GetBounds(double bounds[6]) override;
63 
71  virtual void SetTextProperty(vtkTextProperty* tprop);
72 
74 
91  virtual void SetTextProperties(vtkTextPropertyCollection* coll);
92  virtual vtkTextPropertyCollection* GetTextProperties();
94 
96 
102  virtual vtkDoubleArray* GetTextPropertyMapping();
103  virtual void SetTextPropertyMapping(vtkDoubleArray* mapping);
105 
107 
112  vtkSetMacro(LabelVisibility, bool);
113  vtkGetMacro(LabelVisibility, bool);
114  vtkBooleanMacro(LabelVisibility, bool);
116 
118 
122  vtkSetMacro(SkipDistance, double);
123  vtkGetMacro(SkipDistance, double);
125 
127 
130  vtkGetNewMacro(PolyDataMapper, vtkPolyDataMapper);
131  virtual void SetPolyDataMapper(vtkPolyDataMapper*);
133 
134  void ReleaseGraphicsResources(vtkWindow*) override;
135 
136 protected:
138  ~vtkLabeledContourMapper() override;
139 
140  virtual void ComputeBounds();
141 
142  int FillInputPortInformation(int, vtkInformation*) override;
143 
144  void Reset();
145 
146  bool CheckInputs(vtkRenderer* ren);
147  bool CheckRebuild(vtkRenderer* ren, vtkActor* act);
148  bool PrepareRender(vtkRenderer* ren, vtkActor* act);
149  bool PlaceLabels();
150  bool ResolveLabels();
151  virtual bool CreateLabels(vtkActor* actor);
152  bool BuildStencilQuads();
153  virtual bool ApplyStencil(vtkRenderer* ren, vtkActor* act);
154  bool RenderPolyData(vtkRenderer* ren, vtkActor* act);
155  virtual bool RemoveStencil(vtkRenderer* ren);
156  bool RenderLabels(vtkRenderer* ren, vtkActor* act);
157 
158  bool AllocateTextActors(vtkIdType num);
159  bool FreeTextActors();
160 
161  double SkipDistance = false;
162 
163  bool LabelVisibility = true;
164  vtkIdType NumberOfTextActors = 0;
165  vtkIdType NumberOfUsedTextActors = 0;
166  vtkTextActor3D** TextActors = nullptr;
167 
171 
172  float* StencilQuads = nullptr;
173  vtkIdType StencilQuadsSize = 0;
174  unsigned int* StencilQuadIndices = nullptr;
175  vtkIdType StencilQuadIndicesSize = 0;
176  void FreeStencilQuads();
177 
179 
180 private:
182  void operator=(const vtkLabeledContourMapper&) = delete;
183 
184  struct Private;
185  Private* Internal;
186 };
187 
188 VTK_ABI_NAMESPACE_END
189 #endif
vtkNew< vtkPolyDataMapper > PolyDataMapper
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
abstract specification for renderers
Definition: vtkRenderer.h:63
Draw labeled isolines.
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
an ordered list of vtkTextProperty objects.
dynamic, self-adjusting array of double
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
vtkSmartPointer< vtkDoubleArray > TextPropertyMapping
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkSmartPointer< vtkTextPropertyCollection > TextProperties
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
An actor that displays text.
represent text properties.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
map vtkPolyData to graphics primitives
static vtkAlgorithm * New()
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
#define VTK_MARSHALAUTO
vtkDataSet * GetInput()
Get the input as a vtkDataSet.
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:105