return -1;
}
+//=================================================================================
+// function : setConstructorId( id )
+// purpose :
+//=================================================================================
void GEOMBase_Skeleton::setConstructorId( const int id )
{
if ( myRBGroup && myRBGroup->button( id ) )
myRBGroup->button( id )->setChecked( true );
}
+//=================================================================================
+// function : unsetConstructorId
+// purpose :
+//=================================================================================
+void GEOMBase_Skeleton::unsetConstructorId()
+{
+ // 0020428: EDF 906 GEOM : Performance for Group creation in GEOM
+ // uncheck all buttons
+ // workaround, because setChecked( false ) does not result in Qt4
+ bool isExclusive = myRBGroup->exclusive();
+ myRBGroup->setExclusive( false );
+ QList<QAbstractButton*> btnList = myRBGroup->buttons();
+ for ( int j = 0; j < 2; j++ )
+ {
+ QList<QAbstractButton*>::const_iterator it = btnList.constBegin();
+ for ( ; it != btnList.constEnd(); ++it )
+ (*it)->setCheckable( j == 1 );
+ }
+ myRBGroup->setExclusive( isExclusive );
+}
+
//=================================================================================
// function : ClickOnHelp()
// purpose :
GroupGUI_GroupDlg::GroupGUI_GroupDlg( Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent, false ),
myMode( mode ),
- myBusy( false )
+ myBusy( false ),
+ myIsShapeType( false )
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
//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 (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
+ GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
- myMainObj = anObj;
- myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
- // activate subshapes selection by default
- myEditCurrentArgument = 0;
- activateSelection();
- updateState();
- return;
+ myMainObj = anObj;
+ myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
+ // activate subshapes selection by default
+ myEditCurrentArgument = 0;
+ activateSelection();
+ updateState();
+ return;
}
}
TopoDS_Shape aShape;
if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) )
{
- CORBA::Long anIndex;
- anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
+ CORBA::Long anIndex;
+ anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
if ( anIndex >= 0 ) {
//if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex ))
if ( subSelectionWay() != ALL_SUBSHAPES &&
}
}
}
- if ( !myMainObj->_is_nil() /*&& mySelSubBtn->isChecked()*/)
+ if ( !myMainObj->_is_nil() && myIsShapeType/*&& mySelSubBtn->isChecked()*/)
if ( subSelectionWay() == ALL_SUBSHAPES )
localSelection( myMainObj, getShapeType() );
else if ( !myInPlaceObj->_is_nil() )
//=================================================================================
void GroupGUI_GroupDlg::ConstructorsClicked( int constructorId )
{
+ myIsShapeType = true;
myIdList->clear();
activateSelection();
updateState();
// if ( !myPlaceCheckBox->isChecked() )
if ( subSelectionWay() == ALL_SUBSHAPES )
{
+ if ( !myIsShapeType )
+ return;
myIdList->clear();
GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
TopoDS_Shape aShape;
if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) )
{
- CORBA::Long anIndex;
- anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
+ CORBA::Long anIndex;
+ anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
if ( anIndex >= 0 )
aMapIndex.Add( anIndex );
}
case TopAbs_SOLID: anId = 3; break;
}
setConstructorId( anId );
+ myIsShapeType = true;
}
globalSelection( GEOM_ALLSHAPES );
// local selection
- if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/) {
+ 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() );
aSubObjects[i];
if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) )
{
- CORBA::Long anIndex;
- anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
+ CORBA::Long anIndex;
+ anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
if ( anIndex >= 0 )
aMapIndex.Add( anIndex );
else