Changes for bug NPAL14533 (improvement GetShapesOnShape())

This commit is contained in:
skl 2008-03-31 12:05:05 +00:00
parent b781d18c83
commit 06cf8f676b
24 changed files with 1431 additions and 50 deletions

View File

@ -1382,6 +1382,45 @@ module GEOM
in long theShapeType,
in shape_state theState);
/*!
* \brief Find subshapes complying with given status
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \return List of IDs of all found sub-shapes.
*/
ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
in shape_state theState);
/*!
* \brief Find subshapes complying with given status
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \return List of all found sub-shapes.
*/
ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
in shape_state theState);
/*!
* \brief Find subshapes complying with given status
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \return compound includes all found sub-shapes.
*/
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
in shape_state theState);
/*!
* Get sub-shape(s) of \a theShapeWhere, which are
* coincident with \a theShapeWhat or could be a part of it.

View File

@ -346,6 +346,15 @@ module GEOM
long NumberOfEdges (in GEOM_Object theShape) ;
GEOM_Object ChangeOrientation (in GEOM_Object theShape) ;
GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
in shape_state theState);
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
in shape_state theState);
//-----------------------------------------------------------//
// BlocksOperations //
//-----------------------------------------------------------//

View File

@ -130,6 +130,7 @@ section.png \
select1.png \
sewing.png \
shading.png \
shapesonshape.png \
sketch.png \
sphere.png \
spheredxyz.png \

BIN
resources/shapesonshape.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,114 @@
/****************************************************************************
** Form implementation generated from reading ui file 'DlgRef_2Sel2List_QTD.ui'
**
** Created: Thu Mar 27 16:38:25 2008
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "DlgRef_2Sel2List_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a DlgRef_2Sel2List_QTD as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
DlgRef_2Sel2List_QTD::DlgRef_2Sel2List_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "DlgRef_2Sel2List_QTD" );
DlgRef_2Sel2List_QTDLayout = new QVBoxLayout( this, 11, 6, "DlgRef_2Sel2List_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
GroupBox1Layout->addWidget( LineEdit2, 1, 2 );
ComboBox2 = new QComboBox( FALSE, GroupBox1, "ComboBox2" );
GroupBox1Layout->addMultiCellWidget( ComboBox2, 3, 3, 1, 2 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( TextLabel4, 3, 0 );
ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" );
GroupBox1Layout->addMultiCellWidget( ComboBox1, 2, 2, 1, 2 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( TextLabel3, 2, 0 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
GroupBox1Layout->addWidget( LineEdit1, 0, 2 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( TextLabel2, 1, 0 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( TextLabel1, 0, 0 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( PushButton1, 0, 1 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( PushButton2, 1, 1 );
DlgRef_2Sel2List_QTDLayout->addWidget( GroupBox1 );
languageChange();
resize( QSize(187, 182).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
}
/*
* Destroys the object and frees any allocated resources
*/
DlgRef_2Sel2List_QTD::~DlgRef_2Sel2List_QTD()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void DlgRef_2Sel2List_QTD::languageChange()
{
setCaption( tr( "DlgRef_2Sel2List_QTD" ) );
GroupBox1->setTitle( QString::null );
TextLabel4->setText( tr( "TL4" ) );
TextLabel3->setText( tr( "TL3" ) );
TextLabel2->setText( tr( "TL2" ) );
TextLabel1->setText( tr( "TL1" ) );
PushButton1->setText( QString::null );
PushButton2->setText( QString::null );
}

View File

