VTK
vtkLabeledContourMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLabeledContourMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
32 #ifndef vtkLabeledContourMapper_h
33 #define vtkLabeledContourMapper_h
34 
35 #include "vtkRenderingCoreModule.h" // For export macro
36 
37 #include "vtkMapper.h"
38 #include "vtkNew.h" // For vtkNew
39 #include "vtkSmartPointer.h" // For vtkSmartPointer
40 
41 class vtkDoubleArray;
42 class vtkTextActor3D;
43 class vtkTextProperty;
45 class vtkPolyData;
46 class vtkPolyDataMapper;
47 
48 class VTKRENDERINGCORE_EXPORT vtkLabeledContourMapper : public vtkMapper
49 {
50 public:
51  static vtkLabeledContourMapper *New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
55  void Render(vtkRenderer *ren, vtkActor *act) override;
56 
58 
61  void SetInputData(vtkPolyData *in);
64 
66 
70  double *GetBounds() override;
71  void GetBounds(double bounds[6]) override;
73 
81  virtual void SetTextProperty(vtkTextProperty *tprop);
82 
84 
101  virtual void SetTextProperties(vtkTextPropertyCollection *coll);
102  virtual vtkTextPropertyCollection *GetTextProperties();
104 
106 
112  virtual vtkDoubleArray* GetTextPropertyMapping();
113  virtual void SetTextPropertyMapping(vtkDoubleArray *mapping);
115 
117 
122  vtkSetMacro(LabelVisibility, bool)
123  vtkGetMacro(LabelVisibility, bool)
124  vtkBooleanMacro(LabelVisibility, bool)
126 
128 
132  vtkSetMacro(SkipDistance, double)
133  vtkGetMacro(SkipDistance, double)
135 
137 
140  vtkGetNewMacro(PolyDataMapper, vtkPolyDataMapper)
142 
143  void ReleaseGraphicsResources(vtkWindow *) override;
144 
145 protected:
147  ~vtkLabeledContourMapper() override;
148 
149  virtual void ComputeBounds();
150 
151  int FillInputPortInformation(int, vtkInformation*) override;
152 
153  void Reset();
154 
155  bool CheckInputs(vtkRenderer *ren);
156  bool CheckRebuild(vtkRenderer *ren, vtkActor *act);
157  bool PrepareRender(vtkRenderer *ren, vtkActor *act);
158  bool PlaceLabels();
159  bool ResolveLabels();
160  virtual bool CreateLabels(vtkActor *actor);
161  bool BuildStencilQuads();
162  virtual bool ApplyStencil(vtkRenderer *ren, vtkActor *act);
163  bool RenderPolyData(vtkRenderer *ren, vtkActor *act);
164  virtual bool RemoveStencil(vtkRenderer *ren);
165  bool RenderLabels(vtkRenderer *ren, vtkActor *act);
166 
167  bool AllocateTextActors(vtkIdType num);
168  bool FreeTextActors();
169 
170  double SkipDistance;
171 
176 
180 
181  float *StencilQuads;
183  unsigned int *StencilQuadIndices;
185  void FreeStencilQuads();
186 
188 
189 private:
191  void operator=(const vtkLabeledContourMapper&) = delete;
192 
193  struct Private;
194  Private *Internal;
195 };
196 
197 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkLabeledContourMapper::StencilQuadsSize
vtkIdType StencilQuadsSize
Definition: vtkLabeledContourMapper.h:182
vtkLabeledContourMapper::StencilQuadIndices
unsigned int * StencilQuadIndices
Definition: vtkLabeledContourMapper.h:183
vtkMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkLabeledContourMapper::TextActors
vtkTextActor3D ** TextActors
Definition: vtkLabeledContourMapper.h:175
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:47
vtkLabeledContourMapper::LabelBuildTime
vtkTimeStamp LabelBuildTime
Definition: vtkLabeledContourMapper.h:187
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkSmartPointer< vtkTextPropertyCollection >
vtkLabeledContourMapper::NumberOfUsedTextActors
vtkIdType NumberOfUsedTextActors
Definition: vtkLabeledContourMapper.h:174
vtkTextPropertyCollection
an ordered list of vtkTextProperty objects.
Definition: vtkTextPropertyCollection.h:36
vtkLabeledContourMapper::TextProperties
vtkSmartPointer< vtkTextPropertyCollection > TextProperties
Definition: vtkLabeledContourMapper.h:178
vtkLabeledContourMapper::LabelVisibility
bool LabelVisibility
Definition: vtkLabeledContourMapper.h:172
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkMapper.h
vtkMapper::Render
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
vtkLabeledContourMapper::StencilQuadIndicesSize
vtkIdType StencilQuadIndicesSize
Definition: vtkLabeledContourMapper.h:184
vtkLabeledContourMapper::NumberOfTextActors
vtkIdType NumberOfTextActors
Definition: vtkLabeledContourMapper.h:173
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkLabeledContourMapper
Draw labeled isolines.
Definition: vtkLabeledContourMapper.h:48
vtkSmartPointer.h
vtkNew< vtkPolyDataMapper >
vtkMapper::GetInput
vtkDataSet * GetInput()
Get the input as a vtkDataSet.
vtkMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:114
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkMapper::GetBounds
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkLabeledContourMapper::TextPropertyMapping
vtkSmartPointer< vtkDoubleArray > TextPropertyMapping
Definition: vtkLabeledContourMapper.h:179
vtkNew.h
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkLabeledContourMapper::PolyDataMapper
vtkNew< vtkPolyDataMapper > PolyDataMapper
Definition: vtkLabeledContourMapper.h:177
vtkLabeledContourMapper::SkipDistance
double SkipDistance
Definition: vtkLabeledContourMapper.h:170
vtkLabeledContourMapper::StencilQuads
float * StencilQuads
Definition: vtkLabeledContourMapper.h:181