Version: 9.15.0
LightApp_Study.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, 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 LIGHTAPP_STUDY_H
24 #define LIGHTAPP_STUDY_H
25 
26 #include "LightApp.h"
27 #include "LightApp_Driver.h"
28 
29 #include <CAM_Study.h>
30 
31 #include "string"
32 #include "vector"
33 #include <Qtx.h>
34 
35 #include <QMap>
36 #include <QVariant>
37 
38 class SUIT_Study;
39 class SUIT_Application;
40 class CAM_DataModel;
41 class CAM_ModuleObject;
43 class LightApp_DataModel;
44 
45 //Map to store visual property of the object.
46 //Key: Name of the visual property of the object.
47 //Value: value of the visual property.
48 typedef QMap<QString, QVariant> PropMap;
49 
50 //Map to store objects with it's visual properties.
51 //Key: Entry of the object.
52 //Value: Map of the visual properties of the object.
53 typedef QMap<QString, PropMap> ObjMap;
54 
55 //Map to store view managers and all objects which displayed in views of the view managers.
56 //Key: Id of the viewer.
57 //Value: Map of the objects with it's visual properties.
58 typedef QMap<int, ObjMap> ViewMgrMap;
59 
60 
67 {
68  Q_OBJECT
69 
70 public:
72  virtual ~LightApp_Study();
73 
74  virtual bool createDocument( const QString& );
75  virtual bool openDocument( const QString& );
76  virtual bool loadDocument( const QString& );
77 
78  virtual bool saveDocument();
79  virtual bool saveDocumentAs( const QString&, bool isBackup=false );
80 
81  virtual void closeDocument(bool permanently = true);
82 
83  virtual bool dump( const QString&, bool, bool, bool ) { return false; }
84 
85  virtual bool isSaved() const;
86  virtual bool isModified() const;
87 
88  virtual void addComponent ( const CAM_DataModel* dm);
89 
90  virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
91 
92  virtual QString componentDataType( const QString& ) const;
93  virtual QString referencedToEntry( const QString& ) const;
94  virtual bool isComponent( const QString& ) const;
95  virtual void children( const QString&, QStringList& ) const;
96  virtual void components( QStringList& ) const;
97  virtual QString centry( const QString& ) const;
98 
99  virtual QString getVisualComponentName() const;
100 
101  virtual void setObjectProperty( int, const QString&, const QString&, const QVariant& );
102  virtual void setObjectProperty( const QString&, const QString&, const QVariant& );
103  virtual void setObjectProperty( int, const QString&, const QVariant& );
104  virtual void setObjectProperties( int, const QString&, const PropMap& );
105  virtual QVariant getObjectProperty( int, const QString&, const QString&, const QVariant& ) const;
106  virtual const PropMap& getObjectProperties( int, const QString& );
107  virtual const ObjMap& getObjectProperties( int );
108  virtual const ViewMgrMap& getObjectProperties() const;
109  virtual void removeObjectProperties( int );
110  virtual void removeObjectProperties( const QString& );
111 
112  virtual void setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
113  virtual Qtx::VisibilityState visibilityState(const QString& theEntry) const;
114  virtual void setVisibilityStateForAll(Qtx::VisibilityState theState);
115 
116  virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
117 
118 protected:
119  virtual void saveModuleData ( QString theModuleName, int type, QStringList theListOfFiles );
120  virtual void openModuleData ( QString theModuleName, int type, QStringList& theListOfFiles );
121  virtual bool saveStudyData ( const QString& theFileName, int type );
122  virtual bool openStudyData ( const QString& theFileName, int type );
123 
124  virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName, int type ) const;
125  virtual void SetListOfFiles ( const char* theModuleName, int type,
126  const std::vector<std::string> theListOfFiles );
127 
128  virtual void RemoveTemporaryFiles ( const char*, bool, bool = false );
129 
130 protected:
131  virtual bool openDataModel ( const QString&, CAM_DataModel* );
132  virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
133  SUIT_DataObject* theParent ) const;
134 
135 signals:
136  void saved ( SUIT_Study* );
137  void opened ( SUIT_Study* );
138  void closed ( SUIT_Study* );
139  void created( SUIT_Study* );
140 
142 
143 
144 private:
147 
148  friend class LightApp_Application;
149  friend class LightApp_DataModel;
150 };
151 
152 #endif
#define LIGHTAPP_EXPORT
Definition: LightApp.h:36
QMap< QString, QVariant > PropMap
Definition: LightApp_Study.h:43
QMap< int, ObjMap > ViewMgrMap
Definition: LightApp_Study.h:58
QMap< QString, PropMap > ObjMap
Definition: LightApp_Study.h:53
Base class for all data models used in CAM-based applications.
Definition: CAM_DataModel.h:37
CAM data model root object.
Definition: CAM_DataObject.h:44
Represents document object in the CAM application architecture.
Definition: CAM_Study.h:38
virtual void closeDocument(bool permanently=true)
Called when study is closed.
Definition: CAM_Study.cxx:60
virtual bool openDataModel(const QString &, CAM_DataModel *)
Called when data model is opened.
Definition: CAM_Study.cxx:181
Definition: LightApp_Application.h:77
Definition: LightApp_DataModel.h:47
Base data object class to build the data model for all the SALOME modules.
Definition: LightApp_DataObject.h:36
Definition: LightApp_Driver.h:39
Definition: LightApp_Study.h:67
virtual bool dump(const QString &, bool, bool, bool)
Definition: LightApp_Study.h:83
void saved(SUIT_Study *)
LightApp_Driver * myDriver
Definition: LightApp_Study.h:145
ViewMgrMap myViewMgrMap
Definition: LightApp_Study.h:146
void objVisibilityChanged(QString, Qtx::VisibilityState)
void closed(SUIT_Study *)
void opened(SUIT_Study *)
void created(SUIT_Study *)
VisibilityState
object visibility state
Definition: Qtx.h:116
Definition: SUIT_Application.h:61
Data object representing the data instance in the tree-like hierarchy.
Definition: SUIT_DataObject.h:49
Definition: SUIT_Study.h:41
virtual bool saveDocumentAs(const QString &, bool isBackup=false)
Definition: SUIT_Study.cxx:145
virtual bool isSaved() const
Definition: SUIT_Study.cxx:101
bool saveDocument()
Definition: SUIT_Study.cxx:159
virtual bool createDocument(const QString &)
Definition: SUIT_Study.cxx:125
virtual bool openDocument(const QString &)
Definition: SUIT_Study.cxx:133
virtual bool isModified() const
Definition: SUIT_Study.cxx:109