Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkPoints.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPoints.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00056 #ifndef __vtkPoints_h
00057 #define __vtkPoints_h
00058 
00059 #include "vtkObject.h"
00060 #include "vtkDataArray.h"
00061 
00062 class vtkIdList;
00063 class vtkPoints;
00064 
00065 class VTK_COMMON_EXPORT vtkPoints : public vtkObject
00066 {
00067 public:
00068 //BTX
00069   static vtkPoints *New(int dataType);
00070 //ETX
00071   static vtkPoints *New();
00072 
00073   vtkTypeMacro(vtkPoints,vtkObject);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00077   virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00078   
00080   virtual void Initialize();
00081 
00083   vtkPoints *MakeObject();
00084 
00086 
00092   virtual void SetData(vtkDataArray *);
00093   vtkDataArray *GetData() {return this->Data;};
00095 
00098   virtual int GetDataType();
00099 
00101 
00102   virtual void SetDataType(int dataType);
00103   void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
00104   void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
00105   void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
00106   void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
00107   void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
00108   void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
00109   void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
00110   void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
00111   void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
00112   void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
00113   void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
00115 
00118   void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
00119 
00121   virtual void Squeeze() {this->Data->Squeeze();};
00122 
00124   virtual void Reset() {this->Data->Reset();};
00125 
00127 
00130   virtual void DeepCopy(vtkPoints *ad);
00131   virtual void ShallowCopy(vtkPoints *ad);
00133 
00140   unsigned long GetActualMemorySize();
00141 
00143   vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
00144 
00146   float *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
00147 
00149 
00150   void GetPoint(vtkIdType id, float x[3]) { this->Data->GetTuple(id,x);};
00151   void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x);};
00153 
00155 
00158   void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
00159   void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
00160   void SetPoint(vtkIdType id, double x, double y, double z);
00162 
00164 
00166   void InsertPoint(vtkIdType id, const float x[3])
00167     { this->Data->InsertTuple(id,x);};
00168   void InsertPoint(vtkIdType id, const double x[3])
00169     {this->Data->InsertTuple(id,x);};
00170   void InsertPoint(vtkIdType id, double x, double y, double z);
00172   
00174 
00175   vtkIdType InsertNextPoint(const float x[3]) { 
00176     return this->Data->InsertNextTuple(x);};
00177   vtkIdType InsertNextPoint(const double x[3]) { 
00178     return this->Data->InsertNextTuple(x);};
00179   vtkIdType InsertNextPoint(double x, double y, double z);
00181 
00185   void SetNumberOfPoints(vtkIdType number);
00186 
00188   void GetPoints(vtkIdList *ptId, vtkPoints *fp);
00189 
00191   virtual void ComputeBounds();
00192 
00194   float *GetBounds();
00195 
00197   void GetBounds(float bounds[6]);
00198 
00199 protected:
00200   vtkPoints(int dataType=VTK_FLOAT);
00201   ~vtkPoints();
00202 
00203   float Bounds[6];
00204   vtkTimeStamp ComputeTime; // Time at which bounds computed
00205   vtkDataArray *Data;  // Array which represents data
00206 
00207 private:
00208   vtkPoints(const vtkPoints&);  // Not implemented.
00209   void operator=(const vtkPoints&);  // Not implemented.
00210 };
00211 
00212 inline void vtkPoints::SetNumberOfPoints(vtkIdType number)
00213 {
00214   this->Data->SetNumberOfComponents(3);
00215   this->Data->SetNumberOfTuples(number);
00216 }
00217 
00218 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
00219 {
00220   double p[3];
00221   p[0] = x;
00222   p[1] = y;
00223   p[2] = z;
00224   this->Data->SetTuple(id,p);
00225 }
00226 
00227 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
00228 {
00229   double p[3];
00230 
00231   p[0] = x;
00232   p[1] = y;
00233   p[2] = z;
00234   this->Data->InsertTuple(id,p);
00235 }
00236 
00237 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
00238 {
00239   double p[3];
00240 
00241   p[0] = x;
00242   p[1] = y;
00243   p[2] = z;
00244   return this->Data->InsertNextTuple(p);
00245 }
00246 
00247 
00248 // These include files are placed here so that if Points.h is included 
00249 // all other classes necessary for compilation are also included. 
00250 #include "vtkIdList.h"
00251 
00252 #endif
00253 

Generated on Thu Mar 28 14:19:16 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001