VTK
dox/Graphics/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 "vtkSelectionAlgorithm.h"
00045 
00046 class vtkCompositeDataSet;
00047 class vtkGraph;
00048 class vtkIdTypeArray;
00049 class vtkSelection;
00050 class vtkSelectionNode;
00051 class vtkStringArray;
00052 class vtkTable;
00053 
00054 class VTK_GRAPHICS_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm 
00055 {
00056 public:
00057   static vtkConvertSelection *New();
00058   vtkTypeMacro(vtkConvertSelection, vtkSelectionAlgorithm);
00059   void PrintSelf(ostream& os, vtkIndent indent);
00060 
00063   void SetDataObjectConnection(vtkAlgorithmOutput* in);
00064 
00066 
00070   vtkSetMacro(InputFieldType, int);
00071   vtkGetMacro(InputFieldType, int);
00073   
00075 
00077   vtkSetMacro(OutputType, int);
00078   vtkGetMacro(OutputType, int);
00080   
00082 
00083   virtual void SetArrayName(const char*);
00084   virtual const char* GetArrayName();
00086   
00088 
00089   virtual void SetArrayNames(vtkStringArray*);
00090   vtkGetObjectMacro(ArrayNames, vtkStringArray);
00092 
00094 
00095   void AddArrayName(const char*);
00096   void ClearArrayNames();
00098   
00100 
00102   vtkSetMacro(MatchAnyValues, bool);
00103   vtkGetMacro(MatchAnyValues, bool);
00104   vtkBooleanMacro(MatchAnyValues, bool);
00106 
00108 
00111   static vtkSelection* ToIndexSelection(
00112     vtkSelection* input, 
00113     vtkDataObject* data);
00114   static vtkSelection* ToGlobalIdSelection(
00115     vtkSelection* input, 
00116     vtkDataObject* data);
00117   static vtkSelection* ToPedigreeIdSelection(
00118     vtkSelection* input, 
00119     vtkDataObject* data);
00120   static vtkSelection* ToValueSelection(
00121     vtkSelection* input, 
00122     vtkDataObject* data, 
00123     const char* arrayName);
00124   static vtkSelection* ToValueSelection(
00125     vtkSelection* input, 
00126     vtkDataObject* data, 
00127     vtkStringArray* arrayNames);
00129 
00131 
00134   static void GetSelectedItems(
00135     vtkSelection* input,
00136     vtkDataObject* data,
00137     int fieldType,
00138     vtkIdTypeArray* indices);
00140 
00142 
00144   static void GetSelectedVertices(
00145     vtkSelection* input,
00146     vtkGraph* data,
00147     vtkIdTypeArray* indices);
00148   static void GetSelectedEdges(
00149     vtkSelection* input,
00150     vtkGraph* data,
00151     vtkIdTypeArray* indices);
00152   static void GetSelectedPoints(
00153     vtkSelection* input,
00154     vtkDataSet* data,
00155     vtkIdTypeArray* indices);
00156   static void GetSelectedCells(
00157     vtkSelection* input,
00158     vtkDataSet* data,
00159     vtkIdTypeArray* indices);
00160   static void GetSelectedRows(
00161     vtkSelection* input,
00162     vtkTable* data,
00163     vtkIdTypeArray* indices);
00165   
00167 
00169   static vtkSelection* ToSelectionType(
00170     vtkSelection* input, 
00171     vtkDataObject* data, 
00172     int type, 
00173     vtkStringArray* arrayNames = 0,
00174     int inputFieldType = -1);
00176     
00177 protected:
00178   vtkConvertSelection();
00179   ~vtkConvertSelection();
00180 
00181   virtual int RequestData(
00182     vtkInformation *, 
00183     vtkInformationVector **, 
00184     vtkInformationVector *);
00185   
00186   int Convert(
00187     vtkSelection* input,
00188     vtkDataObject* data,
00189     vtkSelection* output);
00190 
00191   int ConvertCompositeDataSet(
00192     vtkSelection* input,
00193     vtkCompositeDataSet* data,
00194     vtkSelection* output);
00195 
00196   int ConvertToIndexSelection(
00197     vtkSelectionNode* input, 
00198     vtkDataSet* data,
00199     vtkSelectionNode* output);
00200   
00201   int SelectTableFromTable(
00202     vtkTable* selTable,
00203     vtkTable* dataTable,
00204     vtkIdTypeArray* indices);
00205 
00206   int ConvertToBlockSelection(
00207     vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
00208 
00209   virtual int FillInputPortInformation(
00210     int port, vtkInformation* info);
00211   
00212   int OutputType;
00213   int InputFieldType;
00214   vtkStringArray* ArrayNames;
00215   bool MatchAnyValues;
00216 
00217 private:
00218   vtkConvertSelection(const vtkConvertSelection&);  // Not implemented.
00219   void operator=(const vtkConvertSelection&);  // Not implemented.
00220 };
00221 
00222 #endif