00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00038 #ifndef __vtkCellTypes_h
00039 #define __vtkCellTypes_h
00040
00041 #include "vtkObject.h"
00042
00043 #include "vtkIntArray.h"
00044 #include "vtkUnsignedCharArray.h"
00045 #include "vtkCellType.h"
00046
00047 class VTK_FILTERING_EXPORT vtkCellTypes : public vtkObject
00048 {
00049 public:
00050 static vtkCellTypes *New();
00051 vtkTypeRevisionMacro(vtkCellTypes,vtkObject);
00052 void PrintSelf(ostream& os, vtkIndent indent);
00053
00055 int Allocate(int sz=512, int ext=1000);
00056
00058 void InsertCell(int id, unsigned char type, int loc);
00059
00061 int InsertNextCell(unsigned char type, int loc);
00062
00064 void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00065
00067 int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00068
00070 void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00071
00073 int GetNumberOfTypes() { return (this->MaxId + 1);};
00074
00076 int IsType(unsigned char type);
00077
00080 int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00081
00083 unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00084
00086 void Squeeze();
00087
00089 void Reset();
00090
00097 unsigned long GetActualMemorySize();
00098
00101 void DeepCopy(vtkCellTypes *src);
00102
00105 static const char* GetClassNameFromTypeId(int typeId);
00106
00109 static int GetTypeIdFromClassName(const char* classname);
00110
00111 protected:
00112 vtkCellTypes();
00113 ~vtkCellTypes();
00114
00115 vtkUnsignedCharArray *TypeArray;
00116 vtkIntArray *LocationArray;
00117 int Size;
00118 int MaxId;
00119 int Extend;
00120 private:
00121 vtkCellTypes(const vtkCellTypes&);
00122 void operator=(const vtkCellTypes&);
00123 };
00124
00125
00126
00127 inline int vtkCellTypes::IsType(unsigned char type)
00128 {
00129 int numTypes=this->GetNumberOfTypes();
00130
00131 for (int i=0; i<numTypes; i++)
00132 {
00133 if ( type == this->GetCellType(i))
00134 {
00135 return 1;
00136 }
00137 }
00138 return 0;
00139 }
00140
00141
00142 #endif