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

Rendering/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 =========================================================================*/
00075 #ifndef __vtkAxisActor2D_h
00076 #define __vtkAxisActor2D_h
00077 
00078 #include "vtkActor2D.h"
00079 #include "vtkPolyDataMapper2D.h"
00080 #include "vtkTextMapper.h"
00081 
00082 #define VTK_MAX_LABELS 25
00083 
00084 class VTK_RENDERING_EXPORT vtkAxisActor2D : public vtkActor2D
00085 {
00086 public:
00087   vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
00088   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00091   static vtkAxisActor2D *New();
00092   
00094 
00095   vtkViewportCoordinateMacro(Point1);
00097   
00099 
00102   vtkViewportCoordinateMacro(Point2);
00104   
00106 
00108   vtkSetVector2Macro(Range,float);
00109   vtkGetVectorMacro(Range,float,2);
00111 
00113 
00114   vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
00115   vtkGetMacro(NumberOfLabels, int);
00117   
00119 
00120   vtkSetStringMacro(LabelFormat);
00121   vtkGetStringMacro(LabelFormat);
00123 
00125 
00128   vtkSetMacro(AdjustLabels, int);
00129   vtkGetMacro(AdjustLabels, int);
00130   vtkBooleanMacro(AdjustLabels, int);
00132 
00134 
00135   vtkSetStringMacro(Title);
00136   vtkGetStringMacro(Title);
00138 
00140 
00141   vtkSetMacro(Bold, int);
00142   vtkGetMacro(Bold, int);
00143   vtkBooleanMacro(Bold, int);
00145 
00147 
00148   vtkSetMacro(Italic, int);
00149   vtkGetMacro(Italic, int);
00150   vtkBooleanMacro(Italic, int);
00152 
00154 
00156   vtkSetMacro(Shadow, int);
00157   vtkGetMacro(Shadow, int);
00158   vtkBooleanMacro(Shadow, int);
00160 
00162 
00165   vtkSetMacro(FontFamily, int);
00166   vtkGetMacro(FontFamily, int);
00167   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00168   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00169   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00171 
00173 
00175   vtkSetClampMacro(TickLength, int, 0, 100);
00176   vtkGetMacro(TickLength, int);
00178   
00180 
00183   vtkSetClampMacro(TickOffset, int, 0, 100);
00184   vtkGetMacro(TickOffset, int);
00186   
00188 
00189   vtkSetMacro(AxisVisibility, int);
00190   vtkGetMacro(AxisVisibility, int);
00191   vtkBooleanMacro(AxisVisibility, int);
00193 
00195 
00196   vtkSetMacro(TickVisibility, int);
00197   vtkGetMacro(TickVisibility, int);
00198   vtkBooleanMacro(TickVisibility, int);
00200 
00202 
00203   vtkSetMacro(LabelVisibility, int);
00204   vtkGetMacro(LabelVisibility, int);
00205   vtkBooleanMacro(LabelVisibility, int);
00207 
00209 
00210   vtkSetMacro(TitleVisibility, int);
00211   vtkGetMacro(TitleVisibility, int);
00212   vtkBooleanMacro(TitleVisibility, int);
00214 
00216 
00219   vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
00220   vtkGetMacro(FontFactor, float);
00222 
00224 
00226   vtkSetClampMacro(LabelFactor, float, 0.1, 2.0);
00227   vtkGetMacro(LabelFactor, float);
00229 
00231 
00232   int RenderOverlay(vtkViewport* viewport);
00233   int RenderOpaqueGeometry(vtkViewport* viewport);
00234   int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00236 
00240   void ReleaseGraphicsResources(vtkWindow *);
00241 
00243 
00251   static void ComputeRange(float inRange[2], float outRange[2],
00252                            int inNumTicks, int &outNumTicks, float &interval);
00254 
00256 
00263   static int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper, 
00264                          int *size, float factor, 
00265                          int &stringWidth, int &stringHeight);
00267 
00269   void ShallowCopy(vtkProp *prop);
00270 
00271 protected:
00272   vtkAxisActor2D();
00273   ~vtkAxisActor2D();
00274 
00275   vtkCoordinate *Point1Coordinate;
00276   vtkCoordinate *Point2Coordinate;
00277   char  *Title;
00278   float Range[2];
00279   int   NumberOfLabels;
00280   char  *LabelFormat;
00281   int   NumberOfLabelsBuilt;
00282   int   AdjustLabels;
00283   float FontFactor;
00284   float LabelFactor;
00285   int   TickLength;
00286   int   TickOffset;
00287 
00288   int   Bold;
00289   int   Italic;
00290   int   Shadow;
00291   int   FontFamily;
00292   
00293   int   AxisVisibility;
00294   int   TickVisibility;
00295   int   LabelVisibility;
00296   int   TitleVisibility;
00297   
00298   int   LastPoint1[2];
00299   int   LastPoint2[2];
00300   
00301   int   LastSize[2];
00302   int   LastTitleFontSize;
00303   int   LastLabelFontSize;
00304   
00305   virtual void BuildAxis(vtkViewport *viewport);
00306   static float ComputeStringOffset(float width, float height, float theta);
00307   static void SetOffsetPosition(float xTick[3], float theta, int stringHeight,
00308                                 int stringWidth, int offset, vtkActor2D *actor);
00309 
00310   vtkTextMapper *TitleMapper;
00311   vtkActor2D    *TitleActor;
00312 
00313   vtkTextMapper **LabelMappers;
00314   vtkActor2D    **LabelActors;
00315 
00316   vtkPolyData         *Axis;
00317   vtkPolyDataMapper2D *AxisMapper;
00318   vtkActor2D          *AxisActor;
00319 
00320   vtkTimeStamp  BuildTime;
00321 private:
00322   vtkAxisActor2D(const vtkAxisActor2D&);  // Not implemented.
00323   void operator=(const vtkAxisActor2D&);  // Not implemented.
00324 };
00325 
00326 
00327 #endif

Generated on Thu Mar 28 14:19:31 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001