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 "vtkPolyDataAlgorithm.h"
46 #include "vtkRenderingLabelModule.h" // For export macro
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 =
79  33,
80  LowerRight = 65,
81 
82  BaselineLeft = 18,
83  BaselineCenter = 34,
85  BaselineRight = 66,
87 
89  CenterLeft = 20,
90  CenterCenter =
92  36,
93  CenterRight = 68,
94 
96  UpperLeft = 24,
97  UpperCenter = 40,
98  UpperRight = 72
99  };
100 
103  {
104  WORLD = 0,
105  DISPLAY = 1
106  };
108 
110 
113  virtual void SetGravity(int gravity);
114  vtkGetMacro(Gravity, int);
116 
118 
122  vtkSetClampMacro(MaximumLabelFraction, double, 0., 1.);
123  vtkGetMacro(MaximumLabelFraction, double);
125 
127 
131  vtkSetMacro(IteratorType, int);
132  vtkGetMacro(IteratorType, int);
134 
136 
139  vtkSetMacro(UseUnicodeStrings, bool);
140  vtkGetMacro(UseUnicodeStrings, bool);
141  vtkBooleanMacro(UseUnicodeStrings, bool);
143 
144  vtkMTimeType GetMTime() override;
145 
147 
152  vtkGetMacro(PositionsAsNormals, bool);
153  vtkSetMacro(PositionsAsNormals, bool);
154  vtkBooleanMacro(PositionsAsNormals, bool);
156 
158 
162  vtkGetMacro(GeneratePerturbedLabelSpokes, bool);
163  vtkSetMacro(GeneratePerturbedLabelSpokes, bool);
164  vtkBooleanMacro(GeneratePerturbedLabelSpokes, bool);
166 
168 
172  vtkGetMacro(UseDepthBuffer, bool);
173  vtkSetMacro(UseDepthBuffer, bool);
174  vtkBooleanMacro(UseDepthBuffer, bool);
176 
178 
181  vtkGetMacro(OutputTraversedBounds, bool);
182  vtkSetMacro(OutputTraversedBounds, bool);
183  vtkBooleanMacro(OutputTraversedBounds, bool);
185 
187 
191  vtkGetMacro(OutputCoordinateSystem, int);
192  vtkSetClampMacro(OutputCoordinateSystem, int, WORLD, DISPLAY);
193  void OutputCoordinateSystemWorld() { this->SetOutputCoordinateSystem(vtkLabelPlacer::WORLD); }
194  void OutputCoordinateSystemDisplay() { this->SetOutputCoordinateSystem(vtkLabelPlacer::DISPLAY); }
196 
197 protected:
198  vtkLabelPlacer();
199  ~vtkLabelPlacer() override;
200 
201  virtual void SetAnchorTransform(vtkCoordinate*);
202 
203  int FillInputPortInformation(int port, vtkInformation* info) override;
204  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
205  vtkInformationVector* outputVector) override;
206 
207  class Internal;
208  Internal* Buckets;
209 
213  int Gravity;
220 
221  int LastRendererSize[2];
222  double LastCameraPosition[3];
223  double LastCameraFocalPoint[3];
224  double LastCameraViewUp[3];
228 
229 private:
230  vtkLabelPlacer(const vtkLabelPlacer&) = delete;
231  void operator=(const vtkLabelPlacer&) = delete;
232 };
233 
234 #endif // vtkLabelPlacer_h
vtkLabelPlacer::WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabelPlacer.h:104
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkLabelPlacer::OutputCoordinateSystemWorld
void OutputCoordinateSystemWorld()
Definition: vtkLabelPlacer.h:193
vtkLabelPlacer::Renderer
vtkRenderer * Renderer
Definition: vtkLabelPlacer.h:210
vtkLabelPlacer::UseDepthBuffer
bool UseDepthBuffer
Definition: vtkLabelPlacer.h:218
vtkLabelPlacer::Gravity
int Gravity
Definition: vtkLabelPlacer.h:213
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:225
vtkLabelPlacer::DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabelPlacer.h:105
vtkPolyDataAlgorithm.h
vtkX3D::port
Definition: vtkX3D.h:453
vtkLabelPlacer::OutputCoordinateSystemDisplay
void OutputCoordinateSystemDisplay()
Definition: vtkLabelPlacer.h:194
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:102
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkLabelPlacer::IteratorType
int IteratorType
Definition: vtkLabelPlacer.h:226
vtkLabelPlacer::UseUnicodeStrings
bool UseUnicodeStrings
Definition: vtkLabelPlacer.h:219
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:76
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:64
vtkX3D::info
Definition: vtkX3D.h:382
vtkLabelPlacer::AnchorTransform
vtkCoordinate * AnchorTransform
Definition: vtkLabelPlacer.h:211
vtkLabelPlacer::Buckets
Internal * Buckets
Definition: vtkLabelPlacer.h:207
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:58
vtkLabelPlacer::PositionsAsNormals
bool PositionsAsNormals
Definition: vtkLabelPlacer.h:215
vtkLabelPlacer::MaximumLabelFraction
double MaximumLabelFraction
Definition: vtkLabelPlacer.h:214
vtkLabelPlacer::VisiblePoints
vtkSelectVisiblePoints * VisiblePoints
Definition: vtkLabelPlacer.h:212
vtkLabelPlacer::GeneratePerturbedLabelSpokes
bool GeneratePerturbedLabelSpokes
Definition: vtkLabelPlacer.h:217
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:227
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:298
vtkLabelPlacer::OutputTraversedBounds
bool OutputTraversedBounds
Definition: vtkLabelPlacer.h:216
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41