vtkPoints.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00040 #ifndef __vtkPoints_h
00041 #define __vtkPoints_h
00042
00043 #include "vtkObject.h"
00044
00045 #include "vtkDataArray.h"
00046
00047 class vtkIdList;
00048 class vtkPoints;
00049
00050 class VTK_COMMON_EXPORT vtkPoints : public vtkObject
00051 {
00052 public:
00053
00054 static vtkPoints *New(int dataType);
00055
00056 static vtkPoints *New();
00057
00058 vtkTypeRevisionMacro(vtkPoints,vtkObject);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062 virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00063
00065 virtual void Initialize();
00066
00068
00074 virtual void SetData(vtkDataArray *);
00075 vtkDataArray *GetData() {return this->Data;};
00077
00080 virtual int GetDataType();
00081
00083
00084 virtual void SetDataType(int dataType);
00085 void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
00086 void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
00087 void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
00088 void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
00089 void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
00090 void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
00091 void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
00092 void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
00093 void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
00094 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
00095 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
00097
00100 void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
00101
00103 virtual void Squeeze() {this->Data->Squeeze();};
00104
00106 virtual void Reset() {this->Data->Reset();};
00107
00109
00112 virtual void DeepCopy(vtkPoints *ad);
00113 virtual void ShallowCopy(vtkPoints *ad);
00115
00122 unsigned long GetActualMemorySize();
00123
00125 vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
00126
00128 double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
00129
00131 void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x);};
00132
00134
00137 void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
00138 void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
00139 void SetPoint(vtkIdType id, double x, double y, double z);
00141
00143
00145 void InsertPoint(vtkIdType id, const float x[3])
00146 { this->Data->InsertTuple(id,x);};
00147 void InsertPoint(vtkIdType id, const double x[3])
00148 {this->Data->InsertTuple(id,x);};
00149 void InsertPoint(vtkIdType id, double x, double y, double z);
00151
00153
00154 vtkIdType InsertNextPoint(const float x[3]) {
00155 return this->Data->InsertNextTuple(x);};
00156 vtkIdType InsertNextPoint(const double x[3]) {
00157 return this->Data->InsertNextTuple(x);};
00158 vtkIdType InsertNextPoint(double x, double y, double z);
00160
00164 void SetNumberOfPoints(vtkIdType number);
00165
00167 void GetPoints(vtkIdList *ptId, vtkPoints *fp);
00168
00170 virtual void ComputeBounds();
00171
00173 double *GetBounds();
00174
00176 void GetBounds(double bounds[6]);
00177
00178 protected:
00179 vtkPoints(int dataType=VTK_FLOAT);
00180 ~vtkPoints();
00181
00182 double Bounds[6];
00183 vtkTimeStamp ComputeTime;
00184 vtkDataArray *Data;
00185
00186 private:
00187 vtkPoints(const vtkPoints&);
00188 void operator=(const vtkPoints&);
00189 };
00190
00191 inline void vtkPoints::SetNumberOfPoints(vtkIdType number)
00192 {
00193 this->Data->SetNumberOfComponents(3);
00194 this->Data->SetNumberOfTuples(number);
00195 }
00196
00197 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
00198 {
00199 double p[3];
00200 p[0] = x;
00201 p[1] = y;
00202 p[2] = z;
00203 this->Data->SetTuple(id,p);
00204 }
00205
00206 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
00207 {
00208 double p[3];
00209
00210 p[0] = x;
00211 p[1] = y;
00212 p[2] = z;
00213 this->Data->InsertTuple(id,p);
00214 }
00215
00216 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
00217 {
00218 double p[3];
00219
00220 p[0] = x;
00221 p[1] = y;
00222 p[2] = z;
00223 return this->Data->InsertNextTuple(p);
00224 }
00225
00226 #endif
00227