00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkAttributeEditor_h
00026 #define __vtkAttributeEditor_h
00027
00028 #include "vtkUnstructuredGridAlgorithm.h"
00029
00030 class vtkImplicitFunction;
00031 class vtkPointLocator;
00032 class vtkMultiProcessController;
00033 class vtkIdList;
00034 class vtkIntArray;
00035 class vtkPoints;
00036 class vtkDataSet;
00037 class vtkAppendFilter;
00038 class vtkFloatArray;
00039
00040 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00041 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00042 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00043
00044 class VTK_EXPORT vtkAttributeEditor : public vtkUnstructuredGridAlgorithm
00045 {
00046 public:
00047 vtkTypeRevisionMacro(vtkAttributeEditor,vtkUnstructuredGridAlgorithm);
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049
00050 static vtkAttributeEditor *New();
00051
00053
00054 vtkDataSet *GetInput(int idx);
00055 vtkDataSet *GetInput()
00056 {return this->GetInput( 0 );}
00058
00059
00061 void RemoveInput(vtkDataSet *in);
00062
00064
00066 vtkSetMacro(UnfilteredDataset,int);
00067 vtkGetMacro(UnfilteredDataset,int);
00068 vtkBooleanMacro(UnfilteredDataset,int);
00070
00072
00074 vtkSetMacro(Value,double);
00075 vtkGetMacro(Value,double);
00077
00079
00082 virtual void SetClipFunction(vtkImplicitFunction*);
00083 vtkGetObjectMacro(ClipFunction,vtkImplicitFunction);
00085
00087 void SetPickFunction(vtkObject *func);
00088
00090
00096 vtkSetMacro(AttributeMode,int);
00097 vtkGetMacro(AttributeMode,int);
00098 void SetAttributeModeToDefault()
00099 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00100 void SetAttributeModeToUsePointData()
00101 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00102 void SetAttributeModeToUseCellData()
00103 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00104 const char *GetAttributeModeAsString();
00106
00107 vtkSetMacro(AttributeValue,double);
00108 vtkGetMacro(AttributeValue,double);
00109
00110 vtkSetMacro(EditMode,int);
00111 vtkGetMacro(EditMode,int);
00112 vtkBooleanMacro(EditMode,int);
00113
00114
00115
00116 vtkSetMacro(ClearEdits,int);
00117 vtkGetMacro(ClearEdits,int);
00118 vtkBooleanMacro(ClearEdits,int);
00119
00121
00125 vtkSetClampMacro(MergeTolerance,double,0.0001,0.25);
00126 vtkGetMacro(MergeTolerance,double);
00128
00130 unsigned long GetMTime();
00131
00133
00135 void SetLocator(vtkPointLocator *locator);
00136 vtkGetObjectMacro(Locator,vtkPointLocator);
00138
00141 void CreateDefaultLocator();
00142
00143
00144
00146
00147 vtkSetVector3Macro(WorldPoint,double);
00148 vtkGetVector3Macro(WorldPoint,double);
00150
00152
00154 vtkSetMacro(PickCell,int);
00155 vtkGetMacro(PickCell,int);
00156 vtkBooleanMacro(PickCell,int);
00158
00161 void SetController(vtkMultiProcessController* controller);
00162
00163 protected:
00164 vtkAttributeEditor(vtkImplicitFunction *cf=NULL);
00165 ~vtkAttributeEditor();
00166
00167 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00168 virtual int FillInputPortInformation(int port, vtkInformation *info);
00169 vtkImplicitFunction *ClipFunction;
00170
00171 vtkPointLocator *Locator;
00172 double Value;
00173
00174 double MergeTolerance;
00175
00176
00177 void ClipVolume(vtkDataSet *input, vtkUnstructuredGrid *output);
00178
00179 double AttributeValue;
00180 int AttributeMode;
00181 int EditMode;
00182 int IsPointPick;
00183 int UnfilteredDataset;
00184 int ClearEdits;
00185
00186
00187
00188 void RegionExecute(vtkDataSet *readerInput, vtkDataSet *filterInput, vtkDataSet *readerOutput, vtkDataSet *filterOutput);
00189 void PointExecute(vtkDataSet *readerInput, vtkDataSet *filterInput, vtkDataSet *readerOutput, vtkDataSet *filterOutput);
00190 void CellExecute(vtkDataSet *readerInput, vtkDataSet *filterInput, vtkDataSet *readerOutput, vtkDataSet *filterOutput);
00191
00192 void CreateOutput(vtkIdList* regionCellIds);
00193 int CompareProcesses(double bestDist2);
00194
00195
00196 int PickCell;
00197
00198 vtkMultiProcessController* Controller;
00199
00200
00201 double WorldPoint[3];
00202
00203
00204 vtkIdList* PointMap;
00205
00206 vtkIdList* RegionPointIds;
00207
00208
00209
00210
00211 int BestInputIndex;
00212
00213
00214 vtkIdType InsertIdInPointMap(vtkIdType inId);
00215 void InitializePointMap(vtkIdType numerOfInputPoints);
00216 void DeletePointMap();
00217 int ListContainsId(vtkIdList* ids, vtkIdType id);
00218
00219
00220 vtkIdType FindPointId(double pt[3], vtkDataSet* input);
00221
00222 vtkFloatArray *FilterDataArray;
00223 vtkFloatArray *ReaderDataArray;
00224
00225 private:
00226 vtkAttributeEditor(const vtkAttributeEditor&);
00227 void operator=(const vtkAttributeEditor&);
00228 };
00229
00230 #endif