vtkPoints.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00032 #ifndef __vtkPoints_h
00033 #define __vtkPoints_h
00034
00035 #include "vtkObject.h"
00036
00037 #include "vtkDataArray.h"
00038
00039 class vtkIdList;
00040 class vtkPoints;
00041
00042 class VTK_COMMON_EXPORT vtkPoints : public vtkObject
00043 {
00044 public:
00045
00046 static vtkPoints *New(int dataType);
00047
00048 static vtkPoints *New();
00049
00050 vtkTypeRevisionMacro(vtkPoints,vtkObject);
00051 void PrintSelf(ostream& os, vtkIndent indent);
00052
00054 virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00055
00057 virtual void Initialize();
00058
00059 #ifndef VTK_REMOVE_LEGACY_CODE
00060
00061 vtkPoints* MakeObject();
00062 #endif
00063
00065
00071 virtual void SetData(vtkDataArray *);
00072 vtkDataArray *GetData() {return this->Data;};
00074
00077 virtual int GetDataType();
00078
00080
00081 virtual void SetDataType(int dataType);
00082 void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
00083 void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
00084 void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
00085 void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
00086 void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
00087 void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
00088 void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
00089 void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
00090 void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
00091 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
00092 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
00094
00097 void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
00098
00100 virtual void Squeeze() {this->Data->Squeeze();};
00101
00103 virtual void Reset() {this->Data->Reset();};
00104
00106
00109 virtual void DeepCopy(vtkPoints *ad);
00110 virtual void ShallowCopy(vtkPoints *ad);
00112
00119 unsigned long GetActualMemorySize();
00120
00122 vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
00123
00125 float *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
00126
00128
00129 void GetPoint(vtkIdType id, float x[3]) { this->Data->GetTuple(id,x);};
00130 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 float *GetBounds();
00174
00176 void GetBounds(float bounds[6]);
00177
00178 protected:
00179 vtkPoints(int dataType=VTK_FLOAT);
00180 ~vtkPoints();
00181
00182 float 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