From 18b02d3f18f6db1fb45d8510fdcdf064c17164d3 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 24 Apr 2014 17:39:17 +0400 Subject: [PATCH] Connection to SALOME (Issue #31) --- src/NewGeom/CMakeLists.txt | 4 ++- src/NewGeom/NewGeom_DataModel.cpp | 52 +++++++++++++++++++++++++++++++ src/NewGeom/NewGeom_DataModel.h | 32 +++++++++++++++++++ src/NewGeom/NewGeom_Module.cpp | 17 ++++++++++ src/NewGeom/NewGeom_Module.h | 4 +++ 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/NewGeom/NewGeom_DataModel.cpp create mode 100644 src/NewGeom/NewGeom_DataModel.h diff --git a/src/NewGeom/CMakeLists.txt b/src/NewGeom/CMakeLists.txt index 4d908a259..c2c71aae1 100644 --- a/src/NewGeom/CMakeLists.txt +++ b/src/NewGeom/CMakeLists.txt @@ -6,14 +6,16 @@ SET(CMAKE_AUTOMOC ON) SET(PROJECT_HEADERS NewGeom.h NewGeom_Module.h + NewGeom_DataModel.h ) SET(PROJECT_AUTOMOC - ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp + ${CMAKE_CURRENT_BINARY_DIR}/NewGeom_automoc.cpp ) SET(PROJECT_SOURCES NewGeom_Module.cpp + NewGeom_DataModel.cpp ) SET(PROJECT_RESOURCES diff --git a/src/NewGeom/NewGeom_DataModel.cpp b/src/NewGeom/NewGeom_DataModel.cpp new file mode 100644 index 000000000..371fe7a4b --- /dev/null +++ b/src/NewGeom/NewGeom_DataModel.cpp @@ -0,0 +1,52 @@ + +#include "NewGeom_DataModel.h" + + +NewGeom_DataModel::NewGeom_DataModel( CAM_Module* theModule ) + : LightApp_DataModel(theModule) +{ +} + +NewGeom_DataModel::~NewGeom_DataModel() +{ +} + +bool NewGeom_DataModel::open( const QString& thePath, CAM_Study* theStudy, QStringList theFiles ) +{ + return true; +} + +bool NewGeom_DataModel::save( QStringList& theFiles ) +{ + return true; +} + +bool NewGeom_DataModel::saveAs( const QString& thePath, CAM_Study* theStudy, QStringList& theFiles ) +{ + myStudyPath = thePath; + return save( theFiles ); +} + +bool NewGeom_DataModel::close() +{ + return LightApp_DataModel::close(); +} + +bool NewGeom_DataModel::create( CAM_Study* theStudy ) +{ + return true; +} + +bool NewGeom_DataModel::isModified() const +{ + return false; +} + +bool NewGeom_DataModel::isSaved() const +{ + return true; +} + +void NewGeom_DataModel::update( LightApp_DataObject* theObj, LightApp_Study* theStudy ) +{ +} diff --git a/src/NewGeom/NewGeom_DataModel.h b/src/NewGeom/NewGeom_DataModel.h new file mode 100644 index 000000000..66c6bf84d --- /dev/null +++ b/src/NewGeom/NewGeom_DataModel.h @@ -0,0 +1,32 @@ + + +#ifndef NEWGEOM_DATAMODEL_H +#define NEWGEOM_DATAMODEL_H + +#include "NewGeom.h" +#include + +class NewGeom_EXPORT NewGeom_DataModel : public LightApp_DataModel +{ + Q_OBJECT +public: + NewGeom_DataModel( CAM_Module* theModule ); + virtual ~NewGeom_DataModel(); + + virtual bool open( const QString& thePath, CAM_Study* theStudy, QStringList theFiles ); + virtual bool save( QStringList& theFiles ); + virtual bool saveAs( const QString& thePath, CAM_Study* theStudy, QStringList& theFiles ); + virtual bool close(); + virtual bool create( CAM_Study* theStudy ); + + virtual bool isModified() const; + virtual bool isSaved() const; + + virtual void update( LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0 ); + +private: + QString myStudyPath; + +}; + +#endif \ No newline at end of file diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index 4fe5e15a7..e5f2ec1ee 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -1,11 +1,23 @@ #include "NewGeom_Module.h" +#include "NewGeom_DataModel.h" #include #include +extern "C" { + NewGeom_EXPORT CAM_Module* createModule() { + return new NewGeom_Module(); + } + + NewGeom_EXPORT char* getModuleVersion() { + return "0.0"; + } +} + + NewGeom_Module::NewGeom_Module() : LightApp_Module( "NewGeom" ) @@ -19,6 +31,7 @@ NewGeom_Module::~NewGeom_Module() void NewGeom_Module::initialize(CAM_Application* theApp) { + LightApp_Module::initialize(theApp); } void NewGeom_Module::windows(QMap& theWndMap) const @@ -41,4 +54,8 @@ bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy) return LightApp_Module::deactivateModule(theStudy); } +CAM_DataModel* NewGeom_Module::createDataModel() +{ + return new NewGeom_DataModel(this); +} diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h index bd6886e0f..b18ff6606 100644 --- a/src/NewGeom/NewGeom_Module.h +++ b/src/NewGeom/NewGeom_Module.h @@ -21,6 +21,10 @@ public slots: bool activateModule( SUIT_Study* theStudy); bool deactivateModule( SUIT_Study* theStudy); +protected: + CAM_DataModel* createDataModel(); + + private: }; -- 2.39.2