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

# Common/vtkPoints.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkPoints.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00044 #ifndef __vtkPoints_h
    00045 #define __vtkPoints_h
    00046
    00047 #include "vtkObject.h"
    00048
    00049 #include "vtkDataArray.h" // Needed for inline methods
    00050
    00051 class vtkIdList;
    00052 class vtkPoints;
    00053
    00054 class VTK_COMMON_EXPORT vtkPoints : public vtkObject
    00055 {
    00056 public:
    00057 //BTX
    00058   static vtkPoints *New(int dataType);
    00059 //ETX
    00060   static vtkPoints *New();
    00061
    00062   vtkTypeRevisionMacro(vtkPoints,vtkObject);
    00063   void PrintSelf(ostream& os, vtkIndent indent);
    00064
    00066   virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
    00067
    00069   virtual void Initialize();
    00070
    00071 #ifndef VTK_REMOVE_LEGACY_CODE
    00072
    00073   vtkPoints* MakeObject();
    00074 #endif
    00075
    00077
    00083   virtual void SetData(vtkDataArray *);
    00084   vtkDataArray *GetData() {return this->Data;};
    00086
    00089   virtual int GetDataType();
    00090
    00092
    00093   virtual void SetDataType(int dataType);
    00094   void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
    00095   void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
    00096   void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
    00097   void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
    00098   void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
    00099   void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
    00100   void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
    00101   void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
    00102   void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
    00103   void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
    00104   void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
    00106
    00109   void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
    00110
    00112   virtual void Squeeze() {this->Data->Squeeze();};
    00113
    00115   virtual void Reset() {this->Data->Reset();};
    00116
    00118
    00121   virtual void DeepCopy(vtkPoints *ad);
    00122   virtual void ShallowCopy(vtkPoints *ad);
    00124
    00131   unsigned long GetActualMemorySize();
    00132
    00134   vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
    00135
    00137   float *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
    00138
    00140
    00141   void GetPoint(vtkIdType id, float x[3]) { this->Data->GetTuple(id,x);};
    00142   void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x);};
    00144
    00146
    00149   void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
    00150   void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
    00151   void SetPoint(vtkIdType id, double x, double y, double z);
    00153
    00155
    00157   void InsertPoint(vtkIdType id, const float x[3])
    00158     { this->Data->InsertTuple(id,x);};
    00159   void InsertPoint(vtkIdType id, const double x[3])
    00160     {this->Data->InsertTuple(id,x);};
    00161   void InsertPoint(vtkIdType id, double x, double y, double z);
    00163
    00165
    00166   vtkIdType InsertNextPoint(const float x[3]) {
    00167     return this->Data->InsertNextTuple(x);};
    00168   vtkIdType InsertNextPoint(const double x[3]) {
    00169     return this->Data->InsertNextTuple(x);};
    00170   vtkIdType InsertNextPoint(double x, double y, double z);
    00172
    00176   void SetNumberOfPoints(vtkIdType number);
    00177
    00179   void GetPoints(vtkIdList *ptId, vtkPoints *fp);
    00180
    00182   virtual void ComputeBounds();
    00183
    00185   float *GetBounds();
    00186
    00188   void GetBounds(float bounds[6]);
    00189
    00190 protected:
    00191   vtkPoints(int dataType=VTK_FLOAT);
    00192   ~vtkPoints();
    00193
    00194   float Bounds[6];
    00195   vtkTimeStamp ComputeTime; // Time at which bounds computed
    00196   vtkDataArray *Data;  // Array which represents data
    00197
    00198 private:
    00199   vtkPoints(const vtkPoints&);  // Not implemented.
    00200   void operator=(const vtkPoints&);  // Not implemented.
    00201 };
    00202
    00203 inline void vtkPoints::SetNumberOfPoints(vtkIdType number)
    00204 {
    00205   this->Data->SetNumberOfComponents(3);
    00206   this->Data->SetNumberOfTuples(number);
    00207 }
    00208
    00209 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
    00210 {
    00211   double p[3];
    00212   p[0] = x;
    00213   p[1] = y;
    00214   p[2] = z;
    00215   this->Data->SetTuple(id,p);
    00216 }
    00217
    00218 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
    00219 {
    00220   double p[3];
    00221
    00222   p[0] = x;
    00223   p[1] = y;
    00224   p[2] = z;
    00225   this->Data->InsertTuple(id,p);
    00226 }
    00227
    00228 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
    00229 {
    00230   double p[3];
    00231
    00232   p[0] = x;
    00233   p[1] = y;
    00234   p[2] = z;
    00235   return this->Data->InsertNextTuple(p);
    00236 }
    00237
    00238 #endif
    00239