@ -0,0 +1,55 @@
/****************************************************************************
** Form interface generated from reading ui file 'DlgRef_2Sel2List_QTD.ui'
**
** Created: Thu Mar 27 16:38:25 2008
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef DLGREF_2SEL2LIST_QTD_H
#define DLGREF_2SEL2LIST_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QGroupBox;
class QLineEdit;
class QComboBox;
class QLabel;
class QPushButton;
class DlgRef_2Sel2List_QTD : public QWidget
{
Q_OBJECT
public:
DlgRef_2Sel2List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~DlgRef_2Sel2List_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit2;
QComboBox* ComboBox2;
QLabel* TextLabel4;
QComboBox* ComboBox1;
QLabel* TextLabel3;
QLineEdit* LineEdit1;
QLabel* TextLabel2;
QLabel* TextLabel1;
QPushButton* PushButton1;
QPushButton* PushButton2;
protected:
QVBoxLayout* DlgRef_2Sel2List_QTDLayout;
QGridLayout* GroupBox1Layout;
protected slots:
virtual void languageChange();
};
#endif // DLGREF_2SEL2LIST_QTD_H

View File

@ -59,6 +59,7 @@ dist_libDlgRef_la_SOURCES = \
DlgRef_2Sel3Spin2Rb.cxx \
DlgRef_4Sel1List_QTD.cxx \
DlgRef_2Sel1List_QTD.cxx \
DlgRef_2Sel2List_QTD.cxx \
DlgRef_2Sel1List1Check_QTD.cxx \
DlgRef_1List1Spin1Btn_QTD.cxx \
DlgRef_4Sel1List1Check_QTD.cxx \
@ -67,7 +68,7 @@ dist_libDlgRef_la_SOURCES = \
DlgRef_3Spin_QTD.cxx \
DlgRef_3Spin1Check_QTD.cxx \
DlgRef_3Sel3Spin1Check_QTD.cxx \
DlgRef_3Sel3Spin2Check_QTD.cxx \
DlgRef_3Sel3Spin2Check_QTD.cxx \
DlgRef_4Sel1Spin2Check_QTD.cxx \
DlgRef_SpinBox.cxx \
DlgRef_1Sel1Spin.cxx \
@ -85,7 +86,7 @@ dist_libDlgRef_la_SOURCES = \
DlgRef_2Sel4Spin1Check.cxx \
DlgRef_3Sel4Spin2Check.cxx \
DlgRef_3Sel3Spin1Check.cxx \
DlgRef_3Sel3Spin2Check.cxx \
DlgRef_3Sel3Spin2Check.cxx \
DlgRef_1Spin.cxx \
DlgRef_2Spin.cxx \
DlgRef_3Spin.cxx \
@ -122,6 +123,7 @@ MOC_FILES = \
DlgRef_3Sel4Spin2Check_QTD_moc.cxx \
DlgRef_4Sel1List_QTD_moc.cxx \
DlgRef_2Sel1List_QTD_moc.cxx \
DlgRef_2Sel2List_QTD_moc.cxx \
DlgRef_2Sel1List1Check_QTD_moc.cxx \
DlgRef_1List1Spin1Btn_QTD_moc.cxx \
DlgRef_4Sel1List1Check_QTD_moc.cxx \
@ -130,7 +132,7 @@ MOC_FILES = \
DlgRef_3Spin_QTD_moc.cxx \
DlgRef_3Spin1Check_QTD_moc.cxx \
DlgRef_3Sel3Spin1Check_QTD_moc.cxx \
DlgRef_3Sel3Spin2Check_QTD_moc.cxx \
DlgRef_3Sel3Spin2Check_QTD_moc.cxx \
DlgRef_4Sel1Spin2Check_QTD_moc.cxx \
DlgRef_SpinBox_moc.cxx \
DlgRef_1Sel1Spin_moc.cxx \
@ -148,7 +150,7 @@ MOC_FILES = \
DlgRef_2Sel4Spin1Check_moc.cxx \
DlgRef_3Sel4Spin2Check_moc.cxx \
DlgRef_3Sel3Spin1Check_moc.cxx \
DlgRef_3Sel3Spin2Check_moc.cxx \
DlgRef_3Sel3Spin2Check_moc.cxx \
DlgRef_1Spin_moc.cxx \
DlgRef_2Spin_moc.cxx \
DlgRef_3Spin_moc.cxx \
@ -187,6 +189,7 @@ salomeinclude_HEADERS = \
DlgRef_2Sel3Spin2Rb.h \
DlgRef_4Sel1List_QTD.h \
DlgRef_2Sel1List_QTD.h \
DlgRef_2Sel2List_QTD.h \
DlgRef_2Sel1List1Check_QTD.h \
DlgRef_1List1Spin1Btn_QTD.h \
DlgRef_4Sel1List1Check_QTD.h \
@ -195,7 +198,7 @@ salomeinclude_HEADERS = \
DlgRef_3Spin_QTD.h \
DlgRef_3Spin1Check_QTD.h \
DlgRef_3Sel3Spin1Check_QTD.h \
DlgRef_3Sel3Spin2Check_QTD.h \
DlgRef_3Sel3Spin2Check_QTD.h \
DlgRef_4Sel1Spin2Check_QTD.h \
DlgRef_SpinBox.h \
DlgRef_1Sel1Spin.h \
@ -213,7 +216,7 @@ salomeinclude_HEADERS = \
DlgRef_2Sel4Spin1Check.h \
DlgRef_3Sel4Spin2Check.h \
DlgRef_3Sel3Spin1Check.h \
DlgRef_3Sel3Spin2Check.h \
DlgRef_3Sel3Spin2Check.h \
DlgRef_1Spin.h \
DlgRef_2Spin.h \
DlgRef_3Spin.h \

View File

@ -0,0 +1,154 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>DlgRef_2Sel2List_QTD</class>
<widget class="QWidget">
<property name="name">
<cstring>DlgRef_2Sel2List_QTD</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>187</width>
<height>182</height>
</rect>
</property>
<property name="caption">
<string>DlgRef_2Sel2List_QTD</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>
</property>
<property name="title">
<string></string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLineEdit" row="1" column="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
</widget>
<widget class="QComboBox" row="3" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>ComboBox2</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>TextLabel4</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL4</string>
</property>
</widget>
<widget class="QComboBox" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>ComboBox1</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL3</string>
</property>
</widget>
<widget class="QLineEdit" row="0" column="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL2</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL1</string>
</property>
</widget>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>PushButton1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>PushButton2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
</grid>
</widget>
</vbox>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -201,6 +201,10 @@ msgstr "arccenter.png"
msgid "ICON_DLG_ARCHIMEDE"
msgstr "archimede.png"
#GetShapesOnShapeDlg
msgid "ICON_DLG_SHAPES_ON_SHAPE"
msgstr "shapesonshape.png"
#PartitionDlg
msgid "ICON_DLG_PARTITION"
msgstr "partition.png"

View File

@ -465,6 +465,16 @@ msgstr "Step U :"
#==============================================================================
#
#ShapesOnShape
msgid "GEOM_SHAPES_ON_SHAPE"
msgstr "Shapes_on_shape"
msgid "GEOM_SHAPES_ON_SHAPE_ESHAPE"
msgstr "Shape for exploding"
msgid "GEOM_SHAPES_ON_SHAPE_CSHAPE"
msgstr "Shape for checking"
msgid "GEOM_SHAPES_ON_SHAPE_STATE"
msgstr "State"
#Partition
msgid "GEOM_PARTITION"
msgstr "Partition"
@ -1076,6 +1086,10 @@ msgstr "Change Orientation"
msgid "GEOM_ORIENTATION_OPT"
msgstr "Reverse orientation with normal vectors simulation"
#: GeometryGUI_GetShapesOnShapeDlg.cxx
msgid "GEOM_SHAPES_ON_SHAPE_TITLE"
msgstr "Get shapes on shape"
#: GeometryGUI_PartitionDlg.cxx:45
msgid "GEOM_PARTITION_TITLE"
msgstr "Partition Of Object With Tool"
@ -1430,6 +1444,19 @@ msgstr "Bezier"
msgid "GEOM_INTERPOL"
msgstr "Interpolation"
msgid "GEOM_STATE_IN"
msgstr "IN"
msgid "GEOM_STATE_OUT"
msgstr "OUT"
msgid "GEOM_STATE_ON"
msgstr "ON"
msgid "GEOM_STATE_ONIN"
msgstr "ONIN"
msgid "GEOM_STATE_ONOUT"
msgstr "ONOUT"
msgid "GEOM_STATE_INOUT"
msgstr "INOUT"
#
#==============================================================================
#
@ -2589,6 +2616,15 @@ msgstr "Partition"
msgid "STB_PARTITION"
msgstr "Partition"
msgid "TOP_GET_SHAPES_ON_SHAPES"
msgstr "Get shapes on shape"
msgid "MEN_GET_SHAPES_ON_SHAPES"
msgstr "Get shapes on shape"
msgid "STB_GET_SHAPES_ON_SHAPES"
msgstr "Get shapes on shape"
msgid "TOP_ARCHIMEDE"
msgstr "Archimede"

View File

@ -435,6 +435,16 @@ msgstr "Pas U :"
#==============================================================================
#
#GetShapesOnShape
msgid "GEOM_SHAPES_ON_SHAPE"
msgstr "Get shapes on shape"
msgid "GEOM_SHAPES_ON_SHAPE_ESHAPE"
msgstr "Shape for exploding"
msgid "GEOM_SHAPES_ON_SHAPE_CSHAPE"
msgstr "Shape for checking"
msgid "GEOM_SHAPES_ON_SHAPE_STATE"
msgstr "State"
#Partition
msgid "GEOM_PARTITION"
msgstr "Partition"
@ -977,6 +987,10 @@ msgstr "Changer l'Orientation"
msgid "GEOM_ORIENTATION_OPT"
msgstr "Renverser l'orientation avec une simulation de vecteur normal"
#: GeometryGUI_GetShapesOnShapeDlg.cxx
msgid "GEOM_SHAPES_ON_SHAPE_TITLE"
msgstr "Get shapes on shape"
#: GeometryGUI_PartitionDlg.cxx:45
msgid "GEOM_PARTITION_TITLE"
msgstr "Partition d'Objects Avec Outils"
@ -1274,6 +1288,19 @@ msgstr "Bezier"
msgid "GEOM_INTERPOL"
msgstr "Interpolation"
msgid "GEOM_STATE_IN"
msgstr "IN"
msgid "GEOM_STATE_OUT"
msgstr "OUT"
msgid "GEOM_STATE_ON"
msgstr "ON"
msgid "GEOM_STATE_ONIN"
msgstr "ONIN"
msgid "GEOM_STATE_ONOUT"
msgstr "ONOUT"
msgid "GEOM_STATE_INOUT"
msgstr "INOUT"
#
#==============================================================================
#

View File

@ -499,7 +499,8 @@ void GeometryGUI::OnGUIEvent( int id )
id == 504 || // MENU OPERATION - ARCHIMEDE
id == 505 || // MENU OPERATION - FILLET
id == 506 || // MENU OPERATION - CHAMFER
id == 507 ) { // MENU OPERATION - CLIPPING RANGE
id == 507 || // MENU OPERATION - CLIPPING RANGE
id == 508 ) { // MENU OPERATION - GET SHAPES ON SHAPE
#ifndef WNT
library = getLibrary( "libOperationGUI.so" );
#else
@ -830,6 +831,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 505, "FILLET" );
createGeomAction( 506, "CHAMFER" );
//createGeomAction( 507, "CLIPPING" );
createGeomAction( 508, "GET_SHAPES_ON_SHAPES" );
createGeomAction( 9998, "MUL_TRANSFORM" );
createGeomAction( 9995, "EXPLODE_BLOCKS" );
@ -981,6 +983,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( 503, operId, -1 );
createMenu( 504, operId, -1 );
createMenu( 508, operId, -1 );
createMenu( separator(), operId, -1 );
createMenu( 505, transId, -1 );
createMenu( 506, transId, -1 );

View File

@ -50,6 +50,7 @@ using namespace std;
#include "GEOMAlgo_FinderShapeOnQuad.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_ClsfBox.hxx"
#include "GEOMAlgo_ClsfSolid.hxx"
#include "GEOMAlgo_Gluer1.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
@ -116,6 +117,7 @@ using namespace std;
#include <vector>
#include <Standard_NullObject.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@ -1554,7 +1556,7 @@ Handle(TColStd_HSequenceOfInteger)
// Make a Python command
GEOM::TPythonDump(aFunction)
<< "listShapesOnBoxIDs = geompy.GetShapesOnQuadrangleIDs("
<< "listShapesOnBoxIDs = geompy.GetShapesOnBoxIDs("
<< theBox << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
@ -1612,6 +1614,235 @@ Handle(TColStd_HSequenceOfTransient)
}
//=======================================================================
//function : getShapesOnShapeIDs
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfInteger)
GEOMImpl_IShapesOperations::getShapesOnShapeIDs
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
TopoDS_Shape aCheckShape = theCheckShape->GetValue();
TopoDS_Shape aShape = theShape->GetValue();
TopTools_ListOfShape res;
// Check presence of triangulation, build if need
if (!CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// Call algo
GEOMAlgo_FinderShapeOn2 aFinder;
Standard_Real aTol = 0.0001; // default value
Handle(GEOMAlgo_ClsfSolid) aClsfSolid = new GEOMAlgo_ClsfSolid;
aClsfSolid->SetShape(aCheckShape);
aFinder.SetShape(aShape);
aFinder.SetTolerance(aTol);
aFinder.SetClsf(aClsfSolid);
aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
aFinder.SetState(theState);
aFinder.Perform();
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
// the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
if (iErr) {
MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
SetErrorCode(aMsg);
return aSeqOfIDs;
}
Standard_Integer iWrn = aFinder.WarningStatus();
// the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
if (listSS.Extent() < 1) {
//SetErrorCode("Not a single sub-shape of the requested type found on the given surface");
SetErrorCode(NOT_FOUND_ANY); // NPAL18017
}
// Fill sequence of object IDs
aSeqOfIDs = new TColStd_HSequenceOfInteger;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
int id = anIndices.FindIndex(itSub.Value());
aSeqOfIDs->Append(id);
}
return aSeqOfIDs;
}
//=======================================================================
//function : GetShapesOnShapeIDs
/*!
* \brief Find subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfInteger)
GEOMImpl_IShapesOperations::GetShapesOnShapeIDs
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
// The GetShapesOnShape() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction =
GEOM::GetCreatedLast(theShape,theCheckShape)->GetLastFunction();
// Make a Python command
GEOM::TPythonDump(aFunction)
<< "listShapesOnBoxIDs = geompy.GetShapesOnShapeIDs("
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")";
SetErrorCode(OK);
return aSeqOfIDs;
}
//=======================================================================
//function : GetShapesOnShape
/*!
* \brief Find subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfTransient) - found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetShapesOnShape
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
// Find objects by indices
TCollection_AsciiString anAsciiList;
Handle(TColStd_HSequenceOfTransient) aSeq;
aSeq = getObjectsShapesOn( theShape, aSeqOfIDs, anAsciiList );
if ( aSeq.IsNull() || aSeq->IsEmpty() )
return NULL;
// Make a Python command
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
GEOM::TPythonDump(aFunction)
<< "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnShape("
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")";
SetErrorCode(OK);
return aSeq;
}
//=======================================================================
//function : GetShapesOnShapeAsCompound
//=======================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
// Find objects by indices
TCollection_AsciiString anAsciiList;
Handle(TColStd_HSequenceOfTransient) aSeq;
aSeq = getObjectsShapesOn( theShape, aSeqOfIDs, anAsciiList );
if ( aSeq.IsNull() || aSeq->IsEmpty() )
return NULL;
TopoDS_Compound aCompound;
BRep_Builder B;
B.MakeCompound(aCompound);
int i = 1;
for(; i<=aSeq->Length(); i++) {
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(aSeq->Value(i));
TopoDS_Shape aShape_i = anObj->GetValue();
B.Add(aCompound,aShape_i);
}
//Add a new result object
Handle(GEOM_Object) aRes = GetEngine()->AddObject(GetDocID(), GEOM_SHAPES_ON_SHAPE);
Handle(GEOM_Function) aFunction =
aRes->AddFunction(GEOMImpl_ShapeDriver::GetID(), SHAPES_ON_SHAPE);
aFunction->SetValue(aCompound);
GEOM::TPythonDump(aFunction)
<< aRes << " = geompy.GetShapesOnShapeAsCompound("
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")";
SetErrorCode(OK);
return aRes;
}
//=======================================================================
//function : getShapesOnSurfaceIDs
/*!

View File

@ -254,13 +254,46 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnBox(const Handle(GEOM_Object)& theBox,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
GetShapesOnBox(const Handle(GEOM_Object)& theBox,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
/*!
* \brief Find subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
Standard_EXPORT Handle(GEOM_Object)
GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
public:
/*!
@ -298,8 +331,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
* \param theShapeType - the shape type to check
* \retval bool - result of the check
* \param theShapeType - the shape type to check
* \retval bool - result of the check
*/
bool checkTypeShapesOn(const Standard_Integer theShapeType);
@ -312,20 +345,20 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Creates Geom_CylindricalSurface
* \param theAx1 - edge defining cylinder axis
* \param theRadius - cylinder radius
* \retval Handle(Geom_Surface) - resulting surface
* \param theAx1 - edge defining cylinder axis
* \param theRadius - cylinder radius
* \retval Handle(Geom_Surface) - resulting surface
*/
Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
const Standard_Real theRadius);
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Handle(TColStd_HSequenceOfInteger)
getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
@ -335,12 +368,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Find subshapes complying with given status about surface
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/
Handle(TColStd_HSequenceOfTransient)
getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
@ -351,14 +384,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Find IDs of subshapes complying with given status about quadrangle
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theTopLeftPoint - top left quadrangle corner
* \param theTopRigthPoint - top right quadrangle corner
* \param theBottomLeftPoint - bottom left quadrangle corner
* \param theBottomRigthPoint - bottom right quadrangle corner
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theTopLeftPoint - top left quadrangle corner
* \param theTopRigthPoint - top right quadrangle corner
* \param theBottomLeftPoint - bottom left quadrangle corner
* \param theBottomRigthPoint - bottom right quadrangle corner
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Handle(TColStd_HSequenceOfInteger)
getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
@ -371,23 +404,37 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theBox - the box to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
* \param theBox - the box to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theCheckShape - the shape to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Handle(TColStd_HSequenceOfInteger) getShapesOnShapeIDs
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
/*!
* \brief Find shape objects and their entries by their ids
* \param theShape - the main shape
* \param theShapeIDs - theShapeIDs - incoming shape ids
* \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
* \param theShape - the main shape
* \param theShapeIDs - theShapeIDs - incoming shape ids
* \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/
Handle(TColStd_HSequenceOfTransient)
getObjectsShapesOn(const Handle(GEOM_Object)& theShape,
@ -396,9 +443,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
/*!
* \brief Select the object created last
* \param theObj1 - Object 1
* \param theObj2 - Object 2
* \retval Handle(GEOM_Object) - selected object
* \param theObj1 - Object 1
* \param theObj2 - Object 2
* \retval Handle(GEOM_Object) - selected object
*/
static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
const Handle(GEOM_Object)& theObj2);

