From: vsv Date: Mon, 13 Jul 2015 12:21:17 +0000 (+0300) Subject: Create Z layer for constraints X-Git-Tag: V_1.3.0~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=430d8ae1b92d91eb26158425481534b5ed87ca7b;p=modules%2Fshaper.git Create Z layer for constraints --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 018ae1706..ccc0565cc 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -133,6 +133,8 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) 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); @@ -276,11 +278,6 @@ void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation) 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); } @@ -293,11 +290,6 @@ void PartSet_Module::onOperationStarted(ModuleBase_Operation* 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)) { @@ -911,3 +903,28 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) } } } + + +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; + //TColStd_SequenceIteratorOfSequenceOfInteger aIt; + for (int i = 1; i <= aZList.Length(); i++) { + if (aZList(i) == myVisualLayerId) { + aFound = true; + break; + } + } + if (!aFound) + aViewer->AddZLayer(myVisualLayerId); + } +} diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 5520d0d2c..ecb1dffdc 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -200,6 +200,9 @@ protected slots: /// It commits the operation of it is can be committed void onOperationActivatedByPreselection(); + /// A slot called on view window creation + void onViewCreated(ModuleBase_IViewWindow*); + protected: /// Register validators for this module virtual void registerValidators();