Salome HOME
Merge commit 'f709219506b7cd587e94abc5ebed18d629df92d8'
[modules/shaper.git] / src / XGUI / XGUI_Workshop.h
old mode 100755 (executable)
new mode 100644 (file)
index 8267dff..aa12b95
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef XGUI_WORKSHOP_H
 
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_ResultBody.h>
 
 #include <ModuleBase_ActionInfo.h>
 #include <ModuleBase_ActionType.h>
 #include <ModuleBase_Definitions.h>
 
+#include <SelectMgr_ListOfFilter.hxx>
+
 #include <QIcon>
 #include <QObject>
 #include <QKeySequence>
 #include <QMap>
+#include <QTemporaryDir>
 
 #ifndef HAVE_SALOME
 class AppElements_Command;
@@ -57,9 +60,11 @@ class XGUI_OperationMgr;
 class XGUI_PropertyPanel;
 class XGUI_SalomeConnector;
 class XGUI_SalomeViewer;
+class XGUI_SelectionActivate;
 class XGUI_SelectionMgr;
 class XGUI_ViewerProxy;
 class XGUI_WorkshopListener;
+class XGUI_InspectionPanel;
 
 class ModuleBase_IModule;
 class ModuleBase_IViewer;
@@ -103,6 +108,9 @@ Q_OBJECT
   /// Returns selection manager object
   XGUI_SelectionMgr* selector() const { return mySelector; }
 
+  /// Returns selection activating object
+  XGUI_SelectionActivate* selectionActivate() const { return mySelectionActivate; }
+
   /// Returns displayer
   XGUI_Displayer* displayer() const { return myDisplayer; }
 
@@ -124,6 +132,9 @@ Q_OBJECT
   /// Returns property panel widget
   XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
 
+  /// Returns property panel widget
+  XGUI_InspectionPanel* inspectionPanel() const { return myInspectionPanel; }
+
   /// Returns panel for hide object faces
   XGUI_FacesPanel* facesPanel() const { return myFacesPanel; }
 
@@ -175,7 +186,10 @@ Q_OBJECT
   bool canMoveFeature();
 
   /// Move selected features to be after the current feature
-  void moveObjects();
+  void moveObjects(const bool theSplit);
+
+  /// Start a "Recover" feature on the selected one
+  void recoverFeature();
 
   /// Returns true if the object can be shaded. If the object is a compsolid result, the method
   /// checks subobjects of the result
@@ -192,6 +206,11 @@ Q_OBJECT
   /// theObjects a list of selected objects
   void changeColor(const QObjectPtrList& theObjects);
 
+  /// Change Autocolor of the results if it is possible
+  /// The operation is available for group results
+  /// theObjects a list of selected objects
+  void changeAutoColor(const QObjectPtrList& theObjects);
+
   /// Change deflection of the results if it is possible
   /// The operation is available for construction, body and group results
   /// theObjects a list of selected objects
@@ -202,6 +221,10 @@ Q_OBJECT
   /// theObjects a list of selected objects
   void changeTransparency(const QObjectPtrList& theObjects);
 
+  /// Change number of iso-lines for the given objects
+  /// theObjects a list of selected objects
+  void changeIsoLines(const QObjectPtrList& theObjects);
+
   /// Show the given features in 3d Viewer
   void showObjects(const QObjectPtrList& theList, bool isVisible);
 
@@ -213,6 +236,12 @@ Q_OBJECT
   /// \param theMode a mode to set (see \ref XGUI_Displayer)
   void setDisplayMode(const QObjectPtrList& theList, int theMode);
 
+  /// Toggle visualisation of edges direction
+  void toggleEdgesDirection(const QObjectPtrList& theList);
+
+  /// Toggle state of display priority (normal/in front)
+  void toggleBringToFront(const QObjectPtrList& theList);
+
   /// Set selection mode in viewer. If theMode=-1 then activate default mode
   /// \param theMode the selection mode (according to TopAbs_ShapeEnum)
   void setViewerSelectionMode(int theMode);
@@ -223,11 +252,11 @@ Q_OBJECT
   /// Returns current module
   ModuleBase_IModule* module() const { return myModule; }
 
-  /// Returns current directory which contains data files
-  QString currentDataDir() const { return myCurrentDir; }
+  /// Returns current file
+  QString currentDataFile() const { return myCurrentFile; }
 
-  /// Returns current directory which contains data files
-  void setCurrentDataDir(const QString& theDir) { myCurrentDir = theDir; }
+  /// Returns current file
+  void setCurrentDataFile(const QString& theDir) { myCurrentFile = theDir; }
 
   /// Save the current document into a directory
   /// \param theName - path to the directory
@@ -271,12 +300,12 @@ Q_OBJECT
   /// Has to be called in order to display objects from a specifed group
   /// with visibility status = true
   /// \param theDoc the document for objects synchronisation
-  /// \param theGroup the group name
   /// \param theUpdateViewer update viewer flag
   void synchronizeGroupInViewer(const DocumentPtr& theDoc,
-                                const std::string& theGroup,
                                 bool theUpdateViewer);
 
+  void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer);
+
 #endif
   /// Update the property panel content by the XML description of the operation and set the panel
   /// into the operation
@@ -305,10 +334,25 @@ Q_OBJECT
   /// A constant string used for "Move to end" command definition
   /// It is used for specific processing of Undo/Redo for this command.
   static QString MOVE_TO_END_COMMAND;
