Back to index

salome-gui  6.5.0
LightApp_Study.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef LIGHTAPP_STUDY_H
00024 #define LIGHTAPP_STUDY_H
00025 
00026 #include "LightApp.h"
00027 #include "LightApp_Driver.h"
00028 
00029 #include <CAM_Study.h>
00030 
00031 #include "string"
00032 #include "vector"
00033 #include <Qtx.h>
00034 
00035 #include <QMap>
00036 #include <QVariant>
00037 
00038 class SUIT_Study;
00039 class SUIT_Application;
00040 class CAM_DataModel;
00041 class CAM_ModuleObject;
00042 class LightApp_DataObject;
00043 class LightApp_DataModel;
00044 
00045 //Map to store visual property of the object.
00046 //Key:   Name of the visual property of the object.
00047 //Value: value of the visual property.
00048 typedef QMap<QString, QVariant> PropMap;
00049 
00050 //Map to store objects with it's visual properties.
00051 //Key:   Entry of the object.
00052 //Value: Map of the visual properties of the object.
00053 typedef QMap<QString, PropMap> ObjMap;
00054 
00055 //Map to store view managers and all objects which displayed in views of the view managers.
00056 //Key:   Id of the viewer.
00057 //Value: Map of the objects with it's visual properties.
00058 typedef QMap<int, ObjMap> ViewMgrMap;
00059 
00060 
00066 class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
00067 {
00068   Q_OBJECT
00069 
00070 public:
00071   LightApp_Study( SUIT_Application* );
00072   virtual ~LightApp_Study();
00073 
00074   virtual bool        createDocument( const QString& );
00075   virtual bool        openDocument( const QString& );
00076   virtual bool        loadDocument( const QString& ); 
00077 
00078   virtual bool        saveDocument();
00079   virtual bool        saveDocumentAs( const QString& );
00080 
00081   virtual void        closeDocument(bool permanently = true);
00082 
00083   virtual bool        isSaved()  const;
00084   virtual bool        isModified() const;
00085 
00086   virtual void        addComponent   ( const CAM_DataModel* dm);
00087 
00088   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile );
00089 
00090   virtual QString     componentDataType( const QString& ) const;
00091   virtual QString     referencedToEntry( const QString& ) const;
00092   virtual bool        isComponent( const QString& ) const;
00093   virtual void        children( const QString&, QStringList& ) const;
00094   virtual void        components( QStringList& ) const;
00095   virtual QString     centry( const QString& ) const;
00096 
00097   virtual QString     getVisualComponentName() const;
00098 
00099   virtual void              setObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theValue );
00100   virtual QVariant          getObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theDefValue ) const;
00101   virtual void              removeViewMgr      ( int theViewMgrId );
00102   virtual void              setObjectPropMap   ( int theViewMgrId, QString theEntry, PropMap thePropMap );
00103   virtual const PropMap&    getObjectPropMap   ( int theViewMgrId, QString theEntry ) ;
00104   virtual void              removeObjectFromAll( QString theEntry );
00105   virtual const ObjMap&     getObjectMap       ( int theViewMgrId );
00106   virtual const ViewMgrMap& getViewMgrMap      ( int theViewMgrId ) { return myViewMgrMap; };
00107 
00108   virtual void                  setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
00109   virtual Qtx::VisibilityState  visibilityState(const QString& theEntry) const;
00110   virtual void                  setVisibilityStateForAll(Qtx::VisibilityState theState);
00111 
00112   virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
00113 
00114 protected:
00115   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
00116   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
00117   virtual bool        saveStudyData  ( const QString& theFileName );
00118   virtual bool        openStudyData  ( const QString& theFileName );
00119 
00120   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
00121   virtual void        SetListOfFiles ( const char* theModuleName,
00122                                        const std::vector<std::string> theListOfFiles );
00123 
00124   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
00125 
00126 protected:
00127   virtual bool        openDataModel  ( const QString&, CAM_DataModel* );
00128   virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel, 
00129                                           SUIT_DataObject* theParent ) const;
00130 
00131 signals:
00132   void                saved  ( SUIT_Study* );
00133   void                opened ( SUIT_Study* );
00134   void                closed ( SUIT_Study* );
00135   void                created( SUIT_Study* );
00136 
00137 
00138 private:
00139   LightApp_Driver*    myDriver;
00140   ViewMgrMap          myViewMgrMap;
00141 
00142   friend class LightApp_Application;
00143   friend class LightApp_DataModel;
00144 };
00145 
00146 #endif