1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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& , bool isBackup=false );
81 virtual void closeDocument(bool permanently = true);
83 virtual bool dump( const QString&, bool, bool, bool ) { return false; }
85 virtual bool isSaved() const;
86 virtual bool isModified() const;
88 virtual void addComponent ( const CAM_DataModel* dm);
90 virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
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;
99 virtual QString getVisualComponentName() const;
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& );
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);
116 virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
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 );
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 );
128 virtual void RemoveTemporaryFiles ( const char*, bool, bool = false );
131 virtual bool openDataModel ( const QString&, CAM_DataModel* );
132 virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
133 SUIT_DataObject* theParent ) const;
136 void saved ( SUIT_Study* );
137 void opened ( SUIT_Study* );
138 void closed ( SUIT_Study* );
139 void created( SUIT_Study* );
141 void objVisibilityChanged( QString, Qtx::VisibilityState );
145 LightApp_Driver* myDriver;
146 ViewMgrMap myViewMgrMap;
148 friend class LightApp_Application;
149 friend class LightApp_DataModel;