From 09250fc4344abdb4c3cb5d76a26c91b9dc0e5cfa Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 24 Dec 2015 15:26:43 +0300 Subject: [PATCH] Issue #1111 Sketch invisible It is not enough to create selector on initialize(). The problem still exists in the second study because it is not called there. So, it is decided to perform this in connectToStudy() of module. An alternative is to do this in NewGEOM_DataModel before Mgr->load(). The problem is in this place because it causes redisplay signals flush. The viewer should be initialized before this case. --- src/NewGeom/NewGeom_Module.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index dbf3bf669..7361accf9 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -120,19 +120,6 @@ void NewGeom_Module::initialize(CAM_Application* theApp) LightApp_Module::initialize(theApp); inspectSalomeModules(); - // if there are created viewer managers, we should try to create viewer - // selector and initialize viewer with it. It sets interactive contect to the - // proxy viewer. If study is opened, startApplication causes the objects visualization, - // AIS context should be initialized in the viewer before this. - if (!mySelector) { - ViewManagerList OCCViewManagers; - application()->viewManagers(OCCViewer_Viewer::Type(), OCCViewManagers); - if (OCCViewManagers.size() > 0) { - // the viewer is restored by "store_visual_state" - mySelector = createSelector(OCCViewManagers.first()); - } - } - myWorkshop->startApplication(); LightApp_Application* anApp = dynamic_cast(theApp); if (anApp) @@ -153,6 +140,25 @@ void NewGeom_Module::viewManagers(QStringList& theList) const theList.append(OCCViewer_Viewer::Type()); } +//****************************************************** +void NewGeom_Module::connectToStudy(CAM_Study* theStudy) +{ + // if there are created viewer managers, we should try to create viewer + // selector and initialize viewer with it. It sets interactive contect to the + // proxy viewer. If study is opened, CAM application calls this method before the open() of data model + // the NewGeom data model is specific and during open(load) redisplay signals are flushed, so + // we need to connect to the viewer before it. Here, it seems the most appropriate place for this + // according to SALOME architecture. + if (!mySelector) { + ViewManagerList OCCViewManagers; + application()->viewManagers(OCCViewer_Viewer::Type(), OCCViewManagers); + if (OCCViewManagers.size() > 0) { + mySelector = createSelector(OCCViewManagers.first()); + } + } + LightApp_Module::connectToStudy(theStudy); +} + //****************************************************** bool NewGeom_Module::activateModule(SUIT_Study* theStudy) { -- 2.39.2