00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkPVCalculatorWidget_h
00026 #define __vtkPVCalculatorWidget_h
00027
00028 #include "vtkPVWidget.h"
00029
00030 class vtkKWEntry;
00031 class vtkKWLabel;
00032 class vtkKWFrameWithLabel;
00033 class vtkKWFrame;
00034 class vtkKWMenuButton;
00035 class vtkKWMenuButton;
00036 class vtkKWPushButton;
00037 class vtkKWWidget;
00038 class vtkSMProperty;
00039
00040 class VTK_EXPORT vtkPVCalculatorWidget : public vtkPVWidget
00041 {
00042 public:
00043 static vtkPVCalculatorWidget* New();
00044 vtkTypeRevisionMacro(vtkPVCalculatorWidget, vtkPVWidget);
00045 void PrintSelf(ostream& os, vtkIndent indent);
00046
00048 void Create(vtkKWApplication *app);
00049
00051 void UpdateFunction(const char* newSymbol);
00052
00054 void SetFunctionLabel(char *function);
00055
00057 void ChangeAttributeMode(const char* newMode);
00058
00060
00061 void AddScalarVariable(const char* variableName, const char* arrayName,
00062 int component);
00064
00066 void AddVectorVariable(const char* variableName, const char* arrayName);
00067
00069 void ClearFunction();
00070
00071
00073
00075 virtual void Accept();
00076
00078
00080 virtual void Initialize();
00081
00083 virtual void ResetInternal();
00084
00087 virtual void SaveInBatchScript(ofstream *file);
00088
00090 virtual void Trace(ofstream *file);
00091
00098 virtual void UpdateEnableState();
00099
00100 protected:
00101 vtkPVCalculatorWidget();
00102 ~vtkPVCalculatorWidget();
00103
00104 vtkKWFrame* AttributeModeFrame;
00105 vtkKWLabel* AttributeModeLabel;
00106 vtkKWMenuButton* AttributeModeMenu;
00107
00108 vtkKWFrameWithLabel* CalculatorFrame;
00109 vtkKWEntry* FunctionLabel;
00110
00111 vtkKWPushButton* ButtonClear;
00112 vtkKWPushButton* ButtonZero;
00113 vtkKWPushButton* ButtonOne;
00114 vtkKWPushButton* ButtonTwo;
00115 vtkKWPushButton* ButtonThree;
00116 vtkKWPushButton* ButtonFour;
00117 vtkKWPushButton* ButtonFive;
00118 vtkKWPushButton* ButtonSix;
00119 vtkKWPushButton* ButtonSeven;
00120 vtkKWPushButton* ButtonEight;
00121 vtkKWPushButton* ButtonNine;
00122 vtkKWPushButton* ButtonDivide;
00123 vtkKWPushButton* ButtonMultiply;
00124 vtkKWPushButton* ButtonSubtract;
00125 vtkKWPushButton* ButtonAdd;
00126 vtkKWPushButton* ButtonDecimal;
00127 vtkKWPushButton* ButtonDot;
00128 vtkKWPushButton* ButtonSin;
00129 vtkKWPushButton* ButtonCos;
00130 vtkKWPushButton* ButtonTan;
00131 vtkKWPushButton* ButtonASin;
00132 vtkKWPushButton* ButtonACos;
00133 vtkKWPushButton* ButtonATan;
00134 vtkKWPushButton* ButtonSinh;
00135 vtkKWPushButton* ButtonCosh;
00136 vtkKWPushButton* ButtonTanh;
00137 vtkKWPushButton* ButtonPow;
00138 vtkKWPushButton* ButtonSqrt;
00139 vtkKWPushButton* ButtonExp;
00140 vtkKWPushButton* ButtonCeiling;
00141 vtkKWPushButton* ButtonFloor;
00142 vtkKWPushButton* ButtonLog;
00143 vtkKWPushButton* ButtonLog10;
00144 vtkKWPushButton* ButtonAbs;
00145 vtkKWPushButton* ButtonMag;
00146 vtkKWPushButton* ButtonNorm;
00147 vtkKWPushButton* ButtonIHAT;
00148 vtkKWPushButton* ButtonJHAT;
00149 vtkKWPushButton* ButtonKHAT;
00150 vtkKWPushButton* ButtonLeftParenthesis;
00151 vtkKWPushButton* ButtonRightParenthesis;
00152 vtkKWMenuButton* ScalarsMenu;
00153 vtkKWMenuButton* VectorsMenu;
00154
00155 char *LastAcceptedFunction;
00156 vtkSetStringMacro(LastAcceptedFunction);
00157
00158 int ScalarVariableExists(const char *variableName, const char *arrayName,
00159 int component);
00160 int VectorVariableExists(const char *variableName, const char *arrayName);
00161
00162 char **ScalarArrayNames;
00163 char **ScalarVariableNames;
00164 int *ScalarComponents;
00165 int NumberOfScalarVariables;
00166 char **VectorArrayNames;
00167 char **VectorVariableNames;
00168 int NumberOfVectorVariables;
00169 void ClearAllVariables();
00170 void AddAllVariables(int populateMenus);
00171
00172 char *SMFunctionPropertyName;
00173 char *SMScalarVariablePropertyName;
00174 char *SMVectorVariablePropertyName;
00175 char *SMAttributeModePropertyName;
00176 char *SMRemoveAllVariablesPropertyName;
00177
00178 void SetSMFunctionProperty(vtkSMProperty *prop);
00179 vtkSMProperty* GetSMFunctionProperty();
00180 void SetSMScalarVariableProperty(vtkSMProperty *prop);
00181 vtkSMProperty* GetSMScalarVariableProperty();
00182 void SetSMVectorVariableProperty(vtkSMProperty *prop);
00183 vtkSMProperty* GetSMVectorVariableProperty();
00184 void SetSMAttributeModeProperty(vtkSMProperty *prop);
00185 vtkSMProperty* GetSMAttributeModeProperty();
00186 void SetSMRemoveAllVariablesProperty(vtkSMProperty *prop);
00187 vtkSMProperty* GetSMRemoveAllVariablesProperty();
00188
00189 vtkSetStringMacro(SMFunctionPropertyName);
00190 vtkGetStringMacro(SMFunctionPropertyName);
00191 vtkSetStringMacro(SMScalarVariablePropertyName);
00192 vtkGetStringMacro(SMScalarVariablePropertyName);
00193 vtkSetStringMacro(SMVectorVariablePropertyName);
00194 vtkGetStringMacro(SMVectorVariablePropertyName);
00195 vtkSetStringMacro(SMAttributeModePropertyName);
00196 vtkGetStringMacro(SMAttributeModePropertyName);
00197 vtkSetStringMacro(SMRemoveAllVariablesPropertyName);
00198 vtkGetStringMacro(SMRemoveAllVariablesPropertyName);
00199
00200
00201 virtual void CopyProperties(vtkPVWidget* clone, vtkPVSource* pvSource,
00202 vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
00203
00204
00205 int ReadXMLAttributes(vtkPVXMLElement* element,
00206 vtkPVXMLPackageParser* parser);
00207
00208 int GetAttributeMode();
00209 private:
00210 vtkPVCalculatorWidget(const vtkPVCalculatorWidget&);
00211 void operator=(const vtkPVCalculatorWidget&);
00212
00213 vtkSMProperty *SMFunctionProperty;
00214 vtkSMProperty *SMScalarVariableProperty;
00215 vtkSMProperty *SMVectorVariableProperty;
00216 vtkSMProperty *SMAttributeModeProperty;
00217 vtkSMProperty *SMRemoveAllVariablesProperty;
00218 };
00219
00220 #endif