geom/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx

552 lines
19 KiB
C++
Raw Normal View History

2015-02-10 14:25:19 +05:00
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +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
2014-02-18 12:44:41 +06:00
// version 2.1 of the License, or (at your option) any later version.
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +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.
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +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
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +06:00
2009-02-13 17:16:39 +05:00
// GEOM GEOMGUI : GUI for Geometry component
// File : MeasureGUI_CheckCompoundOfBlocksDlg.cxx
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
2005-01-20 11:24:17 +05:00
//
2012-08-09 13:58:02 +06:00
#include "MeasureGUI.h"
2005-01-20 11:24:17 +05:00
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h"
2009-02-13 17:16:39 +05:00
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Tools.h>
#include <SalomeApp_Application.h>
2005-01-20 11:24:17 +05:00
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TColStd_MapOfInteger.hxx>
2009-02-13 17:16:39 +05:00
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
2005-01-20 11:24:17 +05:00
#include <QListWidget>
2005-01-20 11:24:17 +05:00
#define TEXTEDIT_FONT_FAMILY "Courier"
#define TEXTEDIT_FONT_SIZE 11
//=================================================================================
// class : MeasureGUI_CheckCompoundOfBlocksDlg()
// purpose : Constructs a MeasureGUI_CheckCompoundOfBlocksDlg 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
2009-02-13 17:16:39 +05:00
// true to construct a modal dialog.
2005-01-20 11:24:17 +05:00
//=================================================================================
MeasureGUI_CheckCompoundOfBlocksDlg::MeasureGUI_CheckCompoundOfBlocksDlg( GeometryGUI* GUI, QWidget* parent )
: GEOMBase_Skeleton(GUI, parent, false),
myObjectName (0),
mySelButton (0),
myUseC1Check (0),
myTolLbl (0),
mySpinTol (0),
myTextView (0),
myListBox1 (0),
myListBox2 (0)
2005-01-20 11:24:17 +05:00
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
2009-02-13 17:16:39 +05:00
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_CHECK_COMPOUND_OF_BLOCKS" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
2005-01-20 11:24:17 +05:00
2009-02-13 17:16:39 +05:00
setWindowTitle( tr( "GEOM_CHECK_BLOCKS_COMPOUND" ) );
2005-01-20 11:24:17 +05:00
/***************************************************************/
2009-02-13 17:16:39 +05:00
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHECK_BLOCKS_COMPOUND" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
QGroupBox *aGrpParams =
new QGroupBox(tr("GEOM_CHECK_INFOS"), centralWidget());
QGridLayout *aParamsLayout = new QGridLayout(aGrpParams);
QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"), aGrpParams);
QLabel *anErrorsLbl =
new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"), aGrpParams);
QLabel *aNonBlocksLbl =
new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"), aGrpParams);
myObjectName = new QLineEdit(aGrpParams);
mySelButton = new QPushButton(aGrpParams);
myUseC1Check = new QCheckBox(tr("GEOM_USE_C1_CRITERION"), aGrpParams);
myTolLbl = new QLabel(tr("GEOM_ANGULAR_TOLERANCE"), aGrpParams);
mySpinTol = new SalomeApp_DoubleSpinBox(aGrpParams);
myTextView = new QTextBrowser(aGrpParams);
myListBox1 = new QListWidget(aGrpParams);
myListBox2 = new QListWidget(aGrpParams);
myObjectName->setReadOnly(true);
mySelButton->setIcon(image1);
mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
myUseC1Check->setText(tr("GEOM_USE_C1_CRITERION"));
myUseC1Check->setChecked(true);
myTextView->setReadOnly(true);
myListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection);
// Set text view font.
QFont aFont(TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
myTextView->setFont(aFont);
aParamsLayout->setMargin(9);
aParamsLayout->setSpacing(6);
aParamsLayout->addWidget(anObjLbl, 0, 0);
aParamsLayout->addWidget(mySelButton, 0, 1);
aParamsLayout->addWidget(myObjectName, 0, 2);
aParamsLayout->addWidget(myUseC1Check, 1, 0, 1, 3);
aParamsLayout->addWidget(myTolLbl, 2, 0);
aParamsLayout->addWidget(mySpinTol, 2, 1, 1, 2);
aParamsLayout->addWidget(myTextView, 3, 0, 1, 3);
aParamsLayout->addWidget(anErrorsLbl, 4, 0);
aParamsLayout->addWidget(myListBox1, 5, 0, 1, 2);
aParamsLayout->addWidget(aNonBlocksLbl, 4, 2);
aParamsLayout->addWidget(myListBox2, 5, 2);
2009-02-13 17:16:39 +05:00
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( aGrpParams );
2009-02-13 17:16:39 +05:00
/***************************************************************/
myHelpFileName = "check_compound_of_blocks_page.html";
2005-01-20 11:24:17 +05:00
/* Initialisation */
Init();
2005-01-20 11:24:17 +05:00
}
//=================================================================================
// function : ~MeasureGUI_CheckCompoundOfBlocksDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
MeasureGUI_CheckCompoundOfBlocksDlg::~MeasureGUI_CheckCompoundOfBlocksDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::Init()
2005-01-20 11:24:17 +05:00
{
/* init variables */
double SpecificStep = 0.0001;
double aDefaultTol = Precision::Angular();
initSpinBox(mySpinTol, aDefaultTol, MAX_NUMBER, SpecificStep, "ang_tol_precision");
mySpinTol->setValue(aDefaultTol);
myEditCurrentArgument = myObjectName;
// signals and slots connections
2009-02-13 17:16:39 +05:00
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(myObjectName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(myListBox1, SIGNAL(itemSelectionChanged()), this, SLOT(onErrorsListSelectionChanged()));
connect(myListBox2, SIGNAL(itemSelectionChanged()), this, SLOT(onSubShapesListSelectionChanged()));
connect(myUseC1Check, SIGNAL(clicked()), this, SLOT(SetUseC1Tolerance()));
connect(mySpinTol, SIGNAL(valueChanged(double)), this, SLOT(processObject()));
2012-08-09 13:58:02 +06:00
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_BLOCKS_COMPOUND") );
2009-02-13 17:16:39 +05:00
buttonOk()->setEnabled( false );
buttonApply()->setEnabled( false );
2005-01-20 11:24:17 +05:00
activateSelection();
SelectionIntoArgument();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::ClickOnOk()
{
2009-02-13 17:16:39 +05:00
if ( ClickOnApply() )
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool MeasureGUI_CheckCompoundOfBlocksDlg::ClickOnApply()
{
if ( !onAccept() )
return false;
initName();
return true;
}
//=================================================================================
// function : SelectionIntoArgument
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument()
{
erasePreview();
myObj = GEOM::GEOM_Object::_nil();
2009-02-13 17:16:39 +05:00
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) {
myObjectName->setText( "" );
processObject();
return;
}
GEOM::GEOM_Object_var aSelectedObject =
2012-08-09 13:58:02 +06:00
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
2012-08-09 13:58:02 +06:00
if ( aSelectedObject->_is_nil() ) {
myObjectName->setText( "" );
processObject();
return;
}
myObj = aSelectedObject;
myObjectName->setText( GEOMBase::GetName( myObj ) );
processObject();
2012-08-09 13:58:02 +06:00
DISPLAY_PREVIEW_MACRO;
}
//=================================================================================
// function : SetEditCurrentArgument
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::SetEditCurrentArgument()
{
myObjectName->setFocus();
myEditCurrentArgument = myObjectName;
SelectionIntoArgument();
}
//=================================================================================
// function : SetUseC1Tolerance()
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::SetUseC1Tolerance()
{
myTolLbl->setEnabled(myUseC1Check->isChecked());
mySpinTol->setEnabled(myUseC1Check->isChecked());
processObject();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == myObjectName ) {
myEditCurrentArgument = myObjectName;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
2009-02-13 17:16:39 +05:00
if ( aSel )
connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
activateSelection();
2012-08-09 13:58:02 +06:00
DISPLAY_PREVIEW_MACRO
2005-01-20 11:24:17 +05:00
}
//=================================================================================
// function : getBCErrors
// purpose :
//=================================================================================
bool MeasureGUI_CheckCompoundOfBlocksDlg::getBCErrors( bool& theIsCompoundOfBlocks,
2012-08-09 13:58:02 +06:00
GEOM::GEOM_IBlocksOperations::BCErrors& theErrors)
2005-01-20 11:24:17 +05:00
{
if ( myObj->_is_nil() )
return false;
2009-02-13 17:16:39 +05:00
else {
2012-08-09 13:58:02 +06:00
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
2009-02-13 17:16:39 +05:00
try {
2005-01-20 11:24:17 +05:00
GEOM::GEOM_IBlocksOperations::BCErrors_var aErrs;
double aC1Tol = -1.;
if (myUseC1Check->isChecked()) {
aC1Tol = mySpinTol->value();
}
theIsCompoundOfBlocks = anOper->CheckCompoundOfBlocks( myObj, aC1Tol, aErrs );
2012-08-09 13:58:02 +06:00
if (anOper->IsDone() && aErrs->length() > 0)
//if (anOper->IsDone() && !aErrs._is_nil())
theErrors = aErrs;
2005-01-20 11:24:17 +05:00
}
2009-02-13 17:16:39 +05:00
catch ( const SALOME::SALOME_Exception& e ) {
SalomeApp_Tools::QtCatchCorbaException( e );
2005-01-20 11:24:17 +05:00
return false;
}
2012-08-09 13:58:02 +06:00
return anOper->IsDone();
2005-01-20 11:24:17 +05:00
}
}
//=================================================================================
// function : processObject
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::processObject()
{
2009-02-13 17:16:39 +05:00
QString aMsg ( "" );
2005-01-20 11:24:17 +05:00
bool isCompoundOfBlocks;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
2009-02-13 17:16:39 +05:00
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
2012-08-09 13:58:02 +06:00
aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_FAILED" );
myTextView->setText( aMsg );
myListBox1->clear();
myListBox2->clear();
2005-01-20 11:24:17 +05:00
erasePreview();
return;
}
2009-02-13 17:16:39 +05:00
if ( isCompoundOfBlocks ) {
2005-01-20 11:24:17 +05:00
aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS" );
2009-02-13 17:16:39 +05:00
buttonOk()->setEnabled( false );
buttonApply()->setEnabled( false );
2012-08-09 13:58:02 +06:00
}
2009-02-13 17:16:39 +05:00
else {
2005-01-20 11:24:17 +05:00
aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS" );
2009-02-13 17:16:39 +05:00
buttonOk()->setEnabled( true );
buttonApply()->setEnabled( true );
2005-01-20 11:24:17 +05:00
}
myTextView->setText( aMsg );
2005-01-20 11:24:17 +05:00
QStringList aErrList;
QString aErrStr( "" );
QString aConSfx( " # " );
QString aGluedSfx( " # " );
int aConNum = 1;
int aGluedNum = 1;
2009-02-13 17:16:39 +05:00
for ( int i = 0, n = aErrs.length(); i < n; i++ ) {
2005-01-20 11:24:17 +05:00
aErrStr = "";
2009-02-13 17:16:39 +05:00
switch ( aErrs[i].error ) {
2005-01-20 11:24:17 +05:00
case GEOM::GEOM_IBlocksOperations::NOT_BLOCK :
aErrStr = tr("GEOM_CHECK_BLOCKS_NOT_BLOCK");
2005-01-20 11:24:17 +05:00
break;
case GEOM::GEOM_IBlocksOperations::EXTRA_EDGE :
aErrStr = tr("GEOM_CHECK_BLOCKS_EXTRA_EDGE");
2005-01-20 11:24:17 +05:00
break;
case GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION :
aErrStr = tr("GEOM_CHECK_BLOCKS_INVALID_CONNECTION").arg(aConNum++);
2005-01-20 11:24:17 +05:00
break;
case GEOM::GEOM_IBlocksOperations::NOT_CONNECTED :
aErrStr = tr("GEOM_CHECK_BLOCKS_NOT_CONNECTED");
2005-01-20 11:24:17 +05:00
break;
case GEOM::GEOM_IBlocksOperations::NOT_GLUED :
aErrStr = tr("GEOM_CHECK_BLOCKS_NOT_GLUED").arg(aGluedNum++);
2005-01-20 11:24:17 +05:00
break;
default :
2012-08-09 13:58:02 +06:00
aErrStr = "";
break;
2005-01-20 11:24:17 +05:00
}
if ( !aErrStr.isEmpty() )
2009-02-13 17:16:39 +05:00
aErrList.append( aErrStr );
2005-01-20 11:24:17 +05:00
}
myListBox1->clear();
myListBox2->clear();
myListBox1->addItems( aErrList );
2005-01-20 11:24:17 +05:00
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr MeasureGUI_CheckCompoundOfBlocksDlg::createOperation()
{
2009-02-13 17:16:39 +05:00
return getGeomEngine()->GetIBlocksOperations( getStudyId() );
2005-01-20 11:24:17 +05:00
}
//=================================================================================
// function : onErrorsListSelectionChanged
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged()
{
erasePreview();
int aCurItem = myListBox1->currentRow();
2005-01-20 11:24:17 +05:00
if ( aCurItem < 0 )
return;
bool isCompoundOfBlocks;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
2009-02-13 17:16:39 +05:00
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
myTextView->setText( "" );
myListBox1->clear();
myListBox2->clear();
2005-01-20 11:24:17 +05:00
return;
}
2012-08-09 13:58:02 +06:00
myListBox2->clear();
2014-01-28 15:15:19 +06:00
if (aCurItem < aErrs.length()) {
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated;
QStringList aSubShapeList;
TopoDS_Shape aSelShape;
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes( aSelShape, anIndices );
for ( int i = 0, n = aObjLst.length(); i < n; i++ ) {
TopoDS_Shape aSubShape = anIndices.FindKey( aObjLst[i] );
QString aType = GEOMBase::GetShapeTypeString( aSubShape );
if ( !aType.isEmpty() )
aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) );
}
2005-01-20 11:24:17 +05:00
}
myListBox2->addItems( aSubShapeList );
2005-01-20 11:24:17 +05:00
}
}
//=================================================================================
// function : onSubShapesListSelectionChanged
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged()
{
erasePreview();
int aErrCurItem = myListBox1->currentRow();
2005-01-20 11:24:17 +05:00
if ( aErrCurItem < 0 )
return;
2009-02-13 17:16:39 +05:00
QList<int> aIds;
for ( int i = 0, n = myListBox2->count(); i < n; i++ ) {
if ( myListBox2->item( i )->isSelected() )
2005-01-20 11:24:17 +05:00
aIds.append( i );
}
if ( aIds.count() < 1 )
return;
bool isCompoundOfBlocks;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
2009-02-13 17:16:39 +05:00
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
myTextView->setText( "" );
myListBox1->clear();
myListBox2->clear();
2005-01-20 11:24:17 +05:00
return;
}
2012-08-09 13:58:02 +06:00
2005-01-20 11:24:17 +05:00
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aErrCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated;
TopoDS_Shape aSelShape;
2012-08-09 13:58:02 +06:00
TopoDS_Shape aSubShape;
2005-01-20 11:24:17 +05:00
TopTools_IndexedMapOfShape anIndices;
2009-02-13 17:16:39 +05:00
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
2005-01-20 11:24:17 +05:00
QString aMess;
2009-02-13 17:16:39 +05:00
if ( !isValid( aMess ) ) {
2005-01-20 11:24:17 +05:00
return;
}
SALOME_Prs* aPrs = 0;
TopExp::MapShapes( aSelShape, anIndices);
2009-02-13 17:16:39 +05:00
QList<int>::iterator it;
for ( it = aIds.begin(); it != aIds.end(); ++it ) {
2005-01-20 11:24:17 +05:00
aSubShape = anIndices.FindKey(aObjLst[(*it)]);
2012-08-09 13:58:02 +06:00
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "preview_edge_width", 1);
2009-02-13 17:16:39 +05:00
try {
2005-01-20 11:24:17 +05:00
getDisplayer()->SetColor( Quantity_NOC_RED );
2012-08-09 13:58:02 +06:00
getDisplayer()->SetWidth( w );
2005-01-20 11:24:17 +05:00
getDisplayer()->SetToActivate( false );
aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0;
if ( aPrs )
2012-08-09 13:58:02 +06:00
displayPreview( aPrs, true );
2005-01-20 11:24:17 +05:00
}
2009-02-13 17:16:39 +05:00
catch ( const SALOME::SALOME_Exception& e ) {
SalomeApp_Tools::QtCatchCorbaException( e );
2005-01-20 11:24:17 +05:00
}
}
}
}
//=================================================================================
// function : onDisplayPreview
// purpose :
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::onDisplayPreview()
{
DISPLAY_PREVIEW_MACRO;
}
2005-01-20 11:24:17 +05:00
//=================================================================================
// function : activateSelection
// purpose : activate selection of faces, shells, and solids
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::activateSelection()
{
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SOLID );
aMap.Add( GEOM_COMPOUND );
globalSelection( aMap );
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
2009-02-13 17:16:39 +05:00
void MeasureGUI_CheckCompoundOfBlocksDlg::enterEvent( QEvent* )
{
2009-02-13 17:16:39 +05:00
if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool MeasureGUI_CheckCompoundOfBlocksDlg::isValid( QString &msg)
{
return !myObj->_is_nil() && mySpinTol->isValid(msg, !IsPreview());
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool MeasureGUI_CheckCompoundOfBlocksDlg::execute( ObjectList& objects )
{
2012-08-09 13:58:02 +06:00
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
GEOM::GEOM_Object_var anObj = anOper->CheckAndImprove( myObj );
2009-02-13 17:16:39 +05:00
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
return true;
}