VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkStringToNumeric.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 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00034 #ifndef __vtkStringToNumeric_h 00035 #define __vtkStringToNumeric_h 00036 00037 #include "vtkDataObjectAlgorithm.h" 00038 00039 class VTK_INFOVIS_EXPORT vtkStringToNumeric : public vtkDataObjectAlgorithm 00040 { 00041 public: 00042 static vtkStringToNumeric* New(); 00043 vtkTypeMacro(vtkStringToNumeric,vtkDataObjectAlgorithm); 00044 void PrintSelf(ostream& os, vtkIndent indent); 00045 00047 00049 vtkSetMacro(ForceDouble, bool); 00050 vtkGetMacro(ForceDouble, bool); 00051 vtkBooleanMacro(ForceDouble, bool); 00053 00055 00056 vtkSetMacro(DefaultIntegerValue, int); 00057 vtkGetMacro(DefaultIntegerValue, int); 00059 00061 00062 vtkSetMacro(DefaultDoubleValue, double); 00063 vtkGetMacro(DefaultDoubleValue, double); 00065 00067 00076 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool); 00077 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool); 00078 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool); 00080 00082 00083 vtkSetMacro(ConvertFieldData, bool); 00084 vtkGetMacro(ConvertFieldData, bool); 00085 vtkBooleanMacro(ConvertFieldData, bool); 00087 00089 00090 vtkSetMacro(ConvertPointData, bool); 00091 vtkGetMacro(ConvertPointData, bool); 00092 vtkBooleanMacro(ConvertPointData, bool); 00094 00096 00097 vtkSetMacro(ConvertCellData, bool); 00098 vtkGetMacro(ConvertCellData, bool); 00099 vtkBooleanMacro(ConvertCellData, bool); 00101 00103 00104 virtual void SetConvertVertexData(bool b) 00105 { this->SetConvertPointData(b); } 00106 virtual bool GetConvertVertexData() 00107 { return this->GetConvertPointData(); } 00108 vtkBooleanMacro(ConvertVertexData, bool); 00110 00112 00113 virtual void SetConvertEdgeData(bool b) 00114 { this->SetConvertCellData(b); } 00115 virtual bool GetConvertEdgeData() 00116 { return this->GetConvertCellData(); } 00117 vtkBooleanMacro(ConvertEdgeData, bool); 00119 00121 00122 virtual void SetConvertRowData(bool b) 00123 { this->SetConvertPointData(b); } 00124 virtual bool GetConvertRowData() 00125 { return this->GetConvertPointData(); } 00126 vtkBooleanMacro(ConvertRowData, bool); 00128 00130 00131 virtual int ProcessRequest(vtkInformation* request, 00132 vtkInformationVector** inputVector, 00133 vtkInformationVector* outputVector); 00135 00136 protected: 00137 vtkStringToNumeric(); 00138 ~vtkStringToNumeric(); 00139 00141 00142 virtual int RequestDataObject(vtkInformation* request, 00143 vtkInformationVector** inputVector, 00144 vtkInformationVector* outputVector); 00146 00148 void ConvertArrays(vtkFieldData* fieldData); 00149 00150 bool ConvertFieldData; 00151 bool ConvertPointData; 00152 bool ConvertCellData; 00153 bool ForceDouble; 00154 int DefaultIntegerValue; 00155 double DefaultDoubleValue; 00156 bool TrimWhitespacePriorToNumericConversion; 00157 00161 int CountItemsToConvert(vtkFieldData *fieldData); 00162 00163 // These keep track of our progress 00164 int ItemsToConvert; 00165 int ItemsConverted; 00166 00167 int RequestData( 00168 vtkInformation*, 00169 vtkInformationVector**, 00170 vtkInformationVector*); 00171 00172 private: 00173 vtkStringToNumeric(const vtkStringToNumeric&); // Not implemented 00174 void operator=(const vtkStringToNumeric&); // Not implemented 00175 }; 00176 00177 #endif 00178