mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-29 22:40:34 +05:00
clean and align code
This commit is contained in:
parent
656071da94
commit
2d7fa83c28
@ -22,7 +22,7 @@
|
||||
// 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 <LightApp_SelectionMgr.h>
|
||||
@ -162,11 +162,9 @@ 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;
|
||||
|
||||
@ -239,11 +237,10 @@ void GroupGUI_GroupDlg::enterEvent( QEvent* e )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
//function : closeEvent
|
||||
//purpose : remove temporary geom object
|
||||
//=======================================================================
|
||||
|
||||
//=================================================================================
|
||||
void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
setInPlaceObj(GEOM::GEOM_Object::_nil());
|
||||
@ -289,8 +286,8 @@ 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();
|
||||
}
|
||||
@ -325,18 +322,16 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument()
|
||||
myEditCurrentArgument = myMainName;
|
||||
myShape2Name->setText("");
|
||||
}
|
||||
else if ( /*(QRadioButton*)sender() == mySelSubBtn ||*/ send == mySelAllBtn )
|
||||
else if (send == mySelAllBtn)
|
||||
myEditCurrentArgument = 0;
|
||||
else if (send == mySelBtn2 || sender() == mySelectionWayGroup) {
|
||||
setInPlaceObj(GEOM::GEOM_Object::_nil());
|
||||
//if ( myPlaceCheckBox->isChecked() )
|
||||
myShape2Name->setText("");
|
||||
if (subSelectionWay() != ALL_SUBSHAPES)
|
||||
{
|
||||
myEditCurrentArgument = myShape2Name;
|
||||
}
|
||||
else {
|
||||
//myEditCurrentArgument = myMainName;
|
||||
myEditCurrentArgument = 0;
|
||||
}
|
||||
}
|
||||
@ -344,10 +339,6 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument()
|
||||
activateSelection();
|
||||
|
||||
if (send == mySelAllBtn) {
|
||||
// myShape2Name->setText( "" );
|
||||
// myPlaceCheckBox->setChecked( false );
|
||||
// mySelBtn2->setEnabled( false );
|
||||
// myShape2Name->setEnabled( false );
|
||||
selectAllSubShapes();
|
||||
}
|
||||
else
|
||||
@ -402,11 +393,10 @@ 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)
|
||||
{
|
||||
if (! myInPlaceObj->_is_equivalent(theObj))
|
||||
@ -459,7 +449,6 @@ 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;
|
||||
@ -509,7 +498,6 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
|
||||
bool subselected = aMapIndex.Extent();
|
||||
|
||||
// convert inPlace indices to main indices
|
||||
//if ( subselected && myPlaceCheckBox->isChecked() )
|
||||
if (subselected && subSelectionWay() != ALL_SUBSHAPES)
|
||||
{
|
||||
TColStd_IndexedMapOfInteger aMapIndex2;
|
||||
@ -557,7 +545,6 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
|
||||
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;
|
||||
@ -566,7 +553,7 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !myMainObj->_is_nil() && myIsShapeType/*&& mySelSubBtn->isChecked()*/)
|
||||
if (!myMainObj->_is_nil() && myIsShapeType)
|
||||
if (subSelectionWay() == ALL_SUBSHAPES)
|
||||
localSelection(myMainObj, getShapeType());
|
||||
else if (!myInPlaceObj->_is_nil())
|
||||
@ -614,7 +601,6 @@ void GroupGUI_GroupDlg::selectAllSubShapes()
|
||||
return;
|
||||
|
||||
GEOM::ListOfLong_var aSubShapes;
|
||||
// if ( !myPlaceCheckBox->isChecked() )
|
||||
if (subSelectionWay() == ALL_SUBSHAPES)
|
||||
{
|
||||
if (!myIsShapeType)
|
||||
@ -770,11 +756,10 @@ void GroupGUI_GroupDlg::remove()
|
||||
highlightSubShapes();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
//function : subSelectionWay
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//=================================================================================
|
||||
int GroupGUI_GroupDlg::subSelectionWay() const
|
||||
{
|
||||
return mySelectionWayGroup->checkedId();
|
||||
@ -812,7 +797,6 @@ void GroupGUI_GroupDlg::setShapeType( const TopAbs_ShapeEnum theType )
|
||||
myIsShapeType = true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : activateSelection
|
||||
// purpose : Activate selection in accordance with myEditCurrentArgument
|
||||
@ -822,10 +806,10 @@ void GroupGUI_GroupDlg::activateSelection()
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
||||
// local selection
|
||||
if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/
|
||||
&& myIsShapeType) { // check if shape type is already choosen by user
|
||||
if (!myMainObj->_is_nil() && !myEditCurrentArgument
|
||||
&& 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())
|
||||
@ -860,7 +844,6 @@ void GroupGUI_GroupDlg::updateState()
|
||||
// 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);
|
||||
|
||||
GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
|
||||
@ -918,15 +901,10 @@ void GroupGUI_GroupDlg::updateState()
|
||||
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());
|
||||
}
|
||||
@ -971,7 +949,6 @@ void GroupGUI_GroupDlg::highlightSubShapes()
|
||||
{
|
||||
if (myIdList->item(ii)->isSelected()) {
|
||||
int id = myIdList->item(ii)->text().toInt();
|
||||
// if ( myPlaceCheckBox->isChecked() )
|
||||
if (subSelectionWay() != ALL_SUBSHAPES)
|
||||
{
|
||||
if (myMain2InPlaceIndices.IsBound(id))
|
||||
|
Loading…
Reference in New Issue
Block a user