VTK
dox/Rendering/Label/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 "vtkRenderingLabelModule.h" // For export macro
00044 #include "vtkMapper2D.h"
00045 
00046 class vtkCoordinate;
00047 class vtkLabelRenderStrategy;
00048 class vtkSelectVisiblePoints;
00049 
00050 class VTKRENDERINGLABEL_EXPORT vtkLabelPlacementMapper : public vtkMapper2D
00051 {
00052 public:
00053   static vtkLabelPlacementMapper *New();
00054   vtkTypeMacro(vtkLabelPlacementMapper, vtkMapper2D);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056 
00058   void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor);
00059 
00061 
00062   virtual void SetRenderStrategy(vtkLabelRenderStrategy* s);
00063   vtkGetObjectMacro(RenderStrategy, vtkLabelRenderStrategy);
00065 
00067 
00069   vtkSetClampMacro(MaximumLabelFraction,double,0.,1.);
00070   vtkGetMacro(MaximumLabelFraction,double);
00072 
00074 
00076   vtkSetMacro(IteratorType,int);
00077   vtkGetMacro(IteratorType,int);
00079 
00081 
00082   vtkSetMacro(UseUnicodeStrings,bool);
00083   vtkGetMacro(UseUnicodeStrings,bool);
00084   vtkBooleanMacro(UseUnicodeStrings,bool);
00086 
00088 
00092   vtkGetMacro(PositionsAsNormals,bool);
00093   vtkSetMacro(PositionsAsNormals,bool);
00094   vtkBooleanMacro(PositionsAsNormals,bool);
00096 
00098 
00100   vtkGetMacro(GeneratePerturbedLabelSpokes,bool);
00101   vtkSetMacro(GeneratePerturbedLabelSpokes,bool);
00102   vtkBooleanMacro(GeneratePerturbedLabelSpokes,bool);
00104 
00106 
00109   vtkGetMacro(UseDepthBuffer,bool);
00110   vtkSetMacro(UseDepthBuffer,bool);
00111   vtkBooleanMacro(UseDepthBuffer,bool);
00113 
00115 
00117   vtkSetMacro(PlaceAllLabels, bool);
00118   vtkGetMacro(PlaceAllLabels, bool);
00119   vtkBooleanMacro(PlaceAllLabels, bool);
00121 
00123 
00124   vtkSetMacro(OutputTraversedBounds, bool);
00125   vtkGetMacro(OutputTraversedBounds, bool);
00126   vtkBooleanMacro(OutputTraversedBounds, bool);
00128 
00129   //BTX
00130   enum LabelShape {
00131     NONE,
00132     RECT,
00133     ROUNDED_RECT,
00134     NUMBER_OF_LABEL_SHAPES
00135   };
00136   //ETX
00137 
00139 
00141   vtkSetClampMacro(Shape, int, 0, NUMBER_OF_LABEL_SHAPES-1);
00142   vtkGetMacro(Shape, int);
00143   virtual void SetShapeToNone()
00144     { this->SetShape(NONE); }
00145   virtual void SetShapeToRect()
00146     { this->SetShape(RECT); }
00147   virtual void SetShapeToRoundedRect()
00148     { this->SetShape(ROUNDED_RECT); }
00150 
00151   //BTX
00152   enum LabelStyle {
00153     FILLED,
00154     OUTLINE,
00155     NUMBER_OF_LABEL_STYLES
00156   };
00157   //ETX
00158 
00160 
00162   vtkSetClampMacro(Style, int, 0, NUMBER_OF_LABEL_STYLES-1);
00163   vtkGetMacro(Style, int);
00164   virtual void SetStyleToFilled()
00165     { this->SetStyle(FILLED); }
00166   virtual void SetStyleToOutline()
00167     { this->SetStyle(OUTLINE); }
00169 
00171 
00172   vtkSetMacro(Margin, double);
00173   vtkGetMacro(Margin, double);
00175 
00177 
00178   vtkSetVector3Macro(BackgroundColor, double);
00179   vtkGetVector3Macro(BackgroundColor, double);
00181 
00183 
00184   vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
00185   vtkGetMacro(BackgroundOpacity, double);
00187 
00189 
00190   vtkGetObjectMacro(AnchorTransform,vtkCoordinate);
00192 
00193 protected:
00194   vtkLabelPlacementMapper();
00195   ~vtkLabelPlacementMapper();
00196 
00197   virtual void SetAnchorTransform( vtkCoordinate* );
00198 
00199   virtual int FillInputPortInformation( int port, vtkInformation* info );
00200 
00201   //BTX
00202   class Internal;
00203   Internal* Buckets;
00204   //ETX
00205 
00206   vtkLabelRenderStrategy* RenderStrategy;
00207   vtkCoordinate* AnchorTransform;
00208   vtkSelectVisiblePoints* VisiblePoints;
00209   double MaximumLabelFraction;
00210   bool PositionsAsNormals;
00211   bool GeneratePerturbedLabelSpokes;
00212   bool UseDepthBuffer;
00213   bool UseUnicodeStrings;
00214   bool PlaceAllLabels;
00215   bool OutputTraversedBounds;
00216 
00217   int LastRendererSize[2];
00218   double LastCameraPosition[3];
00219   double LastCameraFocalPoint[3];
00220   double LastCameraViewUp[3];
00221   double LastCameraParallelScale;
00222   int IteratorType;
00223 
00224   int Style;
00225   int Shape;
00226   double Margin;
00227   double BackgroundOpacity;
00228   double BackgroundColor[3];
00229 
00230 private:
00231   vtkLabelPlacementMapper(const vtkLabelPlacementMapper&);  // Not implemented.
00232   void operator=(const vtkLabelPlacementMapper&);  // Not implemented.
00233 };
00234 
00235 #endif
00236