Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/atomic.git] / src / ATOMICGUI / ATOMICGUI_DataModel.h
1 // Copyright (C) 2007-2012  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.
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_Data.h"
24 #include <LightApp_DataModel.h>
25 #include <qlist.h>
26
27 class CAM_Module;
28 class LightApp_Study;
29 class LightApp_DataObject;
30 class ATOMICGUI_DataObject;
31
32 /*!
33  * Class       : ATOMICGUI_DataModel
34  * Description : Data Model of ATOMIC component
35  */
36 class ATOMICGUI_DataModel : public LightApp_DataModel
37 {
38   Q_OBJECT
39
40 public:
41   ATOMICGUI_DataModel ( CAM_Module* );
42   virtual ~ATOMICGUI_DataModel();
43
44   virtual bool          open   ( const QString&, CAM_Study*, QStringList );
45   virtual bool          save   ( QStringList& );
46   virtual bool          saveAs ( const QString&, CAM_Study*, QStringList& );
47   virtual bool          close  ();
48   virtual bool          create ( CAM_Study* );
49
50   virtual bool          isModified () const;
51   virtual bool          isSaved    () const;
52   virtual bool          dumpPython( const QString&, CAM_Study*, bool, QStringList& );
53
54   bool                  importFile ( const QString&, CAM_Study* = 0 );
55   bool                  exportFile ( const QString& = QString::null );
56   QString               createMolecule ();
57   bool                  addAtom    ( const QString&, const QString&, 
58                                      const double, const double, const double );
59   bool                  renameObj  ( const QString&, const QString& );
60   bool                  deleteObjs ( const QStringList& );
61
62   ATOMICGUI_DataObject* findObject   ( const QString& ); 
63   ATOMICGUI_DataObject* findMolecule ( const QString& ); 
64
65 protected:
66   virtual void          build();
67
68 private:
69   QString                              myStudyURL;
70   QList<ATOMICGUI_AtomicMolecule>      myMolecules;
71 };
72
73 #endif // ATOMICGUI_DATAMODEL_H