]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMBase/GEOMBase.h
Salome HOME
DCQ : New Architecture
[modules/geom.git] / src / GEOMBase / GEOMBase.h
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GEOMBase.h
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header: 
28
29 #ifndef GEOMBASE_H
30 #define GEOMBASE_H
31
32 #include "GEOMContext.h"
33
34 // SALOME Includes
35 #include "QAD_Config.h"
36 #include "SALOME_Selection.h"
37 #include "GEOM_Actor.h"
38 #include "GEOM_AISShape.hxx"
39 #include "GEOM_InteractiveObject.hxx"
40
41 // Open CASCADE Includes
42 #include <Quantity_Color.hxx>
43
44 // IDL Headers
45 #include <SALOMEconfig.h>
46 #include CORBA_SERVER_HEADER(SALOMEDS)
47 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
48
49 //=================================================================================
50 // class    : GEOMBase
51 // purpose  :
52 //=================================================================================
53 class GEOMBase : public QObject
54 {
55   Q_OBJECT /* for QT compatibility */
56     
57 public :
58   GEOMBase();
59   ~GEOMBase();
60
61   static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
62                           const QString& theParent, const QString& theObject);
63
64   bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
65   bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0);
66
67   /* Selection and objects management */
68   int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType);
69   TopoDS_Shape GetShapeFromIOR(QString IOR);
70   bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds);
71   int GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName); 
72   bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString);
73
74   /* Convertions */
75   GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, 
76                                             Standard_Boolean& testResult);
77   Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO,
78                                                 Standard_Boolean& testResult,
79                                                 bool onlyInActiveView = false); 
80   void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList,
81                                   GEOM::GEOM_Gen::ListOfIOR& listIOR); 
82
83   Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR,
84                                                  Standard_Boolean& testResult,
85                                                  bool onlyInActiveView = false);
86   GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult,
87                                     bool onlyInActiveView = false);
88
89   /* Geometry */
90   bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P);
91
92   /* Used just by Plane and Prism */
93   bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2);
94   void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz);
95
96   /* User dialog 1 parameter returned */
97   double Parameter(Standard_Boolean& res,
98                    const char* aValue1 = 0, const char* aTitle1 = 0,
99                    const char* aTitle = 0, const double bottom = -1E6,
100                    const double top = +1E6, const int decimals = 6);
101
102   //void SetDisplayedObjectList();
103
104   /* Simulation management */
105   bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
106   void DisplaySimulationShape(const TopoDS_Shape& S); 
107   void EraseSimulationShape();
108
109   /* Method used by dialog boxes called when used has entered a name of object in a LineEdit */
110   bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel);
111   bool DefineDlgPosition(QWidget* aDlg, int& x, int& y);
112
113   GEOMContext* myGeomGUI;
114   GEOM::GEOM_Gen_var myGeom;   /* Current Geom Component */
115
116   Quantity_Color myShadingColor;
117   Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
118   bool mySettings_AddInStudy;
119
120 };
121
122 #endif
123