Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Client/vtkPVWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    $RCSfile: vtkPVWindow.h,v $
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
00051 #ifndef __vtkPVWindow_h
00052 #define __vtkPVWindow_h
00053 
00054 #include "vtkKWWindow.h"
00055 
00056 #include "vtkClientServerID.h" // Needed for InteractorID
00057 
00058 class vtkCollection;
00059 class vtkPVGenericRenderWindowInteractor;
00060 class vtkKWCheckButton;
00061 class vtkKWEntry;
00062 class vtkKWFrame;
00063 class vtkKWLabel;
00064 class vtkKWPushButton;
00065 class vtkKWPushButtonWithMenu;
00066 class vtkKWMenuButton;
00067 class vtkKWRadioButton;
00068 class vtkKWRotateCameraInteractor;
00069 class vtkKWToolbar;
00070 class vtkPVAnimationInterface;
00071 class vtkPVApplication;
00072 class vtkPVApplicationSettingsInterface;
00073 class vtkPVCameraManipulator;
00074 class vtkPVColorMap;
00075 class vtkPVComparativeVisManagerGUI;
00076 class vtkPVErrorLogDisplay;
00077 class vtkPVInteractorStyle;
00078 class vtkPVInteractorStyleCenterOfRotation;
00079 class vtkPVLookmarkManager;
00080 class vtkPVReaderModule;
00081 class vtkPVRenderView;
00082 class vtkPVSource;
00083 class vtkPVSourceCollection;
00084 class vtkPVTimerLogDisplay;
00085 class vtkPVTrackballRoll;
00086 class vtkPVVolumeAppearanceEditor;
00087 class vtkPVWidget;
00088 class vtkPVWriter;
00089 class vtkPVXMLPackageParser;
00090 class vtkSMAxesProxy;
00091 class vtkKWSplitFrame;
00092 class vtkPVTraceHelper;
00093 
00094 class vtkPVAnimationManager;
00095 class vtkKWToolbarSet;
00096 
00097 //BTX
00098 template <class key, class data> 
00099 class vtkArrayMap;
00100 template <class value>
00101 class vtkLinkedList;
00102 //ETX
00103 
00104 #define VTK_PV_SOURCE_MENU_INDEX       2
00105 #define VTK_PV_SOURCE_MENU_LABEL       " Source"
00106 #define VTK_PV_ANIMATION_MENU_INDEX    3
00107 #define VTK_PV_ANIMATION_MENU_LABEL    " Animation"
00108 
00109 class VTK_EXPORT vtkPVWindow : public vtkKWWindow
00110 {
00111 public:
00112   static vtkPVWindow* New();
00113   vtkTypeRevisionMacro(vtkPVWindow,vtkKWWindow);
00114   void PrintSelf(ostream& os, vtkIndent indent);
00115 
00118   virtual void Create(vtkKWApplication *app);
00119 
00121 
00122   vtkGetObjectMacro(MainView, vtkPVRenderView);
00124 
00126 
00128   void SetCurrentPVSource(vtkPVSource *comp);
00129   void SetCurrentPVSourceCallback(vtkPVSource *comp);
00130   vtkPVSource *GetCurrentPVSource() {return this->CurrentPVSource;}
00131   vtkPVSource *GetPreviousPVSource(int idx = 1);
00132   vtkPVReaderModule *GetCurrentPVReaderModule();
00134 
00137   void AddPVSource(const char* listname, vtkPVSource *pvs);
00138 
00141   void RemovePVSource(const char* listname, vtkPVSource *pvs);
00142 
00144 
00145   void DeleteAllSourcesCallback();
00146   void DeleteAllSources();
00147   void DeleteSourceAndOutputs(vtkPVSource*);
00149 
00151 
00152   void DeleteAllKeyframesCallback();
00153   void DeleteAllKeyframes();
00155     
00158   vtkPVSource *GetPVSource(const char* listname, const char* sourcename);
00159 
00161 
00162   vtkGetObjectMacro(SelectMenu, vtkKWMenu);
00163   vtkGetObjectMacro(GlyphMenu, vtkKWMenu);
00164   vtkGetObjectMacro(SourceMenu, vtkKWMenu);
00165   vtkGetObjectMacro(FilterMenu, vtkKWMenu);
00167   
00169   void ResetCameraCallback();
00170   
00172 
00174   void ShowCurrentSourceProperties();
00175   void ShowCurrentSourcePropertiesCallback();
00177 
00179   void ShowAnimationPanes();
00180 
00182 
00183   vtkGetObjectMacro(Toolbar, vtkKWToolbar);
00184   vtkGetObjectMacro(InteractorToolbar, vtkKWToolbar);
00185   vtkGetObjectMacro(PickCenterToolbar, vtkKWToolbar);
00186   vtkGetObjectMacro(LookmarkToolbar, vtkKWToolbar);
00188  
00190 
00191   void SaveBatchScript(const char *filename);
00192   void SaveBatchScript(const char *filename, int offScreenFlag, const char* imageFileName, const char* geometryFileName);
00194   
00196 
00197   void SaveSMState();
00198   void SaveSMState(const char *filename);
00200   
00203   void SaveBatchScript();
00204 
00206   void SaveState(const char *filename);
00207 
00210   void SaveState();
00211 
00213 
00214   void SaveTrace();
00215   int SaveTrace(const char*);
00217   
00219   void OpenCallback();
00220 
00222 
00227   int Open(char *fileName, int store);
00228   int Open(char *fileName) { return this->Open(fileName, 0); }
00230 
00235   int OpenCustom(const char* reader, const char* filename);
00236 
00238 
00243   vtkPVReaderModule* InitializeReadCustom(const char* reader, 
00244                                           const char* fileName);
00245   int FinalizeRead       (vtkPVReaderModule* clone, const char *fileName);
00246   int ReadFileInformation(vtkPVReaderModule* clone, const char *fileName);
00248 
00250   void PlayDemo();
00251 
00253 
00254   void ShowTimerLog();
00255   void ShowErrorLog();
00257 
00259   void ShowComparativeVisManager();
00260  
00262   void SaveAnimation();
00263 
00265   void SaveGeometry();
00266 
00269   void WriteData();
00270   
00272 
00273   void WriteVTKFile(const char* filename, int ghostLevel, int timeSeries);
00274   void WriteVTKFile(const char* filename, int ghostLevel)
00275     { this->WriteVTKFile(filename, ghostLevel, 0); }
00276   void WriteVTKFile(const char* filename)
00277     { this->WriteVTKFile(filename, 0); }
00279 
00281 
00283   vtkPVSource *CreatePVSource(const char *className)
00284     { return this->CreatePVSource(className, 0, 1, 1); }
00285   vtkPVSource *CreatePVSource(const char *className, const char* sourceList)
00286     { return this->CreatePVSource(className, sourceList, 1, 1); }
00287   vtkPVSource *CreatePVSource(const char *className, const char* sourceList,
00288                               int add_trace_entry, int grabFocus);
00290   
00291   //BTX
00293 
00294   vtkGetObjectMacro(CameraStyle3D, vtkPVInteractorStyle);
00295   vtkGetObjectMacro(CameraStyle2D, vtkPVInteractorStyle);
00296   //ETX
00298 
00301   vtkPVSourceCollection *GetSourceList(const char* listname);
00302 
00304   void UpdateSelectMenu();
00305 
00307 
00309   void DisableToolbarButtons();
00310   void EnableToolbarButtons();
00311   void EnableToolbarButton(const char* buttonName);
00312   void DisableToolbarButton(const char* buttonName);
00314 
00316   void UpdateSourceMenu();
00317 
00319   void UpdateFilterMenu();
00320   
00322 
00323   vtkGetObjectMacro(AnimationManager, vtkPVAnimationManager);
00325 
00327   void AddPrototype(const char* name, vtkPVSource* prototype);
00328 
00330 
00331   void AddToolbarButton(const char* buttonName, const char* imageName,
00332                         const char* fileName, const char* command, 
00333                         const char* balloonHelp, int buttonVisibility);
00335 
00337 
00339   vtkSetMacro(UseMessageDialog, int);
00340   vtkGetMacro(UseMessageDialog, int);
00341   vtkBooleanMacro(UseMessageDialog, int);
00343 
00345 
00346   vtkSetMacro(InDemo, int);
00347   vtkGetMacro(InDemo, int);
00349 
00351 
00352   vtkSetMacro(InComparativeVis, int);
00353   vtkGetMacro(InComparativeVis, int);
00355 
00357 
00358   void AddManipulator(const char* type, const char* name, 
00359                       vtkPVCameraManipulator*);
00361   
00363 
00364   void AddManipulatorArgument(const char* type, const char* name, 
00365                               const char* variable, vtkPVWidget* widget);
00367 
00369 
00370   vtkSetMacro(InitializeDefaultInterfaces, int);
00371   vtkGetMacro(InitializeDefaultInterfaces, int);
00372   vtkBooleanMacro(InitializeDefaultInterfaces, int);
00374 
00376 
00378   int OpenPackage();
00379   int OpenPackage(const char* fileName);
00381 
00383 
00384   virtual void LoadScript() { this->Superclass::LoadScript(); }
00385   virtual void LoadScript(const char *name);
00387 
00389 
00390   void MouseAction(int action,int button, int x,int y, int shift,int control);
00391   void Configure(int width, int height);
00392   void KeyAction(char keyCode, int x, int y);
00394 
00396 
00397   void SetInteractorStyle(int iStyle);
00398   int GetInteractorStyle();
00400 
00402   void ChangeInteractorStyle(int index);
00403 
00405 
00406   void CenterEntryOpenCallback();
00407   void CenterEntryCloseCallback();
00408   void CenterEntryCallback();
00409   void ResetCenterCallback();
00410   void ToggleCenterActorCallback();
00412 
00414 
00416   vtkGetObjectMacro(CenterXEntry, vtkKWEntry);
00417   vtkGetObjectMacro(CenterYEntry, vtkKWEntry);
00418   vtkGetObjectMacro(CenterZEntry, vtkKWEntry);
00420 
00422   virtual void WarningMessage(const char* message);
00423   
00425   virtual void ErrorMessage(const char* message);
00426 
00428 
00430   vtkPVColorMap* GetPVColorMap(const char* parameterName, 
00431                                int numberOfComponents);
00433 
00435   vtkPVVolumeAppearanceEditor *GetVolumeAppearanceEditor();
00436   
00438   vtkCollection* GetPVColorMaps();
00439 
00441 
00442   void SetCenterOfRotation(float f[3]) 
00443     { this->SetCenterOfRotation(f[0], f[1], f[2]); }
00444   void SetCenterOfRotation(float x, float y, float z);
00446 
00447   //BTX
00449 
00450   vtkGetObjectMacro(CenterOfRotationStyle, vtkPVInteractorStyleCenterOfRotation);
00451   //ETX
00453   
00455 
00457   void EnableNavigationWindow();
00458   void DisableNavigationWindow();
00460 
00462 
00464   virtual void SetInteractiveRenderEnabled(int s);
00465   vtkBooleanMacro(InteractiveRenderEnabled,int);
00466   vtkGetMacro(InteractiveRenderEnabled,int);
00468 
00470   void ReadSourceInterfacesFromString(const char*);
00471   
00473 
00475   vtkLinkedList<vtkPVReaderModule*>* GetReaderList() { return this->ReaderList; }
00476   //ETX
00478 
00480   virtual vtkKWApplicationSettingsInterface *GetApplicationSettingsInterface();
00481 
00482   //BTX
00484 
00485   void SetInteractor(vtkPVGenericRenderWindowInteractor *iren);
00486   vtkPVGenericRenderWindowInteractor* GetInteractor() {return this->Interactor;}
00487   //ETX
00489 
00490   vtkClientServerID GetInteractorID(){ return this->InteractorID;}
00491 
00494   int CheckIfFileIsReadable(const char* fname);
00495 
00497 
00498   vtkGetObjectMacro(TranslateCameraButton, vtkKWRadioButton);
00499   vtkGetObjectMacro(RotateCameraButton, vtkKWRadioButton);
00500   vtkGetObjectMacro(ResetCameraButton, vtkKWPushButtonWithMenu);
00502   
00504   virtual void UpdateToolbarState();
00505 
00507 
00513   virtual void UpdateEnableState();
00514   virtual void UpdateMenuState();
00515   virtual int GetEnabled();
00517 
00519 
00520   void SetProgress(const char* text, int val);
00521   void StartProgress();
00522   void EndProgress();
00524 
00526 
00527   void SetInteractorEventInformation(int x, int y, int ctrl, int shift,
00528                                      char keycode, int repeatcount,
00529                                      const char *keysym);
00530   void InvokeInteractorEvent(const char *event);
00532 
00534   void AcceptCurrentSource();
00535 
00538   void ToolbarMenuCheckCallback(const char* buttonName);
00539 
00541   void DisplayLookmarkManager();
00542 
00543   vtkGetObjectMacro(PVLookmarkManager, vtkPVLookmarkManager);
00544 
00546 
00548   vtkSetMacro(SaveVisibleSourcesOnlyFlag,int);
00550 
00554   void SetToolbarVisibility(const char* identifier, int state);
00555 
00558   virtual void SetSecondaryPanelVisibility(int);
00559 
00562   void AddDefaultAnimation(vtkPVSource* pvSource);
00563 
00567   void UpdateAnimationInterface();
00568 
00570 
00571   vtkGetObjectMacro(TraceHelper, vtkPVTraceHelper);
00573 
00575   void ErrorIconCallback();
00576     
00578   vtkPVComparativeVisManagerGUI* GetComparativeVisManagerGUI();
00579   
00580 //BTX
00581   enum InteractorStyles
00582   {
00583     INTERACTOR_STYLE_UNKNOWN = 0,
00584     INTERACTOR_STYLE_3D = 1,
00585     INTERACTOR_STYLE_2D = 2,
00586     INTERACTOR_STYLE_TRACKBALL = 3,
00587     INTERACTOR_STYLE_CENTER_OF_ROTATION = 4
00588   };
00589 //ETX
00590 
00592 
00597   virtual void ShowMainUserInterface(const char *name)
00598     { this->Superclass::ShowMainUserInterface(name); }
00600 
00601 protected:
00602   vtkPVWindow();
00603   ~vtkPVWindow();
00604 
00605   static const char* ComparativeVisMenuLabel;
00606 
00607   int OpenWithReader(const char *fileName, vtkPVReaderModule* reader);
00608   vtkPVReaderModule* InitializeRead(vtkPVReaderModule* proto, 
00609                                     const char *fileName);
00611   virtual void SaveWindowGeometryToRegistry();
00612 
00614   virtual void RestorePVWindowGeometry();
00615 
00616   // Main render window
00617   vtkPVRenderView *MainView;
00618 
00619   // Should I move this to vtkPVRenderView?
00620   vtkPVGenericRenderWindowInteractor *Interactor;
00621   //InteractorID is a duplicate of InteractorID in PVRenderModule.
00622   //Need to move the logic for InteractorID to PVRenderModule
00623   vtkClientServerID InteractorID;
00624   
00625   // ParaView specific menus
00626   vtkKWMenu *SourceMenu;
00627   vtkKWMenu *FilterMenu;
00628   vtkKWMenu *SelectMenu;
00629   vtkKWMenu *GlyphMenu;
00630 
00631   vtkPVInteractorStyle *CameraStyle2D;
00632   vtkPVInteractorStyle *CameraStyle3D;
00633 
00634   // This should be made into a 3D Widget.
00635   vtkPVInteractorStyleCenterOfRotation *CenterOfRotationStyle;
00636 
00637   // Interactor stuff
00638   vtkKWToolbar *InteractorToolbar;
00639   vtkKWPushButtonWithMenu *ResetCameraButton;
00640   vtkKWRadioButton *RotateCameraButton;
00641   vtkKWRadioButton *TranslateCameraButton;
00642     
00643   // Main toolbar
00644   vtkKWToolbar* Toolbar;
00645   // This controls button visibility.
00646   vtkKWMenuButton* ToolbarMenuButton;
00647  
00648   // widgets for setting center of rotation for rotate camera interactor style
00649   vtkKWToolbar *PickCenterToolbar;
00650   vtkKWPushButton *PickCenterButton;
00651   vtkKWPushButton *ResetCenterButton;
00652   vtkKWPushButton *HideCenterButton;
00653   vtkKWPushButton *CenterEntryOpenCloseButton;
00654   vtkKWFrame *CenterEntryFrame;
00655   vtkKWLabel *CenterXLabel;
00656   vtkKWEntry *CenterXEntry;
00657   vtkKWLabel *CenterYLabel;
00658   vtkKWEntry *CenterYEntry;
00659   vtkKWLabel *CenterZLabel;
00660   vtkKWEntry *CenterZEntry;
00661     
00662   void ResizeCenterActor();
00663   
00664   // Used internally.  Down casts vtkKWApplication to vtkPVApplication
00665   vtkPVApplication *GetPVApplication();
00666 
00667   // Separating out creation of the main view.
00668   void CreateMainView(vtkPVApplication *pvApp);
00669   
00672   virtual void PrepareForDelete();
00673 
00674   vtkPVSource *CurrentPVSource;
00675 
00676   // The animation interface. I put it in window because
00677   // if we ever get more that one renderer, the animation
00678   // will save out the window with all renderers.
00679   vtkPVAnimationManager* AnimationManager;
00680 
00681   // Initialization methods called from create.
00682   void InitializeMenus(vtkKWApplication* app);
00683   void InitializeInteractorInterfaces(vtkKWApplication* app);
00684 
00685   vtkPVTimerLogDisplay *TimerLogDisplay;
00686   vtkPVErrorLogDisplay *ErrorLogDisplay;
00687 
00691   void CreateComparativeVisManagerGUI();
00692 
00693   // Extensions of files that loaded readers recognize.
00694   char *FileExtensions;
00695   char *FileDescriptions;
00696   // Add a file type and the corresponding prototype
00697   void AddFileType(const char* description, const char* ext, 
00698                    vtkPVReaderModule* prototype);
00699 
00700   // Read interface description from XML.
00701   void ReadSourceInterfaces();
00702   void ReadSourceInterfacesFromFile(const char*);
00703   int ReadSourceInterfacesFromDirectory(const char*);
00704 
00705   // Add a file writer.
00706   void AddFileWriter(vtkPVWriter* writer);  
00707   
00708   // Helper for WriteVTKFile() and WritePVTKFile().
00709   vtkPVWriter* FindPVWriter(const char* fileName, int parallel, int numParts); 
00710 
00711 //BTX
00712   vtkArrayMap<const char*, vtkPVSource*>* Prototypes;
00713   vtkArrayMap<const char*, vtkPVSourceCollection*>* SourceLists;
00714   vtkArrayMap<const char*, vtkKWPushButton*>* ToolbarButtons;
00715   vtkArrayMap<const char*, const char*>* Writers;
00716   vtkArrayMap<const char*, int>* MenuState;
00717   vtkLinkedList<vtkPVReaderModule*>* ReaderList;
00718   vtkLinkedList<const char*>* PackageFiles;
00719   vtkLinkedList<vtkPVWriter*>* FileWriterList;
00720 
00721   friend class vtkPVXMLPackageParser;
00722 //ETX
00723 
00724   vtkCollection *PVColorMaps;
00725 
00726   vtkPVVolumeAppearanceEditor *VolumeAppearanceEditor;
00727   
00728   // This can be used to disable the pop-up dialogs if necessary
00729   // (usually used from inside regression scripts)
00730   int UseMessageDialog;
00731 
00732   // Whether or not to read the default interfaces.
00733   int InitializeDefaultInterfaces;
00734 
00739   const char* ExtractFileExtension(const char* fname);
00740 
00742   void CreateErrorLogDisplay();
00743 
00744   void HideCenterActor();
00745   void ShowCenterActor();
00746 
00747   int CenterActorVisibility;
00748 
00749   int InteractiveRenderEnabled;
00750 
00752   virtual void UpdateStatusImage();
00753 
00754   // To avoid disabling menus multiple times.
00755   int MenusDisabled;
00756   int ToolbarButtonsDisabled;
00757 
00758   int InDemo;
00759   int InComparativeVis;
00760 
00761   double LastProgress;
00762   int ExpectProgress;
00763   int ModifiedEnableState;
00764 
00765   vtkClientServerID ServerFileListingID;
00766 
00767   vtkSMAxesProxy *CenterAxesProxy; 
00768   char* CenterAxesProxyName;
00769   vtkSetStringMacro(CenterAxesProxyName);
00770 
00771   vtkPVTraceHelper* TraceHelper;
00772 
00773   int SaveVisibleSourcesOnlyFlag;
00774 
00775   vtkKWToolbar *LookmarkToolbar;
00776   vtkKWPushButton *LookmarkButton;
00777   vtkPVLookmarkManager *PVLookmarkManager;
00778 
00782   virtual void ShowMainUserInterface(vtkKWUserInterfacePanel *panel);
00783 
00784 private:
00785   vtkPVComparativeVisManagerGUI* ComparativeVisManagerGUI;
00786 
00787   vtkPVWindow(const vtkPVWindow&); // Not implemented
00788   void operator=(const vtkPVWindow&); // Not implemented
00789 };
00790 
00791 
00792 #endif

Generated on Tue May 30 12:31:41 2006 for ParaView by doxygen 1.3.5