-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <AIS_Shape.hxx>
-#include <AIS_DimensionSelectionMode.hxx>
#include <Bnd_Box.hxx>
#include <Config_WidgetAPI.h>
// 1. hide main planes if they have been displayed and display sketch preview plane
myPreviewPlanes->erasePreviewPlanes(myWorkshop);
+ QString aSizeOfViewStr = mySizeOfView->text();
+ bool isSetSizeOfView = false;
+ double aSizeOfView = 0;
+ if (!aSizeOfViewStr.isEmpty()) {
+ aSizeOfView = aSizeOfViewStr.toDouble(&isSetSizeOfView);
+ if (isSetSizeOfView && aSizeOfView <= 0) {
+ isSetSizeOfView = false;
+ }
+ }
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
if (aModule) {
CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
- bool isSetSizeOfView = false;
- double aSizeOfView = 0;
- QString aSizeOfViewStr = mySizeOfView->text();
- if (!aSizeOfViewStr.isEmpty()) {
- aSizeOfView = aSizeOfViewStr.toDouble(&isSetSizeOfView);
- if (isSetSizeOfView && aSizeOfView <= 0) {
- isSetSizeOfView = false;
- }
- }
aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, isSetSizeOfView);
if (myViewVisible->isChecked())
aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
if (aRotate) {
myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
}
- QString aSizeOfViewStr = mySizeOfView->text();
- if (!aSizeOfViewStr.isEmpty()) {
- bool isOk;
- double aSizeOfView = aSizeOfViewStr.toDouble(&isOk);
- if (isOk && aSizeOfView > 0) {
- Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView();
- if (!aView3d.IsNull()) {
- Bnd_Box aBndBox;
- double aHalfSize = aSizeOfView/2.0;
- aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize);
- aView3d->FitAll(aBndBox, 0.01, false);
- }
+ if (isSetSizeOfView && aSizeOfView > 0) {
+ Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView();
+ if (!aView3d.IsNull()) {
+ Bnd_Box aBndBox;
+ double aHalfSize = aSizeOfView/2.0;
+ aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize);
+ aView3d->FitAll(aBndBox, 0.01, false);
}
}
if (myOpenTransaction) {
if (aModule)
aModule->onViewTransformed();
- // 6. Update sketcher actions
- XGUI_ActionsMgr* anActMgr = aWorkshop->actionsMgr();
-
myWorkshop->updateCommandStatus();
aWorkshop->selector()->clearSelection();
myWorkshop->viewer()->update();
}
// check plane or planar face of any non-sketch object
if (aCanFillSketch) {
- std::shared_ptr<GeomAPI_Face> aGeomFace;
-
GeomShapePtr aGeomShape = thePrs->shape();
if ((!aGeomShape.get() || aGeomShape->isNull()) && aResult.get()) {
aGeomShape = aResult->shape();
}
else {
aSelAttr->setValue(aFeature, GeomShapePtr());
- GeomShapePtr aShape = aSelAttr->value();
- if (!aShape.get() && aSelAttr->contextFeature().get() &&
+ GeomShapePtr aSelShape = aSelAttr->value();
+ if (!aSelShape.get() && aSelAttr->contextFeature().get() &&
aSelAttr->contextFeature()->firstResult().get()) {
- aShape = aSelAttr->contextFeature()->firstResult()->shape();
+ aSelShape = aSelAttr->contextFeature()->firstResult()->shape();
}
- if (aShape.get() && aShape->isPlanar()) {
- const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
+ if (aSelShape.get() && aSelShape->isPlanar()) {
+ const TopoDS_Shape& aTDShape = aSelShape->impl<TopoDS_Shape>();
setSketchPlane(aTDShape);
isOwnerSet = true;
}
void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow)
{
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+ PartSet_PreviewSketchPlane* aPreviewPlane = aModule->sketchMgr()->previewSketchPlane();
if (toShow) {
CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
- aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
+ if (aPreviewPlane->isPlaneCreated())
+ aPreviewPlane->displaySketchPlane(myWorkshop);
+ else
+ aPreviewPlane->createSketchPlane(aSketch, myWorkshop);
}
else {
- aModule->sketchMgr()->previewSketchPlane()->eraseSketchPlane(myWorkshop, false);
+ aPreviewPlane->eraseSketchPlane(myWorkshop, false);
}
myWorkshop->viewer()->update();
}