-// GEOM GEOMGUI : GUI for Geometry component
+// 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
+// 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 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.
+// 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
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : EntityGUI_SubShapeDlg.cxx
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
-//
-// File : EntityGUI_SubShapeDlg.cxx
-// Author : Lucien PIGNOLONI
-// Module : GEOM
-// $Header$
#include "EntityGUI_SubShapeDlg.h"
-#include "GEOM_Displayer.h"
-#include "QAD_RightFrame.h"
-#include "QAD_Desktop.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+#include <OCCViewer_ViewModel.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
-#include <qmessagebox.h>
+#include <QMessageBox>
//=================================================================================
// class : EntityGUI_SubShapeDlg
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
- :GEOMBase_Skeleton(parent, name, Sel, modal, fl)
+EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl )
+ : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+ QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUBSHAPE" ) ) );
+ QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- setCaption(tr("GEOM_SUBSHAPE_TITLE"));
+ setWindowTitle( tr( "GEOM_SUBSHAPE_TITLE" ) );
/***************************************************************/
- GroupConstructors->setTitle(tr("GEOM_SUB_SHAPE"));
- RadioButton1->setPixmap(image0);
- RadioButton2->close(TRUE);
- RadioButton3->close(TRUE);
-
- GroupPoints = new DlgRef_1Sel1Check1List_QTD(this, "GroupPoints");
- GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
- GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE"));
- GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT"));
- GroupPoints->PushButton1->setPixmap(image1);
+ mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SUB_SHAPE" ) );
+ mainFrame()->RadioButton1->setIcon( image0 );
+ mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->close();
+
+ GroupPoints = new DlgRef_1Sel1Check1List( centralWidget() );
+
+ GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
+ GroupPoints->TextLabel2->setText( tr( "GEOM_SUBSHAPE_TYPE" ) );
+ GroupPoints->CheckButton1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) );
+ GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
- Layout1->addWidget(GroupPoints, 1, 0);
+ QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
+ layout->setMargin( 0 ); layout->setSpacing( 6 );
+ layout->addWidget( GroupPoints );
/***************************************************************/
+ setHelpFileName( "create_explode_page.html" );
+
+ mainFrame()->GroupBoxName->hide();
+
Init();
}
myWithShape = true;
/* type for sub shape selection */
- GroupPoints->ComboBox1->insertItem("Compound");
- GroupPoints->ComboBox1->insertItem("Compsolid");
- GroupPoints->ComboBox1->insertItem("Solid");
- GroupPoints->ComboBox1->insertItem("Shell");
- GroupPoints->ComboBox1->insertItem("Face");
- GroupPoints->ComboBox1->insertItem("Wire");
- GroupPoints->ComboBox1->insertItem("Edge");
- GroupPoints->ComboBox1->insertItem("Vertex");
- GroupPoints->ComboBox1->insertItem("Shape");
-
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC)
- GroupPoints->CheckButton1->setEnabled(false);
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compound" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compsolid" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Solid" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shell" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Face" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Wire" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Edge" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" );
+
+ if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
+ != OCCViewer_Viewer::Type() )
+ GroupPoints->CheckButton1->setEnabled( false );
/* signals and slots connections */
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
- connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
- connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
- connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled()));
-
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
+ connect( GroupPoints->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) );
+
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged( )), this, SLOT( SelectionIntoArgument() ) );
updateButtonState();
//=================================================================================
bool EntityGUI_SubShapeDlg::ClickOnApply()
{
- QAD_Application::getDesktop()->putInfo(tr(""));
+ SUIT_Session::session()->activeApplication()->putInfo( "" );
/* Explode all sub shapes */
- if( isAllSubShapes() ) {
+ if ( isAllSubShapes() ) {
/* More than 30 subshapes : ask confirmation */
- unsigned int nb = NumberOfSubShapes(myShape, shapeType());
- if(nb > 30) {
- const QString caption = tr("GEOM_CONFIRM");
- const QString text = tr("GEOM_CONFIRM_INFO").arg(nb);
- const QString button0 = tr("GEOM_BUT_EXPLODE");
- const QString button1 = tr("GEOM_BUT_CANCEL");
-
- if(QMessageBox::warning(this, caption, text, button0, button1) != 0)
+ unsigned int nb = NumberOfSubShapes( myShape, shapeType() );
+ if ( nb > 30 ) {
+ const QString caption = tr( "GEOM_CONFIRM" );
+ const QString text = tr( "GEOM_CONFIRM_INFO" ).arg( nb );
+ const QString button0 = tr( "GEOM_BUT_EXPLODE" );
+ const QString button1 = tr( "GEOM_BUT_CANCEL" );
+
+ if ( QMessageBox::warning( this, caption, text, button0, button1 ) != 0 )
return false; /* aborted */
}
}
- return onAccept();
+ bool isOk = onAccept();
+
+ // restore selection, corresponding to current selection mode
+ SubShapeToggled();
+
+ return isOk;
}
QString aString = ""; /* name of selection */
- int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true );
- if( nbSel != 1 )
+ int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
+ if ( nbSel != 1 )
return;
TopoDS_Shape S;
- Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
- if ( !IO->hasEntry() )
- {
- QAD_Application::getDesktop()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) );
+ Handle(SALOME_InteractiveObject) IO = firstIObject();
+ if ( !IO->hasEntry() ) {
+ SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) );
updateButtonState();
return;
}
- if ( !myGeomBase->GetTopoFromSelection( mySelection, S ) ||
+ if ( !GEOMBase::GetTopoFromSelection( selectedIO(), S ) ||
S.IsNull() ||
- S.ShapeType() == TopAbs_VERTEX )
- {
+ S.ShapeType() == TopAbs_VERTEX ) {
updateButtonState();
return;
}
Standard_Boolean testResult;
myObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult );
- if ( !testResult || myObject->_is_nil() )
- {
+ if ( !testResult || myObject->_is_nil() ) {
updateButtonState();
return;
}
GroupPoints->LineEdit1->setText( aString );
- int SelectedShapeType = GroupPoints->ComboBox1->currentItem();
+ int SelectedShapeType = GroupPoints->ComboBox1->currentIndex();
int count = GroupPoints->ComboBox1->count();
if ( myWithShape )
// Solving PAL5590
if ( myShape.ShapeType() == TopAbs_COMPOUND ) {
unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND);
- if (nb > 0)
+ if ( nb > 0 )
i++;
}
- while ( i <= myShape.ShapeType())
- {
+ while ( i <= myShape.ShapeType() ) {
GroupPoints->ComboBox1->removeItem( 0 );
i++;
}
- if ( myShape.ShapeType() == TopAbs_COMPOUND )
- {
- if ( myWithShape == false )
- {
- GroupPoints->ComboBox1->insertItem( "Shape" );
+ if ( myShape.ShapeType() == TopAbs_COMPOUND ) {
+ if ( myWithShape == false ) {
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" );
myWithShape = true;
}
}
- else
- {
- if ( myWithShape == true )
- {
+ else {
+ if ( myWithShape == true ) {
GroupPoints->ComboBox1->removeItem( GroupPoints->ComboBox1->count() - 1 );
myWithShape = false;
}
if ( myWithShape )
count1 = count1 - 1;
- if ( SelectedShapeType > myShape.ShapeType() )
- {
- if ( SelectedShapeType == 8 )
- {
- if ( myShape.ShapeType() != TopAbs_COMPOUND )
- {
- GroupPoints->ComboBox1->setCurrentItem( 0 );
+ if ( SelectedShapeType > myShape.ShapeType() ) {
+ if ( SelectedShapeType == 8 ) {
+ if ( myShape.ShapeType() != TopAbs_COMPOUND ) {
+ GroupPoints->ComboBox1->setCurrentIndex( 0 );
ComboTextChanged();
}
}
else
- GroupPoints->ComboBox1->setCurrentItem(count1 - count + SelectedShapeType);
+ GroupPoints->ComboBox1->setCurrentIndex( count1 - count + SelectedShapeType );
}
- else
- {
- GroupPoints->ComboBox1->setCurrentItem( 0 );
+ else {
+ GroupPoints->ComboBox1->setCurrentIndex( 0 );
ComboTextChanged();
}
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->CheckButton1->setChecked( FALSE );
+ GroupPoints->CheckButton1->setChecked( false );
SubShapeToggled();
SelectionIntoArgument();
}
void EntityGUI_SubShapeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if(send == GroupPoints->LineEdit1)
+ if ( send == GroupPoints->LineEdit1 )
SetEditCurrentArgument();
else
return;
//=================================================================================
void EntityGUI_SubShapeDlg::DeactivateActiveDialog()
{
- if(GroupConstructors->isEnabled()) {
+ if ( mainFrame()->GroupConstructors->isEnabled() ) {
GEOMBase_Skeleton::DeactivateActiveDialog();
}
}
void EntityGUI_SubShapeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
SubShapeToggled();
updateButtonState();
}
// function : enterEvent()
// purpose :
//=================================================================================
-void EntityGUI_SubShapeDlg::enterEvent(QEvent* e)
+void EntityGUI_SubShapeDlg::enterEvent( QEvent* )
{
- if(GroupConstructors->isEnabled())
- return;
- ActivateThisDialog();
+ if ( !mainFrame()->GroupConstructors->isEnabled() )
+ ActivateThisDialog();
}
//=================================================================================
{
myObject = GEOM::GEOM_Object::_nil();
myShape.Nullify();
- myEditCurrentArgument->setText("");
+ myEditCurrentArgument->setText( "" );
- int SelectedShapeType = GroupPoints->ComboBox1->currentItem();
+ int SelectedShapeType = GroupPoints->ComboBox1->currentIndex();
int count = GroupPoints->ComboBox1->count();
if ( myWithShape )
count = count - 1;
/* type for sub shape selection */
GroupPoints->ComboBox1->clear();
- GroupPoints->ComboBox1->insertItem("Compound");
- GroupPoints->ComboBox1->insertItem("Compsolid");
- GroupPoints->ComboBox1->insertItem("Solid");
- GroupPoints->ComboBox1->insertItem("Shell");
- GroupPoints->ComboBox1->insertItem("Face");
- GroupPoints->ComboBox1->insertItem("Wire");
- GroupPoints->ComboBox1->insertItem("Edge");
- GroupPoints->ComboBox1->insertItem("Vertex");
- GroupPoints->ComboBox1->insertItem("Shape");
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compound" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compsolid" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Solid" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shell" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Face" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Wire" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Edge" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" );
+ GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" );
myWithShape = true;
- GroupPoints->ComboBox1->setCurrentItem( 8 - count + SelectedShapeType );
+ GroupPoints->ComboBox1->setCurrentIndex( 8 - count + SelectedShapeType );
ComboTextChanged();
updateButtonState();
//=================================================================================
void EntityGUI_SubShapeDlg::SubShapeToggled()
{
- if ( isAllSubShapes() )
- globalSelection( GEOM_ALLSHAPES );
- else
+ globalSelection( GEOM_ALLSHAPES );
+
+ if ( !isAllSubShapes() )
localSelection( myObject, shapeType() );
}
// function : NumberOfSubShapes()
// purpose :
//=================================================================================
-unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes (const TopoDS_Shape& S,
- const int shapeType) const
+unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S,
+ const int shapeType ) const
{
- if (S.IsNull())
+ if ( S.IsNull() )
return 0;
unsigned int index = 0;
TopTools_MapOfShape M;
- if (S.ShapeType() == TopAbs_COMPOUND &&
- (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID ||
- TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND)) {
- TopoDS_Iterator It (S, Standard_True, Standard_True);
- for (; It.More(); It.Next()) {
- if (M.Add(It.Value())) {
- if (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(shapeType) == It.Value().ShapeType()) {
+ if ( S.ShapeType() == TopAbs_COMPOUND &&
+ ( TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE ||
+ TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID ||
+ TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND ) ) {
+ TopoDS_Iterator It( S, Standard_True, Standard_True );
+ for ( ; It.More(); It.Next() ) {
+ if ( M.Add( It.Value() ) ) {
+ if ( TopAbs_ShapeEnum( shapeType ) == TopAbs_SHAPE ||
+ TopAbs_ShapeEnum( shapeType ) == It.Value().ShapeType() ) {
index++;
}
}
}
- } else {
- TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType));
- for (; Exp.More(); Exp.Next()) {
- if (M.Add(Exp.Current())) {
+ }
+ else {
+ TopExp_Explorer Exp ( S, TopAbs_ShapeEnum( shapeType ) );
+ for ( ; Exp.More(); Exp.Next() ) {
+ if ( M.Add( Exp.Current() ) ) {
index++;
}
}
//=================================================================================
void EntityGUI_SubShapeDlg::updateButtonState()
{
- if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC ||
+ if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() ||
myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND ) {
- GroupPoints->CheckButton1->setChecked( FALSE );
- GroupPoints->CheckButton1->setEnabled( FALSE );
+ GroupPoints->CheckButton1->setChecked( false );
+ GroupPoints->CheckButton1->setEnabled( false );
}
else
- GroupPoints->CheckButton1->setEnabled( TRUE );
+ GroupPoints->CheckButton1->setEnabled( true );
}
//=================================================================================
//=================================================================================
int EntityGUI_SubShapeDlg::shapeType() const
{
- int type = GroupPoints->ComboBox1->currentItem();
+ int type = GroupPoints->ComboBox1->currentIndex();
- if (myObject->_is_nil())
+ if ( myObject->_is_nil() )
return type;
// Solving PAL5590
type += myShape.ShapeType() + 1;
- if (myShape.ShapeType() == TopAbs_COMPOUND &&
- NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) {
+ if ( myShape.ShapeType() == TopAbs_COMPOUND &&
+ NumberOfSubShapes( myShape, TopAbs_COMPOUND ) > 0 ) {
type--;
}
bool EntityGUI_SubShapeDlg::isValid( QString& msg )
{
bool isOk = false;
+ Handle(SALOME_InteractiveObject) IO = firstIObject();
+ Standard_Boolean testResult;
+ myObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult );
+ if ( !testResult || myObject->_is_nil() ) {
+ updateButtonState();
+ return isOk;
+ }
if ( !myObject->_is_nil() ) {
if ( isAllSubShapes() )
isOk = true;
- else if ( mySelection->IObjectCount() == 1 ) {
+ else if ( IObjectCount() == 1 ) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult );
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger aMapIndex;
- mySelection->GetIndex( mySelection->firstIObject(), aMapIndex );
+ myGeomGUI->getApp()->selectionMgr()->GetIndexes( firstIObject(), aMapIndex );
isOk = aMapIndex.Extent() > 0;
if ( !isOk )
msg += tr( "NO_SUBSHAPES_SELECTED" );
bool EntityGUI_SubShapeDlg::execute( ObjectList& objects )
{
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow(
- getOperation() )->MakeExplode( myObject, shapeType(), false );
+ getOperation() )->MakeExplode( myObject, shapeType(), true );
if ( !aList->length() )
return false;
// Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active
- if ( !isAllSubShapes() )
- {
- if ( mySelection->IObjectCount() == 1 ) {
+ if ( !isAllSubShapes() ) {
+ if ( IObjectCount() == 1 ) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult );
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger aMapIndex;
- mySelection->GetIndex( mySelection->firstIObject(), aMapIndex );
+ myGeomGUI->getApp()->selectionMgr()->GetIndexes( firstIObject(), aMapIndex );
GEOM::GEOM_ILocalOperations_var aLocOp =
getGeomEngine()->GetILocalOperations( getStudyId() );
return myObject;
}
+QString EntityGUI_SubShapeDlg::getNewObjectName() const
+{
+ return QString::null;
+}