this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
connect(aViewer, SIGNAL(viewTransformed(int)),
SLOT(onViewTransformed(int)));
+ connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
+ SLOT(onViewCreated(ModuleBase_IViewWindow*)));
myMenuMgr = new PartSet_MenuMgr(this);
myCustomPrs = new PartSet_CustomPrs(theWshop);
void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
{
- // z layer is created for all started operations in order to visualize operation AIS presentation
- // over the object
- Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
- aViewer->AddZLayer(myVisualLayerId);
-
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
mySketchMgr->startSketch(theOperation);
}
void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
{
- // the custom presentation should be deactivated before stop sketch,
- // because it uses the active sketch of the sketch manager without checking if it is not null
- Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
- aViewer->RemoveZLayer(myVisualLayerId);
- myVisualLayerId = 0;
myCustomPrs->deactivate();
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
return aCanRedo;
}
+bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const
+{
+ bool aValid = true;
+ if (theActionId == "DELETE_CMD" || theActionId == "MOVE_CMD") {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ if (aFeature) {
+ // part features are removed in the PartSet module only.
+ if (aFeature->getKind() == PartSetPlugin_Part::ID())
+ aValid = false;
+ }
+ }
+ return aValid;
+}
+
bool PartSet_Module::canCommitOperation() const
{
return mySketchMgr->canCommitOperation();
return myMenuMgr->addViewerMenu(theMenu, theStdActions);
}
+void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
+{
+ myMenuMgr->updateViewerMenu(theStdActions);
+}
+
+
void PartSet_Module::activeSelectionModes(QIntList& theModes)
{
theModes.clear();
// 4. delete features
// sketch feature should be skipped, only sub-features can be removed
// when sketch operation is active
- std::set<FeaturePtr> anIgnoredFeatures;
- anIgnoredFeatures.insert(mySketchMgr->activeSketch());
- aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures);
-
+ aWorkshop->deleteFeatures(aSketchObjects);
// 5. stop operation
aWorkshop->displayer()->updateViewer();
aMgr->finishOperation();
}
}
}
+
+
+void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*)
+{
+ // z layer is created for all started operations in order to visualize operation AIS presentation
+ // over the object
+ Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
+ if (myVisualLayerId == 0) {
+ if (myVisualLayerId == 0)
+ aViewer->AddZLayer(myVisualLayerId);
+ } else {
+ TColStd_SequenceOfInteger aZList;
+ aViewer->GetAllZLayers(aZList);
+ bool aFound = false;
+ for (int i = 1; i <= aZList.Length(); i++) {
+ if (aZList(i) == myVisualLayerId) {
+ aFound = true;
+ break;
+ }
+ }
+ if (!aFound)
+ aViewer->AddZLayer(myVisualLayerId);
+ }
+}