Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LightApp_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 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;
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& );
80 
81  virtual void closeDocument(bool permanently = true);
82 
83  virtual bool isSaved() const;
84  virtual bool isModified() const;
85 
86  virtual void addComponent ( const CAM_DataModel* dm);
87 
88  virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
89 
90  virtual QString componentDataType( const QString& ) const;
91  virtual QString referencedToEntry( const QString& ) const;
92  virtual bool isComponent( const QString& ) const;
93  virtual void children( const QString&, QStringList& ) const;
94  virtual void components( QStringList& ) const;
95  virtual QString centry( const QString& ) const;
96 
97  virtual QString getVisualComponentName() const;
98 
99  virtual void setObjectProperty( int, const QString&, const QString&, const QVariant& );
100  virtual void setObjectProperty( const QString&, const QString&, const QVariant& );
101  virtual void setObjectProperty( int, const QString&, const QVariant& );
102  virtual void setObjectProperties( int, const QString&, const PropMap& );
103  virtual QVariant getObjectProperty( int, const QString&, const QString&, const QVariant& ) const;
104  virtual const PropMap& getObjectProperties( int, const QString& );
105  virtual const ObjMap& getObjectProperties( int );
106  virtual const ViewMgrMap& getObjectProperties() const;
107  virtual void removeObjectProperties( int );
108  virtual void removeObjectProperties( const QString& );
109 
110  virtual void setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
111  virtual Qtx::VisibilityState visibilityState(const QString& theEntry) const;
112  virtual void setVisibilityStateForAll(Qtx::VisibilityState theState);
113 
114  virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
115 
116 protected:
117  virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
118  virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
119  virtual bool saveStudyData ( const QString& theFileName );
120  virtual bool openStudyData ( const QString& theFileName );
121 
122  virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
123  virtual void SetListOfFiles ( const char* theModuleName,
124  const std::vector<std::string> theListOfFiles );
125 
126  virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
127 
128 protected:
129  virtual bool openDataModel ( const QString&, CAM_DataModel* );
130  virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
131  SUIT_DataObject* theParent ) const;
132 
133 signals:
134  void saved ( SUIT_Study* );
135  void opened ( SUIT_Study* );
136  void closed ( SUIT_Study* );
137  void created( SUIT_Study* );
138 
139  void objVisibilityChanged( QString, Qtx::VisibilityState );
140 
141 
142 private:
145 
146  friend class LightApp_Application;
147  friend class LightApp_DataModel;
148 };
149 
150 #endif