X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_Module.cpp;h=20cd411016fc4806e4f402843ee6926f4f03479e;hb=3e3d76500389cb3a5a6eeb09f229cd3c83730dac;hp=0b2e410b160e640a4df884d4605cbb9cb6701534;hpb=9b6fa5ea0662642f58e278af3798f4dc9ddd0acf;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 0b2e410b1..20cd41101 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -67,6 +67,7 @@ #include #include #include +#include #include #include @@ -91,7 +92,7 @@ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) : ModuleBase_IModule(theWshop), - myRestartingMode(RM_None) + myRestartingMode(RM_None), myVisualLayerId(0) { //myWorkshop = dynamic_cast(theWshop); mySketchMgr = new PartSet_SketcherMgr(this); @@ -141,6 +142,9 @@ void PartSet_Module::registerValidators() aFactory->registerValidator("PartSet_SketchEntityValidator", new PartSet_SketchEntityValidator); + + aFactory->registerValidator("PartSet_SameTypeAttr", + new PartSet_SameTypeAttrValidator); } void PartSet_Module::registerFilters() @@ -211,6 +215,8 @@ void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) { if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { + Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer(); + aViewer->AddZLayer(myVisualLayerId); mySketchMgr->startSketch(theOperation); } else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) { @@ -226,6 +232,9 @@ void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) { if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { mySketchMgr->stopSketch(theOperation); + Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer(); + aViewer->RemoveZLayer(myVisualLayerId); + myVisualLayerId = 0; } else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) { mySketchMgr->stopNestedSketch(theOperation); @@ -651,3 +660,17 @@ bool PartSet_Module::deleteObjects() return true; } + + +void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) +{ + Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); + if (!anAIS.IsNull()) { + Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS); + if (!aDim.IsNull()) { + Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext(); + aCtx->SetZLayer(aDim, myVisualLayerId); + } + } +} +