1 // Copyright (C) 2014-2023 CEA, EDF
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 email : webmaster.salome@opencascade.com
20 #ifndef SHAPERGUI_DATAMODEL_H
21 #define SHAPERGUI_DATAMODEL_H
23 #include "SHAPER_SHAPERGUI.h"
24 #include <LightApp_DataModel.h>
30 * A Data Model class provides a connection of SALOME data structure and OpenParts application data model
32 class SHAPERGUI_EXPORT SHAPERGUI_DataModel : public LightApp_DataModel
37 /// \param theModule a module instance
38 SHAPERGUI_DataModel(SHAPERGUI* theModule);
39 virtual ~SHAPERGUI_DataModel();
42 /// \param thePath a path to the directory
43 /// \param theStudy a current study
44 /// \param theFiles a list of files to open
45 virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles);
47 /// Save module data to file
48 /// \param theFiles list of created files
49 virtual bool save(QStringList& theFiles);
51 /// Save module data to a file
52 /// \param thePath a path to the directory
53 /// \param theStudy a current study
54 /// \param theFiles a list of files to open
55 virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles);
57 /// Close data structure
60 /// Create data structure
61 /// \param theStudy a current study
62 virtual bool create(CAM_Study* theStudy);
64 /// Returns True if the data structure has been modified
65 virtual bool isModified() const;
67 /// Returns True if the data structure is already saved
68 virtual bool isSaved() const;
70 /// Creates a module root object if it has not been created yet
71 /// and append it to the active study. It is necessary for correct persistent
73 virtual void initRootObject() override;
75 /// Update data object
76 /// \param theObj an data object
77 /// \param theStudy a current study
78 virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
80 /// Redefinition of virtual method: include the module dump in the common SALOME dump
81 virtual bool dumpPython( const QString&, CAM_Study*, bool, QStringList& );
85 * Removes the directory with content if it exists
86 * \param theDirectoryName a directory name
88 static void removeDirectory(const QString& theDirectoryName);
91 /// Pat to a study file
94 /// a path to the temporary directory, created by opening a document file
95 //QString myTmpDirectory;
97 /// it should be created because the files reading is postponed in the module. The directory
98 // should be removed after the model document is closed.