00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkPoints2D_h
00026 #define __vtkPoints2D_h
00027
00028 #include "vtkObject.h"
00029
00030 #include "vtkDataArray.h"
00031
00032 class vtkIdList;
00033
00034 class VTK_COMMON_EXPORT vtkPoints2D : public vtkObject
00035 {
00036 public:
00037
00038 static vtkPoints2D *New(int dataType);
00039
00040 static vtkPoints2D *New();
00041
00042 vtkTypeMacro(vtkPoints2D, vtkObject);
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00046 virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00047
00049 virtual void Initialize();
00050
00052
00058 virtual void SetData(vtkDataArray *);
00059 vtkDataArray *GetData() {return this->Data;}
00061
00064 virtual int GetDataType();
00065
00067
00068 virtual void SetDataType(int dataType);
00069 void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
00070 void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
00071 void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
00072 void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
00073 void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
00074 void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
00075 void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
00076 void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
00077 void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
00078 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
00079 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
00081
00084 void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
00085
00087 virtual void Squeeze() {this->Data->Squeeze();};
00088
00090 virtual void Reset() {this->Data->Reset();};
00091
00093
00096 virtual void DeepCopy(vtkPoints2D *ad);
00097 virtual void ShallowCopy(vtkPoints2D *ad);
00099
00106 unsigned long GetActualMemorySize();
00107
00109 vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();}
00110
00115 double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);}
00116
00118 void GetPoint(vtkIdType id, double x[2]) { this->Data->GetTuple(id,x);}
00119
00121
00124 void SetPoint(vtkIdType id, const float x[2]) { this->Data->SetTuple(id,x);}
00125 void SetPoint(vtkIdType id, const double x[2]) { this->Data->SetTuple(id,x);}
00126 void SetPoint(vtkIdType id, double x, double y);
00128
00130
00132 void InsertPoint(vtkIdType id, const float x[2])
00133 { this->Data->InsertTuple(id,x);}
00134 void InsertPoint(vtkIdType id, const double x[2])
00135 {this->Data->InsertTuple(id,x);}
00136 void InsertPoint(vtkIdType id, double x, double y);
00138
00140
00141 vtkIdType InsertNextPoint(const float x[2]) {
00142 return this->Data->InsertNextTuple(x);}
00143 vtkIdType InsertNextPoint(const double x[2]) {
00144 return this->Data->InsertNextTuple(x);}
00145 vtkIdType InsertNextPoint(double x, double y);
00147
00151 void SetNumberOfPoints(vtkIdType number);
00152
00154 void GetPoints(vtkIdList *ptId, vtkPoints2D *fp);
00155
00157 virtual void ComputeBounds();
00158
00160 double *GetBounds();
00161
00163 void GetBounds(double bounds[4]);
00164
00165 protected:
00166 vtkPoints2D(int dataType=VTK_FLOAT);
00167 ~vtkPoints2D();
00168
00169 double Bounds[4];
00170 vtkTimeStamp ComputeTime;
00171 vtkDataArray *Data;
00172
00173 private:
00174 vtkPoints2D(const vtkPoints2D&);
00175 void operator=(const vtkPoints2D&);
00176 };
00177
00178 inline void vtkPoints2D::SetNumberOfPoints(vtkIdType number)
00179 {
00180 this->Data->SetNumberOfComponents(2);
00181 this->Data->SetNumberOfTuples(number);
00182 }
00183
00184 inline void vtkPoints2D::SetPoint(vtkIdType id, double x, double y)
00185 {
00186 double p[2] = { x, y };
00187 this->Data->SetTuple(id,p);
00188 }
00189
00190 inline void vtkPoints2D::InsertPoint(vtkIdType id, double x, double y)
00191 {
00192 double p[2] = { x, y };
00193 this->Data->InsertTuple(id,p);
00194 }
00195
00196 inline vtkIdType vtkPoints2D::InsertNextPoint(double x, double y)
00197 {
00198 double p[2] = { x, y };
00199 return this->Data->InsertNextTuple(p);
00200 }
00201
00202 #endif