Salome HOME
Copyright update 2021
[samples/atomic.git] / src / ATOMICGUI / ATOMICGUI_DataModel.h
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #if !defined(ATOMICGUI_DATAMODEL_H)
21 #define ATOMICGUI_DATAMODEL_H
22
23 #include "ATOMICGUI_ATOMICGUI.hxx"
24
25 #include "ATOMICGUI_Data.h"
26 #include <LightApp_DataModel.h>
27 #include <qlist.h>
28
29 class CAM_Module;
30 class LightApp_Study;
31 class LightApp_DataObject;
32 class ATOMICGUI_DataObject;
33
34 /*!
35  * Class       : ATOMICGUI_DataModel
36  * Description : Data Model of ATOMIC component
37  */
38 class ATOMICGUI_EXPORT ATOMICGUI_DataModel : public LightApp_DataModel
39 {
40   Q_OBJECT
41
42 public:
43   ATOMICGUI_DataModel ( CAM_Module* );
44   virtual ~ATOMICGUI_DataModel();
45
46   virtual bool          open   ( const QString&, CAM_Study*, QStringList );
47   virtual bool          save   ( QStringList& );
48   virtual bool          saveAs ( const QString&, CAM_Study*, QStringList& );
49   virtual bool          close  ();
50   virtual bool          create ( CAM_Study* );
51
52   virtual bool          isModified () const;
53   virtual bool          isSaved    () const;
54   virtual bool          dumpPython( const QString&, CAM_Study*, bool, QStringList& );
55
56   bool                  importFile ( const QString&, CAM_Study* = 0 );
57   bool                  exportFile ( const QString& = QString::null );
58   QString               createMolecule ();
59   bool                  addAtom    ( const QString&, const QString&, 
60                                      const double, const double, const double );
61   bool                  renameObj  ( const QString&, const QString& );
62   bool                  deleteObjs ( const QStringList& );
63
64   ATOMICGUI_DataObject* findObject   ( const QString& ); 
65   ATOMICGUI_DataObject* findMolecule ( const QString& ); 
66
67 protected:
68   virtual void          build();
69
70 private:
71   QString                              myStudyURL;
72   QList<ATOMICGUI_AtomicMolecule>      myMolecules;
73 };
74
75 #endif // ATOMICGUI_DATAMODEL_H