ModuleBase_Tools::zeroMargins(aLayout);
QGroupBox* aViewBox = new QGroupBox(tr("Sketcher plane"), this);
- QVBoxLayout* aViewLayout = new QVBoxLayout(aViewBox);
+ QGridLayout* aViewLayout = new QGridLayout(aViewBox);
myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
- aViewLayout->addWidget(myViewInverted);
+ aViewLayout->addWidget(myViewInverted, 0, 0);
+
+ myViewVisible = new QCheckBox(tr("Visible"), aViewBox);
+ myViewVisible->setChecked(true);
+ aViewLayout->addWidget(myViewVisible, 0, 1, Qt::AlignRight);
+ connect(myViewVisible, SIGNAL(toggled(bool)), this, SLOT(onShowViewPlane(bool)));
QPushButton* aSetViewBtn =
new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView()));
- aViewLayout->addWidget(aSetViewBtn);
+ aViewLayout->addWidget(aSetViewBtn, 1, 0, 1, 2);
aLayout->addWidget(aViewBox);
bool aDone = false;
if (theValues.empty()) {
// In order to make reselection possible, set empty object and shape should be done
- setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(
+ setSelectionCustom(ModuleBase_ViewerPrsPtr(
new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL)));
aDone = false;
}
}
}
aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, isSetSizeOfView);
- aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
+ if (myViewVisible->isChecked())
+ aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
}
// 2. if the planes were displayed, change the view projection
//******************************************************
-QList<std::shared_ptr<ModuleBase_ViewerPrs>> PartSet_WidgetSketchLabel::findCircularEdgesInPlane()
+QList<ModuleBase_ViewerPrsPtr> PartSet_WidgetSketchLabel::findCircularEdgesInPlane()
{
QList<std::shared_ptr<ModuleBase_ViewerPrs>> aResult;
XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
bool isContains = false;
// Check that edge is not used.
// It is possible that the same edge will be taken from different faces
- foreach(std::shared_ptr<ModuleBase_ViewerPrs> aPrs, aResult) {
+ foreach(ModuleBase_ViewerPrsPtr aPrs, aResult) {
GeomAPI_Edge aUsedEdge(aPrs->shape());
if (aUsedEdge.isEqual(aEdgeShape)) {
isContains = true;
}
}
if (!isContains) {
- std::shared_ptr<ModuleBase_ViewerPrs>
- aPrs(new ModuleBase_ViewerPrs(aResObj, aEdgeShape));
+ ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs(aResObj, aEdgeShape));
aResult.append(aPrs);
}
}
onShowPanel();
}
return ModuleBase_WidgetValidated::eventFilter(theObj, theEvent);
-}
\ No newline at end of file
+}
+
+void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow)
+{
+ PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+ if (toShow) {
+ CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
+ }
+ else {
+ aModule->sketchMgr()->previewSketchPlane()->eraseSketchPlane(myWorkshop, false);
+ }
+ myWorkshop->viewer()->update();
+}
#include <ModuleBase_WidgetValidated.h>
#include <ModuleBase_ViewerFilters.h>
+#include <ModuleBase_ViewerPrs.h>
#include <GeomAPI_Dir.h>
/// Returns True if the selected presentation can be used for plane definition
/// \param thePrs a presentation
- static bool canFillSketch(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ static bool canFillSketch(const ModuleBase_ViewerPrsPtr& thePrs);
/// If widgets has several panels then this method has to show a page which contains information
/// for current feature. By default does nothing
/// Fills the attribute with the value of the selected owner
/// \param thePrs a selected owner
- virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs);
/// Saves the internal parameters to the given feature
/// \return True in success
/// 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<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ bool setSelectionInternal(const QList<ModuleBase_ViewerPrsPtr>& theValues,
const bool theToValidate);
/// Erase preview planes, disconnect widget, change the view projection
/// \param thePrs a selected presentation
- void updateByPlaneSelected(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ void updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs);
/// Set sketch plane from selected object
/// \param theFeature a feature of sketch
/// \param thePrs a presentation
- bool fillSketchPlaneBySelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ bool fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr& thePrs);
/// Redefinition of a virtual function
virtual void showEvent(QShowEvent* theEvent);
/// \param theOn a flag show constraints or not
void onShowConstraint(bool theOn);
+ /// A a slot called on "Change sketch plane" check box toggele
void onChangePlane();
+ /// A a slot called on "Show remaining DOFs" check box toggele
void onShowDOF();
+ /// A a slot called on changing the panel visibility
void onShowPanel();
+ /// A slot which is called on "Visible" plane checkbox toggle
+ void onShowViewPlane(bool);
+
private:
/// Set sketch plane by shape
/// \param theShape a planar face
* (circles, arcs) which are in pane of of the given sketch
* \param theSketch - the sketch
*/
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> findCircularEdgesInPlane();
+ QList<ModuleBase_ViewerPrsPtr> findCircularEdgesInPlane();
private:
/// class to show/hide preview planes
PartSet_PreviewPlanes* myPreviewPlanes;
QCheckBox* myViewInverted;
+ QCheckBox* myViewVisible;
QCheckBox* myRemoveExternal;
QCheckBox* myShowPoints;
QCheckBox* myAutoConstraints;