#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
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);
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);
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;