Version: 6.3.1

src/LightApp/LightApp_Study.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 LightApp_DataObject;
00042 
00043 //Map to store visual property of the object.
00044 //Key:   Name of the visual property of the object.
00045 //Value: value of the visual property.
00046 typedef QMap<QString, QVariant> PropMap;
00047 
00048 //Map to store objects with it's visual properties.
00049 //Key:   Entry of the object.
00050 //Value: Map of the visual properties of the object.
00051 typedef QMap<QString, PropMap> ObjMap;
00052 
00053 //Map to store view managers and all objects which displayed in views of the view managers.
00054 //Key:   Id of the viewer.
00055 //Value: Map of the objects with it's visual properties.
00056 typedef QMap<int, ObjMap> ViewMgrMap;
00057 
00058 
00064 class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
00065 {
00066   Q_OBJECT
00067 
00068 public:
00069   LightApp_Study( SUIT_Application* );
00070   virtual ~LightApp_Study();
00071 
00072   virtual bool        createDocument( const QString& );
00073   virtual bool        openDocument( const QString& );
00074   virtual bool        loadDocument( const QString& ); 
00075 
00076   virtual bool        saveDocument();
00077   virtual bool        saveDocumentAs( const QString& );
00078 
00079   virtual void        closeDocument(bool permanently = true);
00080 
00081   virtual bool        isSaved()  const;
00082   virtual bool        isModified() const;
00083 
00084   virtual void        addComponent   ( const CAM_DataModel* dm);
00085 
00086   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile );
00087 
00088   virtual QString     componentDataType( const QString& ) const;
00089   virtual QString     referencedToEntry( const QString& ) const;
00090   virtual bool        isComponent( const QString& ) const;
00091   virtual void        children( const QString&, QStringList& ) const;
00092   virtual void        components( QStringList& ) const;
00093   virtual QString     centry( const QString& ) const;
00094 
00095   virtual QString     getVisualComponentName() const;
00096 
00097   virtual void              setObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theValue );
00098   virtual QVariant          getObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theDefValue ) const;
00099   virtual void              removeViewMgr      ( int theViewMgrId );
00100   virtual void              setObjectPropMap   ( int theViewMgrId, QString theEntry, PropMap thePropMap );
00101   virtual const PropMap&    getObjectPropMap   ( int theViewMgrId, QString theEntry ) ;
00102   virtual void              removeObjectFromAll( QString theEntry );
00103   virtual const ObjMap&     getObjectMap       ( int theViewMgrId );
00104   virtual const ViewMgrMap& getViewMgrMap      ( int theViewMgrId ) { return myViewMgrMap; };
00105 
00106   virtual void                  setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
00107   virtual Qtx::VisibilityState  visibilityState(const QString& theEntry) const;
00108   virtual void                  setVisibilityStateForAll(Qtx::VisibilityState theState);
00109 
00110   virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
00111 
00112 protected:
00113   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
00114   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
00115   virtual bool        saveStudyData  ( const QString& theFileName );
00116   virtual bool        openStudyData  ( const QString& theFileName );
00117 
00118   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
00119   virtual void        SetListOfFiles ( const char* theModuleName,
00120                                        const std::vector<std::string> theListOfFiles );
00121 
00122   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
00123 
00124 protected:
00125   virtual bool        openDataModel  ( const QString&, CAM_DataModel* );
00126 
00127 signals:
00128   void                saved  ( SUIT_Study* );
00129   void                opened ( SUIT_Study* );
00130   void                closed ( SUIT_Study* );
00131   void                created( SUIT_Study* );
00132 
00133 
00134 private:
00135   LightApp_Driver*    myDriver;
00136   ViewMgrMap          myViewMgrMap;
00137 
00138   friend class LightApp_Application;
00139 };
00140 
00141 #endif 
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS