geom/src/GEOMBase/GEOMBase.h

139 lines
5.0 KiB
C
Raw Normal View History

2011-06-06 13:23:11 +06:00
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
2004-01-07 20:46:21 +05:00
//
2011-06-06 13:23:11 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2004-01-07 20:46:21 +05:00
//
2011-06-06 13:23:11 +06:00
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
2004-01-07 20:46:21 +05:00
//
2011-06-06 13:23:11 +06:00
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
2009-02-13 17:16:39 +05:00
//
2011-06-06 13:23:11 +06:00
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2009-02-13 17:16:39 +05:00
//
2011-06-06 13:23:11 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2009-02-13 17:16:39 +05:00
//
2010-05-14 21:15:28 +06:00
2009-02-13 17:16:39 +05:00
// GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
2004-01-07 20:46:21 +05:00
//
#ifndef GEOMBASE_H
#define GEOMBASE_H
#include "GEOM_GEOMBase.hxx"
2004-01-07 20:46:21 +05:00
// SALOME Includes
2009-02-13 17:16:39 +05:00
#include <GEOM_AISShape.hxx>
2004-01-07 20:46:21 +05:00
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
2004-12-01 15:39:14 +05:00
#include CORBA_SERVER_HEADER(GEOM_Gen)
// QT Includes
2009-02-13 17:16:39 +05:00
#include <QString>
2004-12-01 15:39:14 +05:00
class GEOM_Actor;
class SALOME_ListIO;
class QWidget;
2004-01-07 20:46:21 +05:00
//=================================================================================
// class : GEOMBase
// purpose :
//=================================================================================
class GEOMBASE_EXPORT GEOMBase
2004-01-07 20:46:21 +05:00
{
public :
/* Selection and objects management */
2010-12-29 16:12:27 +05:00
static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape );
static TopoDS_Shape GetShapeFromIOR( const QString& IOR );
static bool GetShape( GEOM::GEOM_Object_ptr object,
TopoDS_Shape& shape,
const TopAbs_ShapeEnum type = TopAbs_SHAPE );
static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects );
static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects,
QString& name,
const bool shapesOnly = false );
static QString GetShapeTypeString( const TopoDS_Shape& shape );
2004-01-07 20:46:21 +05:00
/* Convertions */
2010-12-29 16:12:27 +05:00
static Handle(GEOM_AISShape)
ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO,
bool onlyInActiveView = false );
2004-01-07 20:46:21 +05:00
2010-12-29 16:12:27 +05:00
static Handle(AIS_InteractiveObject)
GetAIS( const Handle(SALOME_InteractiveObject)& IO,
bool onlyInActiveView = false,
bool onlyGeom = false );
static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects );
2004-12-01 15:39:14 +05:00
2010-12-29 16:12:27 +05:00
static Handle(GEOM_AISShape)
ConvertIORinGEOMAISShape( const QString& IOR,
bool onlyInActiveView = false );
static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR,
bool onlyInActiveView = false );
2004-01-07 20:46:21 +05:00
2010-12-29 16:12:27 +05:00
static GEOM::GEOM_Object_ptr
ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO );
2004-12-01 15:39:14 +05:00
2010-12-29 16:12:27 +05:00
static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
GEOM::ListOfGO& geomObjects,
bool shapesOnly = false );
2004-12-01 15:39:14 +05:00
2010-12-29 16:12:27 +05:00
static GEOM::GEOM_Object_ptr
GetObjectFromIOR( const QString& IOR );
2010-12-29 16:12:27 +05:00
static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
2004-12-01 15:39:14 +05:00
2004-01-07 20:46:21 +05:00
/* Geometry */
2010-12-29 16:12:27 +05:00
static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point );
2004-01-07 20:46:21 +05:00
/* Used just by Plane and Prism */
2010-12-29 16:12:27 +05:00
static bool LinearEdgeExtremities( const TopoDS_Shape& shape,
gp_Pnt& point1, gp_Pnt& point2 );
static void GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2,
double& dx, double& dy, double& dz );
2004-01-07 20:46:21 +05:00
/* Simulation management */
2010-12-29 16:12:27 +05:00
static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds );
2004-01-07 20:46:21 +05:00
2004-12-01 15:39:14 +05:00
/* Generates default names */
2010-12-29 16:12:27 +05:00
static bool SelectionByNameInDialogs( QWidget* widget,
const QString& userObjectName,
const SALOME_ListIO& IObjects );
2004-12-01 15:39:14 +05:00
/* Shows message box with error code */
2010-12-29 16:12:27 +05:00
static void DefineDlgPosition( QWidget* dlg, int& x, int& y );
2004-01-07 20:46:21 +05:00
2004-06-16 21:24:55 +06:00
/* This method generates default names for results of geometrical operations */
2010-12-29 16:12:27 +05:00
static QString GetDefaultName( const QString& operation, bool extractPrefix = false );
2004-12-01 15:39:14 +05:00
/* Shows message box with error code and comment */
2010-12-29 16:12:27 +05:00
static void ShowErrorMessage( const QString& errorCode, const QString& comment = QString() );
2004-06-16 21:24:55 +06:00
2004-12-01 15:39:14 +05:00
/* Gets name of object */
2010-12-29 16:12:27 +05:00
static QString GetName( GEOM::GEOM_Object_ptr object );
2004-01-07 20:46:21 +05:00
/* Check if object has shape */
2010-12-29 16:12:27 +05:00
static bool IsShape( GEOM::GEOM_Object_ptr object );
/* Get string representation of shape type */
static QString TypeName( TopAbs_ShapeEnum type );
/* Get study entry for the given object */
static QString GetEntry( GEOM::GEOM_Object_ptr object );
/* Publish sub-shape under the main object */
static void PublishSubObject( GEOM::GEOM_Object_ptr object );
2004-01-07 20:46:21 +05:00
};
2009-02-13 17:16:39 +05:00
#endif // GEOMBASE_H