initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / PVFoamReader / PVFoamReader / vtkPVFoamSelectTimeSet.h
blob70ab8cc97fb2393529cc2424cefb7f36fa1206ec
1 /*=========================================================================
3 Program: ParaView
4 Module: $RCSfile: vtkPVFoamSelectTimeSet.h,v $
6 Copyright (c) Kitware, Inc.
7 All rights reserved.
8 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
15 // .NAME vtkPVFoamSelectTimeSet - Special time selection widget used by PVFoamReaderModule
16 // .SECTION Description
17 // This is a PVWidget specially designed to be used with PVFoamReaderModule.
18 // It provides support for multiple sets. The time value selected by
19 // the user is passed to the Foam reader with a SetTimeValue() call.
21 #ifndef __vtkPVFoamSelectTimeSet_h
22 #define __vtkPVFoamSelectTimeSet_h
24 #include "vtkPVWidget.h"
26 class vtkKWLabel;
27 class vtkKWMenu;
28 class vtkKWLabeledFrame;
29 class vtkDataArrayCollection;
30 class vtkPVScalarListWidgetProperty;
32 class VTK_EXPORT vtkPVFoamSelectTimeSet : public vtkPVWidget
34 public:
35 static vtkPVFoamSelectTimeSet* New();
36 vtkTypeRevisionMacro(vtkPVFoamSelectTimeSet, vtkPVWidget);
37 void PrintSelf(ostream& os, vtkIndent indent);
39 virtual void Create(vtkKWApplication *pvApp);
41 //BTX
42 // Description:
43 // Called when accept button is pushed.
44 // Sets objects variable to the widgets value.
45 // Adds a trace entry. Side effect is to turn modified flag off.
46 virtual void AcceptInternal(vtkClientServerID);
47 //ETX
49 // Description:
50 // Called when the reset button is pushed.
51 // Sets widget's value to the object-variable's value.
52 // Side effect is to turn the modified flag off.
53 virtual void ResetInternal();
55 // Description:
56 // Adds a script to the menu of the animation interface.
57 virtual void AddAnimationScriptsToMenu(vtkKWMenu *menu,
58 vtkPVAnimationInterfaceEntry *ai);
60 // Description:
61 // Called whenthe animation method menu item is selected.
62 // Needed for proper tracing.
63 // It would be nice if the menu and cascade menus would trace
64 // invokation of items (?relying of enumeration of menu items or label?)
65 void AnimationMenuCallback(vtkPVAnimationInterfaceEntry *ai);
67 // Description:
68 // This is the labeled frame around the timeset tree.
69 vtkGetObjectMacro(LabeledFrame, vtkKWLabeledFrame);
71 // Description:
72 // Label displayed on the labeled frame.
73 void SetLabel(const char* label);
74 const char* GetLabel();
76 // Description:
77 // Updates the time value label and the time ivar.
78 void SetTimeValue(float time);
79 vtkGetMacro(TimeValue, float);
81 // Description:
82 // Calls this->SetTimeValue () and Reader->SetTimeValue()
83 // with currently selected time value.
84 void SetTimeValueCallback(const char* item);
86 //BTX
87 // Description:
88 // Creates and returns a copy of this widget. It will create
89 // a new instance of the same type as the current object
90 // using NewInstance() and then copy some necessary state
91 // parameters.
92 vtkPVFoamSelectTimeSet* ClonePrototype(vtkPVSource* pvSource,
93 vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
94 //ETX
96 // Description:
97 // This serves a dual purpose. For tracing and for saving state.
98 virtual void Trace(ofstream *file);
100 // Description:
101 // Set/get the property to use with this widget.
102 virtual void SetProperty(vtkPVWidgetProperty *prop);
103 virtual vtkPVWidgetProperty* GetProperty();
105 // Description:
106 // Create the right property for use with this widget.
107 virtual vtkPVWidgetProperty* CreateAppropriateProperty();
109 // Description:
110 // Set/get the command to pass the value to VTK.
111 vtkSetStringMacro(SetCommand);
112 vtkGetStringMacro(SetCommand);
114 // Description:
115 // Save this widget to a file.
116 virtual void SaveInBatchScript(ofstream *file);
118 protected:
119 vtkPVFoamSelectTimeSet();
120 ~vtkPVFoamSelectTimeSet();
122 vtkPVFoamSelectTimeSet(const vtkPVFoamSelectTimeSet&); // Not implemented
123 void operator=(const vtkPVFoamSelectTimeSet&); // Not implemented
125 vtkPVScalarListWidgetProperty *Property;
127 char *SetCommand;
129 vtkSetStringMacro(FrameLabel);
130 vtkGetStringMacro(FrameLabel);
132 vtkKWWidget* Tree;
133 vtkKWWidget* TreeFrame;
134 vtkKWLabel* TimeLabel;
135 vtkKWLabeledFrame* LabeledFrame;
137 void AddRootNode(const char* name, const char* text);
138 void AddChildNode(const char* parent, const char* name,
139 const char* text, const char* data);
141 float TimeValue;
142 char* FrameLabel;
144 vtkDataArrayCollection* TimeSets;
145 vtkClientServerID ServerSideID;
147 // Fill the TimeSets collection with that from the actual reader.
148 void SetTimeSetsFromReader();
150 //BTX
151 virtual void CopyProperties(vtkPVWidget* clone, vtkPVSource* pvSource,
152 vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
153 //ETX
155 int ReadXMLAttributes(vtkPVXMLElement* element,
156 vtkPVXMLPackageParser* parser);
158 // Description:
159 // An interface for saving a widget into a script.
160 virtual void SaveInBatchScriptForPart(ofstream *file, vtkClientServerID);
164 #endif