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

Servers/Filters/vtkAttributeEditor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAttributeEditor.h,v $
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 =========================================================================*/
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 //ETX
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   // When this flag is set, the next time the filter is executed, the arrays of edits will be deleted.
00115   // This is meant to be called just before a timestep change is about to occur.
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   // Point picking stuff - borrowed from vtkPickFilter
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   //helper functions
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   // Point picking stuff:
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   // Flag that toggles between picking cells or picking points.
00196   int PickCell;
00197 
00198   vtkMultiProcessController* Controller;
00199 
00200   // Input pick point.
00201   double WorldPoint[3];
00202 
00203   // Index is the input id, value is the output id.
00204   vtkIdList* PointMap;
00205   // Index is the output id, value is the input id.
00206   vtkIdList* RegionPointIds;
00207 
00208   // I need this because I am converting this filter
00209   // to have multiple inputs, and removing the layer feature
00210   // at the same time.  Maps can only be from one input.
00211   int BestInputIndex;
00212 
00213   // Returns outputId.
00214   vtkIdType InsertIdInPointMap(vtkIdType inId);
00215   void InitializePointMap(vtkIdType numerOfInputPoints);
00216   void DeletePointMap();
00217   int ListContainsId(vtkIdList* ids, vtkIdType id);
00218 
00219   // Locator did not do what I wanted.
00220   vtkIdType FindPointId(double pt[3], vtkDataSet* input);
00221 
00222   vtkFloatArray *FilterDataArray;
00223   vtkFloatArray *ReaderDataArray;
00224 
00225 private:
00226   vtkAttributeEditor(const vtkAttributeEditor&);  // Not implemented.
00227   void operator=(const vtkAttributeEditor&);  // Not implemented.
00228 };
00229 
00230 #endif

Generated on Tue May 30 12:31:45 2006 for ParaView by doxygen 1.3.5