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
33 #include "GEOM_AISShape.hxx"
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SALOMEDS)
38 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
39 #include CORBA_SERVER_HEADER(GEOM_Gen)
46 class TColStd_MapOfInteger;
50 //=================================================================================
53 //=================================================================================
60 // SAN -- TO BE REMOVED !!!
61 static bool Display( GEOM::GEOM_Object_ptr ) {return false;}
62 static bool AddInStudy( GEOM::GEOM_Object_ptr ) {return false;}
63 static void DisplaySimulationShape(const TopoDS_Shape& S) {};
64 static void EraseSimulationShape() {};
65 // SAN -- TO BE REMOVED !!!
67 /* Selection and objects management */
68 static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType);
69 static TopoDS_Shape GetShapeFromIOR(QString IOR);
70 static bool GetShape( const GEOM::GEOM_Object_ptr&, TopoDS_Shape&, const TopAbs_ShapeEnum = TopAbs_SHAPE );
71 static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds);
72 static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName, const bool theShapesOnly = false );
73 static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString);
76 static GEOM::GEOM_Object_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO,
77 Standard_Boolean& testResult);
78 static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO,
79 Standard_Boolean& testResult,
80 bool onlyInActiveView = false);
82 static Handle(AIS_InteractiveObject) GetAIS( const Handle(SALOME_InteractiveObject)& theIO,
83 const bool isOnlyInActiveView = false );
84 static void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList,
85 GEOM::string_array& listIOR);
87 static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR,
88 Standard_Boolean& testResult,
89 bool onlyInActiveView = false);
90 static GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult,
91 bool onlyInActiveView = false);
93 static GEOM::GEOM_Object_ptr ConvertIOinGEOMObject(const Handle(SALOME_InteractiveObject)& IO,
94 Standard_Boolean& testResult);
96 static void ConvertListOfIOInListOfGO( const SALOME_ListIO& aList,
97 GEOM::ListOfGO& listGO,
98 const bool theShapesOnly = false );
100 static GEOM::GEOM_Object_ptr GetObjectFromIOR( const char* theIOR );
102 static char* GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject );
105 static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P);
107 /* Used just by Plane and Prism */
108 static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2);
109 static void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz);
111 /* User dialog 1 parameter returned */
112 static double Parameter(Standard_Boolean& res,
113 const char* aValue1 = 0, const char* aTitle1 = 0,
114 const char* aTitle = 0, const double bottom = -1E6,
115 const double top = +1E6, const int decimals = 6);
117 /* Simulation management */
118 static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
120 /* Generates default names */
121 static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, const SALOME_ListIO& aList);
122 /* Shows message box with error code */
123 static bool DefineDlgPosition(QWidget* aDlg, int& x, int& y);
125 /* This method generates default names for results of geometrical operations */
126 static QString GetDefaultName(const QString& theOperation);
127 /* Shows message box with error code and comment */
128 static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0);
130 /* Gets name of object */
131 static QString GetName( GEOM::GEOM_Object_ptr );
133 static bool IsShape( GEOM::GEOM_Object_ptr theObj );