2007-10-23 14:08:53 +00:00
|
|
|
// GEOM GEOMGUI : GUI for Geometry component
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
2007-10-23 14:08:53 +00:00
|
|
|
// Copyright (C) 2003 CEA
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
2007-10-23 14:08:53 +00: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-12-01 10:39:14 +00:00
|
|
|
//
|
2007-10-23 14:08:53 +00: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.
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
2007-10-23 14:08:53 +00: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
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
2006-06-01 11:32:40 +00:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
2007-10-23 14:08:53 +00:00
|
|
|
// File : BlocksGUI_QuadFaceDlg.cxx
|
|
|
|
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
|
2004-12-01 10:39:14 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "BlocksGUI_QuadFaceDlg.h"
|
|
|
|
|
2007-10-24 08:17:54 +00:00
|
|
|
#include <DlgRef.h>
|
2007-10-23 14:08:53 +00:00
|
|
|
#include <GeometryGUI.h>
|
|
|
|
#include <GEOMBase.h>
|
|
|
|
#include <GEOMImpl_Types.hxx>
|
|
|
|
|
|
|
|
#include <SUIT_Session.h>
|
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SalomeApp_Application.h>
|
|
|
|
#include <LightApp_SelectionMgr.h>
|
2005-06-02 07:17:09 +00:00
|
|
|
|
|
|
|
#include <qlabel.h>
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
//=================================================================================
|
|
|
|
// class : BlocksGUI_QuadFaceDlg()
|
|
|
|
// purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'.
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
|
|
|
|
: GEOMBase_Skeleton( theGeometryGUI, parent )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2006-05-06 08:44:32 +00:00
|
|
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
2007-10-23 14:08:53 +00:00
|
|
|
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_VERT" ) ) );
|
|
|
|
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_2_EDGE" ) ) );
|
|
|
|
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_EDGE" ) ) );
|
|
|
|
QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
setWindowTitle( tr( "GEOM_QUAD_FACE_TITLE" ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
/***************************************************************/
|
2007-10-23 14:08:53 +00:00
|
|
|
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_QUAD_FACE" ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
mainFrame()->RadioButton1->setIcon( image1 );
|
|
|
|
mainFrame()->RadioButton2->setIcon( image2 );
|
|
|
|
mainFrame()->RadioButton3->setIcon( image3 );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// Create first group
|
2007-10-23 14:08:53 +00:00
|
|
|
myGrp1 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
createSelWg( tr( "VERTEX_1" ), imageS, myGrp1, Vertex1 );
|
|
|
|
createSelWg( tr( "VERTEX_2" ), imageS, myGrp1, Vertex2 );
|
|
|
|
createSelWg( tr( "VERTEX_3" ), imageS, myGrp1, Vertex3 );
|
|
|
|
createSelWg( tr( "VERTEX_4" ), imageS, myGrp1, Vertex4 );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// Create second group
|
2007-10-23 14:08:53 +00:00
|
|
|
myGrp2 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
createSelWg( tr( "EDGE_1" ), imageS, myGrp2, Edge12 );
|
|
|
|
createSelWg( tr( "EDGE_2" ), imageS, myGrp2, Edge22 );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// Create fird group
|
2007-10-23 14:08:53 +00:00
|
|
|
myGrp3 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
createSelWg( tr( "EDGE_1" ), imageS, myGrp3, Edge14 );
|
|
|
|
createSelWg( tr( "EDGE_2" ), imageS, myGrp3, Edge24 );
|
|
|
|
createSelWg( tr( "EDGE_3" ), imageS, myGrp3, Edge34 );
|
|
|
|
createSelWg( tr( "EDGE_4" ), imageS, myGrp3, Edge44 );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// Add groups to layout
|
2007-10-23 14:08:53 +00:00
|
|
|
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
|
|
|
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
|
|
|
layout->addWidget( myGrp1 );
|
|
|
|
layout->addWidget( myGrp2 );
|
|
|
|
layout->addWidget( myGrp3 );
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
/***************************************************************/
|
|
|
|
|
2008-02-06 15:43:50 +00:00
|
|
|
setHelpFileName( "build_by_blocks_page.html#quad_face_anchor" );
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~BlocksGUI_QuadFaceDlg()
|
|
|
|
// purpose : Destroys the object and frees any allocated resources
|
|
|
|
//=================================================================================
|
|
|
|
BlocksGUI_QuadFaceDlg::~BlocksGUI_QuadFaceDlg()
|
|
|
|
{
|
|
|
|
// no need to delete child widgets, Qt does it all for us
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : Init()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::Init()
|
|
|
|
{
|
|
|
|
// signals and slots connections
|
2007-10-23 14:08:53 +00:00
|
|
|
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
|
|
|
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
|
|
|
|
|
|
|
connect( this, SIGNAL( constructorsClicked( int ) ),
|
|
|
|
this, SLOT( ConstructorsClicked( int ) ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
QMap<int, QPushButton*>::iterator anIterBtn;
|
2007-10-23 14:08:53 +00:00
|
|
|
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
|
|
|
|
connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
|
|
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// init controls and fields
|
2007-10-23 14:08:53 +00:00
|
|
|
initName( tr( "GEOM_QUAD_FACE" ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
myConstructorId = -1;
|
2007-10-23 14:08:53 +00:00
|
|
|
ConstructorsClicked( 0 );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ConstructorsClicked()
|
|
|
|
// purpose : Radio button management
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
void BlocksGUI_QuadFaceDlg::ConstructorsClicked( int constructorId )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( myConstructorId == constructorId )
|
2004-12-01 10:39:14 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
myConstructorId = constructorId;
|
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
switch ( constructorId ) {
|
2004-12-01 10:39:14 +00:00
|
|
|
case 0:
|
|
|
|
myGrp2->hide();
|
|
|
|
myGrp3->hide();
|
|
|
|
myGrp1->show();
|
|
|
|
myEditCurrentArgument = mySelName[Vertex1];
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
myGrp1->hide();
|
|
|
|
myGrp3->hide();
|
|
|
|
myGrp2->show();
|
|
|
|
myEditCurrentArgument = mySelName[Edge12];
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
myGrp1->hide();
|
|
|
|
myGrp2->hide();
|
|
|
|
myGrp3->show();
|
|
|
|
myEditCurrentArgument = mySelName[Edge14];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// clear line edits
|
|
|
|
QMap<int, QLineEdit*>::iterator anIterLE;
|
2007-10-23 14:08:53 +00:00
|
|
|
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
|
|
|
|
anIterLE.value()->setText( "" );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// init fields
|
|
|
|
myShape1 = myShape2 = GEOM::GEOM_Object::_nil();
|
|
|
|
myShape3 = myShape4 = myShape1;
|
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
qApp->processEvents();
|
|
|
|
updateGeometry();
|
|
|
|
resize( minimumSize() );
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
activateSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnOk()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::ClickOnOk()
|
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( ClickOnApply() )
|
2004-12-01 10:39:14 +00:00
|
|
|
ClickOnCancel();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnApply()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
bool BlocksGUI_QuadFaceDlg::ClickOnApply()
|
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( !onAccept() )
|
2004-12-01 10:39:14 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
initName();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection has changed
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
|
|
|
|
{
|
|
|
|
erasePreview();
|
2007-10-23 14:08:53 +00:00
|
|
|
myEditCurrentArgument->setText( "" );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
// Get index of current selection focus
|
|
|
|
int aCurrFocus = -1;
|
|
|
|
QMap<int, QLineEdit*>::iterator anIter;
|
2007-10-23 14:08:53 +00:00
|
|
|
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
|
|
|
|
if ( myEditCurrentArgument == anIter.value() ) {
|
2004-12-01 10:39:14 +00:00
|
|
|
aCurrFocus = anIter.key();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GEOM::GEOM_Object_var anObj;
|
|
|
|
Standard_Boolean aResult = Standard_False;
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( IObjectCount() == 1 ) {
|
|
|
|
anObj = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
|
|
|
|
if ( aResult ) {
|
2004-12-01 10:39:14 +00:00
|
|
|
if (anObj->_is_nil()) {
|
|
|
|
aResult = Standard_False;
|
2007-10-23 14:08:53 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
2007-10-23 14:08:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2004-12-01 10:39:14 +00:00
|
|
|
anObj = GEOM::GEOM_Object::_nil();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
switch ( aCurrFocus ) {
|
|
|
|
case Vertex1:
|
|
|
|
case Edge12:
|
|
|
|
case Edge14:
|
|
|
|
myShape1 = anObj; break;
|
|
|
|
case Vertex2:
|
|
|
|
case Edge22:
|
|
|
|
case Edge24:
|
|
|
|
myShape2 = anObj; break;
|
|
|
|
case Vertex3:
|
|
|
|
case Edge34:
|
|
|
|
myShape3 = anObj; break;
|
|
|
|
case Vertex4:
|
|
|
|
case Edge44:
|
|
|
|
myShape4 = anObj; break;
|
|
|
|
default:
|
2004-12-01 10:39:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
displayPreview();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SetEditCurrentArgument()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument()
|
|
|
|
{
|
|
|
|
QPushButton* aSender = (QPushButton*)sender();
|
|
|
|
|
|
|
|
QMap<int, QPushButton*>::iterator anIter;
|
2007-10-23 14:08:53 +00:00
|
|
|
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
|
|
|
|
if ( anIter.value() == aSender ) {
|
2004-12-01 10:39:14 +00:00
|
|
|
mySelName[anIter.key()]->setFocus();
|
|
|
|
myEditCurrentArgument = mySelName[anIter.key()];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
activateSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ActivateThisDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::ActivateThisDialog()
|
|
|
|
{
|
|
|
|
GEOMBase_Skeleton::ActivateThisDialog();
|
2007-10-23 14:08:53 +00:00
|
|
|
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
|
|
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
activateSelection();
|
|
|
|
displayPreview();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : enterEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
void BlocksGUI_QuadFaceDlg::enterEvent( QEvent* )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
2004-12-01 10:39:14 +00:00
|
|
|
this->ActivateThisDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : DeactivateActiveDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
//void BlocksGUI_QuadFaceDlg::DeactivateActiveDialog()
|
|
|
|
//{
|
|
|
|
// // disconnect selection
|
|
|
|
// GEOMBase_Skeleton::DeactivateActiveDialog();
|
|
|
|
//}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : createSelWg()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
void BlocksGUI_QuadFaceDlg::createSelWg( const QString& theLbl,
|
2004-12-01 10:39:14 +00:00
|
|
|
QPixmap& thePix,
|
|
|
|
QWidget* theParent,
|
2007-10-23 14:08:53 +00:00
|
|
|
const int theId )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
QLabel* lab = new QLabel( theLbl, theParent );
|
|
|
|
mySelBtn[theId] = new QPushButton( theParent );
|
|
|
|
mySelBtn[theId]->setIcon( thePix );
|
|
|
|
mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
|
|
|
mySelName[theId] = new QLineEdit( theParent );
|
|
|
|
mySelName[theId]->setReadOnly( true );
|
|
|
|
QGridLayout* l = 0;
|
|
|
|
if ( !theParent->layout() ) {
|
|
|
|
l = new QGridLayout( theParent );
|
|
|
|
l->setMargin( 9 ); l->setSpacing( 6 );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
l = qobject_cast<QGridLayout*>( theParent->layout() );
|
|
|
|
}
|
|
|
|
int row = l->rowCount();
|
|
|
|
l->addWidget( lab, row, 0 );
|
|
|
|
l->addWidget( mySelBtn[theId], row, 1 );
|
|
|
|
l->addWidget( mySelName[theId], row, 2 );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : activateSelection
|
|
|
|
// purpose : Activate selection in accordance with myEditCurrentArgument
|
|
|
|
//=================================================================================
|
|
|
|
void BlocksGUI_QuadFaceDlg::activateSelection()
|
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( myEditCurrentArgument == mySelName[Vertex1] ||
|
|
|
|
myEditCurrentArgument == mySelName[Vertex2] ||
|
|
|
|
myEditCurrentArgument == mySelName[Vertex3] ||
|
|
|
|
myEditCurrentArgument == mySelName[Vertex4] ) {
|
|
|
|
globalSelection( GEOM_POINT );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
globalSelection( GEOM_EDGE );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SelectionIntoArgument();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : createOperation
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
GEOM::GEOM_IOperations_ptr BlocksGUI_QuadFaceDlg::createOperation()
|
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
return getGeomEngine()->GetIBlocksOperations( getStudyId() );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : isValid
|
|
|
|
// purpose : Verify validity of input data
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
bool BlocksGUI_QuadFaceDlg::isValid( QString& )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2007-10-23 14:08:53 +00:00
|
|
|
bool ok = false;
|
|
|
|
switch ( getConstructorId() ) {
|
|
|
|
case 0:
|
|
|
|
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
|
|
|
|
!myShape3->_is_nil() && !myShape4->_is_nil() );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
|
|
|
|
!myShape3->_is_nil() && !myShape4->_is_nil() );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
2007-10-23 14:08:53 +00:00
|
|
|
return ok;
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : execute
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-23 14:08:53 +00:00
|
|
|
bool BlocksGUI_QuadFaceDlg::execute( ObjectList& objects )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
GEOM::GEOM_Object_var anObj;
|
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
switch ( getConstructorId() ) {
|
|
|
|
case 0:
|
|
|
|
anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad4Vertices
|
|
|
|
( myShape1, myShape2, myShape3, myShape4 );
|
|
|
|
res = true;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad2Edges
|
|
|
|
( myShape1, myShape2 );
|
|
|
|
res = true;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad
|
|
|
|
( myShape1, myShape2, myShape3, myShape4 );
|
|
|
|
res = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
2007-10-23 14:08:53 +00:00
|
|
|
if ( !anObj->_is_nil() )
|
|
|
|
objects.push_back( anObj._retn() );
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
return res;
|
|
|
|
}
|