1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 #ifndef SHAPERGUI_DATAMODEL_H
5 #define SHAPERGUI_DATAMODEL_H
7 #include "SHAPER_SHAPERGUI.h"
8 #include <LightApp_DataModel.h>
14 * A Data Model class provides a connection of SALOME data structure and OpenParts application data model
16 class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel
21 /// \param theModule a module instance
22 SHAPERGUI_DataModel(SHAPERGUI* theModule);
23 virtual ~SHAPERGUI_DataModel();
26 /// \param thePath a path to the directory
27 /// \param theStudy a current study
28 /// \param theFiles a list of files to open
29 virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles);
31 /// Save module data to file
32 /// \param theFiles list of created files
33 virtual bool save(QStringList& theFiles);
35 /// Save module data to a file
36 /// \param thePath a path to the directory
37 /// \param theStudy a current study
38 /// \param theFiles a list of files to open
39 virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles);
41 /// Close data structure
44 /// Create data structure
45 /// \param theStudy a current study
46 virtual bool create(CAM_Study* theStudy);
48 /// Returns True if the data structure has been modified
49 virtual bool isModified() const;
51 /// Returns True if the data structure is already saved
52 virtual bool isSaved() const;
54 /// Creates a module root object if it has not been created yet
55 /// and append it to the active study. It is necessary for correct persistent
57 void initRootObject();
59 /// Update data object
60 /// \param theObj an data object
61 /// \param theStudy a current study
62 virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
64 /// Redefinition of virtual method: include the module dump in the common SALOME dump
65 virtual bool dumpPython( const QString&, CAM_Study*, bool, QStringList& );
69 * Removes the directory with content if it exists
70 * \param theDirectoryName a directory name
72 static void removeDirectory(const QString& theDirectoryName);
75 /// Pat to a study file
78 /// a path to the temporary directory, created by opening a document file
79 QString myTmpDirectory;
81 /// it should be created because the files reading is postponed in the module. The directory
82 // should be removed after the model document is closed.