+  /// A constant string used for "Move to end and split" command definition
+  /// It is used for specific processing of Undo/Redo for this command.
+  static QString MOVE_TO_END_SPLIT_COMMAND;
 
   /// Closes all in the current session and load the directory
   /// \param theDirectory a path to directory
-  void openDirectory(const QString& theDirectory);
+  void openFile(const QString& theDirectory);
+
+  void updateAutoComputeState();
+
+  void deactivateCurrentSelector();
+
+  /// The method updates a Color Scale object in the viewer
+  void updateColorScaleVisibility();
+
+  /// The method updates a Text of Group names in the viewer.
+  void updateGroupsText();
+
+  void showHelpPage(const QString& thePage) const;
 
 signals:
   /// Emitted when selection happens in Salome viewer
@@ -377,6 +421,21 @@ signals:
   /// Create a new document
   void onNew();
 
+  /// Import part structure from a file
+  void onImportPart();
+
+  /// Import shape from a file
+  void onImportShape();
+
+  /// Import  image from a file
+  void onImportImage();
+
+  /// Export features to a file
+  void onExportPart();
+
+  /// Export a shape to a file
+  void onExportShape();
+
 #ifndef HAVE_SALOME
   /// Exit application
   void onExit();
@@ -385,20 +444,20 @@ signals:
   void onPreferences();
 #endif
 
+  /// A slot calleon toggle of auto-compute button
+  void onAutoApply();
+
   /// Activates/deactivates the trihedron in the viewer AIS context
   void onTrihedronVisibilityChanged(bool theState);
 
   /// Apply the current transparency value if preview in transparency dialog is switched on
   void onTransparencyValueChanged();
 
-  /// Switch on/off preview of transparency change
-  void onPreviewStateChanged();
-
  protected:
   /// Sets the granted operations for the parameter operation. Firstly, it finds the nested features
   /// and set them into the operation. Secondly, it asks the module about ids of granted operations.
   /// \param theOperation an operation
-   void setGrantedFeatures(ModuleBase_Operation* theOperation);
+  void setGrantedFeatures(ModuleBase_Operation* theOperation);
 
 private:
   /// Display results from document
@@ -448,10 +507,20 @@ private:
   /// the operation can be committed and do it if it returns true.
   void onAcceptActionClicked();
 
+  /// Called by OkPlus button clicked in the property panel. Asks the error manager whether
+  /// the operation can be committed and do it if it returns true.
+  void onAcceptPlusActionClicked();
+
   /// Called by Preview button clicked in the property panel. Sends signal to model to
   /// compute preview.
   void onPreviewActionClicked();
 
+  /// Called on help button clicked in the property panel.
+  void onHelpActionClicked() const;
+
+  //! The slot is called only once on resizing of Object Browser
+  void onDockSizeChanged();
+
  private:
   /// Init menu
   void initMenu();
@@ -470,15 +539,11 @@ private:
   /// \param theParent a parent of widget
   QDockWidget* createObjectBrowser(QWidget* theParent);
 
-  /// Create property panel widget
-  /// \param theParent a parent of widget
-  QDockWidget* createPropertyPanel(QWidget* theParent);
-
   // Creates Dock widgets: Object browser and Property panel
   void createDockWidgets();
 
   /// Extends undo/redo toolbutton's with history menu
-  /// \param theObject - in the OpenParts it is a QToolButton by itself,
+  /// \param theObject - in the CADBuilder it is a QToolButton by itself,
   /// in salome mode - QAction that creates a button.
   /// \param theSignal - void "updateUndoHistory" or "updateRedoHistory" SIGNAL;
   /// \param theSlot - onUndo(int) or onRedo(int) SLOT
@@ -492,6 +557,13 @@ private:
   /// \param theTimes number of applies the given action
   void processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes);
 
+  /// Clear content of temporary directory
+  void clearTemporaryDir();
+
+  /// Set current point of view normal to selected planar face
+  /// \param toInvert invert the normal vector
+  void setNormalView(bool toInvert = false);
+
 private:
 #ifndef HAVE_SALOME
   AppElements_MainWindow* myMainWindow; ///< desktop window
@@ -503,6 +575,7 @@ private:
   XGUI_PropertyPanel* myPropertyPanel; ///< container of feature attributes widgets
   XGUI_FacesPanel* myFacesPanel; ///< panel for hide object faces
   XGUI_SelectionMgr* mySelector; ///< handler of selection processing
+  XGUI_SelectionActivate* mySelectionActivate; /// manager of selection activating
   XGUI_Displayer* myDisplayer; ///< handler of objects display
   XGUI_OperationMgr* myOperationMgr;  ///< manager to manipulate through the operations
   XGUI_ActionsMgr* myActionsMgr; ///< manager of workshop actions
@@ -514,9 +587,11 @@ private:
   XGUI_ContextMenuMgr* myContextMenuMgr; ///< manager of context menu build
   XGUI_ModuleConnector* myModuleConnector; ///< implementation of ModuleBase_IWorkshop
   XGUI_WorkshopListener* myEventsListener; ///< processing of events
-  QString myCurrentDir; ///< cached the last open directory
+  QString myCurrentFile; ///< cached the last open directory
   QIntList myViewerSelMode; ///< selection modes set in the viewer
   Config_DataModelReader* myDataModelXMLReader; ///< XML reader of data model
+  XGUI_InspectionPanel* myInspectionPanel; ///< container of feature attributes widgets
+  QTemporaryDir myTmpDir; ///< a direcory for uncompressed files
 };
 
 #endif