Salome HOME
Issue #251. Append Export/Import NewGeom commands in the SALOME desktop.
[modules/shaper.git] / src / PartSet / PartSet_Module.h
index d0698530717639ee7386beb0b993802fa3cd6525..a3a188ad0347ff9a10f376b7bc06d3f382f84928 100644 (file)
@@ -5,8 +5,10 @@
 
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_Definitions.h>
+#include <ModuleBase_ViewerFilters.h>
 #include <XGUI_Command.h>
 #include <ModelAPI_Feature.h>
+#include <StdSelect_FaceFilter.hxx>
 
 #include <QMap>
 #include <QObject>
@@ -15,8 +17,6 @@
 
 #include <boost/shared_ptr.hpp>
 
-class QMouseEvent;
-class QKeyEvent;
 class PartSet_Listener;
 class ModelAPI_Feature;
 class XGUI_ViewerPrs;
@@ -44,11 +44,6 @@ Q_OBJECT
   /// \param theCmdId the operation name
   //virtual void launchOperation(const QString& theCmdId);
 
-  /// Activates the feature in the displayer
-  /// \param theFeature the feature instance to be displayed
-  /// \param isUpdateViewer the flag whether the viewer should be updated
-  void activateFeature(ObjectPtr theFeature, const bool isUpdateViewer);
-
   /// Updates current operation preview, if it has it.
   /// \param theCmdId the operation name
   void updateCurrentPreview(const std::string& theCmdId);
@@ -60,6 +55,10 @@ Q_OBJECT
 
   XGUI_Workshop* xWorkshop() const;
 
+
+  /// Returns list of selection modes for the given object for sketch operation
+  static QIntList sketchSelectionModes(ObjectPtr theFeature);
+
  public slots:
   void onFeatureTriggered();
   /// SLOT, that is called after the operation is started. Connect on the focus activated signal
@@ -69,26 +68,6 @@ Q_OBJECT
   void onOperationStopped(ModuleBase_Operation* theOperation);
   /// SLOT, that is called afetr the popup menu action clicked.
   void onContextMenuCommand(const QString& theId, bool isChecked);
-  /// SLOT, that is called by mouse press in the viewer.
-  /// The mouse released point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMousePressed(QMouseEvent* theEvent);
-  /// SLOT, that is called by mouse release in the viewer.
-  /// The mouse released point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMouseReleased(QMouseEvent* theEvent);
-  /// SLOT, that is called by mouse move in the viewer.
-  /// The mouse moved point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMouseMoved(QMouseEvent* theEvent);
-
-  /// SLOT, that is called by the key in the viewer is clicked.
-  /// \param theEvent the mouse event
-  void onKeyRelease(QKeyEvent* theEvent);
-
-  /// SLOT, that is called by the mouse double click in the viewer.
-  /// \param theEvent the mouse event
-  void onMouseDoubleClick(QMouseEvent* theEvent);
 
   /// SLOT, to apply to the current viewer the operation
   /// \param theX the X projection value
@@ -114,8 +93,9 @@ Q_OBJECT
   /// \param theFeatures a list of features to be selected
   void onSetSelection(const QList<ObjectPtr>& theFeatures);
 
-  /// SLOT, to close the viewer local context
-  void onCloseLocalContext();
+  /// SLOT, Defines Sketch editing mode
+  /// \param thePln - plane of current sketch
+  void setSketchingMode(const gp_Pln& thePln);
 
   /// SLOT, to visualize the feature in another local context mode
   /// \param theFeature the feature to be put in another local context mode
@@ -127,6 +107,36 @@ Q_OBJECT
   /// \param the attribute of the feature
   void onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute);
 
+  /// Called when sketch is launched
+  void onSketchLaunched();
+
+protected slots:
+  /// Called on selection changed event
+  virtual void onSelectionChanged();
+
+  /// SLOT, that is called by mouse press in the viewer.
+  /// The mouse released point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMousePressed(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by mouse release in the viewer.
+  /// The mouse released point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMouseReleased(QMouseEvent* theEvent);
+  
+  /// SLOT, that is called by mouse move in the viewer.
+  /// The mouse moved point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMouseMoved(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by the mouse double click in the viewer.
+  /// \param theEvent the mouse event
+  virtual void onMouseDoubleClick(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by the key in the viewer is clicked.
+  /// \param theEvent the mouse event
+  virtual void onKeyRelease(QKeyEvent* theEvent);
+
  protected:
   /// Creates a new operation
   /// \param theCmdId the operation name
@@ -139,11 +149,16 @@ Q_OBJECT
   //! Edits the feature
   void editFeature(FeaturePtr theFeature);
 
+  gp_Pln getSketchPlane(FeaturePtr theSketch) const;
+
  private:
   //XGUI_Workshop* myWorkshop;
   PartSet_Listener* myListener;
 
   std::map<std::string, std::string> myFeaturesInFiles;
+
+  Handle(StdSelect_FaceFilter) myPlaneFilter;
+  Handle(ModuleBase_ShapeInPlaneFilter) mySketchFilter;
 };
 
 #endif