VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
35 class VTKCOMMONCORE_EXPORT vtkPoints2D : public vtkObject
36 {
37 public:
38 //BTX
39  static vtkPoints2D *New(int dataType);
40 //ETX
41  static vtkPoints2D *New();
42 
43  vtkTypeMacro(vtkPoints2D, vtkObject);
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() {this->Data->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 number);
156 
158  void GetPoints(vtkIdList *ptId, vtkPoints2D *fp);
159 
161  virtual void ComputeBounds();
162 
164  double *GetBounds();
165 
167  void GetBounds(double bounds[4]);
168 
169 protected:
170  vtkPoints2D(int dataType=VTK_FLOAT);
171  ~vtkPoints2D();
172 
173  double Bounds[4];
174  vtkTimeStamp ComputeTime; // Time at which bounds computed
175  vtkDataArray *Data; // Array which represents data
176 
177 private:
178  vtkPoints2D(const vtkPoints2D&); // Not implemented.
179  void operator=(const vtkPoints2D&); // Not implemented.
180 };
181 
183 {
184  this->Data->SetNumberOfComponents(2);
185  this->Data->SetNumberOfTuples(number);
186 }
187 
188 inline void vtkPoints2D::SetPoint(vtkIdType id, double x, double y)
189 {
190  double p[2] = { x, y };
191  this->Data->SetTuple(id,p);
192 }
193 
194 inline void vtkPoints2D::InsertPoint(vtkIdType id, double x, double y)
195 {
196  double p[2] = { x, y };
197  this->Data->InsertTuple(id,p);
198 }
199 
200 inline vtkIdType vtkPoints2D::InsertNextPoint(double x, double y)
201 {
202  double p[2] = { x, y };
203  return this->Data->InsertNextTuple(p);
204 }
205 
206 #endif
void SetDataTypeToDouble()
Definition: vtkPoints2D.h:80
void InsertPoint(vtkIdType id, const double x[2])
Definition: vtkPoints2D.h:135
void SetNumberOfPoints(vtkIdType number)
Definition: vtkPoints2D.h:182
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
void SetDataTypeToUnsignedChar()
Definition: vtkPoints2D.h:72
void * GetVoidPointer(const int id)
Definition: vtkPoints2D.h:85
virtual void Reset()
Definition: vtkPoints2D.h:91
void InsertPoint(vtkIdType id, const float x[2])
Definition: vtkPoints2D.h:133
record modification and/or execution time
Definition: vtkTimeStamp.h:34
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkDataArray * GetData()
Definition: vtkPoints2D.h:60
virtual void SetNumberOfTuples(vtkIdType number)=0
int vtkIdType
Definition: vtkType.h:268
void GetPoint(vtkIdType id, double x[2])
Definition: vtkPoints2D.h:119
void SetDataTypeToUnsignedShort()
Definition: vtkPoints2D.h:74
#define VTK_DOUBLE
Definition: vtkType.h:36
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
#define VTK_FLOAT
Definition: vtkType.h:35
vtkTimeStamp ComputeTime
Definition: vtkPoints2D.h:174
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
represent and manipulate 2D points
Definition: vtkPoints2D.h:35
list of point or cell ids
Definition: vtkIdList.h:35
void SetPoint(vtkIdType id, const float x[2])
Definition: vtkPoints2D.h:125
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define VTK_SHORT
Definition: vtkType.h:29
#define VTK_CHAR
Definition: vtkType.h:26
#define VTK_LONG
Definition: vtkType.h:33
void SetDataTypeToUnsignedInt()
Definition: vtkPoints2D.h:76
virtual void Squeeze()
Definition: vtkPoints2D.h:88
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
vtkDataArray * Data
Definition: vtkPoints2D.h:175
void SetPoint(vtkIdType id, const double x[2])
Definition: vtkPoints2D.h:126
virtual void SetNumberOfComponents(int)
double * GetPoint(vtkIdType id)
Definition: vtkPoints2D.h:116
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
vtkIdType InsertNextPoint(const float x[2])
Definition: vtkPoints2D.h:142
void SetDataTypeToInt()
Definition: vtkPoints2D.h:75
void RemovePoint(vtkIdType id)
Definition: vtkPoints2D.h:150
#define VTK_BIT
Definition: vtkType.h:25
void SetDataTypeToBit()
Definition: vtkPoints2D.h:70
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
vtkIdType GetNumberOfPoints()
Definition: vtkPoints2D.h:110
void SetDataTypeToChar()
Definition: vtkPoints2D.h:71
void SetDataTypeToFloat()
Definition: vtkPoints2D.h:79
static vtkObject * New()
void SetDataTypeToUnsignedLong()
Definition: vtkPoints2D.h:78
void SetDataTypeToShort()
Definition: vtkPoints2D.h:73
vtkIdType InsertNextPoint(const double x[2])
Definition: vtkPoints2D.h:144
void SetDataTypeToLong()
Definition: vtkPoints2D.h:77
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
#define VTK_INT
Definition: vtkType.h:31