Version: 9.16.0
GEOMBase.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// GEOM GEOMGUI : GUI for Geometry component
24// File : GEOMBase.h
25// Author : Damien COQUERET, Open CASCADE S.A.S.
26//
27#ifndef GEOMBASE_H
28#define GEOMBASE_H
29
30#include "GEOM_GEOMBase.hxx"
31
32// SALOME Includes
33#include <GEOM_AISShape.hxx>
34#include "GEOM_GenericObjPtr.h"
35
36// IDL Headers
37#include <SALOMEconfig.h>
38#include CORBA_SERVER_HEADER(SALOMEDS)
39#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
40#include CORBA_SERVER_HEADER(GEOM_Gen)
41
42// QT Includes
43#include <QString>
44
45class GEOM_Actor;
46class SALOME_ListIO;
47
48class QWidget;
49
50//=================================================================================
51// class : GEOMBase
52// purpose :
53//=================================================================================
55{
56public :
57 /* Selection and objects management */
58 static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape );
59 static TopoDS_Shape GetShapeFromIOR( const QString& IOR );
60 static bool GetShape( GEOM::GEOM_Object_ptr object,
61 TopoDS_Shape& shape,
62 const TopAbs_ShapeEnum type = TopAbs_SHAPE );
63 static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects );
64 static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects,
65 QString& name,
66 const bool shapesOnly = false );
67 static QString GetShapeTypeString( const TopoDS_Shape& shape );
68
69 /* Conversions */
71 ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO,
72 bool onlyInActiveView = false );
73
75 GetAIS( const Handle(SALOME_InteractiveObject)& IO,
76 bool onlyInActiveView = false,
77 bool onlyGeom = false );
78 static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects );
79
81 ConvertIORinGEOMAISShape( const QString& IOR,
82 bool onlyInActiveView = false );
83 static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR,
84 bool onlyInActiveView = false );
85
86 static GEOM::GEOM_Object_ptr
87 ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO );
88
89 static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
90 GEOM::ListOfGO& geomObjects,
91 bool shapesOnly = false );
92
93 static GEOM::GEOM_Object_ptr
94 GetObjectFromIOR( const QString& IOR );
95
96 static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
97
98 static GEOM::GEOM_Object_ptr GetObjectFromEntry(const char* entry);
99
100 /* Geometry */
101 static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point );
102
103 /* Used just by Plane and Prism */
104 static bool LinearEdgeExtremities( const TopoDS_Shape& shape,
105 gp_Pnt& point1, gp_Pnt& point2 );
106 static void GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2,
107 double& dx, double& dy, double& dz );
108
109 /* Simulation management */
110 static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds );
111
112 /* Generates default names */
113 static bool SelectionByNameInDialogs( QWidget* widget,
114 const QString& userObjectName,
115 const SALOME_ListIO& IObjects );
116 /* Shows message box with error code */
117 static void DefineDlgPosition( QWidget* dlg, int& x, int& y );
118
119 /* This method generates default names for results of geometrical operations */
120 static QString GetDefaultName( const QString& operation, bool extractPrefix = false );
121
122 /* Shows message box with error code and comment */
123 static void ShowErrorMessage( const QString& errorCode, const QString& comment = QString() );
124
125 /* Gets name of object */
126 static QString GetName( GEOM::GEOM_Object_ptr object );
127 static QString GetName( const QList<GEOM::GeomObjPtr>& objects );
128
129 /* Check if object has shape */
130 static bool IsShape( GEOM::GEOM_Object_ptr object );
131
132 /* Get string representation of shape type */
133 static QString TypeName( TopAbs_ShapeEnum type, bool capitalize = false );
134
135 /* Get study entry for the given object */
136 static QString GetEntry( GEOM::GEOM_Object_ptr object );
137
138 /* Publish sub-shape under the main object */
139 static void PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name = QString() );
140
141 static void Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
142};
143
144#endif // GEOMBASE_H
Handle(TColStd_HSequenceOfTransient) AdvancedEngine_IOperations
Create a T-shape object with specified caracteristics for the main and the incident pipes (radius,...
Definition: AdvancedEngine_IOperations.cxx:1907
#define GEOMBASE_EXPORT
Definition: GEOM_GEOMBase.hxx:36
Definition: GEOMBase.h:55
static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const QString &IOR
static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject) &IO
static Handle(AIS_InteractiveObject) GetAIS(const Handle(SALOME_InteractiveObject) &IO
....
Definition: GEOM_AISShape.hxx:44
This class allows to display an OpenCASCADE CAD model in a VTK viewer.
Definition: GEOM_Actor.h:60
sequence< GEOM_Object > ListOfGO
Definition: GEOM_Gen.idl:290