VTK
vtkLabelPlacer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLabelPlacer.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
42 #ifndef vtkLabelPlacer_h
43 #define vtkLabelPlacer_h
44 
45 #include "vtkRenderingLabelModule.h" // For export macro
46 #include "vtkPolyDataAlgorithm.h"
47 
48 class vtkRenderer;
49 class vtkCoordinate;
51 
52 class VTKRENDERINGLABEL_EXPORT vtkLabelPlacer : public vtkPolyDataAlgorithm
53 {
54 public:
55  static vtkLabelPlacer* New();
57  void PrintSelf( ostream& os, vtkIndent indent ) override;
58 
59  vtkGetObjectMacro(Renderer,vtkRenderer);
60  virtual void SetRenderer( vtkRenderer* );
61 
62  vtkGetObjectMacro(AnchorTransform,vtkCoordinate);
63 
66  {
67  VerticalBottomBit = 1,
68  VerticalBaselineBit = 2,
69  VerticalCenterBit = 4,
70  VerticalTopBit = 8,
71  HorizontalLeftBit = 16,
72  HorizontalCenterBit = 32,
73  HorizontalRightBit = 64,
74  VerticalBitMask = 15,
75  HorizontalBitMask = 112,
76 
77  LowerLeft=17,
78  LowerCenter=33,
79  LowerRight=65,
80 
81  BaselineLeft=18,
82  BaselineCenter=34,
83  BaselineRight=66,
84 
85  CenterLeft=20,
86  CenterCenter=36,
87  CenterRight=68,
88 
89  UpperLeft=24,
90  UpperCenter=40,
91  UpperRight=72
92  };
93 
96  {
97  WORLD=0,
98  DISPLAY=1
99  };
100 
102 
105  virtual void SetGravity( int gravity );
106  vtkGetMacro(Gravity,int);
108 
110 
114  vtkSetClampMacro(MaximumLabelFraction,double,0.,1.);
115  vtkGetMacro(MaximumLabelFraction,double);
117 
119 
123  vtkSetMacro(IteratorType,int);
124  vtkGetMacro(IteratorType,int);
126 
128 
131  vtkSetMacro(UseUnicodeStrings,bool);
132  vtkGetMacro(UseUnicodeStrings,bool);
133  vtkBooleanMacro(UseUnicodeStrings,bool);
135 
136  vtkMTimeType GetMTime() override;
137 
139 
144  vtkGetMacro(PositionsAsNormals,bool);
145  vtkSetMacro(PositionsAsNormals,bool);
146  vtkBooleanMacro(PositionsAsNormals,bool);
148 
150 
154  vtkGetMacro(GeneratePerturbedLabelSpokes,bool);
155  vtkSetMacro(GeneratePerturbedLabelSpokes,bool);
156  vtkBooleanMacro(GeneratePerturbedLabelSpokes,bool);
158 
160 
164  vtkGetMacro(UseDepthBuffer,bool);
165  vtkSetMacro(UseDepthBuffer,bool);
166  vtkBooleanMacro(UseDepthBuffer,bool);
168 
170 
173  vtkGetMacro(OutputTraversedBounds,bool);
174  vtkSetMacro(OutputTraversedBounds,bool);
175  vtkBooleanMacro(OutputTraversedBounds,bool);
177 
179 
183  vtkGetMacro(OutputCoordinateSystem,int);
184  vtkSetClampMacro(OutputCoordinateSystem,int,WORLD,DISPLAY);
185  void OutputCoordinateSystemWorld() { this->SetOutputCoordinateSystem( vtkLabelPlacer::WORLD ); }
186  void OutputCoordinateSystemDisplay() { this->SetOutputCoordinateSystem( vtkLabelPlacer::DISPLAY ); }
188 
189 protected:
190  vtkLabelPlacer();
191  ~vtkLabelPlacer() override;
192 
193  virtual void SetAnchorTransform( vtkCoordinate* );
194 
195  int FillInputPortInformation( int port, vtkInformation* info ) override;
196  int RequestData( vtkInformation* request,
197  vtkInformationVector** inputVector, vtkInformationVector* outputVector ) override;
198 
199  class Internal;
200  Internal* Buckets;
201 
205  int Gravity;
212 
213  int LastRendererSize[2];
214  double LastCameraPosition[3];
215  double LastCameraFocalPoint[3];
216  double LastCameraViewUp[3];
220 
221 private:
222  vtkLabelPlacer( const vtkLabelPlacer& ) = delete;
223  void operator = ( const vtkLabelPlacer& ) = delete;
224 };
225 
226 #endif // vtkLabelPlacer_h
vtkLabelPlacer::WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabelPlacer.h:97
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkLabelPlacer::OutputCoordinateSystemWorld
void OutputCoordinateSystemWorld()
Definition: vtkLabelPlacer.h:185
vtkLabelPlacer::Renderer
vtkRenderer * Renderer
Definition: vtkLabelPlacer.h:202
vtkLabelPlacer::UseDepthBuffer
bool UseDepthBuffer
Definition: vtkLabelPlacer.h:210
vtkLabelPlacer::Gravity
int Gravity
Definition: vtkLabelPlacer.h:205
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLabelPlacer::LastCameraParallelScale
double LastCameraParallelScale
Definition: vtkLabelPlacer.h:217
vtkLabelPlacer::DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabelPlacer.h:98
vtkPolyDataAlgorithm.h
vtkX3D::port
Definition: vtkX3D.h:447
vtkLabelPlacer::OutputCoordinateSystemDisplay
void OutputCoordinateSystemDisplay()
Definition: vtkLabelPlacer.h:186
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkLabelPlacer::OutputCoordinates
OutputCoordinates
Coordinate systems that output dataset may use.
Definition: vtkLabelPlacer.h:95
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkLabelPlacer::IteratorType
int IteratorType
Definition: vtkLabelPlacer.h:218
vtkLabelPlacer::UseUnicodeStrings
bool UseUnicodeStrings
Definition: vtkLabelPlacer.h:211
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:75
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkLabelPlacer
place a prioritized hierarchy of labels in screen space
Definition: vtkLabelPlacer.h:52
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkLabelPlacer::AnchorTransform
vtkCoordinate * AnchorTransform
Definition: vtkLabelPlacer.h:203
vtkLabelPlacer::Buckets
Internal * Buckets
Definition: vtkLabelPlacer.h:199
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkLabelPlacer::PositionsAsNormals
bool PositionsAsNormals
Definition: vtkLabelPlacer.h:207
vtkLabelPlacer::MaximumLabelFraction
double MaximumLabelFraction
Definition: vtkLabelPlacer.h:206
vtkLabelPlacer::VisiblePoints
vtkSelectVisiblePoints * VisiblePoints
Definition: vtkLabelPlacer.h:204
vtkLabelPlacer::GeneratePerturbedLabelSpokes
bool GeneratePerturbedLabelSpokes
Definition: vtkLabelPlacer.h:209
vtkSelectVisiblePoints
extract points that are visible (based on z-buffer calculation)
Definition: vtkSelectVisiblePoints.h:54
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkLabelPlacer::LabelGravity
LabelGravity
Specifications for the placement of the label relative to an anchor point.
Definition: vtkLabelPlacer.h:65
vtkLabelPlacer::OutputCoordinateSystem
int OutputCoordinateSystem
Definition: vtkLabelPlacer.h:219
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkLabelPlacer::OutputTraversedBounds
bool OutputTraversedBounds
Definition: vtkLabelPlacer.h:208
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41