Salome HOME
Pipe validator fix
[modules/shaper.git] / src / PartSet / PartSet_SketcherMgr.h
index 3b0a868c93e5f57cb9ab896b1a204cc23eaba857..062bd102f2f876701d1ed66fb20dd2f48a18e43b 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "PartSet.h"
 
+#include "PartSet_Filters.h"
 #include "PartSet_Tools.h"
 
 #include <ModelAPI_Feature.h>
@@ -32,6 +33,10 @@ class ModuleBase_IViewWindow;
 class ModuleBase_ModelWidget;
 class ModuleBase_Operation;
 class XGUI_OperationMgr;
+class XGUI_Workshop;
+
+class Handle_AIS_InteractiveObject;
+
 class QMouseEvent;
 
 /**
@@ -140,9 +145,14 @@ public:
   /// \param theOperation a committed operation
   void commitNestedSketch(ModuleBase_Operation* theOperation);
 
+  /// Append the sketch plane filter into the current viewer
+  /// \param toActivate state whether the filter should be activated/deactivated
+  void activatePlaneFilter(const bool& toActivate);
+
   /// Commit the operation if it is possible. If the operation is dimention constraint,
   /// it gives widget editor to input dimention value
-  void operationActivatedByPreselection();
+  /// \return true if the operation is stopped after activation
+  bool operationActivatedByPreselection();
 
   /// Returns True if there are available Undos and the sketch manager allows undo
   /// \return the boolean result
@@ -167,6 +177,21 @@ public:
   /// \param theObject a model object
   bool canDisplayObject(const ObjectPtr& theObject) const;
 
+  /// Returns whether the constraint object can be displayed. It depends on the sketch check
+  /// box states
+  /// \param theObject a model object
+  /// \param theState the constraint visible state state to be checked
+  /// \param isProcessed an output parameter if it is processed
+  /// \return result value
+  bool canDisplayConstraint(const FeaturePtr& theObject,
+                            const PartSet_Tools::ConstraintVisibleState& theState,
+                            bool& isProcessed) const;
+
+  /// Check the given objects either there are some results of the current sketch. If so,
+  /// it suggests to delete them as there are no functionality to show back hidden sketch objects
+  /// \param theObjects a list of hidden objects
+  virtual void processHiddenObject(const std::list<ObjectPtr>& theObjects);
+
   /// Returns true if the mouse is over viewer or property panel value is changed
   /// \return boolean result
   bool canDisplayCurrentCreatedFeature() const;
@@ -215,6 +240,11 @@ public:
   /// \param theModes a list of modes
   static void sketchSelectionModes(QIntList& theModes);
 
+  /// Create specific for the module presentation
+  /// \param theResult an object for presentation
+  /// \return created presentation or NULL(default value)
+  virtual Handle_AIS_InteractiveObject createPresentation(const ResultPtr& theResult);
+
   /// Connects or disconnects to the value changed signal of the property panel widgets
   /// \param theWidget a property contol widget
   /// \param isToConnect a boolean value whether connect or disconnect
@@ -224,14 +254,24 @@ public:
   /// \param thePreviousState the previous widget value state
   void widgetStateChanged(int thePreviousState);
 
+  /// If the current operation is a dimention one, the style of dimension visualization is send for
+  /// the current object
+  /// \param theObject an object to be customized
+  void customizePresentation(const ObjectPtr& theObject);
+
+  /// Update sketch presentations according to the the state
+  /// \param theType a type of sketch visualization style
+  /// \param theState a boolean state
+  void updateBySketchParameters(const PartSet_Tools::ConstraintVisibleState& theType,
+                                bool theState);
+
 public slots:
   /// Process sketch plane selected event
   void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
 
-  /// Toggle show constraints
-  void onShowConstraintsToggle(bool theState, int theType);
-
 private slots:
+  /// Toggle show constraints
+  void onShowConstraintsToggle(int theType, bool theState);
   /// Process the enter mouse to the view port. If the current operation is a create of
   /// a nested sketch feature, it updates internal flags to display the feature on mouse move
   void onEnterViewPort();
@@ -262,6 +302,12 @@ private:
   void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent, 
                   Point& thePoint);
 
+  /// Show distance value editor if it is a distance operation and all attribute references
+  /// are filled by preseletion
+  /// \return true if the value is accepted
+  static bool setDistanceValueByPreselection(ModuleBase_Operation* theOperation,
+                                             ModuleBase_IWorkshop* theWorkshop);
+
   typedef QMap<FeaturePtr, std::pair<std::set<AttributePtr>, std::set<ResultPtr> > >
                                                                        FeatureToSelectionMap;
 
@@ -316,6 +362,9 @@ private:
                         const bool isToDisplay, const bool isFlushRedisplay = true);
 
 private:
+  /// Returns current workshop
+  XGUI_Workshop* workshop() const;
+  /// Returns operation manager
   XGUI_OperationMgr* operationMgr() const;
 
 private:
@@ -332,6 +381,7 @@ private:
 
   CompositeFeaturePtr myCurrentSketch;
 
+  Handle(PartSet_CirclePointFilter) myCirclePointFilter;
   Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter;
   FeatureToSelectionMap myCurrentSelection;
   bool myPreviousUpdateViewerEnabled;