Common/vtkPoints.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00028 #ifndef __vtkPoints_h
00029 #define __vtkPoints_h
00030
00031 #include "vtkObject.h"
00032
00033 #include "vtkDataArray.h"
00034
00035 class vtkIdList;
00036 class vtkPoints;
00037
00038 class VTK_COMMON_EXPORT vtkPoints : public vtkObject
00039 {
00040 public:
00041
00042 static vtkPoints *New(int dataType);
00043
00044 static vtkPoints *New();
00045
00046 vtkTypeRevisionMacro(vtkPoints,vtkObject);
00047 void PrintSelf(ostream& os, vtkIndent indent);
00048
00050 virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00051
00053 virtual void Initialize();
00054
00056
00062 virtual void SetData(vtkDataArray *);
00063 vtkDataArray *GetData() {return this->Data;};
00065
00068 virtual int GetDataType();
00069
00071
00072 virtual void SetDataType(int dataType);
00073 void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
00074 void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
00075 void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
00076 void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
00077 void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
00078 void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
00079 void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
00080 void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
00081 void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
00082 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
00083 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
00085
00088 void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
00089
00091 virtual void Squeeze() {this->Data->Squeeze();};
00092
00094 virtual void Reset() {this->Data->Reset();};
00095
00097
00100 virtual void DeepCopy(vtkPoints *ad);
00101 virtual void ShallowCopy(vtkPoints *ad);
00103
00110 unsigned long GetActualMemorySize();
00111
00113 vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
00114
00116 double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
00117
00119 void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x);};
00120
00122
00125 void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
00126 void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
00127 void SetPoint(vtkIdType id, double x, double y, double z);
00129
00131
00133 void InsertPoint(vtkIdType id, const float x[3])
00134 { this->Data->InsertTuple(id,x);};
00135 void InsertPoint(vtkIdType id, const double x[3])
00136 {this->Data->InsertTuple(id,x);};
00137 void InsertPoint(vtkIdType id, double x, double y, double z);
00139
00141
00142 vtkIdType InsertNextPoint(const float x[3]) {
00143 return this->Data->InsertNextTuple(x);};
00144 vtkIdType InsertNextPoint(const double x[3]) {
00145 return this->Data->InsertNextTuple(x);};
00146 vtkIdType InsertNextPoint(double x, double y, double z);
00148
00152 void SetNumberOfPoints(vtkIdType number);
00153
00155 void GetPoints(vtkIdList *ptId, vtkPoints *fp);
00156
00158 virtual void ComputeBounds();
00159
00161 double *GetBounds();
00162
00164 void GetBounds(double bounds[6]);
00165
00166 protected:
00167 vtkPoints(int dataType=VTK_FLOAT);
00168 ~vtkPoints();
00169
00170 double Bounds[6];
00171 vtkTimeStamp ComputeTime;
00172 vtkDataArray *Data;
00173
00174 private:
00175 vtkPoints(const vtkPoints&);
00176 void operator=(const vtkPoints&);
00177 };
00178
00179 inline void vtkPoints::SetNumberOfPoints(vtkIdType number)
00180 {
00181 this->Data->SetNumberOfComponents(3);
00182 this->Data->SetNumberOfTuples(number);
00183 }
00184
00185 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
00186 {
00187 double p[3];
00188 p[0] = x;
00189 p[1] = y;
00190 p[2] = z;
00191 this->Data->SetTuple(id,p);
00192 }
00193
00194 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
00195 {
00196 double p[3];
00197
00198 p[0] = x;
00199 p[1] = y;
00200 p[2] = z;
00201 this->Data->InsertTuple(id,p);
00202 }
00203
00204 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
00205 {
00206 double p[3];
00207
00208 p[0] = x;
00209 p[1] = y;
00210 p[2] = z;
00211 return this->Data->InsertNextTuple(p);
00212 }
00213
00214 #endif
00215