-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include "ATOMSOLVGUI.h"
#include "ATOMSOLVGUI_DataModel.h"
#include "ATOMSOLVGUI_Displayer.h"
#include "ATOMSOLVGUI_Selection.h"
#include "ATOMSOLVGUI_TransparencyDlg.h"
+#include "ATOMSOLV_Component_Generator.hxx"
+
+#include <ATOMSOLV_version.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+#include "SALOME_NamingService_Abstract.hxx"
+#include "SALOME_KernelServices.hxx"
+
#include <LightApp_DataOwner.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_Preferences.h>
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-using namespace std;
+#include <utilities.h>
ATOMSOLV_ORB::ATOMSOLV_Gen_var ATOMSOLVGUI::myEngine = ATOMSOLV_ORB::ATOMSOLV_Gen::_nil();
// Constructor
ATOMSOLVGUI::ATOMSOLVGUI() :
- SalomeApp_Module( "ATOMSOLV" ), // default name
- LightApp_Module( "ATOMSOLV" )
+ SalomeApp_Module( "ATOMSOLV" )
{
}
if ( !app )
myEngine = ATOMSOLV_ORB::ATOMSOLV_Gen::_nil();
else {
- Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" );
+ SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
+ Engines::EngineComponent_var comp;
+ if(ns->IsTrueNS())
+ {
+ comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" );
+ }
+ else
+ {
+ comp = RetrieveATOMSOLVInstance();
+ CORBA::Object_var comp2 = CORBA::Object::_narrow(comp);
+ KERNEL::RegisterCompo("ATOMSOLV",comp2);
+ }
ATOMSOLV_ORB::ATOMSOLV_Gen_ptr atomGen = ATOMSOLV_ORB::ATOMSOLV_Gen::_narrow(comp);
ASSERT( !CORBA::is_nil( atomGen ) );
myEngine = atomGen;
createMenu( ProcessData, aMenuId, 10 );
// create toolbars
- int aToolId = createTool ( tr( "TOOL_ATOMSOLV" ) );
+ int aToolId = createTool ( tr( "TOOL_ATOMSOLV" ), QString( "AtomSolv" ) );
createTool( RetrieveData, aToolId );
createTool( ProcessData, aToolId );
ATOMSOLV_ORB::ATOMSOLV_Gen_var engine = GetATOMSOLVGen();
ATOMSOLV_ORB::TMoleculeList lst;
lst.length( 0 );
- engine->setData( theStudy->id(), lst );
+ engine->setData( lst );
}
SalomeApp_Module::studyClosed( theStudy );
void ATOMSOLVGUI::windows( QMap<int, int>& theMap ) const
{
theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+#ifndef DISABLE_PYCONSOLE
theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+#endif
}
// Default view managers
ATOMSOLV_ORB::ATOMSOLV_Gen_var engine = GetATOMSOLVGen();
SalomeApp_Application* app = getApp();
if ( !CORBA::is_nil( engine ) && app ) {
- Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServerPy","ATOMGEN" );
+ Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","ATOMGEN" );
ATOMGEN_ORB::ATOMGEN_Gen_var atomGen = ATOMGEN_ORB::ATOMGEN_Gen::_narrow( comp );
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( !CORBA::is_nil( atomGen ) && appStudy ) {
- const int studyID = appStudy->id();
// in case current study is not loaded by ATOMGEN component - call Load on it
if ( _PTR( Study ) studyDS = appStudy->studyDS() ) {
if ( _PTR( SComponent ) atomGenSComp = studyDS->FindComponent( "ATOMGEN" ) ) {
}
// retrieve data from ATOMGEN
- ATOMGEN_ORB::MoleculeList_var inData = atomGen->getData( studyID );
+ ATOMGEN_ORB::MoleculeList_var inData = atomGen->getData();
// "convert" Molecules to TMolecules, set default temperature of '0'
const int n = inData->length();
outData[ i ] = tmol;
}
- engine->setData( studyID, outData );
+ engine->setData( outData );
app->updateObjectBrowser();
}
ATOMSOLV_ORB::ATOMSOLV_Gen_var engine = GetATOMSOLVGen();
SalomeApp_Application* app = getApp();
if ( !CORBA::is_nil( engine ) && app ) {
- if ( const int studyID = app->activeStudy()->id() > 0 ) {
- // call processData on engine
- engine->processData( studyID );
- // update data objects in object browser
- updateObjBrowser();
- // redisplay atoms that are already displayed (as their temperature changed..)
- ViewManagerList vmans;
- getApp()->viewManagers( SVTK_Viewer::Type(), vmans );
- for ( QList<SUIT_ViewManager*>::iterator it = vmans.begin(); it != vmans.end(); ++it ) {
- QVector<SUIT_ViewWindow*> views = (*it)->getViews();
- for ( int i = 0; i < views.size(); i++ ) {
- if ( SVTK_ViewWindow* svtkView = dynamic_cast<SVTK_ViewWindow*>( views[ i ] ) ) {
- vtkActorCollection* actors = svtkView->getRenderer()->GetActors();
- actors->InitTraversal();
- while ( vtkActor* actor = actors->GetNextActor() )
- if ( SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor ) )
- if ( salomeActor->hasIO() ) {
- // printf( " -- must redisplay actor salomeActor: %s\n", salomeActor->getIO()->getEntry() );
- ATOMSOLVGUI_Displayer().updateActor( salomeActor );
- }
- }
+ // call processData on engine
+ engine->processData();
+ // update data objects in object browser
+ updateObjBrowser();
+ // redisplay atoms that are already displayed (as their temperature changed..)
+ ViewManagerList vmans;
+ getApp()->viewManagers( SVTK_Viewer::Type(), vmans );
+ for ( QList<SUIT_ViewManager*>::iterator it = vmans.begin(); it != vmans.end(); ++it ) {
+ QVector<SUIT_ViewWindow*> views = (*it)->getViews();
+ for ( int i = 0; i < views.size(); i++ ) {
+ if ( SVTK_ViewWindow* svtkView = dynamic_cast<SVTK_ViewWindow*>( views[ i ] ) ) {
+ vtkActorCollection* actors = svtkView->getRenderer()->GetActors();
+ actors->InitTraversal();
+ while ( vtkActor* actor = actors->GetNextActor() )
+ if ( SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor ) )
+ if ( salomeActor->hasIO() ) {
+ // printf( " -- must redisplay actor salomeActor: %s\n", salomeActor->getIO()->getEntry() );
+ ATOMSOLVGUI_Displayer().updateActor( salomeActor );
+ }
}
}
}
// Export the module
extern "C" {
+ ATOMSOLVGUI_EXPORT
CAM_Module* createModule()
{
return new ATOMSOLVGUI();
}
+ ATOMSOLVGUI_EXPORT
+ char* getModuleVersion()
+ {
+ return (char*)ATOMSOLV_VERSION_STR;
+ }
}