// PARAVIS : ParaView wrapper SALOME module
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2010-2015 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : PVGUI_Module.h
-// Author : Sergey ANIKIN
+// Author : Sergey ANIKIN, Adrien BRUNETON
//
#define PVGUI_Module_H
#include <SalomeApp_Module.h>
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(PVSERVER_Gen)
#include <ostream>
+#include <vtkType.h>
+#include <QTimer>
+
+#include <pqVariableType.h>
class QMenu;
class QDockWidget;
class vtkPVMain;
class pqOptions;
class pqServer;
-class pqViewManager;
class pqMainWindowCore;
+class vtkEventQtSlotConnect;
+class pqPythonScriptEditor;
+class pqPVApplicationCore;
+class pqDataRepresentation;
+class pqRepresentation;
+class PVViewer_GUIElements;
+class PVViewer_EngineWrapper;
class PVGUI_Module : public SalomeApp_Module
{
//! Menu actions
enum { // Menu "File"
- OpenFileId,
-
- LoadStateId,
- SaveStateId,
-
- SaveDataId,
- SaveScreenshotId,
- ExportId,
-
- SaveAnimationId,
- SaveGeometryId,
-
- ConnectId,
- DisconnectId,
-
- // Menu "Edit"
- UndoId,
- RedoId,
-
- CameraUndoId,
- CameraRedoId,
-
- ChangeInputId,
- IgnoreTimeId,
- DeleteId,
- DeleteAllId,
-
- //InteractId,
- //SelectCellsOnId,
- //SelectPointsOnId,
- //SelectCellsThroughId,
- //SelectPointsThroughId,
- //SelectBlockId,
-
- SettingsId,
- ViewSettingsId,
-
- // Menu "View"
- FullScreenId,
-// ResetCameraId,
-// PositiveXId,
-// NegativeXId,
-// PositiveYId,
-// NegativeYId,
-// PositiveZId,
-// NegativeZId,
-//
-// ShowCenterId,
-// ResetCenterId,
-// PickCenterId,
-// ShowColorLegendId,
-// EditColorMapId,
-// ResetRangeId,
-//
-// AnimationInspectorId,
-// AnimationViewId,
-// ComparativeViewInspectorId,
-// SelectionInspectorId,
-// LookmarkBrowserId,
-// LookmarkInspectorId,
-// ObjectInspectorId,
-// PipelineBrowserId,
-// StatisticsViewId,
-
- // Menu "Sources"
- // TODO...
-
- // Menu "Filters"
- // TODO...
-
- // Menu "Animation"
- FirstFrameId,
- PreviousFrameId,
- PlayId,
- NextFrameId,
- LastFrameId,
- LoopId,
-
- // Menu "Tools"
- CreateCustomFilterId,
- ManageCustomFiltersId,
- CreateLookmarkId,
- ManageLinksId,
- AddCameraLinkId,
- ManagePluginsExtensionsId,
- DumpWidgetNamesId,
- RecordTestId,
- RecordTestScreenshotId,
- PlayTestId,
- MaxWindowSizeId,
- TimerLogId,
- OutputWindowId,
- PythonShellId,
-
- // Menu "Help"
- AboutParaViewId,
- ParaViewHelpId,
- EnableTooltipsId
+ OpenFileId,
+
+ LoadStateId,
+ SaveStateId,
+
+ SaveDataId,
+ SaveScreenshotId,
+ ExportId,
+
+ SaveAnimationId,
+ SaveGeometryId,
+
+ ConnectId,
+ DisconnectId,
+
+ // Menu "Edit"
+ UndoId,
+ RedoId,
+
+ CameraUndoId,
+ CameraRedoId,
+
+ FindDataId,
+ ChangeInputId,
+ IgnoreTimeId,
+ DeleteId,
+ DeleteAllId,
+
+ SettingsId,
+ ViewSettingsId,
+
+ // Menu "View"
+ FullScreenId,
+
+ // Menu "Animation"
+ FirstFrameId,
+ PreviousFrameId,
+ PlayId,
+ NextFrameId,
+ LastFrameId,
+ LoopId,
+
+ // Menu "Tools"
+ CreateCustomFilterId,
+ ManageCustomFiltersId,
+ CreateLookmarkId,
+ ManageLinksId,
+ AddCameraLinkId,
+ ManagePluginsExtensionsId,
+ DumpWidgetNamesId,
+ RecordTestId,
+ RecordTestScreenshotId,
+ PlayTestId,
+ MaxWindowSizeId,
+ CustomWindowSizeId,
+ TimerLogId,
+ OutputWindowId,
+ PythonShellId,
+ ShowTraceId,
+ RestartTraceId,
+
+ // Menu "Help"
+ AboutParaViewId,
+ ParaViewHelpId,
+ EnableTooltipsId,
+
+ // Menu "Window" - "New Window"
+ ParaViewNewWindowId,
+
+ // "Save state" ParaVis module root object popup
+ SaveStatePopupId,
+
+ // "Add state" and "Reload state" popups
+ AddStatePopupId,
+ CleanAndAddStatePopupId,
+
+ // "Rename" and "Delete" popups (Object Browser)
+ ParaVisRenameId,
+ ParaVisDeleteId
};
public:
virtual void initialize( CAM_Application* );
virtual void windows( QMap<int, int>& ) const;
- pqViewManager* getMultiViewManager() const;
-
- virtual QString engineIOR() const;
-
- /*! Compares the contents of the window with the given reference image,
- * returns true if they "match" within some tolerance
- */
- /*bool compareView( const QString& ReferenceImage, double Threshold,
- std::ostream& Output, const QString& TempDirectory );*/
+ virtual QString engineIOR() const; // to be removed when becoming Light
void openFile(const char* theName);
+ void executeScript(const char *script);
void saveParaviewState(const char* theFileName);
void loadParaviewState(const char* theFileName);
+ void clearParaviewState();
QString getTraceString();
+ void startTrace();
+ void stopTrace();
void saveTrace(const char* theName);
pqServer* getActiveServer();
virtual void createPreferences();
+ virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
+
+ inline static PVViewer_EngineWrapper * GetEngine();
+ inline static PVSERVER_ORB::PVSERVER_Gen_var GetCPPEngine(); // to be removed once light!
+ inline static pqPVApplicationCore * GetPVApplication();
+
+ virtual CAM_DataModel* createDataModel();
+ void fixAnimationScene();
+
public slots:
- void onImportFromVisu(QString theEntry);
+ //void onImportFromVisu(QString theEntry);
private:
- //! Initialize ParaView if not yet done (once per session)
- static bool pvInit();
+ void deleteTemporaryFiles();
//! Create actions for ParaView GUI operations
void pvCreateActions();
//! Returns QMenu object for a given menu id
QMenu* getMenu( const int );
-
- void deleteTemporaryFiles();
- QList<QToolBar*> getParaViewToolbars();
+ //! Discover help project files from the resources.
+ QString getHelpFileName();
+
+ //! Create actions for ParaViS
+ void createActions();
+
+ //! Create menus for ParaViS
+ void createMenus();
+
+ //! Load selected state
+ void loadSelectedState(bool toClear);
+
+ //! Get list of embedded macros files
+ QStringList getEmbeddedMacrosList();
+
+ //! update macros state
+ void updateMacros();
+
+ //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
+ void storeCommonWindowsState();
+
+ //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
+ void restoreCommonWindowsState();
private slots:
- void showHelpForProxy( const QString& proxy );
+ void showHelpForProxy( const QString&, const QString& );
void onPreAccept();
void onPostAccept();
void endWaitCursor();
- void activateTrace();
+ // void buildToolbarsMenu();
+
+ //void showParaViewHelp();
+ //void showHelp(const QString& url);
- void buildToolbarsMenu();
+ void onDataRepresentationUpdated();
- void showParaViewHelp();
- void showHelp(const QString& url);
+ void onStartProgress();
+ void onEndProgress();
+ void onShowTrace();
+ void onRestartTrace();
+
+// void onNewParaViewWindow();
+
+ void onSaveMultiState();
+ void onAddState();
+ void onCleanAddState();
+
+ void onRename();
+ void onDelete();
public slots:
virtual bool activateModule( SUIT_Study* );
virtual bool deactivateModule( SUIT_Study* );
virtual void onApplicationClosed( SUIT_Application* );
+ virtual void studyClosed( SUIT_Study* );
-private:
- class pqImplementation;
- pqImplementation* Implementation;
+protected slots:
+ virtual void onModelOpened();
+ virtual void onPushTraceTimer();
+ virtual void onInitTimer();
+private:
int mySelectionControlsTb;
int mySourcesMenuId;
int myFiltersMenuId;
int myToolbarsMenuId;
int myMacrosMenuId;
+ int myRecentMenuId;
+
+ typedef QMap<QWidget*, bool> WgMap;
+ WgMap myDockWidgets;
+ WgMap myToolbars;
+ WgMap myToolbarBreaks;
+ QList<QMenu*> myMenus;
- QList<QDockWidget*> myDockWidgets;
+ typedef QMap<int, bool> DockWindowMap;
+ DockWindowMap myCommonMap;
QStringList myTemporaryFiles;
- QMap<QToolBar*, bool> myToolbarState;
-
QtMsgHandler myOldMsgHandler;
+
+ vtkEventQtSlotConnect *VTKConnect;
+
+ pqPythonScriptEditor* myTraceWindow;
+
+ int myStateCounter;
+
+ //! Single shot timer used to connect to the PVServer, and start the trace.
+ QTimer * myInitTimer;
+
+ //! Timer used to regularly push the Python trace to the engine.
+ QTimer * myPushTraceTimer;
+
+ PVViewer_GUIElements * myGuiElements;
+
+ static PVSERVER_ORB::PVSERVER_Gen_var MyEngine;
+
};
#endif // PVGUI_Module_H