1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef LIGHTAPP_STUDY_H
24 #define LIGHTAPP_STUDY_H
27 #include "LightApp_Driver.h"
29 #include <CAM_Study.h>
39 class SUIT_Application;
41 class CAM_ModuleObject;
42 class LightApp_DataObject;
43 class LightApp_DataModel;
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;
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;
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;
62 Custom study, using for open/close of documents HDF format.
63 Data of each module can be saved to different files, those
64 after that are combined into one HDF file
66 class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
71 LightApp_Study( SUIT_Application* );
72 virtual ~LightApp_Study();
74 virtual bool createDocument( const QString& );
75 virtual bool openDocument( const QString& );
76 virtual bool loadDocument( const QString& );
78 virtual bool saveDocument();
79 virtual bool saveDocumentAs( const QString& );
81 virtual void closeDocument(bool permanently = true);
83 virtual bool isSaved() const;
84 virtual bool isModified() const;
86 virtual void addComponent ( const CAM_DataModel* dm);
88 virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
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;
97 virtual QString getVisualComponentName() const;
99 virtual void setObjectProperty ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theValue );
100 virtual QVariant getObjectProperty ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theDefValue ) const;
101 virtual void removeViewMgr ( int theViewMgrId );
102 virtual void setObjectPropMap ( int theViewMgrId, QString theEntry, PropMap thePropMap );
103 virtual const PropMap& getObjectPropMap ( int theViewMgrId, QString theEntry ) ;
104 virtual void removeObjectFromAll( QString theEntry );
105 virtual const ObjMap& getObjectMap ( int theViewMgrId );
106 virtual const ViewMgrMap& getViewMgrMap ( int theViewMgrId ) { return myViewMgrMap; };
108 virtual void setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
109 virtual Qtx::VisibilityState visibilityState(const QString& theEntry) const;
110 virtual void setVisibilityStateForAll(Qtx::VisibilityState theState);
112 virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
115 virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
116 virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
117 virtual bool saveStudyData ( const QString& theFileName );
118 virtual bool openStudyData ( const QString& theFileName );
120 virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
121 virtual void SetListOfFiles ( const char* theModuleName,
122 const std::vector<std::string> theListOfFiles );
124 virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
127 virtual bool openDataModel ( const QString&, CAM_DataModel* );
128 virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
129 SUIT_DataObject* theParent ) const;
132 void saved ( SUIT_Study* );
133 void opened ( SUIT_Study* );
134 void closed ( SUIT_Study* );
135 void created( SUIT_Study* );
139 LightApp_Driver* myDriver;
140 ViewMgrMap myViewMgrMap;
142 friend class LightApp_Application;
143 friend class LightApp_DataModel;