View File

@ -83,6 +83,9 @@
#define GEOM_COMPOUNDFILTER 41
#define GEOM_SHAPES_ON_SHAPE 42
//GEOM_Function types
#define COPY_WITH_REF 1
@ -249,6 +252,8 @@
#define GROUP_FUNCTION 1
#define SHAPES_ON_SHAPE 1
// Blocks
#define BLOCK_FACE_FOUR_PNT 1
#define BLOCK_FACE_FOUR_EDGES 2

View File

@ -1290,6 +1290,133 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
return aSeq._retn();
}
//=============================================================================
/*!
* GetShapesOnShape
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
if ( theShape == NULL || theCheckShape == NULL )
return aSeq._retn();
//Get the reference objects
Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theCheckShape->GetEntry());
if (aShape.IsNull() || aCheckShape.IsNull() )
return aSeq._retn();
//Get Shapes On Shape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
(aCheckShape,aShape, theShapeType,ShapeState(theState));
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* GetShapesOnShapeAsCompound
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if ( theShape == NULL || theCheckShape == NULL )
return aGEOMObject._retn();
//Get the reference objects
Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theCheckShape->GetEntry());
if (aShape.IsNull() || aCheckShape.IsNull() )
return aGEOMObject._retn();
//Get Shapes On Shape
Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
(aCheckShape,aShape, theShapeType,ShapeState(theState));
if (anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* GetShapesOnShapeIDs
*/
//=============================================================================
GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState)
{
GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
//Set a not done flag
GetOperations()->SetNotDone();
if ( theShape == NULL || theCheckShape == NULL )
return aSeq._retn();
//Get the reference objects
Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theCheckShape->GetEntry());
if (aShape.IsNull() || aCheckShape.IsNull() )
return aSeq._retn();
//Get Shapes On Shape
Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
(aCheckShape,aShape, theShapeType,ShapeState(theState));
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = aHSeq->Value(i);
return aSeq._retn();
}
//=============================================================================
/*!
* GetInPlace

View File

@ -175,6 +175,22 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
CORBA::Long theShapeType,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat);

View File

@ -1892,6 +1892,7 @@ CORBA::Long GEOM_Superv_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
return aRes;
}
//=============================================================================
// ChangeOrientation:
//=============================================================================
@ -1906,6 +1907,46 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ChangeOrientation (GEOM::GEOM_Object_ptr th
}
//=============================================================================
// GetShapesOnShape:
//=============================================================================
GEOM::GEOM_List_ptr GEOM_Superv_i::GetShapesOnShape
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState)
{
beginService( " GEOM_Superv_i::GetShapesOnShape" );
MESSAGE("GEOM_Superv_i::GetShapesOnShape");
getShapesOp();
GEOM::ListOfGO* aList =
myShapesOp->GetShapesOnShape(theCheckShape, theShape, theShapeType, theState);
GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList));
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
endService( " GEOM_Superv_i::GetShapesOnShape" );
return aListPtr->_this();
}
//=============================================================================
// GetShapesOnShapeAsCompound:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState)
{
beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound");
getShapesOp();
GEOM::GEOM_Object_ptr anObj =
myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState);
endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
return anObj;
}
//=============================== BlocksOperations ============================
//=============================================================================
// MakeQuad4Vertices:

View File

@ -414,6 +414,17 @@ public:
CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape);
GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape);
GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
//-----------------------------------------------------------//
// BlocksOperations //
//-----------------------------------------------------------//

View File

@ -1107,6 +1107,38 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType,
# situated relatively the specified \a theCheckShape by the
# certain way, defined through \a theState parameter.
# @param theCheckShape Shape for relative comparing.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved.
# @param theState The state of the subshapes to find. It can be one of
# ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
# @return List of all found sub-shapes.
#
def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
theShapeType, theState)
RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
return aList
## Works like the above method, but returns result as compound
#
def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
theShapeType, theState)
RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
return anObj
## Works like the above method, but returns list of sub-shapes indices
#
def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
theShapeType, theState)
RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
return aList
## Get sub-shape(s) of theShapeWhere, which are
# coincident with \a theShapeWhat or could be a part of it.
# @param theShapeWhere Shape to find sub-shapes of.

View File

@ -39,6 +39,7 @@ dist_libOperationGUI_la_SOURCES = \
OperationGUI.cxx \
OperationGUI_ArchimedeDlg.cxx \
OperationGUI_PartitionDlg.cxx \
OperationGUI_GetShapesOnShapeDlg.cxx \
OperationGUI_FilletDlg.cxx \
OperationGUI_ChamferDlg.cxx \
OperationGUI_ClippingDlg.cxx
@ -46,6 +47,7 @@ dist_libOperationGUI_la_SOURCES = \
MOC_FILES = \
OperationGUI_ArchimedeDlg_moc.cxx \
OperationGUI_PartitionDlg_moc.cxx \
OperationGUI_GetShapesOnShapeDlg_moc.cxx \
OperationGUI_FilletDlg_moc.cxx \
OperationGUI_ChamferDlg_moc.cxx \
OperationGUI_ClippingDlg_moc.cxx
@ -75,6 +77,7 @@ libOperationGUI_la_CPPFLAGS = \
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMAlgo \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix

View File

@ -40,8 +40,8 @@
#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
#include "OperationGUI_FilletDlg.h" // Method FILLET
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h"
#include "OperationGUI_GetShapesOnShapeDlg.h"
using namespace std;
@ -80,6 +80,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 505: (new OperationGUI_FilletDlg (getGeometryGUI(), parent))->show(); break;
case 506: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break;
case 507: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
case 508: (new OperationGUI_GetShapesOnShapeDlg (getGeometryGUI(), parent))->show(); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
}

View File

@ -0,0 +1,345 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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.
//
// 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.
//
// 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : OperationGUI_GetShapesOnShapeDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
#include "OperationGUI_GetShapesOnShapeDlg.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <qcombobox.h>
#include <qlabel.h>
//using namespace std;
//==============================================================================
// class : OperationGUI_GetShapesOnShapeDlg()
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
// 'parent', with the name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg(GeometryGUI* theGeometryGUI,
QWidget* parent)
:GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_GetShapesOnShapeDlg", false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SHAPES_ON_SHAPE")));
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setCaption(tr("GEOM_SHAPES_ON_SHAPE_TITLE"));
GroupConstructors->setTitle(tr("GEOM_SHAPES_ON_SHAPE"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
GroupPoints = new DlgRef_2Sel2List_QTD(this, "GroupPoints");
//GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
GroupPoints->GroupBox1->setTitle("Input data");
GroupPoints->TextLabel1->setText(tr("GEOM_SHAPES_ON_SHAPE_ESHAPE"));
GroupPoints->TextLabel2->setText(tr("GEOM_SHAPES_ON_SHAPE_CSHAPE"));
GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT"));
GroupPoints->TextLabel4->setText(tr("GEOM_SHAPES_ON_SHAPE_STATE"));
GroupPoints->PushButton1->setPixmap(image2);
GroupPoints->PushButton2->setPixmap(image2);
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0);
Init();
}
//=================================================================================
// function : ~OperationGUI_GetShapesOnShapeDlg
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
OperationGUI_GetShapesOnShapeDlg::~OperationGUI_GetShapesOnShapeDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::Init()
{
/* type for sub shape selection */
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE"));
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE"));
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
/* type for state selection */
GroupPoints->ComboBox2->insertItem(tr("GEOM_STATE_IN"));
GroupPoints->ComboBox2->insertItem(tr("GEOM_STATE_OUT"));
GroupPoints->ComboBox2->insertItem(tr("GEOM_STATE_ON"));
GroupPoints->ComboBox2->insertItem(tr("GEOM_STATE_ONIN"));
GroupPoints->ComboBox2->insertItem(tr("GEOM_STATE_ONOUT"));
GroupPoints->LineEdit1->clear();
GroupPoints->LineEdit2->clear();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
connect(GroupPoints->ComboBox2, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
globalSelection( GEOM_ALLSHAPES );
initName( GroupConstructors->title() );
resize(0, 0);
GroupPoints->TextLabel3->show();
GroupPoints->ComboBox1->show();
GroupPoints->ComboBox1->setCurrentItem(0);
GroupPoints->ComboBox2->show();
GroupPoints->ComboBox2->setCurrentItem(0);
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::ClickOnOk()
{
if ( ClickOnApply() )
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool OperationGUI_GetShapesOnShapeDlg::ClickOnApply()
{
if ( !onAccept() )
return false;
initName();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( "" );
QString aString = "";
int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
if(nbSel>0) {
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes && GEOMBase::IsShape( aSelectedObject ) ) {
{
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myObject2 = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( aString );
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 )
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
globalSelection( GEOM_ALLSHAPES );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::enterEvent(QEvent * e)
{
if ( !GroupConstructors->isEnabled() )
ActivateThisDialog();
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation()
{
return getGeomEngine()->GetIShapesOperations( getStudyId() );
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool OperationGUI_GetShapesOnShapeDlg::isValid( QString& msg )
{
Handle(SALOME_InteractiveObject) IO = firstIObject();
Standard_Boolean testResult;
GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult );
if ( !testResult || anObject->_is_nil() )
return false;
return !CORBA::is_nil( myObject1 ) && !CORBA::is_nil( myObject2 );
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool OperationGUI_GetShapesOnShapeDlg::execute( ObjectList& objects )
{
int aLimit = GroupPoints->ComboBox1->currentItem();
switch (aLimit)
{
case 0: aLimit = GEOM::SOLID ; break;
case 1: aLimit = GEOM::SHELL ; break;
case 2: aLimit = GEOM::FACE ; break;
case 3: aLimit = GEOM::WIRE ; break;
case 4: aLimit = GEOM::EDGE ; break;
case 5: aLimit = GEOM::VERTEX; break;
default: aLimit = GEOM::SHAPE ;
}
GEOM::shape_state aState;
switch (GroupPoints->ComboBox2->currentItem())
{
case 0: aState = GEOM::ST_IN; break;
case 1: aState = GEOM::ST_OUT; break;
case 2: aState = GEOM::ST_ON; break;
case 3: aState = GEOM::ST_ONIN; break;
case 4: aState = GEOM::ST_ONOUT; break;
default: break;
}
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::
_narrow( getOperation() )->GetShapesOnShapeAsCompound(myObject2, myObject1,
(CORBA::Short) aLimit,
aState);
if (!anObj->_is_nil())
objects.push_back( anObj._retn() );
return objects.size();
}
//=================================================================================
// function : closeEvent
// purpose :
//=================================================================================
void OperationGUI_GetShapesOnShapeDlg::closeEvent( QCloseEvent* e )
{
GEOMBase_Skeleton::closeEvent( e );
}
//=======================================================================
//function : ComboTextChanged
//purpose :
//=======================================================================
void OperationGUI_GetShapesOnShapeDlg::ComboTextChanged()
{
bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
}

View File

@ -0,0 +1,77 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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.
//
// 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.
//
// 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : OperationGUI_GetShapesOnShapeDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_GETSHAPESONSHAPE_H
#define DIALOGBOX_GETSHAPESONSHAPE_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_2Sel2List_QTD.h"
#include "GEOMAlgo_State.hxx"
//=================================================================================
// class : OperationGUI_GetShapesOnShapeDlg
// purpose :
//=================================================================================
class OperationGUI_GetShapesOnShapeDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
OperationGUI_GetShapesOnShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0);
~OperationGUI_GetShapesOnShapeDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e );
private:
void Init();
void enterEvent(QEvent * e);
GEOM::GEOM_Object_var myObject1;
GEOM::GEOM_Object_var myObject2;
int myShapeType;
GEOMAlgo_State myState;
DlgRef_2Sel2List_QTD* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void LineEditReturnPressed();
void ActivateThisDialog();
void ComboTextChanged();
};
#endif // DIALOGBOX_GETSHAPESONSHAPE_H