VTK
|
00001 /*============================================================================== 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMappedDataArray.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 ==============================================================================*/ 00034 #ifndef __vtkMappedDataArray_h 00035 #define __vtkMappedDataArray_h 00036 00037 #include "vtkTypedDataArray.h" 00038 00039 #include "vtkTypeTemplate.h" // for vtkTypeTemplate 00040 00041 template <class Scalar> 00042 class vtkMappedDataArray : public vtkTypeTemplate<vtkMappedDataArray<Scalar>, 00043 vtkTypedDataArray<Scalar> > 00044 { 00045 public: 00046 typedef vtkTypedDataArray<Scalar> Superclass; 00047 typedef typename Superclass::ValueType ValueType; 00048 00055 static vtkMappedDataArray<Scalar>* FastDownCast(vtkAbstractArray *source); 00056 00057 void PrintSelf(ostream &os, vtkIndent indent); 00058 00059 // vtkAbstractArray virtual method that must be reimplemented. 00060 void DeepCopy(vtkAbstractArray *aa) = 0; 00061 vtkVariant GetVariantValue(vtkIdType idx) = 0; 00062 void SetVariantValue(vtkIdType idx, vtkVariant value) = 0; 00063 void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) = 0; 00064 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) = 0; 00065 void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, 00066 vtkAbstractArray *source, double *weights) = 0; 00067 void InterpolateTuple(vtkIdType i, vtkIdType id1, 00068 vtkAbstractArray* source1, vtkIdType id2, 00069 vtkAbstractArray* source2, double t) = 0; 00070 00071 // vtkDataArray virtual method that must be reimplemented. 00072 void DeepCopy(vtkDataArray *da) = 0; 00073 00077 void * GetVoidPointer(vtkIdType id); 00078 00082 void ExportToVoidPointer(void *ptr); 00083 00089 void DataChanged(); 00090 00093 void SetVoidArray(void *, vtkIdType, int); 00094 00096 00097 void * WriteVoidPointer(vtkIdType /*id*/, vtkIdType /*number*/) 00098 { 00099 vtkErrorMacro(<<"WriteVoidPointer: Method not implemented."); 00100 return NULL; 00101 } 00103 00105 void Modified(); 00106 00107 // vtkAbstractArray override: 00108 bool HasStandardMemoryLayout() { return false; } 00109 00110 protected: 00111 vtkMappedDataArray(); 00112 ~vtkMappedDataArray(); 00113 00114 virtual int GetArrayType() 00115 { 00116 return vtkAbstractArray::MappedDataArray; 00117 } 00118 00119 private: 00120 vtkMappedDataArray(const vtkMappedDataArray &); // Not implemented. 00121 void operator=(const vtkMappedDataArray &); // Not implemented. 00122 00124 00125 ValueType *TemporaryScalarPointer; 00126 size_t TemporaryScalarPointerSize; 00127 }; 00129 00130 #include "vtkMappedDataArray.txx" 00131 00132 // Adds an implementation of NewInstanceInternal() that returns a standard 00133 // (unmapped) VTK array, if possible. Use this with classes that derive from 00134 // vtkTypeTemplate, otherwise, use vtkMappedDataArrayTypeMacro. 00135 #define vtkMappedDataArrayNewInstanceMacro(thisClass) \ 00136 protected: \ 00137 vtkObjectBase *NewInstanceInternal() const \ 00138 { \ 00139 if (vtkDataArray *da = \ 00140 vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \ 00141 { \ 00142 return da; \ 00143 } \ 00144 return thisClass::New(); \ 00145 } \ 00146 public: 00147 00148 // Same as vtkTypeMacro, but adds an implementation of NewInstanceInternal() 00149 // that returns a standard (unmapped) VTK array, if possible. 00150 #define vtkMappedDataArrayTypeMacro(thisClass, superClass) \ 00151 vtkAbstractTypeMacroWithNewInstanceType(thisClass, superClass, vtkDataArray) \ 00152 vtkMappedDataArrayNewInstanceMacro(thisClass) 00153 00154 #endif //__vtkMappedDataArray_h 00155 00156 // VTK-HeaderTest-Exclude: vtkMappedDataArray.h