VTK
dox/Rendering/vtkLabelPlacementMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLabelPlacementMapper.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 -------------------------------------------------------------------------*/
00040 #ifndef __vtkLabelPlacementMapper_h
00041 #define __vtkLabelPlacementMapper_h
00042 
00043 #include "vtkMapper2D.h"
00044 
00045 class vtkCoordinate;
00046 class vtkLabelRenderStrategy;
00047 class vtkSelectVisiblePoints;
00048 
00049 class VTK_RENDERING_EXPORT vtkLabelPlacementMapper : public vtkMapper2D
00050 {
00051 public:
00052   static vtkLabelPlacementMapper *New();
00053   vtkTypeMacro(vtkLabelPlacementMapper, vtkMapper2D);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055 
00057   void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor);
00058 
00060 
00061   virtual void SetRenderStrategy(vtkLabelRenderStrategy* s);
00062   vtkGetObjectMacro(RenderStrategy, vtkLabelRenderStrategy);
00064 
00066 
00068   vtkSetClampMacro(MaximumLabelFraction,double,0.,1.);
00069   vtkGetMacro(MaximumLabelFraction,double);
00071 
00073 
00075   vtkSetMacro(IteratorType,int);
00076   vtkGetMacro(IteratorType,int);
00078 
00080 
00081   vtkSetMacro(UseUnicodeStrings,bool);
00082   vtkGetMacro(UseUnicodeStrings,bool);
00083   vtkBooleanMacro(UseUnicodeStrings,bool);
00085 
00087 
00091   vtkGetMacro(PositionsAsNormals,bool);
00092   vtkSetMacro(PositionsAsNormals,bool);
00093   vtkBooleanMacro(PositionsAsNormals,bool);
00095 
00097 
00099   vtkGetMacro(GeneratePerturbedLabelSpokes,bool);
00100   vtkSetMacro(GeneratePerturbedLabelSpokes,bool);
00101   vtkBooleanMacro(GeneratePerturbedLabelSpokes,bool);
00103 
00105 
00108   vtkGetMacro(UseDepthBuffer,bool);
00109   vtkSetMacro(UseDepthBuffer,bool);
00110   vtkBooleanMacro(UseDepthBuffer,bool);
00112 
00114 
00116   vtkSetMacro(PlaceAllLabels, bool);
00117   vtkGetMacro(PlaceAllLabels, bool);
00118   vtkBooleanMacro(PlaceAllLabels, bool);
00120 
00122 
00123   vtkSetMacro(OutputTraversedBounds, bool);
00124   vtkGetMacro(OutputTraversedBounds, bool);
00125   vtkBooleanMacro(OutputTraversedBounds, bool);
00127 
00128   //BTX
00129   enum LabelShape {
00130     NONE,
00131     RECT,
00132     ROUNDED_RECT,
00133     NUMBER_OF_LABEL_SHAPES
00134   };
00135   //ETX
00136 
00138 
00140   vtkSetClampMacro(Shape, int, 0, NUMBER_OF_LABEL_SHAPES-1);
00141   vtkGetMacro(Shape, int);
00142   virtual void SetShapeToNone()
00143     { this->SetShape(NONE); }
00144   virtual void SetShapeToRect()
00145     { this->SetShape(RECT); }
00146   virtual void SetShapeToRoundedRect()
00147     { this->SetShape(ROUNDED_RECT); }
00149 
00150   //BTX
00151   enum LabelStyle {
00152     FILLED,
00153     OUTLINE,
00154     NUMBER_OF_LABEL_STYLES
00155   };
00156   //ETX
00157 
00159 
00161   vtkSetClampMacro(Style, int, 0, NUMBER_OF_LABEL_STYLES-1);
00162   vtkGetMacro(Style, int);
00163   virtual void SetStyleToFilled()
00164     { this->SetStyle(FILLED); }
00165   virtual void SetStyleToOutline()
00166     { this->SetStyle(OUTLINE); }
00168 
00170 
00171   vtkSetMacro(Margin, double);
00172   vtkGetMacro(Margin, double);
00174 
00176 
00177   vtkSetVector3Macro(BackgroundColor, double);
00178   vtkGetVector3Macro(BackgroundColor, double);
00180 
00182 
00183   vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
00184   vtkGetMacro(BackgroundOpacity, double);
00186 
00188 
00189   vtkGetObjectMacro(AnchorTransform,vtkCoordinate);
00191 
00192 protected:
00193   vtkLabelPlacementMapper();
00194   ~vtkLabelPlacementMapper();
00195 
00196   virtual void SetAnchorTransform( vtkCoordinate* );
00197 
00198   virtual int FillInputPortInformation( int port, vtkInformation* info );
00199 
00200   //BTX
00201   class Internal;
00202   Internal* Buckets;
00203   //ETX
00204 
00205   vtkLabelRenderStrategy* RenderStrategy;
00206   vtkCoordinate* AnchorTransform;
00207   vtkSelectVisiblePoints* VisiblePoints;
00208   double MaximumLabelFraction;
00209   bool PositionsAsNormals;
00210   bool GeneratePerturbedLabelSpokes;
00211   bool UseDepthBuffer;
00212   bool UseUnicodeStrings;
00213   bool PlaceAllLabels;
00214   bool OutputTraversedBounds;
00215 
00216   int LastRendererSize[2];
00217   double LastCameraPosition[3];
00218   double LastCameraFocalPoint[3];
00219   double LastCameraViewUp[3];
00220   double LastCameraParallelScale;
00221   int IteratorType;
00222 
00223   int Style;
00224   int Shape;
00225   double Margin;
00226   double BackgroundOpacity;
00227   double BackgroundColor[3];
00228 
00229 private: 
00230   vtkLabelPlacementMapper(const vtkLabelPlacementMapper&);  // Not implemented.
00231   void operator=(const vtkLabelPlacementMapper&);  // Not implemented.
00232 };
00233 
00234 #endif
00235