VTK
dox/Filters/Extraction/vtkConvertSelection.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkConvertSelection.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 =========================================================================*/
00015 /*----------------------------------------------------------------------------
00016  Copyright (c) Sandia Corporation
00017  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00018 ----------------------------------------------------------------------------*/
00041 #ifndef __vtkConvertSelection_h
00042 #define __vtkConvertSelection_h
00043 
00044 #include "vtkFiltersExtractionModule.h" // For export macro
00045 #include "vtkSelectionAlgorithm.h"
00046 
00047 class vtkCompositeDataSet;
00048 class vtkGraph;
00049 class vtkIdTypeArray;
00050 class vtkSelection;
00051 class vtkSelectionNode;
00052 class vtkStringArray;
00053 class vtkTable;
00054 class vtkExtractSelection;
00055 
00056 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
00057 {
00058 public:
00059   static vtkConvertSelection *New();
00060   vtkTypeMacro(vtkConvertSelection, vtkSelectionAlgorithm);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00065   void SetDataObjectConnection(vtkAlgorithmOutput* in);
00066 
00068 
00072   vtkSetMacro(InputFieldType, int);
00073   vtkGetMacro(InputFieldType, int);
00075 
00077 
00079   vtkSetMacro(OutputType, int);
00080   vtkGetMacro(OutputType, int);
00082 
00084 
00085   virtual void SetArrayName(const char*);
00086   virtual const char* GetArrayName();
00088 
00090 
00091   virtual void SetArrayNames(vtkStringArray*);
00092   vtkGetObjectMacro(ArrayNames, vtkStringArray);
00094 
00096 
00097   void AddArrayName(const char*);
00098   void ClearArrayNames();
00100 
00102 
00104   vtkSetMacro(MatchAnyValues, bool);
00105   vtkGetMacro(MatchAnyValues, bool);
00106   vtkBooleanMacro(MatchAnyValues, bool);
00108 
00110 
00111   virtual void SetSelectionExtractor(vtkExtractSelection*);
00112   vtkGetObjectMacro(SelectionExtractor,vtkExtractSelection);
00114 
00116 
00119   static vtkSelection* ToIndexSelection(
00120     vtkSelection* input,
00121     vtkDataObject* data);
00122   static vtkSelection* ToGlobalIdSelection(
00123     vtkSelection* input,
00124     vtkDataObject* data);
00125   static vtkSelection* ToPedigreeIdSelection(
00126     vtkSelection* input,
00127     vtkDataObject* data);
00128   static vtkSelection* ToValueSelection(
00129     vtkSelection* input,
00130     vtkDataObject* data,
00131     const char* arrayName);
00132   static vtkSelection* ToValueSelection(
00133     vtkSelection* input,
00134     vtkDataObject* data,
00135     vtkStringArray* arrayNames);
00137 
00139 
00142   static void GetSelectedItems(
00143     vtkSelection* input,
00144     vtkDataObject* data,
00145     int fieldType,
00146     vtkIdTypeArray* indices);
00148 
00150 
00152   static void GetSelectedVertices(
00153     vtkSelection* input,
00154     vtkGraph* data,
00155     vtkIdTypeArray* indices);
00156   static void GetSelectedEdges(
00157     vtkSelection* input,
00158     vtkGraph* data,
00159     vtkIdTypeArray* indices);
00160   static void GetSelectedPoints(
00161     vtkSelection* input,
00162     vtkDataSet* data,
00163     vtkIdTypeArray* indices);
00164   static void GetSelectedCells(
00165     vtkSelection* input,
00166     vtkDataSet* data,
00167     vtkIdTypeArray* indices);
00168   static void GetSelectedRows(
00169     vtkSelection* input,
00170     vtkTable* data,
00171     vtkIdTypeArray* indices);
00173 
00175 
00177   static vtkSelection* ToSelectionType(
00178     vtkSelection* input,
00179     vtkDataObject* data,
00180     int type,
00181     vtkStringArray* arrayNames = 0,
00182     int inputFieldType = -1);
00184 
00185 protected:
00186   vtkConvertSelection();
00187   ~vtkConvertSelection();
00188 
00189   virtual int RequestData(
00190     vtkInformation *,
00191     vtkInformationVector **,
00192     vtkInformationVector *);
00193 
00194   int Convert(
00195     vtkSelection* input,
00196     vtkDataObject* data,
00197     vtkSelection* output);
00198 
00199   int ConvertCompositeDataSet(
00200     vtkSelection* input,
00201     vtkCompositeDataSet* data,
00202     vtkSelection* output);
00203 
00204   int ConvertToIndexSelection(
00205     vtkSelectionNode* input,
00206     vtkDataSet* data,
00207     vtkSelectionNode* output);
00208 
00209   int SelectTableFromTable(
00210     vtkTable* selTable,
00211     vtkTable* dataTable,
00212     vtkIdTypeArray* indices);
00213 
00214   int ConvertToBlockSelection(
00215     vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
00216 
00217   virtual int FillInputPortInformation(
00218     int port, vtkInformation* info);
00219 
00220   int OutputType;
00221   int InputFieldType;
00222   vtkStringArray* ArrayNames;
00223   bool MatchAnyValues;
00224   vtkExtractSelection* SelectionExtractor;
00225 
00226 private:
00227   vtkConvertSelection(const vtkConvertSelection&);  // Not implemented.
00228   void operator=(const vtkConvertSelection&);  // Not implemented.
00229 };
00230 
00231 #endif