Version: 6.3.1

src/GEOMGUI/GeometryGUI.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 // GEOM GEOMGUI : GUI for Geometry component
00024 // File   : GeometryGUI.h
00025 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00026 //
00027 #ifndef GEOMETRYGUI_H
00028 #define GEOMETRYGUI_H
00029 
00030 #include "GEOM_GEOMGUI.hxx"
00031 
00032 #include <SalomeApp_Module.h>
00033 
00034 #include <GEOM_Client.hxx>
00035 #include <SALOME_InteractiveObject.hxx>
00036 #include <SALOMEDSClient.hxx>
00037 
00038 #include "GEOMGUI.h"
00039 
00040 // QT Includes
00041 #include <QMap>
00042 
00043 // OCCT Includes
00044 #include <gp_Ax3.hxx>
00045 #include <Graphic3d_HArray1OfBytes.hxx>
00046 
00047 // IDL headers
00048 #include "SALOMEconfig.h"
00049 #include CORBA_CLIENT_HEADER(SALOMEDS)
00050 
00051 // minimum allowed value for deflection coefficient
00052 #define DEFLECTION_MIN 1e-06
00053 
00054 //Define separators
00055 #define NAME_SEPARATOR  '_' // character used to separate parameter names
00056 #define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b)
00057 
00058 #define VISIBILITY_PROP       "Visibility"      //Object visibility property
00059 #define OPACITY_PROP          "Opacity"         //Object opacity property
00060 #define TRANSPARENCY_PROP     "Transparency"    //Object transparency property
00061 #define DISPLAY_MODE_PROP     "DisplayMode"     //Object display mode property
00062 #define ISOS_PROP             "Isos"            //Number of the Isos property of the object
00063 #define COLOR_PROP            "Color"           //Color of the object 
00064 #define VECTOR_MODE_PROP      "VectorMode"      //Vector mode property
00065 #define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property
00066 #define MARKER_TYPE_PROP      "MarkerType"      // Marker type property
00067 
00068 
00069 class QDialog;
00070 class QMenu;
00071 class GEOMGUI_OCCSelector;
00072 class LightApp_VTKSelector;
00073 class LightApp_Selection;
00074 class SUIT_ViewManager;
00075 class SalomeApp_Study;
00076 
00077 //=================================================================================
00078 // class    : GeometryGUI
00079 // purpose  :
00080 //=================================================================================
00081 class  GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
00082 {
00083   Q_OBJECT;
00084 
00085 public:
00086   // Constructor
00087   GeometryGUI();
00088 
00089   // Destructor
00090   ~GeometryGUI();
00091 
00092   virtual LightApp_Displayer* displayer();
00093   virtual void                initialize( CAM_Application* );
00094   virtual QString             engineIOR() const;
00095 
00096   static Handle(Graphic3d_HArray1OfBytes) getTexture( SalomeApp_Study*, int, int&, int& );
00097 
00098   static bool                 InitGeomGen();
00099 
00100   static  GEOM::GEOM_Gen_var  GetGeomGen();
00101 
00102   static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
00103   static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
00104 
00105   static void                 Modified( bool = true );
00106 
00107   GEOM_Client&                GetShapeReader()    { static SHAPE_READER(myShapeReader);return myShapeReader; }
00108 
00109   // Get active dialog box
00110   QDialog*                    GetActiveDialogBox(){ return myActiveDialogBox; }
00111   // Set active dialog box
00112   void                        SetActiveDialogBox( QDialog* aDlg );
00113 
00114   // Non modal dialog boxes management
00115   void                        EmitSignalDeactivateDialog();
00116   void                        EmitSignalCloseAllDialogs();
00117   void                        EmitSignalDefaultStepValueChanged( double newVal );
00118 
00119   // Process action
00120   void                        OnGUIEvent( int id );
00121 
00122   // The Working Plane management
00123   void                        SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp;   }
00124   gp_Ax3                      GetWorkingPlane()            { return myWorkingPlane; }
00125   void                        ActiveWorkingPlane();
00126 
00127   virtual bool                renameObject( const QString&, const QString& );
00128 
00129   virtual void                windows( QMap<int, int>& ) const;
00130   virtual void                viewManagers( QStringList& ) const;
00131 
00132   virtual void                contextMenuPopup( const QString&, QMenu*, QString& );
00133   virtual void                createPreferences();
00134   virtual void                preferencesChanged( const QString&, const QString& );
00135   int                         getLocalSelectionMode() const;
00136   void                        setLocalSelectionMode(const int mode);
00137 
00138   virtual void storeVisualParameters  (int savePoint);
00139   virtual void restoreVisualParameters(int savePoint);
00140 
00141 public slots:
00142   virtual bool                deactivateModule( SUIT_Study* );
00143   virtual bool                activateModule( SUIT_Study* );
00144   virtual void                OnKeyPress  ( SUIT_ViewWindow*, QKeyEvent*   );
00145   virtual void                OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
00146   virtual void                OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
00147 
00148 protected slots:
00149   virtual void                onViewManagerAdded( SUIT_ViewManager* );
00150   virtual void                onViewManagerRemoved( SUIT_ViewManager* );
00151 
00152 private slots:
00153   void                        OnGUIEvent();
00154   void                        onWindowActivated( SUIT_ViewWindow* );
00155   void                        onViewAboutToShow();
00156 
00157 signals :
00158   void                        SignalDeactivateActiveDialog();
00159   void                        SignalCloseAllDialogs();
00160   void                        SignalDefaultStepValueChanged( double newVal );
00161 
00162 protected:
00163   virtual LightApp_Selection* createSelection() const;
00164 
00165 private:
00166   GEOMGUI*                    getLibrary( const QString& libraryName );
00167   void                        createGeomAction( const int id, const QString& po_id,
00168                                                 const QString& icon_id = QString(""),
00169                                                 const int key = 0, const bool toggle = false,
00170                               const QString& shortcutAction = QString() );
00171   void                        createPopupItem( const int, const QString& clients, const QString& types,
00172                                                const bool isSingle = false, const int isVisible = -1,
00173                                                const bool isExpandAll = false, const bool isOCC = false,
00174                                                const int parentId = -1 );
00175 
00176   void                        createOriginAndBaseVectors();
00177 
00178 public:
00179   static GEOM::GEOM_Gen_var   myComponentGeom;   // GEOM engine!!!
00180 
00181 private:  
00182 
00183   typedef QMap<long, Handle(Graphic3d_HArray1OfBytes)> TextureMap;
00184   typedef QMap<long, TextureMap> StudyTextureMap;
00185   typedef QMap<QString, GEOMGUI*> GUIMap;
00186 
00187   GUIMap                      myGUIMap;          // GUI libraries map
00188   QDialog*                    myActiveDialogBox; // active dialog box
00189   gp_Ax3                      myWorkingPlane;
00190   QMap<int,QString>           myRules;           // popup rules
00191   static StudyTextureMap      myTextureMap;      // texture map
00192 
00193   QList<GEOMGUI_OCCSelector*>  myOCCSelectors;
00194   QList<LightApp_VTKSelector*> myVTKSelectors;
00195 
00196   LightApp_Displayer*         myDisplayer;
00197   int                         myLocalSelectionMode; //Select Only
00198 
00199   friend class DisplayGUI;
00200 };
00201 
00202 #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