VTK  9.3.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 
25 #include "vtkMapper.h"
26 #include "vtkNew.h" // For vtkNew
27 #include "vtkSmartPointer.h" // For vtkSmartPointer
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkDoubleArray;
31 class vtkTextActor3D;
32 class vtkTextProperty;
34 class vtkPolyData;
35 class vtkPolyDataMapper;
36 
37 class VTKRENDERINGCORE_EXPORT vtkLabeledContourMapper : public vtkMapper
38 {
39 public:
40  static vtkLabeledContourMapper* New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
44  void Render(vtkRenderer* ren, vtkActor* act) override;
45 
47 
50  void SetInputData(vtkPolyData* in);
53 
55 
59  double* GetBounds() override;
60  void GetBounds(double bounds[6]) override;
62 
70  virtual void SetTextProperty(vtkTextProperty* tprop);
71 
73 
90  virtual void SetTextProperties(vtkTextPropertyCollection* coll);
91  virtual vtkTextPropertyCollection* GetTextProperties();
93 
95 
101  virtual vtkDoubleArray* GetTextPropertyMapping();
102  virtual void SetTextPropertyMapping(vtkDoubleArray* mapping);
104 
106 
111  vtkSetMacro(LabelVisibility, bool);
112  vtkGetMacro(LabelVisibility, bool);
113  vtkBooleanMacro(LabelVisibility, bool);
115 
117 
121  vtkSetMacro(SkipDistance, double);
122  vtkGetMacro(SkipDistance, double);
124 
126 
129  vtkGetNewMacro(PolyDataMapper, vtkPolyDataMapper);
131 
132  void ReleaseGraphicsResources(vtkWindow*) override;
133 
134 protected:
136  ~vtkLabeledContourMapper() override;
137 
138  virtual void ComputeBounds();
139 
140  int FillInputPortInformation(int, vtkInformation*) override;
141 
142  void Reset();
143 
144  bool CheckInputs(vtkRenderer* ren);
145  bool CheckRebuild(vtkRenderer* ren, vtkActor* act);
146  bool PrepareRender(vtkRenderer* ren, vtkActor* act);
147  bool PlaceLabels();
148  bool ResolveLabels();
149  virtual bool CreateLabels(vtkActor* actor);
150  bool BuildStencilQuads();
151  virtual bool ApplyStencil(vtkRenderer* ren, vtkActor* act);
152  bool RenderPolyData(vtkRenderer* ren, vtkActor* act);
153  virtual bool RemoveStencil(vtkRenderer* ren);
154  bool RenderLabels(vtkRenderer* ren, vtkActor* act);
155 
156  bool AllocateTextActors(vtkIdType num);
157  bool FreeTextActors();
158 
159  double SkipDistance = false;
160 
161  bool LabelVisibility = true;
162  vtkIdType NumberOfTextActors = 0;
163  vtkIdType NumberOfUsedTextActors = 0;
164  vtkTextActor3D** TextActors = nullptr;
165 
169 
170  float* StencilQuads = nullptr;
171  vtkIdType StencilQuadsSize = 0;
172  unsigned int* StencilQuadIndices = nullptr;
173  vtkIdType StencilQuadIndicesSize = 0;
174  void FreeStencilQuads();
175 
177 
178 private:
180  void operator=(const vtkLabeledContourMapper&) = delete;
181 
182  struct Private;
183  Private* Internal;
184 };
185 
186 VTK_ABI_NAMESPACE_END
187 #endif
vtkNew< vtkPolyDataMapper > PolyDataMapper
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
abstract specification for renderers
Definition: vtkRenderer.h:61
Draw labeled isolines.
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
an ordered list of vtkTextProperty objects.
dynamic, self-adjusting array of double
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
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:76
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).
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:104