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