Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

imaging/vtkAxisActor2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAxisActor2D.h,v $
00005   Language:  C++
00006 
00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00077 #ifndef __vtkAxisActor2D_h
00078 #define __vtkAxisActor2D_h
00079 
00080 #include "vtkActor2D.h"
00081 #include "vtkPolyDataMapper2D.h"
00082 #include "vtkTextMapper.h"
00083 
00084 #define VTK_MAX_LABELS 25
00085 
00086 class VTK_EXPORT vtkAxisActor2D : public vtkActor2D
00087 {
00088 public:
00089   vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
00090   void PrintSelf(ostream& os, vtkIndent indent);
00091 
00093   static vtkAxisActor2D *New();
00094   
00096   vtkViewportCoordinateMacro(Point1);
00097   
00101   vtkViewportCoordinateMacro(Point2);
00102   
00105   vtkSetVector2Macro(Range,float);
00106   vtkGetVectorMacro(Range,float,2);
00107 
00109   vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
00110   vtkGetMacro(NumberOfLabels, int);
00111   
00113   vtkSetStringMacro(LabelFormat);
00114   vtkGetStringMacro(LabelFormat);
00115 
00119   vtkSetMacro(AdjustLabels, int);
00120   vtkGetMacro(AdjustLabels, int);
00121   vtkBooleanMacro(AdjustLabels, int);
00122 
00124   vtkSetStringMacro(Title);
00125   vtkGetStringMacro(Title);
00126 
00128   vtkSetMacro(Bold, int);
00129   vtkGetMacro(Bold, int);
00130   vtkBooleanMacro(Bold, int);
00131 
00133   vtkSetMacro(Italic, int);
00134   vtkGetMacro(Italic, int);
00135   vtkBooleanMacro(Italic, int);
00136 
00139   vtkSetMacro(Shadow, int);
00140   vtkGetMacro(Shadow, int);
00141   vtkBooleanMacro(Shadow, int);
00142 
00146   vtkSetMacro(FontFamily, int);
00147   vtkGetMacro(FontFamily, int);
00148   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00149   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00150   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00151 
00154   vtkSetClampMacro(TickLength, int, 0, 100);
00155   vtkGetMacro(TickLength, int);
00156   
00160   vtkSetClampMacro(TickOffset, int, 0, 100);
00161   vtkGetMacro(TickOffset, int);
00162   
00164   vtkSetMacro(AxisVisibility, int);
00165   vtkGetMacro(AxisVisibility, int);
00166   vtkBooleanMacro(AxisVisibility, int);
00167 
00169   vtkSetMacro(TickVisibility, int);
00170   vtkGetMacro(TickVisibility, int);
00171   vtkBooleanMacro(TickVisibility, int);
00172 
00174   vtkSetMacro(LabelVisibility, int);
00175   vtkGetMacro(LabelVisibility, int);
00176   vtkBooleanMacro(LabelVisibility, int);
00177 
00179   vtkSetMacro(TitleVisibility, int);
00180   vtkGetMacro(TitleVisibility, int);
00181   vtkBooleanMacro(TitleVisibility, int);
00182 
00186   vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
00187   vtkGetMacro(FontFactor, float);
00188 
00191   vtkSetClampMacro(LabelFactor, float, 0.1, 2.0);
00192   vtkGetMacro(LabelFactor, float);
00193 
00195   int RenderOverlay(vtkViewport* viewport);
00196   int RenderOpaqueGeometry(vtkViewport* viewport);
00197   int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00198 
00202   void ReleaseGraphicsResources(vtkWindow *);
00203 
00212   static void ComputeRange(float inRange[2], float outRange[2],
00213                            int inNumTicks, int &outNumTicks, float &interval);
00214 
00222   static int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper, 
00223           int *size, float factor, 
00224           int &stringWidth, int &stringHeight);
00225 
00227   void ShallowCopy(vtkProp *prop);
00228 
00229 protected:
00230   vtkAxisActor2D();
00231   ~vtkAxisActor2D();
00232   vtkAxisActor2D(const vtkAxisActor2D&) {};
00233   void operator=(const vtkAxisActor2D&) {};
00234 
00235   vtkCoordinate *Point1Coordinate;
00236   vtkCoordinate *Point2Coordinate;
00237   char  *Title;
00238   float Range[2];
00239   int   NumberOfLabels;
00240   char  *LabelFormat;
00241   int   NumberOfLabelsBuilt;
00242   int   AdjustLabels;
00243   float FontFactor;
00244   float LabelFactor;
00245   int   TickLength;
00246   int   TickOffset;
00247 
00248   int   Bold;
00249   int   Italic;
00250   int   Shadow;
00251   int   FontFamily;
00252   
00253   int   AxisVisibility;
00254   int   TickVisibility;
00255   int   LabelVisibility;
00256   int   TitleVisibility;
00257   
00258   int   LastPoint1[2];
00259   int   LastPoint2[2];
00260   
00261   int   LastSize[2];
00262   int   LastTitleFontSize;
00263   int   LastLabelFontSize;
00264   
00265 private:
00266   void BuildAxis(vtkViewport *viewport);
00267   static float ComputeStringOffset(float width, float height, float theta);
00268   static void SetOffsetPosition(float xTick[3], float theta, int stringHeight, 
00269                                 int stringWidth, int offset, vtkActor2D *actor);
00270 
00271   vtkTextMapper *TitleMapper;
00272   vtkActor2D    *TitleActor;
00273 
00274   vtkTextMapper **LabelMappers;
00275   vtkActor2D    **LabelActors;
00276 
00277   vtkPolyData         *Axis;
00278   vtkPolyDataMapper2D *AxisMapper;
00279   vtkActor2D          *AxisActor;
00280 
00281   vtkTimeStamp  BuildTime;
00282 };
00283 
00284 
00285 #endif

Generated on Wed Nov 21 12:27:05 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001