Salome HOME
Fix compilation problem with OCCT 6.7.0
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI.hxx
index 49e7126904af2b602fcfe63d94a5a95420f5a6b7..b0451661df67ae94f586be9503c84d3cb2fd19ed 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2013  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <OB_Browser.h>
 #include <SalomeApp_Module.h>
 #include <SalomeApp_DataObject.h>
-// #include <LightApp_Module.h>
 
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_DataModel.h>
-
+#include <SOCC_Prs.h>
 #include <SALOMEconfig.h>
 
-
-// #include "MyBasicGUI_PointDlg.hxx"
-// #include "Resource.hxx"
 #include "HEXABLOCKGUI_Resource.hxx"
-
-#include "GEOMGUI_OCCSelector.h"
-
+#include "HEXABLOCKGUI_OCCSelector.h"
 #include "hexa_base.hxx"
 
 
-
-
-#include CORBA_CLIENT_HEADER(HEXABLOCK_Gen)
-// #include CORBA_CLIENT_HEADER(GEOM_Gen)
-// #include CORBA_CLIENT_HEADER(SMESH_Gen)
-
+// #include CORBA_CLIENT_HEADER(HEXABLOCK_Gen)  // Abu Juin 2013
 
 namespace HEXABLOCK
 {
@@ -65,15 +54,15 @@ namespace HEXABLOCK
     class VtkDocumentGraphicView;
     class OccGraphicView;
     class GraphicViewsHandler;
-    class DocumentDelegate;
+//    class DocumentDelegate;
     class DocumentModel;
     class PatternDataModel;
-    class PatternBuilderModel;
+//    class PatternBuilderModel;
     class AssociationsModel;
     class GroupsModel;
     class MeshModel;
     class PatternDataSelectionModel;
-    class PatternBuilderSelectionModel;
+//    class PatternBuilderSelectionModel;
     class GroupsSelectionModel;
     class MeshSelectionModel;
 
@@ -122,17 +111,9 @@ class SUIT_ViewWindow;
 class SVTK_ViewWindow;
 class OCCViewer_ViewWindow;
 class LightApp_VTKSelector;
-class MyGEOMBase_Helper;
 
-// // SALOME KERNEL includes
-// #include <SALOMEDS_Study.hxx>
-// #include <SALOMEDSClient_StudyBuilder.hxx>
-// #include <SALOMEDSClient_SComponent.hxx>
-// #include <SALOMEDSClient_ClientFactory.hxx>
-// #include <SALOMEDSClient_IParameters.hxx>
 
-
-class HEXABLOCKGUI : public SalomeApp_Module
+class HexaExport HEXABLOCKGUI : public SalomeApp_Module
 {
   Q_OBJECT
 
@@ -150,32 +131,27 @@ public:
 
   static SalomeApp_Study*         activeStudy();
 
-  static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* );
-//   static SMESH::SMESH_Gen_ptr             InitSMESHGen( SalomeApp_Application* app, const std::string& container = "FactoryServer" );
-  static GEOM::GEOM_Gen_ptr InitGEOMGen( SalomeApp_Application* app, const std::string& container = "FactoryServer" );
-
+  // static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* );
   static LightApp_SelectionMgr*   selectionMgr();
+  static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
+  static ViewType getActiveViewType();
+  static HEXABLOCKGUI*  getInstance();
 
   //add an object in the study
-  static QString addInStudy(QString& fileName);
-
+  void addInStudy(QMap<QString, TopoDS_Shape>& topo_shapes,
+                         QMap<QString, QString>& docShapesEntry,
+                         QMap<QString, QString>& docShapesName);
 
-//  static SVTK_ViewWindow*      currentVtkView;
   static HEXABLOCK::GUI::VtkDocumentGraphicView* currentDocGView;
   static HEXABLOCK::GUI::OccGraphicView* currentOccGView;
-  static MyGEOMBase_Helper*    geomBaseHelper;
   static bool assocInProgress;
   static SalomeApp_Application* myApplication;
-  static GEOMGUI_OCCSelector* currentOccSelector;
-
- //HEXABLOCK::GUI::DocumentModel*
 
   virtual void initialize( CAM_Application* app);
 
   virtual bool renameAllowed( const QString& ) const;
   virtual bool renameObject( const QString& entry, const QString& name);
   virtual void windows( QMap<int, int>& theMap) const;
-//   virtual LightApp_Displayer* displayer();
   virtual QString  engineIOR() const;
 
   virtual void viewManagers(QStringList& list) const;
@@ -197,22 +173,31 @@ public:
   void showAllMenus();
   void updateSelectors();
 
-//   void showBaseMenus(bool show);
-//   void showEditionMenus(bool show);
-//   void showExecMenus(bool show);
-//   void showCommonMenus(bool show);
-
   void switchModel(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview);
   void switchOnGraphicView(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview);
   void switchOffGraphicView(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview,
                               bool saveCurrentDlg = true);
   void showDockWidgets(bool isVisible);
 
-  HEXABLOCK::GUI::VtkDocumentGraphicView* getCurrentVtkGraphicView();
-  HEXABLOCK::GUI::VtkDocumentGraphicView* getDocument(SalomeApp_DataObject* studyObject);
+  HEXABLOCK::GUI::VtkDocumentGraphicView* getCurrentVtkGraphicView() const { return currentDocGView; }
+  HEXABLOCK::GUI::VtkDocumentGraphicView* getOrCreateDocument(SalomeApp_DataObject* studyObject);
+  HEXABLOCK::GUI::VtkDocumentGraphicView* getDocGViewByEntry(const QString& entry) const
+  {
+      return ( (docs.contains(entry) ? docs[entry] : NULL ) );
+  }
   HEXABLOCK::GUI::DocumentModel* getCurrentModel();
   HEXABLOCK::GUI::HexaBaseDialog* getDlgBox(HEXABLOCK::GUI::VtkDocumentGraphicView* view);
-  static ViewType getActiveViewType();
+  QTreeView* getPatternDataTreeView() const { return _patternDataTreeView; }
+  QTreeView* getPatternGeomTreeView() const { return _patternGeomTreeView; }
+
+  void showVertexInfoDialog(HEXA_NS::Vertex* vertex);
+  void showEdgeInfoDialog(HEXA_NS::Edge* edge);
+  void showQuadInfoDialog(HEXA_NS::Quad* quad);
+  void showHexaInfoDialog(HEXA_NS::Hexa* hexa);
+  void showVectorInfoDialog(HEXA_NS::Vector* vector);
+  void showGroupInfoDialog(HEXA_NS::Group* group);
+  void showLawInfoDialog(HEXA_NS::Law* law);
+  void showPropagationInfoDialog(HEXA_NS::Propagation* propagation);
 
 public slots:
   bool deactivateModule( SUIT_Study* theStudy);
@@ -224,15 +209,13 @@ public slots:
   void showAssociationMenus(bool show);
   void showGroupsMenus(bool show);
   void showMeshMenus(bool show);
-  
+
 protected slots:
   void onWindowActivated( SUIT_ViewWindow* svw);
   void onWindowClosed( SUIT_ViewWindow* svw);
-//  void OnMouseMove( SUIT_ViewWindow*, QMouseEvent* );
 
   virtual void                        onViewManagerAdded( SUIT_ViewManager* );
   virtual void                        onViewManagerRemoved( SUIT_ViewManager* );
-//   void onTryClose(bool &isClosed, QxScene_ViewWindow* window);
 
   void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
   void showActor();
@@ -240,21 +223,18 @@ protected slots:
   void showOnlyActor();
 
 protected:
-//   virtual  CAM_DataModel* createDataModel();
   bool createSComponent();
-//   virtual bool isSelectionCompatible();
   virtual bool eventFilter(QObject *obj, QEvent *event);
 
   void _showDialogBox( HEXABLOCK::GUI::HexaBaseDialog* diag );
   HEXABLOCK::GUI::HexaBaseDialog* currentDialog;
 
-//   bool _selectFromTree;
+  SOCC_Prs* lastOccPrs;
+  HEXABLOCK::GUI::VtkDocumentGraphicView* lastVtkDocGView;
+
   HEXABLOCKGUI_Resource* _myresource;
-//   SUIT_ResourceMgr* _myresource;
   static int _oldStudyId;
-  static HEXABLOCK_ORB::HEXABLOCK_Gen_var _hexaEngine;
-//   static SMESH::SMESH_Gen_var             _smeshEngine;
-  static GEOM::GEOM_Gen_var               _geomEngine;
+  // static HEXABLOCK_ORB::HEXABLOCK_Gen_var _hexaEngine;  // Hexa6 TODo
 private slots:
 
   void slot_modelChanged(const QModelIndex &topLeft, const QModelIndex  &bottomRight);
@@ -275,28 +255,22 @@ private slots:
   void addHexa();
 
   void addVector();
-  void addCylinder();
-  void addPipe();
-//   void makeCartesian();
-//   void makeCylindrical();
+//  void addCylinder();
+//  void addPipe();
   void makeGrid();
   void makeCylinder();
   void makePipe();
   void makeCylinders();
   void makePipes();
 
-//   void makeRind();    // NEW HEXA3
   void makeHemiSphere();  // NEW HEXA3
 
   void removeHexa();
   void prismQuad();
   void joinQuad();
-//   void mergeVertices();
-//   void mergeEdges();
   void merge();
   void disconnectElts();
   void cutEdge();
-//   void makeTranslation();
   void makeTransformation();
   void makeSymmetry();
   void performTransformation();
@@ -333,15 +307,21 @@ private slots:
 
 private:
 
-  QList<GEOMGUI_OCCSelector*>  myOCCSelectors;
+  QList<HEXABLOCKGUI_OCCSelector*>  myOCCSelectors;
   QList<LightApp_VTKSelector*> myVTKSelectors;
 
 
   QStringList getQuickDirList();
-//  HEXABLOCK::GUI::DocumentGraphicView* newGraphicView();
-  void restoreGraphicViews();
   void clearDialogs();
 
+  SOCC_Prs* getOccPrs(HEXABLOCK::GUI::VtkDocumentGraphicView* docGView)
+  {
+      if (docGView == NULL)
+          return NULL;
+      if (!occPrs.contains(docGView))
+          occPrs[docGView] = new SOCC_Prs();
+      return occPrs[docGView];
+  }
 
   // -------------------------------------------------------------------------------------------------
   //          MainWindow presentation
@@ -354,6 +334,8 @@ private:
   QDockWidget *_dwInputPanel;    // user Input
 
 
+  // ** Elements creation and modification Dialogs **
+
   // Dialog Box ( to keep persistent values )
   HEXABLOCK::GUI::VertexDialog*                 _vertexDiag;
   HEXABLOCK::GUI::EdgeDialog*                   _edgeDiag;
@@ -390,6 +372,16 @@ private:
   HEXABLOCK::GUI::ModelInfoDialog*              _modelInfoDiag;
   HEXABLOCK::GUI::AddShapeDialog*               _addShapeDiag;
 
+  // ** Elements information dialogs **
+  HEXABLOCK::GUI::VertexDialog*                 _vertexInfoDialog;
+  HEXABLOCK::GUI::EdgeDialog*                   _edgeInfoDialog;
+  HEXABLOCK::GUI::QuadDialog*                   _quadInfoDialog;
+  HEXABLOCK::GUI::HexaDialog*                   _hexaInfoDialog;
+  HEXABLOCK::GUI::VectorDialog*                 _vectorInfoDialog;
+  HEXABLOCK::GUI::GroupDialog*                  _groupInfoDialog;
+  HEXABLOCK::GUI::LawDialog*                    _lawInfoDialog;
+  HEXABLOCK::GUI::PropagationDialog*            _propagationInfoDialog;
+
 
   std::set<HEXABLOCK::GUI::HexaBaseDialog*> currentModelDialogs;
   // Actions
@@ -408,15 +400,14 @@ private:
 
   // Pattern Builder
   QAction *_addVector;
-  QAction *_addCylinder;
-  QAction *_addPipe;
+//  QAction *_addCylinder;
+//  QAction *_addPipe;
   QAction *_makeGrid; //Cartesian, Cylindrical, Spherical
   QAction *_makeCylinder;
   QAction *_makePipe;
   QAction *_makeCylinders;
   QAction *_makePipes;
 
-//   QAction *_makeRind;   // NEW HEXA3
   QAction *_makeHemiSphere; // NEW HEXA3
 
 
@@ -453,52 +444,51 @@ private:
 
   // Meshing
   QAction *_computeMesh;
-
   QAction* _showModelInfoAct;
-
   QAction* _addShapeAct;
 
-//  QAction *_showAct;
-//  QAction *_showOnlyAct;
-//  QAction *_hideAct;
+
+  QAction* _sep1; // tmonin
+  QAction* _sep2; // tmonin
+  QAction* _sep3; // tmonin
+  QAction* _sep4; // ...... tparti
 
   // -------------------------------------------------------------------------------------------------
-  //          Model/View implementation  
+  //          Model/View implementation
   // -------------------------------------------------------------------------------------------------
 
   HEXABLOCK::GUI::AssociationsModel   *_associationsModel;    // sub-part of DocumentModel
 
-
   //      VIEW      VIEW      VIEW      VIEW      VIEW      VIEW      VIEW      VIEW      VIEW      VIEW
   QTreeView* _patternDataTreeView;    //  document's pattern : 1 ( only one view )
-  QTreeView* _patternBuilderTreeView; //  document's pattern : 1 ( only one view )
+//  QTreeView* _patternBuilderTreeView; //  document's pattern : 1 ( only one view )
   QTreeView* _patternGeomTreeView; // the geometries' tree view
   QTreeView* _associationTreeView;    //  document's association : 1 ( only one view )
   QTreeView* _groupsTreeView; //  document's groups
   QTreeView* _meshTreeView;   //  document's mesh property: 1 ( only one view )
 
   //      DELEGATE      DELEGATE      DELEGATE      DELEGATE      DELEGATE      DELEGATE      DELEGATE
-  HEXABLOCK::GUI::DocumentDelegate    *_treeViewDelegate;  // specific editor for each item of the tree 
+//  HEXABLOCK::GUI::DocumentDelegate    *_treeViewDelegate;  // specific editor for each item of the tree
 
   HEXABLOCK::GUI::GraphicViewsHandler*  graphicViewsHandler; //vtk views hanlder (create, close, ...)
 
-  //  SALOME   SALOME    SALOME     SALOME     SALOME     SALOME     SALOME     SALOME     SALOME     SALOME
-  std::map<QString, HEXABLOCK::GUI::VtkDocumentGraphicView*>  docs; //  key = entry
+  //  SALOME   SALOME    SALOME   SALOME     SALOME     SALOME     SALOME     SALOME     SALOME     SALOME
+  QMap<QString, HEXABLOCK::GUI::VtkDocumentGraphicView*>  docs; //  key = entry
   QMap<HEXABLOCK::GUI::VtkDocumentGraphicView*, HEXABLOCK::GUI::HexaBaseDialog*>  gViewDlgBox; //  key = entry
+  QMap<HEXABLOCK::GUI::VtkDocumentGraphicView*, SOCC_Prs*> occPrs;
 
-//   int _documentCnt;
   bool _isSaved;
   bool moduleActivatedOnce;
 
   QDir* loadDocLastPath;
   QDir* saveDocLastPath;
 
-
   void testDocument();
   void test_make_cart_grid();
   void test_make_elmts_transform();
-  
 
+  QString       addDocInStudy (HEXA_NS::Document* doc);  // Hexa6
+  HEXA_NS::Hex* hexa_root;                               // Hexa6
 };
 
 #endif