VTK
vtkPoints2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPoints2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef vtkPoints2D_h
26 #define vtkPoints2D_h
27 
28 #include "vtkCommonCoreModule.h" // For export macro
29 #include "vtkObject.h"
30 
31 #include "vtkDataArray.h" // Needed for inline methods
32 
33 class vtkIdList;
34 
36 {
37 public:
38 //BTX
39  static vtkPoints2D *New(int dataType);
40 //ETX
41  static vtkPoints2D *New();
42 
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47  virtual int Allocate(const vtkIdType sz, const vtkIdType ext = 1000);
48 
50  virtual void Initialize();
51 
53 
59  virtual void SetData(vtkDataArray *);
60  vtkDataArray *GetData() { return this->Data; }
62 
65  virtual int GetDataType();
66 
68 
69  virtual void SetDataType(int dataType);
70  void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
71  void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
72  void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
73  void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
74  void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
75  void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
76  void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
77  void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
78  void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
79  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
80  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
82 
85  void *GetVoidPointer(const int id) { return this->Data->GetVoidPointer(id); }
86 
88  virtual void Squeeze() { this->Data->Squeeze(); }
89 
91  virtual void Reset();
92 
94 
97  virtual void DeepCopy(vtkPoints2D *ad);
98  virtual void ShallowCopy(vtkPoints2D *ad);
100 
107  unsigned long GetActualMemorySize();
108 
110  vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples(); }
111 
116  double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);}
117 
119  void GetPoint(vtkIdType id, double x[2]) { this->Data->GetTuple(id,x); }
120 
122 
125  void SetPoint(vtkIdType id, const float x[2]) { this->Data->SetTuple(id,x); }
126  void SetPoint(vtkIdType id, const double x[2]) { this->Data->SetTuple(id,x); }
127  void SetPoint(vtkIdType id, double x, double y);
129 
131 
133  void InsertPoint(vtkIdType id, const float x[2])
134  { this->Data->InsertTuple(id,x); }
135  void InsertPoint(vtkIdType id, const double x[2])
136  { this->Data->InsertTuple(id,x); }
137  void InsertPoint(vtkIdType id, double x, double y);
139 
141 
142  vtkIdType InsertNextPoint(const float x[2])
143  { return this->Data->InsertNextTuple(x); }
144  vtkIdType InsertNextPoint(const double x[2])
145  { return this->Data->InsertNextTuple(x); }
146  vtkIdType InsertNextPoint(double x, double y);
148 
150  void RemovePoint(vtkIdType id) { this->Data->RemoveTuple(id); }
151 
155  void SetNumberOfPoints(vtkIdType numPoints);
156 
159  int Resize(vtkIdType numPoints);
160 
162  void GetPoints(vtkIdList *ptId, vtkPoints2D *fp);
163 
165  virtual void ComputeBounds();
166 
168  double *GetBounds();
169 
171  void GetBounds(double bounds[4]);
172 
173 protected:
174  vtkPoints2D(int dataType = VTK_FLOAT);
176 
177  double Bounds[4];
178  vtkTimeStamp ComputeTime; // Time at which bounds computed
179  vtkDataArray *Data; // Array which represents data
180 
181 private:
182  vtkPoints2D(const vtkPoints2D&); // Not implemented.
183  void operator=(const vtkPoints2D&); // Not implemented.
184 };
185 
186 inline void vtkPoints2D::Reset()
187 {
188  this->Data->Reset();
189  this->Modified();
190 }
191 
193 {
194  this->Data->SetNumberOfComponents(2);
195  this->Data->SetNumberOfTuples(numPoints);
196  this->Modified();
197 }
198 
199 inline int vtkPoints2D::Resize(vtkIdType numPoints)
200 {
201  this->Data->SetNumberOfComponents(2);
202  this->Modified();
203  return this->Data->Resize(numPoints);
204 }
205 
206 inline void vtkPoints2D::SetPoint(vtkIdType id, double x, double y)
207 {
208  double p[2] = { x, y };
209  this->Data->SetTuple(id, p);
210 }
211 
212 inline void vtkPoints2D::InsertPoint(vtkIdType id, double x, double y)
213 {
214  double p[2] = { x, y };
215  this->Data->InsertTuple(id, p);
216 }
217 
219 {
220  double p[2] = { x, y };
221  return this->Data->InsertNextTuple(p);
222 }
223 
224 #endif
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:36
vtkPoints2D::GetBounds
void GetBounds(double bounds[4])
vtkPoints2D::New
static vtkPoints2D * New()
VTKCOMMONCORE_EXPORT
#define VTKCOMMONCORE_EXPORT
Definition: vtkCommonCoreModule.h:15
vtkAbstractArray::Resize
virtual int Resize(vtkIdType numTuples)=0
vtkPoints2D::Reset
virtual void Reset()
Definition: vtkPoints2D.h:186
vtkIdType
int vtkIdType
Definition: vtkType.h:275
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
vtkPoints2D::InsertPoint
void InsertPoint(vtkIdType id, const float x[2])
Definition: vtkPoints2D.h:133
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPoints2D::GetData
vtkDataArray * GetData()
Definition: vtkPoints2D.h:60
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject::Modified
virtual void Modified()
vtkPoints2D::SetDataTypeToUnsignedChar
void SetDataTypeToUnsignedChar()
Definition: vtkPoints2D.h:72
vtkPoints2D::GetVoidPointer
void * GetVoidPointer(const int id)
Definition: vtkPoints2D.h:85
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkDataArray::InsertTuple
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
vtkPoints2D::GetPoints
void GetPoints(vtkIdList *ptId, vtkPoints2D *fp)
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkPoints2D::SetDataType
virtual void SetDataType(int dataType)
vtkPoints2D::SetDataTypeToUnsignedShort
void SetDataTypeToUnsignedShort()
Definition: vtkPoints2D.h:74
vtkPoints2D::SetNumberOfPoints
void SetNumberOfPoints(vtkIdType numPoints)
Definition: vtkPoints2D.h:192
vtkPoints2D::GetPoint
void GetPoint(vtkIdType id, double x[2])
Definition: vtkPoints2D.h:119
vtkPoints2D::Initialize
virtual void Initialize()
vtkPoints2D::ComputeTime
vtkTimeStamp ComputeTime
Definition: vtkPoints2D.h:178
vtkPoints2D::GetDataType
virtual int GetDataType()
vtkAbstractArray::SetNumberOfComponents
virtual void SetNumberOfComponents(int)
vtkCommonCoreModule.h
vtkAbstractArray::Reset
void Reset()
Definition: vtkAbstractArray.h:228
vtkPoints2D::Allocate
virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000)
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:26
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPoints2D::~vtkPoints2D
~vtkPoints2D()
vtkPoints2D::ComputeBounds
virtual void ComputeBounds()
vtkPoints2D::vtkPoints2D
vtkPoints2D(int dataType=VTK_FLOAT)
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:35
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:36
vtkPoints2D::Squeeze
virtual void Squeeze()
Definition: vtkPoints2D.h:88
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
vtkPoints2D::SetPoint
void SetPoint(vtkIdType id, const float x[2])
Definition: vtkPoints2D.h:125
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:33
vtkPoints2D::GetPoint
double * GetPoint(vtkIdType id)
Definition: vtkPoints2D.h:116
vtkPoints2D::SetDataTypeToUnsignedInt
void SetDataTypeToUnsignedInt()
Definition: vtkPoints2D.h:76
vtkObject.h
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
vtkPoints2D::InsertNextPoint
vtkIdType InsertNextPoint(const float x[2])
Definition: vtkPoints2D.h:142
vtkPoints2D::Data
vtkDataArray * Data
Definition: vtkPoints2D.h:179
vtkPoints2D::SetPoint
void SetPoint(vtkIdType id, const double x[2])
Definition: vtkPoints2D.h:126
vtkPoints2D::RemovePoint
void RemovePoint(vtkIdType id)
Definition: vtkPoints2D.h:150
vtkPoints2D::Resize
int Resize(vtkIdType numPoints)
Definition: vtkPoints2D.h:199
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:29
vtkDataArray.h
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkPoints2D::DeepCopy
virtual void DeepCopy(vtkPoints2D *ad)
vtkDataArray::InsertNextTuple
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
vtkDataArray::SetTuple
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
vtkPoints2D::ShallowCopy
virtual void ShallowCopy(vtkPoints2D *ad)
vtkPoints2D::GetBounds
double * GetBounds()
vtkPoints2D::SetDataTypeToInt
void SetDataTypeToInt()
Definition: vtkPoints2D.h:75
vtkPoints2D::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Definition: vtkPoints2D.h:110
vtkPoints2D::SetDataTypeToFloat
void SetDataTypeToFloat()
Definition: vtkPoints2D.h:79
vtkPoints2D::SetDataTypeToShort
void SetDataTypeToShort()
Definition: vtkPoints2D.h:73
vtkPoints2D::SetData
virtual void SetData(vtkDataArray *)
vtkAbstractArray::SetNumberOfTuples
virtual void SetNumberOfTuples(vtkIdType number)=0
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkPoints2D::InsertNextPoint
vtkIdType InsertNextPoint(const double x[2])
Definition: vtkPoints2D.h:144
vtkPoints2D::SetDataTypeToBit
void SetDataTypeToBit()
Definition: vtkPoints2D.h:70
VTK_BIT
#define VTK_BIT
Definition: vtkType.h:25
VTK_INT
#define VTK_INT
Definition: vtkType.h:31
vtkPoints2D::New
static vtkPoints2D * New(int dataType)
vtkPoints2D::SetDataTypeToChar
void SetDataTypeToChar()
Definition: vtkPoints2D.h:71
vtkPoints2D::SetDataTypeToUnsignedLong
void SetDataTypeToUnsignedLong()
Definition: vtkPoints2D.h:78
vtkPoints2D::GetActualMemorySize
unsigned long GetActualMemorySize()
vtkPoints2D::SetDataTypeToLong
void SetDataTypeToLong()
Definition: vtkPoints2D.h:77
vtkPoints2D::SetDataTypeToDouble
void SetDataTypeToDouble()
Definition: vtkPoints2D.h:80
vtkPoints2D::InsertPoint
void InsertPoint(vtkIdType id, const double x[2])
Definition: vtkPoints2D.h:135
vtkPoints2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)