1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SHAPERGUI_DATAMODEL_H
22 #define SHAPERGUI_DATAMODEL_H
24 #include "SHAPER_SHAPERGUI.h"
25 #include <LightApp_DataModel.h>
31 * A Data Model class provides a connection of SALOME data structure and OpenParts application data model
33 class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel
38 /// \param theModule a module instance
39 SHAPERGUI_DataModel(SHAPERGUI* theModule);
40 virtual ~SHAPERGUI_DataModel();
43 /// \param thePath a path to the directory
44 /// \param theStudy a current study
45 /// \param theFiles a list of files to open
46 virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles);
48 /// Save module data to file
49 /// \param theFiles list of created files
50 virtual bool save(QStringList& theFiles);
52 /// Save module data to a file
53 /// \param thePath a path to the directory
54 /// \param theStudy a current study
55 /// \param theFiles a list of files to open
56 virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles);
58 /// Close data structure
61 /// Create data structure
62 /// \param theStudy a current study
63 virtual bool create(CAM_Study* theStudy);
65 /// Returns True if the data structure has been modified
66 virtual bool isModified() const;
68 /// Returns True if the data structure is already saved
69 virtual bool isSaved() const;
71 /// Creates a module root object if it has not been created yet
72 /// and append it to the active study. It is necessary for correct persistent
74 void initRootObject();
76 /// Update data object
77 /// \param theObj an data object
78 /// \param theStudy a current study
79 virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
81 /// Redefinition of virtual method: include the module dump in the common SALOME dump
82 virtual bool dumpPython( const QString&, CAM_Study*, bool, QStringList& );
86 * Removes the directory with content if it exists
87 * \param theDirectoryName a directory name
89 static void removeDirectory(const QString& theDirectoryName);
92 /// Pat to a study file
95 /// a path to the temporary directory, created by opening a document file
96 QString myTmpDirectory;
98 /// it should be created because the files reading is postponed in the module. The directory
99 // should be removed after the model document is closed.