default, it is Group_n.</li>
<li>Then, using the "Select" button, select the <b>Main Shape</b> (a
geometrical object on which the group will be created). </li>
+<li> <b>Select Sub-Shapes</b> button group lets you restrict range
+of group elements you operate with.
+<ul><li>\b All button enables work with all sub-shapes of the Main
+Shape.</li>
+<li><b>In Place of Second Shape</b> restricts range of accesible
+elements to those sub-shapes of the Main Shape that geometrically
+coincide with the <b>Second Shape</b>.</li>
+<li><b>Sub-Shapes of Second Shape</b> restricts range of elements to
+those sub-shapes of the Main Shape that are sub-shapes of <b>Second
+Shape</b>.</li>
+</ul>
<li> You can select the elements of your group in two ways:
<ul>
-<li>You can select them
-manually in the 3D Viewer, and add to the group by clicking the \b Add
-button (keep down the Shift button on the keyboard to select several
-elements and add all them together). The indexes of the selected
-elements will be displayed in the list. To delete elements from the
-list, select them and click \b Remove button.\n
- Checking in <b>Select in Place of Second Shape</b> box allows you
-to specify <b>Second Shape</b> which will restrict selection to those
-subshapes of the main shape that geometrically coincide with the
-Second Shape.
-</li>
+<li>You can select them manually in the 3D Viewer, and add to the
+group by clicking the \b Add button (keep down the Shift button on the
+keyboard to select several elements and add all them together). The
+indexes of the selected elements will be displayed in the list. To
+delete elements from the list, select them and click \b Remove
+button.</li>
<li>Clicking <b>Select All</b> button you can add all object's
elements of a certain type in the list of the elements of the
group. To delete elements from the list, select them and click \b
-Remove button. If you set <b>Second shape</b>, action of <b>Select
-All</b> is limited to subshapes geometrically coincident with the
-Second Shape</li>
-</ul></li>
+Remove button. If you set <b>Second Shape</b>, action of <b>Select
+All</b> is limited according to you choice in <b>Select Sub-Shapes</b>
+button group.</li></ul>
+</li>
<li>Finally, confirm your selection by clicking \b OK (also closes the
Menu) or \b Apply (leaves the Menu open for creation of other groups),
or skip it by clicking \b Close button.</li>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2 };
GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
:GEOMBase_Skeleton( theGeometryGUI, parent, "GroupGUI_GroupDlg", false,
Layout1->addWidget( GroupMedium, 2, 0 );
QWidget* aFrame = new QWidget( GroupMedium );
- QGridLayout* aMedLayout = new QGridLayout( aFrame, 5, 4, 0, 6 );
+ QGridLayout* aMedLayout = new QGridLayout( aFrame, 6, 4, 0, 6 );
QLabel* aMainLabel = new QLabel( tr( "MAIN_SHAPE" ), aFrame );
myShape2Name->setEnabled( false );
//mySelSubBtn = new QRadioButton ( tr( "SELECT_SUB_SHAPES" ), aFrame );
- myPlaceCheckBox = new QCheckBox ( tr( "GET_IN_PLACE" ), aFrame );
+ //myPlaceCheckBox = new QCheckBox ( tr( "GET_IN_PLACE" ), aFrame );
+ mySelectionWayGroup = new QButtonGroup(1, Qt::Horizontal, tr("SELECT_SUB_SHAPES"),aFrame);
+ mySelectionWayGroup->setExclusive(true);
+ QRadioButton* allSubs = new QRadioButton(tr("ALL_SUBSHAPES") ,mySelectionWayGroup);
+ QRadioButton* inPlaceSubs = new QRadioButton(tr("GET_IN_PLACE") ,mySelectionWayGroup);
+ QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2"),mySelectionWayGroup);
+ mySelectionWayGroup->insert(allSubs , ALL_SUBSHAPES);
+ mySelectionWayGroup->insert(inPlaceSubs, GET_IN_PLACE);
+ mySelectionWayGroup->insert(shape2Subs , SUBSHAPES_OF_SHAPE2);
+ mySelectionWayGroup->setButton( ALL_SUBSHAPES );
+
mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), aFrame );
myAddBtn = new QPushButton( tr( "ADD" ), aFrame );
myRemBtn = new QPushButton( tr( "REMOVE" ), aFrame );
//aMedLayout->addMultiCellWidget( mySelSubBtn, 2, 2, 0, 1 );
//aMedLayout->addWidget( myPlaceCheckBox, 2, 2 );
- aMedLayout->addMultiCellWidget( myPlaceCheckBox, 2, 2, 0, 2 );
+ //aMedLayout->addMultiCellWidget( myPlaceCheckBox, 2, 2, 0, 2 );
+ aMedLayout->addMultiCellWidget( mySelectionWayGroup, 2, 4, 0, 2 );
aMedLayout->addWidget( mySelAllBtn, 2, 3 );
- aMedLayout->addMultiCellWidget( myIdList, 3, 4, 0, 2 );
aMedLayout->addWidget( myAddBtn, 3, 3 );
aMedLayout->addWidget( myRemBtn, 4, 3 );
+ aMedLayout->addMultiCellWidget( myIdList, 5, 5, 0, 3 );
+ aMedLayout->setRowStretch( 5, 1 );
+
setHelpFileName("work_with_groups_page.html");
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
//connect( mySelSubBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( myPlaceCheckBox, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ //connect( myPlaceCheckBox, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( mySelectionWayGroup,SIGNAL(clicked(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() ) );
}
else if ( /*(QRadioButton*)sender() == mySelSubBtn ||*/ send == mySelAllBtn )
myEditCurrentArgument = 0;
- else if ( send == mySelBtn2 || (QCheckBox*)sender() == myPlaceCheckBox ) {
+ else if ( send == mySelBtn2 || sender() == mySelectionWayGroup ) {
setInPlaceObj( GEOM::GEOM_Object::_nil() );
- if ( myPlaceCheckBox->isChecked() ) {
+ //if ( myPlaceCheckBox->isChecked() )
+ myShape2Name->setText( "" );
+ if ( subSelectionWay() != ALL_SUBSHAPES )
+ {
myEditCurrentArgument = myShape2Name;
- //myIdList->clear();
- myShape2Name->setText( "" );
}
else {
//myEditCurrentArgument = myMainName;
myEditCurrentArgument = 0;
- myShape2Name->setText( "" );
- //myIdList->clear();
}
}
if ( !anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent( myGroup )) {
SUIT_OverrideCursor wc;
myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
- GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
- setInPlaceObj( aGetInPlaceObj );
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ if ( subSelectionWay() == GET_IN_PLACE ) {
+ GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
+ setInPlaceObj( aGetInPlaceObj );
+ }
+ else {
+ setInPlaceObj( anObj );
+ }
myEditCurrentArgument = 0;
//myBusy = true; // just activate but do not select in the list
activateSelection();
{
if ( ! myInPlaceObj->_is_equivalent( theObj ) )
{
- const char* tmpName = "InPlaceObj";
+ const char* tmpName = "__InPlaceObj__";
// remove old InPlaceObj
if ( !myInPlaceObj->_is_nil() ) {
- if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName ))
+ if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName )) {
getStudy()->studyDS()->NewBuilder()->RemoveObjectWithChildren( SO );
- getGeomEngine()->RemoveObject(myInPlaceObj);
+ getGeomEngine()->RemoveObject(myInPlaceObj);
+ }
}
// publish InPlaceObj to enable localSelection(InPlaceObj)
- if ( !theObj->_is_nil() ) {
+ 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);
//=================================================================================
void GroupGUI_GroupDlg::SelectionIntoArgument()
{
- if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name ) {
+// if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name )
+ if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name ) {
onGetInPlace();
return;
}
bool subselected = aMapIndex.Extent();
// convert inPlace indices to main indices
- if ( subselected && myPlaceCheckBox->isChecked() )
+ //if ( subselected && myPlaceCheckBox->isChecked() )
+ if ( subselected && subSelectionWay() != ALL_SUBSHAPES )
{
TColStd_IndexedMapOfInteger aMapIndex2;
CORBA::Long anIndex;
anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
if ( anIndex >= 0 ) {
- if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex ))
+ //if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex ))
+ if ( subSelectionWay() != ALL_SUBSHAPES &&
+ ! myMain2InPlaceIndices.IsBound( anIndex ))
continue;
aMapIndex.Add( anIndex );
}
}
}
if ( !myMainObj->_is_nil() /*&& mySelSubBtn->isChecked()*/)
- if ( !myInPlaceObj->_is_nil() )
- localSelection( myInPlaceObj, getShapeType() );
- else
+ if ( subSelectionWay() == ALL_SUBSHAPES )
localSelection( myMainObj, getShapeType() );
+ else if ( !myInPlaceObj->_is_nil() )
+ localSelection( myInPlaceObj, getShapeType() );
}
if (aMapIndex.Extent() >= 1) {
return;
GEOM::ListOfLong_var aSubShapes;
- if ( !myPlaceCheckBox->isChecked() )
+// if ( !myPlaceCheckBox->isChecked() )
+ if ( subSelectionWay() == ALL_SUBSHAPES )
{
myIdList->clear();
GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
return GroupConstructors->id( GroupConstructors->selected() );
}
+//=======================================================================
+//function : subSelectionWay
+//purpose :
+//=======================================================================
+
+int GroupGUI_GroupDlg::subSelectionWay() const
+{
+ return mySelectionWayGroup->id( mySelectionWayGroup->selected() );
+}
+
//=================================================================================
// function : getShapeType()
// purpose :
// local selection
if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/) {
- if ( !myPlaceCheckBox->isChecked() )
+// if ( !myPlaceCheckBox->isChecked() )
+ if ( subSelectionWay() == ALL_SUBSHAPES )
localSelection( myMainObj, getShapeType() );
else if ( !myInPlaceObj->_is_nil() )
localSelection( myInPlaceObj, getShapeType() );
hasSel = myIdList->isSelected( ii );
myRemBtn->setEnabled( hasSel );
//mySelSubBtn->setEnabled( !CORBA::is_nil( myMainObj ) );
- myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) );
+ //myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) );
+ mySelectionWayGroup->setEnabled( !CORBA::is_nil( myMainObj ) );
mySelAllBtn->setEnabled( !CORBA::is_nil( myMainObj ) );
- mySelBtn2->setEnabled( myPlaceCheckBox->isChecked() );
- myShape2Name->setEnabled( myPlaceCheckBox->isChecked() );
- if ( !myPlaceCheckBox->isChecked() )
+// 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() );
}
for ( ; ii < nn; ii++ )
if ( myIdList->isSelected( ii ) ) {
int id = myIdList->item( ii )->text().toInt();
- if ( myPlaceCheckBox->isChecked() )
+// if ( myPlaceCheckBox->isChecked() )
+ if ( subSelectionWay() != ALL_SUBSHAPES )
{
if (myMain2InPlaceIndices.IsBound( id ))
id = myMain2InPlaceIndices( id );