CompositeFeaturePtr aSketch = mySketchMgr->activeSketch();
if (aSketch.get()) {
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- if (PartSet_SketcherMgr::isSketchOperation(anOperation))
+ if (PartSet_SketcherMgr::isSketchOperation(anOperation) && mySketchMgr->previewSketchPlane()->isDisplayed())
mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
}
}
}
+void PartSet_PreviewSketchPlane::clearPlanePreview()
+{
+ myPlane = std::shared_ptr<GeomAPI_AISObject>();
+ myShape = std::shared_ptr<GeomAPI_Shape>();
+}
+
+
void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& theSketch,
ModuleBase_IWorkshop* theWorkshop)
{
void setSizeOfView(double theSizeOfView, bool isUseSizeOfView,
const std::shared_ptr<GeomAPI_Pnt>& theCentralPoint = std::shared_ptr<GeomAPI_Pnt>());
+ /// Returns True if the plane preview is already created
bool isPlaneCreated() const {
return myPlane.get();
}
+ /// Returns current state of the plane preview visibility
+ bool isDisplayed() const { return myPreviewIsDisplayed; }
+
+ /// Displays preview planes
+ /// \param theWorkshop the application workshop
void displaySketchPlane(ModuleBase_IWorkshop* theWorkshop);
+ /// Nullyfies current plane preview object.
+ /// Important: Before call of this function the plane has to be erased from viewer
+ void clearPlanePreview();
+
private:
/// Create a square face by parameters
std::shared_ptr<GeomAPI_AISObject> createPreviewPlane();
aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, isSetSizeOfView);
if (myViewVisible->isChecked())
aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
+ else
+ aModule->sketchMgr()->previewSketchPlane()->clearPlanePreview();
}
// 2. if the planes were displayed, change the view projection