Salome HOME
Issue #1343. Improvement of Extrusion and Revolution operations: Bug correction:...
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.h
index ff6689d1cb74bc333cb99596c50cdf544cb3581f..4e8ccd1b11b6d2fb5c44a21ea5e0c32f90d35ecf 100644 (file)
 #include <ModuleBase_WidgetValidated.h>
 #include <ModuleBase_ViewerFilters.h>
 
-#include <GeomAPI_Pnt.h>
 #include <GeomAPI_Dir.h>
-#include <GeomAPI_AISObject.h>
 
 #include <TopoDS_Shape.hxx>
 
 #include <QMap>
 
+class PartSet_PreviewPlanes;
+
 class QLabel;
 class XGUI_OperationMgr;
 class XGUI_Workshop;
 class QCheckBox;
 class QStackedWidget;
 
-/// the plane edge width
-#define SKETCH_WIDTH        "4"
-
-/// face of the square-face displayed for selection of general plane
-#define PLANE_SIZE          "200"
-
 /**
 * \ingroup Modules
 * A model widget implementation for a label which provides specific behaviour 
@@ -79,6 +73,8 @@ public:
   virtual void setHighlighted(bool) { /*do nothing*/ };
   virtual void enableFocusProcessing();
 
+  static bool canFillSketch(const ModuleBase_ViewerPrs& thePrs);
+
   static bool fillSketchPlaneBySelection(const FeaturePtr& theFeature,
                                          const ModuleBase_ViewerPrs& thePrs);
 
@@ -133,6 +129,15 @@ protected:
   virtual void blockAttribute(const bool& theToBlock, bool& isFlushesActived,
                               bool& isAttributeSetInitializedBlocked);
 
+  /// Set the given wrapped value to the current widget
+  /// This value should be processed in the widget according to the needs
+  /// The method is called by the current operation to process the operation preselection.
+  /// It is redefined to do nothing if the plane of the sketch has been already set.
+  /// \param theValues the wrapped selection values
+  /// \param theToValidate a validation flag
+  bool setSelectionInternal(const QList<ModuleBase_ViewerPrs>& theValues,
+                            const bool theToValidate);
+
   /// Erase preview planes, disconnect widget, change the view projection
   /// \param thePrs a selected presentation
   void updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs);
@@ -153,33 +158,15 @@ protected:
   void onShowConstraint(bool theOn);
 
  private:
-   /// Create preview of planes for sketch plane selection
-   /// \param theOrigin an origin of the plane
-   /// \param theNorm a normal vector of the plane
-   /// \param theRGB a color of plane presentation [r, g, b] array
-  AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin, 
-                                  std::shared_ptr<GeomAPI_Dir> theNorm, 
-                                  const int theRGB[3]);
-
-  //! Returns workshop
-  XGUI_Workshop* workshop() const;
-
   /// Set sketch plane by shape
   /// \param theShape a planar face
   static std::shared_ptr<GeomAPI_Dir> setSketchPlane(const FeaturePtr& theFeature,
                                                      const TopoDS_Shape& theShape);
 
-  /// Erase preview planes
-  void erasePreviewPlanes();
-
-  /// Show preview planes
-  void showPreviewPlanes();
-
 
-  AISObjectPtr myYZPlane;
-  AISObjectPtr myXZPlane;
-  AISObjectPtr myXYPlane;
-  bool myPreviewDisplayed;
+private:
+  /// class to show/hide preview planes
+  PartSet_PreviewPlanes* myPreviewPlanes;
 
   QCheckBox* myViewInverted;