From: nds Date: Thu, 24 Dec 2015 12:26:43 +0000 (+0300) Subject: Issue #1111 Sketch invisible X-Git-Tag: V_2.1.0~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=09250fc4344abdb4c3cb5d76a26c91b9dc0e5cfa;p=modules%2Fshaper.git 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. --- 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) {