1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Damien COQUERET
32 #include "GEOMContext.h"
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"
41 // Open CASCADE Includes
42 #include <Quantity_Color.hxx>
45 #include <SALOMEconfig.h>
46 #include CORBA_SERVER_HEADER(SALOMEDS)
47 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
49 //=================================================================================
52 //=================================================================================
53 class GEOMBase : public QObject
55 Q_OBJECT /* for QT compatibility */
61 static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
62 const QString& theParent, const QString& theObject);
64 bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
65 bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0);
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);
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);
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);
90 bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P);
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);
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);
102 //void SetDisplayedObjectList();
104 /* Simulation management */
105 bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
106 void DisplaySimulationShape(const TopoDS_Shape& S);
107 void EraseSimulationShape();
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);
113 GEOMContext* myGeomGUI;
114 GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
116 Quantity_Color myShadingColor;
117 Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
118 bool mySettings_AddInStudy;