VTK
dox/Rendering/vtkLabelPlacer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLabelPlacer.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00044 #ifndef __vtkLabelPlacer_h
00045 #define __vtkLabelPlacer_h
00046 
00047 #include "vtkPolyDataAlgorithm.h"
00048 
00049 class vtkRenderer;
00050 class vtkCoordinate;
00051 class vtkSelectVisiblePoints;
00052 
00053 class VTK_RENDERING_EXPORT vtkLabelPlacer : public vtkPolyDataAlgorithm
00054 {
00055 public:
00056   static vtkLabelPlacer* New();
00057   vtkTypeMacro(vtkLabelPlacer,vtkPolyDataAlgorithm);
00058   virtual void PrintSelf( ostream& os, vtkIndent indent );
00059 
00060   vtkGetObjectMacro(Renderer,vtkRenderer);
00061   virtual void SetRenderer( vtkRenderer* );
00062 
00063   vtkGetObjectMacro(AnchorTransform,vtkCoordinate);
00064 
00065   //BTX
00067   enum LabelGravity
00068     {
00069     VerticalBottomBit   = 1,
00070     VerticalBaselineBit = 2,
00071     VerticalCenterBit   = 4,
00072     VerticalTopBit      = 8,
00073     HorizontalLeftBit   = 16,
00074     HorizontalCenterBit = 32,
00075     HorizontalRightBit  = 64,
00076     VerticalBitMask     = 15,
00077     HorizontalBitMask   = 112,
00078 
00079     LowerLeft=17,      
00080     LowerCenter=33,    
00081     LowerRight=65,     
00082 
00083     BaselineLeft=18,   
00084     BaselineCenter=34, 
00085     BaselineRight=66,  
00086 
00087     CenterLeft=20,     
00088     CenterCenter=36,   
00089     CenterRight=68,    
00090 
00091     UpperLeft=24,      
00092     UpperCenter=40,    
00093     UpperRight=72      
00094     };
00095 
00097   enum OutputCoordinates
00098     {
00099     WORLD=0,           
00100     DISPLAY=1          
00101     };
00102   //ETX
00103 
00105 
00106   virtual void SetGravity( int gravity );
00107   vtkGetMacro(Gravity,int);
00109 
00111 
00113   vtkSetClampMacro(MaximumLabelFraction,double,0.,1.);
00114   vtkGetMacro(MaximumLabelFraction,double);
00116 
00118 
00120   vtkSetMacro(IteratorType,int);
00121   vtkGetMacro(IteratorType,int);
00123 
00125 
00126   vtkSetMacro(UseUnicodeStrings,bool);
00127   vtkGetMacro(UseUnicodeStrings,bool);
00128   vtkBooleanMacro(UseUnicodeStrings,bool);
00130 
00131   virtual unsigned long GetMTime();
00132 
00134 
00138   vtkGetMacro(PositionsAsNormals,bool);
00139   vtkSetMacro(PositionsAsNormals,bool);
00140   vtkBooleanMacro(PositionsAsNormals,bool);
00142 
00144 
00146   vtkGetMacro(GeneratePerturbedLabelSpokes,bool);
00147   vtkSetMacro(GeneratePerturbedLabelSpokes,bool);
00148   vtkBooleanMacro(GeneratePerturbedLabelSpokes,bool);
00150 
00152 
00155   vtkGetMacro(UseDepthBuffer,bool);
00156   vtkSetMacro(UseDepthBuffer,bool);
00157   vtkBooleanMacro(UseDepthBuffer,bool);
00159 
00161 
00163   vtkGetMacro(OutputTraversedBounds,bool);
00164   vtkSetMacro(OutputTraversedBounds,bool);
00165   vtkBooleanMacro(OutputTraversedBounds,bool);
00167 
00169 
00172   vtkGetMacro(OutputCoordinateSystem,int);
00173   vtkSetClampMacro(OutputCoordinateSystem,int,WORLD,DISPLAY);
00174   void OutputCoordinateSystemWorld() { this->SetOutputCoordinateSystem( vtkLabelPlacer::WORLD ); }
00175   void OutputCoordinateSystemDisplay() { this->SetOutputCoordinateSystem( vtkLabelPlacer::DISPLAY ); }
00177 
00178 protected:
00179   vtkLabelPlacer();
00180   virtual ~vtkLabelPlacer();
00181 
00182   virtual void SetAnchorTransform( vtkCoordinate* );
00183 
00184   int FillInputPortInformation( int port, vtkInformation* info );
00185   virtual int RequestData( vtkInformation* request,
00186     vtkInformationVector** inputVector, vtkInformationVector* outputVector );
00187 
00188   //BTX
00189   class Internal;
00190   Internal* Buckets;
00191   //ETX
00192 
00193   vtkRenderer* Renderer;
00194   vtkCoordinate* AnchorTransform;
00195   vtkSelectVisiblePoints* VisiblePoints;
00196   int Gravity;
00197   double MaximumLabelFraction;
00198   bool PositionsAsNormals;
00199   bool OutputTraversedBounds;
00200   bool GeneratePerturbedLabelSpokes;
00201   bool UseDepthBuffer;
00202   bool UseUnicodeStrings;
00203 
00204   int LastRendererSize[2];
00205   double LastCameraPosition[3];
00206   double LastCameraFocalPoint[3];
00207   double LastCameraViewUp[3];
00208   double LastCameraParallelScale;
00209   int IteratorType;
00210   int OutputCoordinateSystem;
00211   
00212 private:
00213   vtkLabelPlacer( const vtkLabelPlacer& ); // Not implemented.
00214   void operator = ( const vtkLabelPlacer& ); // Not implemented.
00215 };
00216 
00217 #endif // __vtkLabelPlacer_h