Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SalomeApp_Study.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef SALOMEAPP_STUDY_H
24 #define SALOMEAPP_STUDY_H
25 
26 #include "SalomeApp.h"
27 
28 #include <LightApp_Study.h>
29 
30 #ifdef WIN32
31 #pragma warning( disable:4251 )
32 #endif
33 
34 #include "SALOMEDSClient.hxx"
35 
37 {
38  Q_OBJECT
39 
40  class Observer_i;
41 
42 public:
44  virtual ~SalomeApp_Study();
45 
46  virtual int id() const;
47  virtual QString studyName() const;
48 
49  virtual bool createDocument( const QString& );
50  virtual bool openDocument( const QString& );
51  virtual bool loadDocument( const QString& );
52 
53  virtual bool saveDocument();
54  virtual bool saveDocumentAs( const QString& );
55 
56  virtual void closeDocument(bool permanently = true);
57 
58  virtual bool dump( const QString&, bool, bool, bool );
59 
60  virtual bool isSaved() const;
61  virtual bool isModified() const;
62  virtual void Modified();
63 
64  virtual void addComponent ( const CAM_DataModel* dm);
65 
66  _PTR(Study) studyDS() const;
67 
68  virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile);
69 
70  // to delete all references to object, whose have the same component
71  void deleteReferencesTo( _PTR( SObject ) );
72 
73  virtual QString componentDataType( const QString& ) const;
74  virtual QString referencedToEntry( const QString& ) const;
75  virtual bool isComponent( const QString& ) const;
76  virtual void children( const QString&, QStringList& ) const;
77  virtual void components( QStringList& ) const;
78  virtual QString centry( const QString& ) const;
79 
80  std::vector<int> getSavePoints();
81  void removeSavePoint(int savePoint);
82  QString getNameOfSavePoint(int savePoint);
83  void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
84 
85  virtual void restoreState(int savePoint);
86 #ifndef DISABLE_PYCONSOLE
87  void updateFromNotebook(const QString&, bool);
88 #endif
89 
90  virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
91 
92 protected:
93  virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
94  virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
95  virtual bool saveStudyData ( const QString& theFileName );
96  virtual bool openStudyData ( const QString& theFileName );
97 
98  virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
99  virtual void SetListOfFiles ( const char* theModuleName,
100  const std::vector<std::string> theListOfFiles);
101  virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
102 
103 protected:
104  virtual void dataModelInserted( const CAM_DataModel* );
105  virtual bool openDataModel( const QString&, CAM_DataModel* );
106  void setStudyDS(const _PTR(Study)& s );
107  virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
108  SUIT_DataObject* theParent ) const;
109 protected slots:
110  virtual void updateModelRoot( const CAM_DataModel* );
111 #ifndef DISABLE_PYCONSOLE
112  void onNoteBookVarUpdate( QString theVarName );
113 #endif
114 
115 private:
116  QString newStudyName() const;
117 
118 private:
119  _PTR(Study) myStudyDS;
121 
122 #ifndef DISABLE_PYCONSOLE
123  signals:
124  void notebookVarUpdated( QString theVarName );
125 #endif
126 };
127 
128 #ifdef WIN32
129 #pragma warning( default:4251 )
130 #endif
131 
132 #endif