From: vsr Date: Wed, 9 Dec 2009 13:26:30 +0000 (+0000) Subject: Merge from BR_phase16 branch (09/12/09) X-Git-Tag: V6_0_0~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f697bd63921ef6d841f3d5520ebd56fdcd1a834d;p=modules%2Fgeom.git Merge from BR_phase16 branch (09/12/09) --- diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx index a8360dc51..929bed410 100644 --- a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx @@ -18,7 +18,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// + #include "GEOM_SelectionFilter.h" #include "GEOM_Client.hxx" @@ -65,6 +65,19 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const if ( getShape( obj, shape ) ) return contains( shape.ShapeType() ) && isShapeOk( shape ); } + + // IMP 0020435: fine local selection + { + const LightApp_DataOwner* owner = dynamic_cast(sOwner); + if (owner) { + QString entry = owner->entry(); + int index = entry.lastIndexOf("_"); + if (index > 0) { + return true; + } + } + } + return false; } @@ -72,7 +85,8 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const // function : getObject // purpose : //======================================================================= -GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject( const SUIT_DataOwner* sOwner, const bool extractReference ) const +GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject (const SUIT_DataOwner* sOwner, + const bool extractReference) const { GEOM::GEOM_Object_var anObj; @@ -119,18 +133,18 @@ bool GEOM_SelectionFilter::getShape (const GEOM::GEOM_Object_ptr& theObject, SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); static GEOM::GEOM_Gen_var geomGen; if(CORBA::is_nil( geomGen )) { - Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); - geomGen = GEOM::GEOM_Gen::_narrow( comp ); + Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + geomGen = GEOM::GEOM_Gen::_narrow( comp ); } if ( !CORBA::is_nil( geomGen ) ) { - TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); - if ( !aTopoDSShape.IsNull() ) - { - theShape = aTopoDSShape; - return true; - } + if ( !aTopoDSShape.IsNull() ) + { + theShape = aTopoDSShape; + return true; + } } } } diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 7cbc862c3..5833f54bf 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1025,6 +1025,44 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, return prs; } +//================================================================= +/*! + * GEOM_Displayer::buildSubshapePresentation + * Builds/finds object's presentation for the current viewer + * Calls corresponding Update() method by means of double dispatch + * For not published objects (for Mantis issue 0020435) + */ +//================================================================= +SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape, + const QString& entry, + SALOME_View* theViewFrame) +{ + SALOME_Prs* prs = 0; + internalReset(); + + myViewFrame = theViewFrame ? theViewFrame : GetActiveView(); + + if (myViewFrame) + { + prs = LightApp_Displayer::buildPresentation(entry, theViewFrame); + if (prs) + { + Handle(SALOME_InteractiveObject) theIO = new SALOME_InteractiveObject(); + theIO->setEntry(entry.toLatin1().constData()); + if (!theIO.IsNull()) + { + // set interactive object + setIO(theIO); + // finally set shape + setShape(aShape); + myType = GEOM_SUBSHAPE; + } + UpdatePrs(prs); // Update presentation by using of the double dispatch + } + } + return prs; +} + //================================================================= /*! * GEOM_Displayer::internalReset diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 90b551fc3..8b11fe66f 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -155,9 +155,14 @@ public: static SALOMEDS::Color getUniqueColor( const QList& ); + /* Builds presentation of not published object */ + virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape, + const QString&, + SALOME_View* = 0); + protected: /* internal methods */ - /* Builds presentation accordint to the current viewer type */ + /* Builds presentation according to the current viewer type */ virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); /* Sets interactive object */ diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index a1cc0bdb9..d49e014a7 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -19,134 +19,162 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMGUI : GUI for Geometry component -// File : GroupGUI_GroupDlg.cxx -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) -// +// GEOM GEOMGUI : GUI for Geometry component +// File : GroupGUI_GroupDlg.cxx +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + #include "GroupGUI_GroupDlg.h" +#include +#include +#include +#include + +#include +#include + #include + +#include +#include +#include +#include +#include + #include #include #include #include -#include -#include - -#include -#include -#include -#include -#include +#include +#include #include #include #include #include +#include +#include + +#include +#include +#include #include #include #include +#include + enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 }; -GroupGUI_GroupDlg::GroupGUI_GroupDlg( Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent ) - : GEOMBase_Skeleton( theGeometryGUI, parent, false ), - myMode( mode ), - myBusy( false ), - myIsShapeType( false ) +GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false), + myMode(mode), + myBusy(false), + myIsShapeType(false) { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QPixmap image0 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_VERTEX" ) ) ); - QPixmap image1 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_EDGE" ) ) ); - QPixmap image2 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_FACE" ) ) ); - QPixmap image3 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_SOLID" ) ) ); - QPixmap iconSelect ( resMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image0 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX"))); + QPixmap image1 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE"))); + QPixmap image2 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE"))); + QPixmap image3 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_SOLID"))); + QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); - setWindowTitle( myMode == CreateGroup ? tr( "CREATE_GROUP_TITLE" ) : tr( "EDIT_GROUP_TITLE" ) ); + setWindowTitle(myMode == CreateGroup ? tr("CREATE_GROUP_TITLE") : tr("EDIT_GROUP_TITLE")); // Shape type button group - mainFrame()->GroupConstructors->setEnabled( myMode == CreateGroup ); - mainFrame()->GroupConstructors->setTitle( tr( "SHAPE_TYPE" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setIcon( image1 ); - mainFrame()->RadioButton3->setIcon( image2 ); - mainFrame()->RadioButton4->setIcon( image3 ); + mainFrame()->GroupConstructors->setEnabled(myMode == CreateGroup); + mainFrame()->GroupConstructors->setTitle(tr("SHAPE_TYPE")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setIcon(image1); + mainFrame()->RadioButton3->setIcon(image2); + mainFrame()->RadioButton4->setIcon(image3); mainFrame()->RadioButton4->show(); // Group name - mainFrame()->GroupBoxName->setTitle( tr( "GROUP_NAME" ) ); + mainFrame()->GroupBoxName->setTitle(tr("GROUP_NAME")); // Main shape and sub-shapes - QGroupBox* GroupMedium = new QGroupBox( tr( "MAIN_SUB_SHAPES" ), centralWidget() ); - QGridLayout* aMedLayout = new QGridLayout( GroupMedium ); - aMedLayout->setMargin( 9 ); - aMedLayout->setSpacing( 6 ); - - QLabel* aMainLabel = new QLabel( tr( "MAIN_SHAPE" ), GroupMedium ); - - mySelBtn = new QPushButton( GroupMedium ); - mySelBtn->setIcon( iconSelect ); - mySelBtn->setEnabled( myMode == CreateGroup ); - - myMainName = new QLineEdit( GroupMedium ); - myMainName->setReadOnly( true ); - myMainName->setEnabled( myMode == CreateGroup ); - - QLabel* aSecondLabel = new QLabel( tr( "SECOND_SHAPE" ), GroupMedium ); - - mySelBtn2 = new QPushButton( GroupMedium ); - mySelBtn2->setIcon( iconSelect ); - mySelBtn2->setEnabled( false ); - - myShape2Name = new QLineEdit( GroupMedium ); - myShape2Name->setReadOnly( true ); - myShape2Name->setEnabled( false ); - - mySelectionWayGroupBox = new QGroupBox( tr("SHAPE_SEL_RESTR"), GroupMedium ); - mySelectionWayGroup = new QButtonGroup( mySelectionWayGroupBox ); - QRadioButton* allSubs = new QRadioButton( tr( "NO_RESTR" ) , mySelectionWayGroupBox ); - QRadioButton* inPlaceSubs = new QRadioButton( tr( "GEOM_PARTS_OF_SHAPE2" ), mySelectionWayGroupBox ); - QRadioButton* shape2Subs = new QRadioButton( tr( "SUBSHAPES_OF_SHAPE2" ) , mySelectionWayGroupBox ); - QVBoxLayout* mySelWayLayout = new QVBoxLayout( mySelectionWayGroupBox ); - mySelWayLayout->setMargin( 9 ); - mySelWayLayout->setSpacing( 6 ); - mySelWayLayout->addWidget( allSubs ); - mySelWayLayout->addWidget( inPlaceSubs ); - mySelWayLayout->addWidget( shape2Subs ); - mySelectionWayGroup->addButton( allSubs, ALL_SUBSHAPES ); - mySelectionWayGroup->addButton( inPlaceSubs, GET_IN_PLACE ); - mySelectionWayGroup->addButton( shape2Subs, SUBSHAPES_OF_SHAPE2 ); - allSubs->setChecked( true ); - - mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), GroupMedium ); - myAddBtn = new QPushButton( tr( "ADD" ), GroupMedium ); - myRemBtn = new QPushButton( tr( "REMOVE" ), GroupMedium ); - myIdList = new QListWidget( GroupMedium ); - - myIdList->setSelectionMode( QAbstractItemView::ExtendedSelection ); - myIdList->setFlow( QListView::TopToBottom ); - myIdList->setWrapping( true ); - - aMedLayout->addWidget( aMainLabel, 0, 0 ); - aMedLayout->addWidget( mySelBtn, 0, 1 ); - aMedLayout->addWidget( myMainName, 0, 2, 1, 2 ); - aMedLayout->addWidget( aSecondLabel, 1, 0 ); - aMedLayout->addWidget( mySelBtn2, 1, 1 ); - aMedLayout->addWidget( myShape2Name, 1, 2, 1, 2 ); - aMedLayout->addWidget( mySelectionWayGroupBox, 2, 0, 3, 3 ); - aMedLayout->addWidget( mySelAllBtn, 2, 3 ); - aMedLayout->addWidget( myAddBtn, 3, 3 ); - aMedLayout->addWidget( myRemBtn, 4, 3 ); - aMedLayout->addWidget( myIdList, 5, 0, 1, 4 ); - aMedLayout->setRowStretch( 5, 1 ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupMedium ); - - setHelpFileName( "work_with_groups_page.html" ); + QGroupBox* GroupMedium = new QGroupBox(tr("MAIN_SUB_SHAPES"), centralWidget()); + QGridLayout* aMedLayout = new QGridLayout(GroupMedium); + aMedLayout->setMargin(9); + aMedLayout->setSpacing(6); + + QLabel* aMainLabel = new QLabel(tr("MAIN_SHAPE"), GroupMedium); + + mySelBtn = new QPushButton(GroupMedium); + mySelBtn->setIcon(iconSelect); + mySelBtn->setEnabled(myMode == CreateGroup); + + myMainName = new QLineEdit(GroupMedium); + myMainName->setReadOnly(true); + myMainName->setEnabled(myMode == CreateGroup); + + QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), GroupMedium); + + mySelBtn2 = new QPushButton(GroupMedium); + mySelBtn2->setIcon(iconSelect); + mySelBtn2->setEnabled(false); + + myShape2Name = new QLineEdit(GroupMedium); + myShape2Name->setReadOnly(true); + myShape2Name->setEnabled(false); + + myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium); + myRestrictGroup = new QButtonGroup(myRestrictGroupBox); + QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox); + QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox); + QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox); + QVBoxLayout* aRestrictLayout = new QVBoxLayout(myRestrictGroupBox); + aRestrictLayout->setMargin(9); + aRestrictLayout->setSpacing(6); + aRestrictLayout->addWidget(allSubs); + aRestrictLayout->addWidget(inPlaceSubs); + aRestrictLayout->addWidget(shape2Subs); + myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES); + myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE); + myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2); + allSubs->setChecked(true); + + myShowOnlyBtn = new QPushButton(tr("Show only selected"), GroupMedium); + myHideSelBtn = new QPushButton(tr("Hide selected"), GroupMedium); + myShowAllBtn = new QPushButton(tr("Show all sub-shapes"), GroupMedium); + + mySelAllBtn = new QPushButton(tr("SELECT_ALL"), GroupMedium); + myAddBtn = new QPushButton(tr("ADD"), GroupMedium); + myRemBtn = new QPushButton(tr("REMOVE"), GroupMedium); + + myIdList = new QListWidget(GroupMedium); + + myIdList->setSelectionMode(QAbstractItemView::ExtendedSelection); + myIdList->setFlow(QListView::TopToBottom); + myIdList->setWrapping(true); + + aMedLayout->addWidget(aMainLabel, 0, 0); + aMedLayout->addWidget(mySelBtn, 0, 1); + aMedLayout->addWidget(myMainName, 0, 2, 1, 2); + aMedLayout->addWidget(aSecondLabel, 1, 0); + aMedLayout->addWidget(mySelBtn2, 1, 1); + aMedLayout->addWidget(myShape2Name, 1, 2, 1, 2); + aMedLayout->addWidget(myRestrictGroupBox, 2, 0, 3, 3); + + aMedLayout->addWidget(myShowOnlyBtn, 2, 3); + aMedLayout->addWidget(myHideSelBtn, 3, 3); + aMedLayout->addWidget(myShowAllBtn, 4, 3); + + aMedLayout->addWidget(mySelAllBtn, 5, 3); + aMedLayout->addWidget(myAddBtn, 6, 3); + aMedLayout->addWidget(myRemBtn, 7, 3); + + aMedLayout->addWidget(myIdList, 5, 0, 3, 3); + aMedLayout->setRowStretch(5, 1); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupMedium); + + setHelpFileName("work_with_groups_page.html"); Init(); } @@ -161,24 +189,21 @@ GroupGUI_GroupDlg::~GroupGUI_GroupDlg() //================================================================================= void GroupGUI_GroupDlg::Init() { - // san -- TODO: clear selected sub-shapes... - //mySelSubBtn->setChecked( true ); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); //unset shape type to avoid preparation of selection before exact user shape type selection - //setConstructorId( -1 ); //non valid shape type unsetConstructorId(); myIsShapeType = false; - if ( myMode == CreateGroup ) { - initName( tr( "GROUP_PREFIX" ) ); + if (myMode == CreateGroup) { + initName(tr("GROUP_PREFIX")); // Get ready for main shape selection myEditCurrentArgument = myMainName; - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect( mySelBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); } else if (myMode == EditGroup) { SALOME_ListIO aSelList; @@ -189,38 +214,41 @@ void GroupGUI_GroupDlg::Init() GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { + if (aResult && !CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) { myGroup = anObj; - mainFrame()->ResultName->setText( GEOMBase::GetName( myGroup ) ); + mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup)); - GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - myMainObj = anOper->GetMainShape( myGroup ); - if ( !CORBA::is_nil( myMainObj ) ) - myMainName->setText( GEOMBase::GetName( myMainObj ) ); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + myMainObj = anOper->GetMainShape(myGroup); + if (!CORBA::is_nil(myMainObj)) + myMainName->setText(GEOMBase::GetName(myMainObj)); - setShapeType( (TopAbs_ShapeEnum)anOper->GetType( myGroup ) ); + setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup)); - GEOM::ListOfLong_var aCurrList = anOper->GetObjects( myGroup ); - for ( int i = 0, n = aCurrList->length(); i < n; i++ ) - myIdList->addItem( new QListWidgetItem( QString( "%1" ).arg( aCurrList[i] ) ) ); + GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup); + for (int i = 0, n = aCurrList->length(); i < n; i++) + myIdList->addItem(new QListWidgetItem(QString("%1").arg(aCurrList[i]))); myEditCurrentArgument = 0; } - connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); } } - connect( aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ); + connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - 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( mySelectionWayGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( add() ) ); - connect( myRemBtn, SIGNAL( clicked() ), this, SLOT( remove() ) ); - connect( myIdList, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) ); + connect(myRestrictGroup, SIGNAL(buttonClicked(int)), this, SLOT(SetEditCurrentArgument())); + connect(mySelAllBtn, SIGNAL(clicked()), this, SLOT(selectAllSubShapes())); + connect(myAddBtn, SIGNAL(clicked()), this, SLOT(add())); + connect(myRemBtn, SIGNAL(clicked()), this, SLOT(remove())); + connect(myShowOnlyBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myHideSelBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); setInPlaceObj(GEOM::GEOM_Object::_nil()); @@ -233,22 +261,22 @@ void GroupGUI_GroupDlg::Init() // function : enterEvent() // purpose : //================================================================================= -void GroupGUI_GroupDlg::enterEvent( QEvent* e ) +void GroupGUI_GroupDlg::enterEvent(QEvent* e) { - if ( !buttonCancel()->isEnabled() ) + if (!buttonCancel()->isEnabled()) ActivateThisDialog(); } -//======================================================================= +//================================================================================= //function : closeEvent //purpose : remove temporary geom object -//======================================================================= - -void GroupGUI_GroupDlg::closeEvent( QCloseEvent* e ) +//================================================================================= +void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); + setInPlaceObj(GEOM::GEOM_Object::_nil()); + erasePreview(true); - GEOMBase_Skeleton::closeEvent( e ); + GEOMBase_Skeleton::closeEvent(e); } //================================================================================= @@ -257,7 +285,7 @@ void GroupGUI_GroupDlg::closeEvent( QCloseEvent* e ) //================================================================================= void GroupGUI_GroupDlg::ClickOnOk() { - if ( ClickOnApply() ) + if (ClickOnApply()) ClickOnCancel(); } @@ -267,17 +295,18 @@ void GroupGUI_GroupDlg::ClickOnOk() //================================================================================= bool GroupGUI_GroupDlg::ClickOnApply() { - if ( !onAccept( myMode == CreateGroup, true ) ) + if (!onAccept(myMode == CreateGroup, true)) return false; - if ( myMode == CreateGroup ) - { - initName(); - myIdList->clear(); - ConstructorsClicked( getConstructorId() ); - } + if (myMode == CreateGroup) + { + initName(); + myIdList->clear(); + ConstructorsClicked(getConstructorId()); + } else activateSelection(); + return true; } @@ -289,30 +318,12 @@ void GroupGUI_GroupDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); activateSelection(); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GroupGUI_GroupDlg::LineEditReturnPressed() -{ - QLineEdit* send = ( QLineEdit* )sender(); - - if ( send == myMainName && !myEditCurrentArgument ) { - myEditCurrentArgument = myMainName; - activateSelection(); - } - else - GEOMBase_Skeleton::LineEditReturnPressed(); - - updateState(); -} - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -321,37 +332,24 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == mySelBtn ) { + if (send == mySelBtn) { myEditCurrentArgument = myMainName; - myShape2Name->setText( "" ); + myShape2Name->setText(""); } - else if ( /*(QRadioButton*)sender() == mySelSubBtn ||*/ send == mySelAllBtn ) - myEditCurrentArgument = 0; - else if ( send == mySelBtn2 || sender() == mySelectionWayGroup ) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - //if ( myPlaceCheckBox->isChecked() ) - myShape2Name->setText( "" ); - if ( subSelectionWay() != ALL_SUBSHAPES ) - { + else if (send == mySelBtn2 || sender() == myRestrictGroup) { + setInPlaceObj(GEOM::GEOM_Object::_nil()); + myShape2Name->setText(""); + if (subSelectionWay() != ALL_SUBSHAPES) { myEditCurrentArgument = myShape2Name; } else { - //myEditCurrentArgument = myMainName; myEditCurrentArgument = 0; } } activateSelection(); - if ( send == mySelAllBtn ) { -// myShape2Name->setText( "" ); -// myPlaceCheckBox->setChecked( false ); -// mySelBtn2->setEnabled( false ); -// myShape2Name->setEnabled( false ); - selectAllSubShapes(); - } - else - updateState(); + updateState(); } //================================================================================= @@ -360,13 +358,13 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument() //================================================================================= void GroupGUI_GroupDlg::onGetInPlace() { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - myEditCurrentArgument->setText( "" ); + setInPlaceObj(GEOM::GEOM_Object::_nil()); + myEditCurrentArgument->setText(""); bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); myIdList->clearSelection(); - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; @@ -384,15 +382,15 @@ void GroupGUI_GroupDlg::onGetInPlace() myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - if ( subSelectionWay() == GET_IN_PLACE ) { + if (subSelectionWay() == GET_IN_PLACE) { GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj); - setInPlaceObj( aGetInPlaceObj ); + setInPlaceObj(aGetInPlaceObj); } else { bool isVisible = true; - if ( SALOME_View* view = GEOM_Displayer::GetActiveView() ) - isVisible = view->isVisible( aSelList.First() ); - setInPlaceObj( anObj, isVisible ); + if (SALOME_View* view = GEOM_Displayer::GetActiveView()) + isVisible = view->isVisible(aSelList.First()); + setInPlaceObj(anObj, isVisible); } myEditCurrentArgument = 0; //myBusy = true; // just activate but do not select in the list @@ -402,54 +400,34 @@ void GroupGUI_GroupDlg::onGetInPlace() } } -//======================================================================= +//================================================================================= //function : setInPlaceObj //purpose : temporarily add an object to study and remove old InPlaceObj -//======================================================================= - -void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj, const bool isVisible ) +//================================================================================= +void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool isVisible) { - if ( ! myInPlaceObj->_is_equivalent( theObj ) ) + if (!myInPlaceObj->_is_equivalent(theObj)) { - const char* tmpName = "__InPlaceObj__"; - // remove old InPlaceObj - if ( !myInPlaceObj->_is_nil() ) { - if ( myInPlaceObjSelectState == GET_IN_PLACE || - myInPlaceObjSelectState == SUBSHAPES_OF_INVISIBLE_SHAPE2 ) { - // hide temporary object or initially invisible shape 2 (issue 0014047) - GEOM_Displayer aDisplayer(getStudy()); - aDisplayer.Erase( myInPlaceObj, true ); - } - if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName )) { - getStudy()->studyDS()->NewBuilder()->RemoveObjectWithChildren( SO ); - getGeomEngine()->RemoveObject(myInPlaceObj); - } - } - // publish InPlaceObj to enable localSelection(InPlaceObj) - if ( !theObj->_is_nil() && subSelectionWay() == GET_IN_PLACE ) { - SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS()); - SALOMEDS::SObject_var aSO = - getGeomEngine()->AddInStudy(aStudyDS, theObj, tmpName, myMainObj); - } myInPlaceObj = theObj; } + // build map of indices myMain2InPlaceIndices.Clear(); - if ( !myInPlaceObj->_is_nil() ) { - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + if (!myInPlaceObj->_is_nil()) { + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId()); - GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode( myInPlaceObj, getShapeType(), false); + GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false); for (int i = 0; i < aSubObjects->length(); i++) { - CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] ); - if ( aMainIndex >= 0 && aPlaceIndex > 0) - myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex ); + CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex(myMainObj, aSubObjects[i]); + CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex(myInPlaceObj, aSubObjects[i]); + if (aMainIndex >= 0 && aPlaceIndex > 0) + myMain2InPlaceIndices.Bind(aMainIndex, aPlaceIndex); } } myInPlaceObjSelectState = subSelectionWay(); - if ( myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible ) + if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible) myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2; } @@ -459,306 +437,264 @@ void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj, const bool //================================================================================= void GroupGUI_GroupDlg::SelectionIntoArgument() { -// if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name ) if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) { onGetInPlace(); return; } - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - if (myEditCurrentArgument == myMainName) { // Selection of a main shape is active myEditCurrentArgument->setText(""); myIdList->clear(); - if (aSelList.Extent() == 1) { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + int nbSel = aSelList.Extent(); + + if (nbSel == 1) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { myMainObj = anObj; - myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); + myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); // activate subshapes selection by default myEditCurrentArgument = 0; activateSelection(); updateState(); - return; } } - - myMainObj = GEOM::GEOM_Object::_nil(); + else { + myMainObj = GEOM::GEOM_Object::_nil(); + } } else { // an attempt to synchronize list box selection with 3d viewer - if ( myBusy ) { + if (myBusy) { return; } bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); myIdList->clearSelection(); TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - bool subselected = aMapIndex.Extent(); - - // convert inPlace indices to main indices - //if ( subselected && myPlaceCheckBox->isChecked() ) - if ( subselected && subSelectionWay() != ALL_SUBSHAPES ) - { - TColStd_IndexedMapOfInteger aMapIndex2; - - TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices ); - for ( ; m2ip.More(); m2ip.Next() ) { - int inPlaceId = m2ip.Value(); - if ( aMapIndex.Contains( inPlaceId )) { - aMapIndex2.Add( m2ip.Key() ); - } - } - aMapIndex = aMapIndex2; - } - - // try to find out and process the object browser selection - if ( !subselected ) { - globalSelection( GEOM_ALLSHAPES ); - - GEOM::ListOfGO anObjects; - GEOMBase::ConvertListOfIOInListOfGO(aSelList, anObjects); - - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - - for (int i = 0; i < anObjects.length(); i++) - { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) - { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; - } - else if (aGeomObj->GetType() == GEOM_GROUP) - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - else - continue; - - for (int i = 0; i < aSubObjects->length(); i++) - { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) { - //if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex )) - if ( subSelectionWay() != ALL_SUBSHAPES && - ! myMain2InPlaceIndices.IsBound( anIndex )) - continue; - aMapIndex.Add( anIndex ); - } - } - } - } - if ( !myMainObj->_is_nil() && myIsShapeType/*&& mySelSubBtn->isChecked()*/) - if ( subSelectionWay() == ALL_SUBSHAPES ) - localSelection( myMainObj, getShapeType() ); - else if ( !myInPlaceObj->_is_nil() ) - localSelection( myInPlaceObj, getShapeType() ); - } - - if (aMapIndex.Extent() >= 1) { + if (nbSel) { QMap aMap; - for ( int i = 0, n = myIdList->count(); i < n; i++ ) - aMap.insert( myIdList->item( i )->text().toInt(), i ); + for (int i = 0, n = myIdList->count(); i < n; i++) + aMap.insert(myIdList->item(i)->text().toInt(), i); - for ( int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++ ) { - if ( aMap.contains( aMapIndex( ii ) ) ) - myIdList->item( aMap[aMapIndex( ii )])->setSelected( true ); + for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) { + if (aMap.contains(aMapIndex(ii))) + myIdList->item(aMap[aMapIndex(ii)])->setSelected(true); } } - myIdList->blockSignals( isBlocked ); - } + myIdList->blockSignals(isBlocked); - updateState(); + updateState(nbSel); + } } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void GroupGUI_GroupDlg::ConstructorsClicked( int constructorId ) +void GroupGUI_GroupDlg::ConstructorsClicked(int constructorId) { - if (!myIsShapeType && getConstructorId() != constructorId) - setConstructorId( constructorId ); + if (getConstructorId() != constructorId) + setConstructorId(constructorId); + myIsShapeType = true; myIdList->clear(); + myEditCurrentArgument = 0; + + setInPlaceObj(myInPlaceObj); // to rebuild myMain2InPlaceIndices activateSelection(); updateState(); - setInPlaceObj( myInPlaceObj ); // to rebuild myMain2InPlaceIndices } //================================================================================= // function : selectAllSubShapes -// purpose : +// purpose : //================================================================================= void GroupGUI_GroupDlg::selectAllSubShapes() { - if ( CORBA::is_nil( myMainObj ) || !myIsShapeType ) + if (CORBA::is_nil(myMainObj) || !myIsShapeType) return; GEOM::ListOfLong_var aSubShapes; - - // if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false); + if (aSubShapes->length() > 0) { + if (subSelectionWay() == ALL_SUBSHAPES) { - if ( !myIsShapeType ) - return; - myIdList->clear(); - GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false); - - if ( !aShOp->IsDone() ) + myIdList->clear(); // for sorted final list? + + if (!aShOp->IsDone()) return; } - else + else { aSubShapes = new GEOM::ListOfLong(); - aSubShapes->length( myMain2InPlaceIndices.Extent() ); - TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices ); - for ( int i = 0; m2ip.More(); i++, m2ip.Next() ) - aSubShapes[ i ] = m2ip.Key(); - } - bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); - - for ( int i = 0, n = aSubShapes->length(); i < n; i++ ) { - CORBA::Long anIndex = aSubShapes[i]; - if ( anIndex < 0 ) - continue; - - QListWidgetItem* anItem = 0; - QString text = QString( "%1" ).arg( anIndex ); - if ( !myInPlaceObj->_is_nil() ) { - QList found = myIdList->findItems( text, Qt::MatchExactly ); - if ( found.count() ) anItem = found[0]; + aSubShapes->length(myMain2InPlaceIndices.Extent()); + TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip (myMain2InPlaceIndices); + for (int i = 0; m2ip.More(); i++, m2ip.Next()) + aSubShapes[i] = m2ip.Key(); } - if ( !anItem ) { - anItem = new QListWidgetItem( text ); - myIdList->addItem( anItem ); + + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals(true); + + for (int i = 0, n = aSubShapes->length(); i < n; i++) { + CORBA::Long anIndex = aSubShapes[i]; + if (anIndex < 0) + continue; + + QListWidgetItem* anItem = 0; + QString text = QString("%1").arg(anIndex); + if (!myInPlaceObj->_is_nil()) { + QList found = myIdList->findItems(text, Qt::MatchExactly); + if (found.count()) anItem = found[0]; + } + if (!anItem) { + anItem = new QListWidgetItem(text); + myIdList->addItem(anItem); + } + anItem->setSelected(true); } - anItem->setSelected( true ); + + myIdList->blockSignals(isBlocked); + highlightSubShapes(); } - - myIdList->blockSignals( isBlocked ); - highlightSubShapes(); } //================================================================================= -// function : add -// purpose : +// function : showOnlySelected +// purpose : //================================================================================= -void GroupGUI_GroupDlg::add() +void GroupGUI_GroupDlg::showOnlySelected() { - TColStd_MapOfInteger aMap; - for ( int i = 0, n = myIdList->count(); i < n; i++ ) - aMap.Add( myIdList->item( i )->text().toInt() ); - - TColStd_IndexedMapOfInteger aMapIndex; + if (CORBA::is_nil(myMainObj) || !myIsShapeType) + return; - SALOME_ListIO aSelIOs; - SalomeApp_Application* app = myGeomGUI->getApp(); - if ( app ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( aSelMgr ) { - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - else { // selected the same subshape as the main object - SALOME_ListIO aSelList; - TColStd_IndexedMapOfInteger aMap; - aSelMgr->selectedObjects(aSelList); - if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( aSelectedObject->_is_equivalent(myMainObj) ) - aMapIndex.Add(1); // add index of the only subshape of selected type - } - } - } + QPushButton* send = (QPushButton*)sender(); + if (send == myShowAllBtn) { + activateSelection(); + return; } - GEOM::ListOfGO anObjects; - // get selected sub-shapes of myInPlaceObj - if ( aMapIndex.Extent() > 0 && !myInPlaceObj->_is_nil() ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - anObjects.length( aMapIndex.Extent() ); - for ( int i = 1; i <= aMapIndex.Extent(); i++ ) - anObjects[ i-1 ] = aShapesOp->GetSubShape( myInPlaceObj, aMapIndex( i )); + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + GEOM_Displayer* aDisplayer = getDisplayer(); - aMapIndex.Clear(); + if (send == myHideSelBtn) { + aDisplayer->Erase(aSelList, false, true); } + else { + aDisplayer->EraseAll(); + aDisplayer->Display(aSelList, true); + } +} - // try to find out and process the object browser selection or InPlace sub-shapes - if ( !aMapIndex.Extent() ) - { - if ( anObjects.length() == 0 ) - GEOMBase::ConvertListOfIOInListOfGO(aSelIOs, anObjects); +//================================================================================= +// function : getSelectedSubshapes +// purpose : +//================================================================================= +int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex) +{ + theMapIndex.Clear(); - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + SalomeApp_Application* app = myGeomGUI->getApp(); + if (!app) return 0; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); - for (int i = 0; i < anObjects.length(); i++) + // try to find out and process the global selection + // (of not published objects and of published sub-shapes) + { + SALOME_ListIteratorOfListIO anIter (aSelList); + for (int i = 0; anIter.More(); anIter.Next(), i++) { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) + Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); + QString anEntry = anIObj->getEntry(); + QString str = "_"; + int index = anEntry.lastIndexOf(str); + if (index > 0) // selection among special preview { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; + anEntry.remove(0, index+1); + int anIndex = anEntry.toInt(); + if (anIndex) + theMapIndex.Add(anIndex); } - else if (aGeomObj->GetType() == GEOM_GROUP) - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - else - break; - - for (int i = 0; i < aSubObjects->length(); i++) + else // selection among published shapes { + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if (!appStudy) return 0; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) - aMapIndex.Add( anIndex ); + if (GEOMBase::GetShape(aGeomObj, aShape)) { + if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) { + TopTools_IndexedMapOfShape aMainMap; + TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); + TopExp::MapShapes(aMainShape, aMainMap); + + TopExp_Explorer anExp (aShape, getShapeType()); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int anIndex = aMainMap.FindIndex(aSubShape); + if (anIndex >= 0) { + if (subSelectionWay() != ALL_SUBSHAPES && + !myMain2InPlaceIndices.IsBound(anIndex)) + continue; + theMapIndex.Add(anIndex); + } + } + } } } - } + } // for aSelList } - if ( aMapIndex.Extent() >= 1 ) { + return theMapIndex.Extent(); +} + +//================================================================================= +// function : add +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::add() +{ + TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); + + TColStd_MapOfInteger aMap; + for (int i = 0, n = myIdList->count(); i < n; i++) + aMap.Add(myIdList->item(i)->text().toInt()); + + if (nbSel > 0) { bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); - for ( int i = 1, n = aMapIndex.Extent(); i <= n; i++ ) { - if ( aMap.Contains( aMapIndex( i ) ) ) + for (int i = 1, n = aMapIndex.Extent(); i <= n; i++) { + if (aMap.Contains(aMapIndex(i))) continue; - QListWidgetItem* anItem = new QListWidgetItem( QString( "%1" ).arg( aMapIndex( i ) ) ); - myIdList->addItem( anItem ); - anItem->setSelected( true ); + QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i))); + myIdList->addItem(anItem); + anItem->setSelected(true); } - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); } updateState(); @@ -766,30 +702,29 @@ void GroupGUI_GroupDlg::add() //================================================================================= // function : remove -// purpose : +// purpose : //================================================================================= void GroupGUI_GroupDlg::remove() { bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); - QListIterator it( myIdList->selectedItems() ); - while ( it.hasNext() ) + QListIterator it (myIdList->selectedItems()); + while (it.hasNext()) delete it.next(); - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); highlightSubShapes(); } -//======================================================================= +//================================================================================= //function : subSelectionWay -//purpose : -//======================================================================= - +//purpose : +//================================================================================= int GroupGUI_GroupDlg::subSelectionWay() const { - return mySelectionWayGroup->checkedId(); + return myRestrictGroup->checkedId(); } //================================================================================= @@ -798,7 +733,7 @@ int GroupGUI_GroupDlg::subSelectionWay() const //================================================================================= TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const { - switch ( getConstructorId() ) { + switch (getConstructorId()) { case 0: return TopAbs_VERTEX; case 1: return TopAbs_EDGE; case 2: return TopAbs_FACE; @@ -811,157 +746,106 @@ TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const // function : setShapeType() // purpose : //================================================================================= -void GroupGUI_GroupDlg::setShapeType( const TopAbs_ShapeEnum theType ) +void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType) { int anId = 0; - switch ( theType ) { + switch (theType) { case TopAbs_VERTEX: anId = 0; break; case TopAbs_EDGE: anId = 1; break; case TopAbs_FACE: anId = 2; break; case TopAbs_SOLID: anId = 3; break; } - setConstructorId( anId ); + setConstructorId(anId); if (!myIsShapeType) { myIsShapeType = true; - // workaround top avoid set checked button 0 - setConstructorId( anId ); + // workaround to avoid set checked button 0 + setConstructorId(anId); } } - //================================================================================= // function : activateSelection // purpose : Activate selection in accordance with myEditCurrentArgument //================================================================================= void GroupGUI_GroupDlg::activateSelection() { - globalSelection( GEOM_ALLSHAPES ); + erasePreview(false); // local selection - if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/ - && myIsShapeType) { // check if shape type is already choosen by user - -// if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) - localSelection( myMainObj, getShapeType() ); - else if ( !myInPlaceObj->_is_nil() ) - localSelection( myInPlaceObj, getShapeType() ); - } + if (!myMainObj->_is_nil() && + !myEditCurrentArgument && + myIsShapeType) // check if shape type is already choosen by user + { + GEOM_Displayer* aDisplayer = getDisplayer(); - SelectionIntoArgument(); -} + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if (activeStudy) + aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (aViewWindow == 0) return; -//================================================================================= -// function : updateState -// purpose : -//================================================================================= -void GroupGUI_GroupDlg::updateState() -{ - bool isAdd = false; + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if (aViewManager->getType() != OCCViewer_Viewer::Type() && + aViewManager->getType() != SVTK_Viewer::Type()) + return; - TColStd_IndexedMapOfInteger aMapIndex; + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView == 0) return; + + TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); + TopoDS_Shape aRestrictionShape; + if (subSelectionWay() == ALL_SUBSHAPES) + aRestrictionShape = aMainShape; + else if (!myInPlaceObj->_is_nil()) + aRestrictionShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myInPlaceObj); + else ; + + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(aMainShape, aSubShapesMap); + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + QString anEntryBase = aMainEntry.in(); + + TopExp_Explorer anExp (aRestrictionShape, getShapeType()); + for (; anExp.More(); anExp.Next()) + { + TopoDS_Shape aSubShape = anExp.Current(); + int index = aSubShapesMap.FindIndex(aSubShape); + QString anEntry = anEntryBase + QString("_%1").arg(index); - SALOME_ListIO aSelIOs; - SalomeApp_Application* app = myGeomGUI->getApp(); - if ( app ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( aSelMgr ) { - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - else { // selected the same subshape as the main object - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - if (aSelList.Extent() == 1) { - myBusy = true; - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( aSelectedObject->_is_equivalent(myMainObj) ) { - aMapIndex.Add(1); // add index of the only subshape of selected type - TColStd_MapOfInteger anIds; // higlight selected index - anIds.Add(1); - aSelMgr->AddOrRemoveIndex(aSelList.First(), anIds, false); - } - myBusy = false; - } + SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); + if (aPrs) { + displayPreview(aPrs, true, false); // append, do not update } } + aDisplayer->UpdateViewer(); } - // try to find out and process the object browser selection - if ( !aMapIndex.Extent() && !CORBA::is_nil( myMainObj ) ) { - GEOM::ListOfGO anObjects; - //GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects); - GEOMBase::ConvertListOfIOInListOfGO(aSelIOs, anObjects); + globalSelection(GEOM_ALLSHAPES); - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - - isAdd = true; - - for (int i = 0; i < anObjects.length(); i++) - { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; - } - else if (aGeomObj->GetType() == GEOM_GROUP) { - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - } - else { - aMapIndex.Clear(); - break; - } + SelectionIntoArgument(); +} - for (int i = 0; i < aSubObjects->length(); i++) - { - TopoDS_Shape aShape; - aSubObjects[i]; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) - aMapIndex.Add( anIndex ); - else - isAdd = false; - } - else - isAdd = false; +//================================================================================= +// function : updateState +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::updateState (bool isAdd) +{ + myAddBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd); + //myShowOnlyBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd); - if ( !isAdd ) { - aMapIndex.Clear(); - break; - } - } - if ( !isAdd ) { - aMapIndex.Clear(); - break; - } - } - } + bool hasSel = myIdList->selectedItems().count() > 0; - isAdd = aMapIndex.Extent() > 0; + myRemBtn->setEnabled(hasSel); + myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj)); + mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj)); - myAddBtn->setEnabled( !myEditCurrentArgument && !CORBA::is_nil( myMainObj ) && isAdd ); - bool hasSel = myIdList->selectedItems().count() > 0; - myRemBtn->setEnabled( hasSel ); - //mySelSubBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); - //myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) ); - mySelectionWayGroupBox->setEnabled( !CORBA::is_nil( myMainObj ) ); - mySelAllBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); -// mySelBtn2->setEnabled( myPlaceCheckBox->isChecked() ); -// myShape2Name->setEnabled( myPlaceCheckBox->isChecked() ); - mySelBtn2->setEnabled( subSelectionWay() != ALL_SUBSHAPES ); - myShape2Name->setEnabled( subSelectionWay() != ALL_SUBSHAPES ); -// if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) - setInPlaceObj( GEOM::GEOM_Object::_nil() ); + mySelBtn2->setEnabled( subSelectionWay() != ALL_SUBSHAPES); + myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES); + if (subSelectionWay() == ALL_SUBSHAPES) + setInPlaceObj(GEOM::GEOM_Object::_nil()); } //================================================================================= @@ -979,20 +863,7 @@ void GroupGUI_GroupDlg::selectionChanged() //================================================================================= void GroupGUI_GroupDlg::highlightSubShapes() { - if ( CORBA::is_nil( myMainObj ) ) - return; - - Standard_Boolean isOk; - char* objIOR; - - if ( myInPlaceObj->_is_nil() ) - objIOR = GEOMBase::GetIORFromObject( myMainObj ); - else - objIOR = GEOMBase::GetIORFromObject( myInPlaceObj ); - - Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR, isOk, true ); - free( objIOR ); - if ( !isOk || aSh.IsNull() ) + if (CORBA::is_nil(myMainObj)) return; TColStd_MapOfInteger anIds; @@ -1000,36 +871,72 @@ void GroupGUI_GroupDlg::highlightSubShapes() myBusy = true; int ii = 0, nn = myIdList->count(); - for ( ; ii < nn; ii++ ) + for (; ii < nn; ii++) { - if ( myIdList->item( ii )->isSelected() ) { - int id = myIdList->item( ii )->text().toInt(); - // if ( myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() != ALL_SUBSHAPES ) - { - if ( myMain2InPlaceIndices.IsBound( id ) ) - id = myMain2InPlaceIndices( id ); - else { - myIdList->item( ii )->setSelected( false ); - continue; - } + if (myIdList->item(ii)->isSelected()) { + int id = myIdList->item(ii)->text().toInt(); + if (subSelectionWay() != ALL_SUBSHAPES && + !myMain2InPlaceIndices.IsBound(id)) { + myIdList->item(ii)->setSelected(false); + } + else { + anIds.Add(id); } - anIds.Add( id ); } } SalomeApp_Application* app = myGeomGUI->getApp(); LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); aSelMgr->clearSelected(); - aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = app->activeStudy(); + if (activeStudy) + aViewWindow = app->desktop()->activeWindow(); + if (aViewWindow == 0) return; + + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if (aViewManager->getType() != OCCViewer_Viewer::Type() && + aViewManager->getType() != SVTK_Viewer::Type()) + return; + + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView == 0) return; + + // TODO: use here GEOMBase_Helper::myPreview instead of ic->DisplayedObjects() + + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)aViewManager)->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + + SALOME_ListIO aSelList; + + AIS_ListIteratorOfListOfInteractive ite (List); + for (; ite.More(); ite.Next()) { + if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (aSh->hasIO()) { + Handle(SALOME_InteractiveObject) anIO = aSh->getIO(); + QString anEntry = anIO->getEntry(); + int index = anEntry.lastIndexOf("_"); + anEntry.remove(0, index+1); + int anIndex = anEntry.toInt(); + if (anIds.Contains(anIndex)) + aSelList.Append(anIO); + } + } + } + aSelMgr->setSelectedObjects(aSelList); myBusy = false; if (nn < 3000) - updateState(); + updateState(aSelList.Extent() > 0); else { - myAddBtn->setEnabled( true ); - myRemBtn->setEnabled( true ); + myAddBtn->setEnabled(true); + myAddBtn->setEnabled(true); + myRemBtn->setEnabled(true); } } @@ -1039,11 +946,11 @@ void GroupGUI_GroupDlg::highlightSubShapes() //================================================================================= GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() { - return getGeomEngine()->GetIGroupOperations( getStudyId() ); + return getGeomEngine()->GetIGroupOperations(getStudyId()); } #define RETURN_WITH_MSG(a, b) \ - if ( !(a) ) { \ + if (!(a)) { \ theMessage += (b); \ return false; \ } @@ -1052,23 +959,23 @@ GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool GroupGUI_GroupDlg::isValid( QString& theMessage ) +bool GroupGUI_GroupDlg::isValid(QString& theMessage) { SalomeApp_Study* study = getStudy(); ASSERT(study); - RETURN_WITH_MSG ( !study->studyDS()->GetProperties()->IsLocked(), tr( "GEOM_STUDY_LOCKED" ) ) + RETURN_WITH_MSG (!study->studyDS()->GetProperties()->IsLocked(), tr("GEOM_STUDY_LOCKED")) - if ( myMode == CreateGroup ) { - RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_MAIN_OBJ" ) ) + if (myMode == CreateGroup) { + RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_MAIN_OBJ")) } else { - RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_GROUP" ) ) + RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_GROUP")) } QString aName (getNewObjectName()); - RETURN_WITH_MSG ( !aName.trimmed().isEmpty(), tr( "EMPTY_NAME" ) ) + RETURN_WITH_MSG (!aName.trimmed().isEmpty(), tr("EMPTY_NAME")) - RETURN_WITH_MSG ( myIdList->count(), tr( "EMPTY_LIST" ) ) + RETURN_WITH_MSG (myIdList->count(), tr("EMPTY_LIST")) return true; } @@ -1076,10 +983,8 @@ bool GroupGUI_GroupDlg::isValid( QString& theMessage ) // function : execute // purpose : //================================================================================= -bool GroupGUI_GroupDlg::execute( ObjectList& objects ) +bool GroupGUI_GroupDlg::execute(ObjectList& objects) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); GEOM::GEOM_Object_var aGroup; @@ -1116,20 +1021,20 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) } SalomeApp_Study* study = getStudy(); - if ( study ) { - char* objIOR = GEOMBase::GetIORFromObject( aGroup ); - std::string IOR( objIOR ); - free( objIOR ); - if ( IOR != "" ) { - _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); - if ( SO ) { + if (study) { + char* objIOR = GEOMBase::GetIORFromObject(aGroup); + std::string IOR(objIOR); + free(objIOR); + if (IOR != "") { + _PTR(SObject) SO (study->studyDS()->FindObjectIOR(IOR)); + if (SO) { _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder()); - aBuilder->SetName( SO, getNewObjectName().toLatin1().constData() ); + aBuilder->SetName(SO, getNewObjectName().toLatin1().constData()); } } } - objects.push_back( aGroup._retn() ); + objects.push_back(aGroup._retn()); return true; } @@ -1139,12 +1044,12 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) // Purpose : Get father object for object to be added in study // ( called with addInStudy method ) //================================================================ -GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj ) +GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather(GEOM::GEOM_Object_ptr theObj) { GEOM::GEOM_Object_var aFatherObj; - if ( theObj->GetType() == GEOM_GROUP ) { - GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - aFatherObj = anOper->GetMainShape( theObj ); + if (theObj->GetType() == GEOM_GROUP) { + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + aFatherObj = anOper->GetMainShape(theObj); } return aFatherObj._retn(); } diff --git a/src/GroupGUI/GroupGUI_GroupDlg.h b/src/GroupGUI/GroupGUI_GroupDlg.h index 337d0da4f..fcee5bde7 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.h +++ b/src/GroupGUI/GroupGUI_GroupDlg.h @@ -19,10 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMGUI : GUI for Geometry component -// File : GroupGUI_GroupDlg.h -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) -// +// GEOM GEOMGUI : GUI for Geometry component +// File : GroupGUI_GroupDlg.h +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + #ifndef GROUPGUI_GROUPDLG_H #define GROUPGUI_GROUPDLG_H @@ -30,6 +30,7 @@ #include #include +#include class QGroupBox; class QLineEdit; @@ -59,7 +60,7 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); - + void closeEvent( QCloseEvent* ); private slots: @@ -70,23 +71,25 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); - + void selectAllSubShapes(); void add(); void remove(); + void showOnlySelected(); void selectionChanged(); - + private: void Init(); void enterEvent( QEvent* ); - int subSelectionWay() const; + int subSelectionWay() const; TopAbs_ShapeEnum getShapeType() const; void setShapeType( const TopAbs_ShapeEnum ); void activateSelection(); - void updateState(); + void updateState(bool isAdd = false); void highlightSubShapes(); void onGetInPlace(); void setInPlaceObj( GEOM::GEOM_Object_var, const bool isVisible=1); + int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex); private: Mode myMode; @@ -102,11 +105,14 @@ private: QLineEdit* myMainName; QPushButton* mySelBtn2; QLineEdit* myShape2Name; - QGroupBox* mySelectionWayGroupBox; - QButtonGroup* mySelectionWayGroup; + QGroupBox* myRestrictGroupBox; + QButtonGroup* myRestrictGroup; QPushButton* mySelAllBtn; QPushButton* myAddBtn; QPushButton* myRemBtn; + QPushButton* myShowOnlyBtn; + QPushButton* myHideSelBtn; + QPushButton* myShowAllBtn; QListWidget* myIdList; };