VTK
dox/Common/DataModel/vtkRect.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVector.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 
00026 #ifndef __vtkRect_h
00027 #define __vtkRect_h
00028 
00029 #include "vtkVector.h"
00030 
00031 template<typename T>
00032 class vtkRect : public vtkVector<T, 4>
00033 {
00034 public:
00035   vtkRect()
00036   {
00037   }
00038 
00039   vtkRect(const T& x, const T& y, const T& width, const T& height)
00040   {
00041     this->Data[0] = x;
00042     this->Data[1] = y;
00043     this->Data[2] = width;
00044     this->Data[3] = height;
00045   }
00046 
00047   explicit vtkRect(const T* init) : vtkVector<T, 4>(init) { }
00048 
00050 
00051   void Set(const T& x, const T& y, const T& width, const T& height)
00052   {
00053     this->Data[0] = x;
00054     this->Data[1] = y;
00055     this->Data[2] = width;
00056     this->Data[3] = height;
00057   }
00059 
00061   void SetX(const T& x) { this->Data[0] = x; }
00062 
00064   const T& GetX() const { return this->Data[0]; }
00065 
00067   void SetY(const T& y) { this->Data[1] = y; }
00068 
00070   const T& GetY() const { return this->Data[1]; }
00071 
00073   void SetWidth(const T& width) { this->Data[2] = width; }
00074 
00076   const T& GetWidth() const { return this->Data[2]; }
00077 
00079   void SetHeight(const T& height) { this->Data[3] = height; }
00080 
00082   const T& GetHeight() const { return this->Data[3]; }
00083 
00085   VTK_LEGACY(const T& X() const);
00086 
00088   VTK_LEGACY(const T& Y() const);
00089 
00091   VTK_LEGACY(const T& Width() const);
00092 
00094 
00095   VTK_LEGACY(const T& Height() const);
00096 };
00098 
00099 class vtkRecti : public vtkRect<int>
00100 {
00101 public:
00102   vtkRecti() {}
00103   vtkRecti(int x, int y, int width, int height)
00104     : vtkRect<int>(x, y, width, height) {}
00105   explicit vtkRecti(const int *init) : vtkRect<int>(init) {}
00106 };
00107 
00108 class vtkRectf : public vtkRect<float>
00109 {
00110 public:
00111   vtkRectf() {}
00112   vtkRectf(float x, float y, float width, float height)
00113     : vtkRect<float>(x, y, width, height) {}
00114   explicit vtkRectf(const float *init) : vtkRect<float>(init) {}
00115 };
00116 
00117 class vtkRectd : public vtkRect<double>
00118 {
00119 public:
00120   vtkRectd() {}
00121   vtkRectd(double x, double y, double width, double height)
00122     : vtkRect<double>(x, y, width, height) {}
00123   explicit vtkRectd(const double *init) : vtkRect<double>(init) {}
00124 };
00125 
00126 #ifndef VTK_LEGACY_REMOVE
00127 template<typename T>
00128 const T& vtkRect<T>::X() const
00129 {
00130   VTK_LEGACY_REPLACED_BODY(vtkRect::X, "VTK 6.0", vtkRect::GetX);
00131   return this->GetX();
00132 }
00133 
00134 template<typename T>
00135 const T& vtkRect<T>::Y() const
00136 {
00137   VTK_LEGACY_REPLACED_BODY(vtkRect::Y, "VTK 6.0", vtkRect::GetY);
00138   return this->GetY();
00139 }
00140 
00141 template<typename T>
00142 const T& vtkRect<T>::Width() const
00143 {
00144   VTK_LEGACY_REPLACED_BODY(vtkRect::Width, "VTK 6.0", vtkRect::GetWidth);
00145   return this->GetWidth();
00146 }
00147 
00148 template<typename T>
00149 const T& vtkRect<T>::Height() const
00150 {
00151   VTK_LEGACY_REPLACED_BODY(vtkRect::Height, "VTK 6.0", vtkRect::GetHeight);
00152   return this->GetHeight();
00153 }
00154 
00155 #endif // VTK_LEGACY_REMOVE
00156 
00157 
00158 #endif // __vtkRect_h
00159 // VTK-HeaderTest-Exclude: vtkRect.h