Code refactoring

This commit is contained in:
vsr 2010-12-29 11:25:05 +00:00
parent 5a0b94e3b5
commit 3012e7ea8e
43 changed files with 151 additions and 219 deletions

View File

@ -97,11 +97,10 @@ bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
aSelMgr->selectedObjects( aList ); aSelMgr->selectedObjects( aList );
if ( aList.Extent() == 1 ) { if ( aList.Extent() == 1 ) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult ); GEOMBase::ConvertIOinGEOMObject( aList.First() );
if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { if ( !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) {
aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent ); aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent );
break; break;
} }

View File

@ -213,11 +213,10 @@ void GroupGUI_GroupDlg::Init()
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent()) { if (aSelList.Extent()) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) { if ( !CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP ) {
myGroup = anObj; myGroup = anObj;
mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup)); mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup));
@ -376,10 +375,9 @@ void GroupGUI_GroupDlg::onGetInPlace()
if (aSelList.Extent() != 1) if (aSelList.Extent() != 1)
return; return;
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { if ( GEOMBase::IsShape(anObj) ) {
if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) { if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
@ -455,11 +453,10 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
int nbSel = aSelList.Extent(); int nbSel = aSelList.Extent();
if (nbSel == 1) { if (nbSel == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { if ( GEOMBase::IsShape(anObj) ) {
myMainObj = anObj; myMainObj = anObj;
myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
// activate subshapes selection by default // activate subshapes selection by default

View File

@ -159,10 +159,7 @@ void MeasureGUI_AngleDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() > 0) { if (aSelList.Extent() > 0) {
Standard_Boolean testResult = Standard_False; aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult)
aSelectedObject = GEOM::GEOM_Object::_nil();
} }
// clear selection // clear selection

View File

@ -170,11 +170,10 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || aSelectedObject->_is_nil()) { if ( aSelectedObject->_is_nil() ) {
processObject(); processObject();
return; return;
} }

View File

@ -176,11 +176,10 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !testResult || aSelectedObject->_is_nil() ) { if ( aSelectedObject->_is_nil() ) {
myGrp->LineEdit1->setText( "" ); myGrp->LineEdit1->setText( "" );
processObject(); processObject();
return; return;
@ -362,21 +361,16 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged()
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem]; GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated; GEOM::ListOfLong aObjLst = aErr.incriminated;
TopoDS_Shape aSelShape;
TopoDS_Shape aSubShape;
TopTools_IndexedMapOfShape anIndices;
QStringList aSubShapeList; QStringList aSubShapeList;
QString aSubShapeName( "" ); TopoDS_Shape aSelShape;
Standard_CString aTypeString;
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) { if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
TopExp::MapShapes( aSelShape, anIndices); TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes( aSelShape, anIndices );
for ( int i = 0, n = aObjLst.length(); i < n; i++ ) { for ( int i = 0, n = aObjLst.length(); i < n; i++ ) {
aSubShapeName = ""; TopoDS_Shape aSubShape = anIndices.FindKey( aObjLst[i] );
aSubShape = anIndices.FindKey(aObjLst[i]); QString aType = GEOMBase::GetShapeTypeString( aSubShape );
if ( GEOMBase::GetShapeTypeString( aSubShape, aTypeString ) ) if ( !aType.isEmpty() )
aSubShapeName = QString( aTypeString ) + QString( "_" ) + QString::number( aObjLst[i] ); aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) );
if ( !aSubShapeName.isEmpty() )
aSubShapeList.append( aSubShapeName );
} }
} }
myGrp->ListBox2->clear(); myGrp->ListBox2->clear();

View File

@ -142,10 +142,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() > 0) { if (aSelList.Extent() > 0) {
Standard_Boolean testResult = Standard_False; aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult)
aSelectedObject = GEOM::GEOM_Object::_nil();
} }
// clear selection // clear selection

View File

@ -171,11 +171,10 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -135,11 +135,10 @@ void MeasureGUI_PointDlg::SelectionIntoArgument()
if (aSelList.Extent() < 1) if (aSelList.Extent() < 1)
return; return;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || aSelectedObject->_is_nil()) if ( aSelectedObject->_is_nil() )
return; return;
myObj = aSelectedObject; myObj = aSelectedObject;

View File

@ -177,16 +177,13 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength,
//================================================================================= //=================================================================================
SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs() SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs()
{ {
TopoDS_Shape aShape, aResult; SALOME_Prs* prs = 0;
TopoDS_Shape shape;
if ( myObj->_is_nil() ||
!GEOMBase::GetShape( myObj, aShape ) ||
aShape.IsNull() ||
aShape.ShapeType() != TopAbs_EDGE ||
!GEOMBase::CreateArrowForLinearEdge( aShape, aResult ) ||
aResult.IsNull() )
return 0;
return getDisplayer()->BuildPrs( aResult );
if ( GEOMBase::GetShape( myObj, shape, TopAbs_EDGE ) ) {
shape = GEOMBase::CreateArrowForLinearEdge( shape );
if ( !shape.IsNull() )
prs = getDisplayer()->BuildPrs( shape );
}
return prs;
} }

View File

@ -254,10 +254,7 @@ void MeasureGUI_Skeleton::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() > 0) { if (aSelList.Extent() > 0) {
Standard_Boolean testResult = Standard_False; aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult)
aSelectedObject = GEOM::GEOM_Object::_nil();
} }
if (aSelectedObject->_is_nil()) { if (aSelectedObject->_is_nil()) {

View File

@ -188,10 +188,9 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
if (aSelList.Extent() != 1) if (aSelList.Extent() != 1)
return; return;
Standard_Boolean testResult = Standard_False; myShape = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
myShape = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || myShape->_is_nil() || !GEOMBase::IsShape(myShape)) { if ( !GEOMBase::IsShape(myShape) ) {
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
return; return;
} }

View File

@ -415,11 +415,10 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
{ {
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
myShape = anObj; myShape = anObj;
myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
displayPreview(); displayPreview();
@ -433,11 +432,10 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
{ {
myFace[ aCurrFocus ] = -1; myFace[ aCurrFocus ] = -1;
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes); aSelMgr->GetIndexes(aSelList.First(), anIndexes);
@ -456,11 +454,10 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
if (aCurrFocus == Faces) myFaces.Clear(); if (aCurrFocus == Faces) myFaces.Clear();
else myEdges.Clear(); else myEdges.Clear();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes); aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

@ -188,11 +188,10 @@ void OperationGUI_Fillet1d2dDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupVertexes->LineEdit1) { if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
QString aName = GEOMBase::GetName( anObj ); QString aName = GEOMBase::GetName( anObj );
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
@ -229,11 +228,10 @@ void OperationGUI_Fillet1d2dDlg::SelectionIntoArgument()
myVertexes.Clear(); myVertexes.Clear();
bool isPreview = myIs1D; bool isPreview = myIs1D;
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes); aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

@ -345,11 +345,10 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
{ {
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
myShape = anObj; myShape = anObj;
myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
displayPreview(); displayPreview();
@ -365,11 +364,10 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear(); if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear();
else myFaces.Clear(); else myFaces.Clear();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) { if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes); aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

@ -189,9 +189,8 @@ void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true);
if (nbSel > 0) { if (nbSel > 0) {
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( GEOMBase::IsShape(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) {
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
// clear selection // clear selection
@ -294,9 +293,8 @@ GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation()
bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&) bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&)
{ {
//Handle(SALOME_InteractiveObject) IO = firstIObject(); //Handle(SALOME_InteractiveObject) IO = firstIObject();
//Standard_Boolean testResult; //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO );
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); //if ( anObject->_is_nil() )
//if (!testResult || anObject->_is_nil())
// return false; // return false;
return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2); return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);

View File

@ -248,10 +248,9 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -263,10 +263,9 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -257,10 +257,9 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if (CORBA::is_nil(aSelectedObject))
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -309,10 +309,9 @@ void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -329,10 +329,9 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False;
TopAbs_ShapeEnum aNeedType = TopAbs_EDGE; TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopoDS_Shape aShape; TopoDS_Shape aShape;

View File

@ -246,10 +246,9 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
} }
/* nbSel == 1 ! */ /* nbSel == 1 ! */
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if ( !testResult || CORBA::is_nil( aSelectedObject ) ) if ( CORBA::is_nil( aSelectedObject ) )
return; return;
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );

View File

@ -253,10 +253,9 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -173,11 +173,10 @@ void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOM::GEOM_Object_ptr aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult ); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !testResult ) if ( CORBA::is_nil( aSelectedObject ) )
return; return;
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {

View File

@ -184,9 +184,8 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( GEOMBase::IsShape(myObject) ) {
if (aRes && GEOMBase::IsShape(myObject)) {
myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(myObject, aShape, TopAbs_WIRE)) if (GEOMBase::GetShape(myObject, aShape, TopAbs_WIRE))

View File

@ -243,9 +243,8 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
if ( aSelList.Extent() == 1 ) { if ( aSelList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( aSelectedObj ) )
if ( !CORBA::is_nil( aSelectedObj ) && aRes )
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
QString aName = GEOMBase::GetName( aSelectedObj ); QString aName = GEOMBase::GetName( aSelectedObj );

View File

@ -204,11 +204,10 @@ void RepairGUI_FreeBoundDlg::onSelectionDone()
if ( aSelList.Extent() != 1 ) if ( aSelList.Extent() != 1 )
return; return;
Standard_Boolean isOk = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( aSelList.First(), isOk ); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) if ( !GEOMBase::IsShape( anObj ) )
return; return;
else { else {
myObj = anObj; myObj = anObj;

View File

@ -239,11 +239,10 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
return; return;
} }
Standard_Boolean isOk = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( aSelList.First(), isOk ); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) { if ( !GEOMBase::IsShape( anObj ) ) {
myEdit->setText( "" ); myEdit->setText( "" );
return; return;
} }

View File

@ -298,9 +298,8 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
if ( aSelList.Extent() == 1 ) { if ( aSelList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( myObject ) )
if ( aRes )
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
} }
updateButtonState(); updateButtonState();

View File

@ -210,9 +210,8 @@ void RepairGUI_LimitToleranceDlg::SelectionIntoArgument()
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( !CORBA::is_nil( myObject ) )
if (aRes)
myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
} }
updateButtonState(); updateButtonState();

View File

@ -179,11 +179,10 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOM::GEOM_Object_ptr aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult ); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !testResult ) if ( CORBA::is_nil( aSelectedObject ) )
return; return;
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {

View File

@ -186,9 +186,8 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( GEOMBase::IsShape(myObject) ) {
if (aRes && GEOMBase::IsShape(myObject)) {
myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
// clear selection // clear selection

View File

@ -173,9 +173,8 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument()
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( GEOMBase::IsShape(myObject) ) {
if (aRes && GEOMBase::IsShape(myObject)) {
myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
// clear selection // clear selection

View File

@ -187,9 +187,8 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
if ( aSelList.Extent() == 1 ) { if ( aSelList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( myObject ) )
if ( aRes )
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
} }
} }

View File

@ -366,13 +366,12 @@ void RepairGUI_ShapeProcessDlg::selectionChanged()
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
Standard_Boolean aRes = Standard_False;
int i = 0; int i = 0;
myObjects->length(aSelList.Extent()); myObjects->length(aSelList.Extent());
for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) { for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) if ( !CORBA::is_nil( aSelectedObject ) )
myObjects[i++] = aSelectedObject; myObjects[i++] = aSelectedObject;
} }
myObjects->length( i ); myObjects->length( i );
if ( i == 1 ) if ( i == 1 )

View File

@ -177,9 +177,8 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( GEOMBase::IsShape(myObject) ) {
if (aRes && GEOMBase::IsShape(myObject)) {
myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(myObject, aShape, TopAbs_FACE)) if (GEOMBase::GetShape(myObject, aShape, TopAbs_FACE))
@ -245,10 +244,9 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
aSelMgr->clearSelected(); aSelMgr->clearSelected();
Standard_Boolean isOk;
QString objIOR = GEOMBase::GetIORFromObject(myObject); QString objIOR = GEOMBase::GetIORFromObject(myObject);
Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape(objIOR.toLatin1().constData(), isOk, true); Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR, true );
if (!isOk || aSh.IsNull()) if ( aSh.IsNull() )
return; return;
aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false);

View File

@ -122,9 +122,8 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
SALOME_ListIteratorOfListIO aSelIt (aSelList); SALOME_ListIteratorOfListIO aSelIt (aSelList);
for (; aSelIt.More(); aSelIt.Next()) { for (; aSelIt.More(); aSelIt.Next()) {
Handle(SALOME_InteractiveObject) io = aSelIt.Value(); Handle(SALOME_InteractiveObject) io = aSelIt.Value();
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( io );
GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject(io, testResult); if ( !CORBA::is_nil( aGeomObj ) ) {
if (testResult) {
anOp->RecomputeObject(aGeomObj); anOp->RecomputeObject(aGeomObj);
SUIT_ViewWindow* wnd; SUIT_ViewWindow* wnd;

View File

@ -244,49 +244,46 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; myArgument = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
myArgument = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( CORBA::is_nil(myArgument) )
if (!testResult || CORBA::is_nil(myArgument))
return; return;
aName = GEOMBase::GetName(myArgument); aName = GEOMBase::GetName(myArgument);
if (testResult && !myArgument->_is_nil()) { TopoDS_Shape aShape;
TopoDS_Shape aShape; if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if (getConstructorId() == 1)
if (getConstructorId() == 1) aNeedType = TopAbs_EDGE;
aNeedType = TopAbs_EDGE; else if (getConstructorId() == 2)
else if (getConstructorId() == 2) aNeedType = TopAbs_FACE;
aNeedType = TopAbs_FACE;
TColStd_IndexedMapOfInteger aMap;
TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes(aSelList.First(), aMap);
aSelMgr->GetIndexes(aSelList.First(), aMap); if (aMap.Extent() == 1) {
if (aMap.Extent() == 1) { int anIndex = aMap(1);
int anIndex = aMap(1); if (aNeedType == TopAbs_VERTEX)
if (aNeedType == TopAbs_VERTEX) aName += QString(":vertex_%1").arg(anIndex);
aName += QString(":vertex_%1").arg(anIndex); else
else aName += QString(":edge_%1").arg(anIndex);
aName += QString(":edge_%1").arg(anIndex);
//Find SubShape Object in Father
//Find SubShape Object in Father GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName);
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName);
if (aFindedObject->_is_nil()) { // Object not found in study
if (aFindedObject->_is_nil()) { // Object not found in study GEOM::GEOM_IShapesOperations_var aShapesOp =
GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations(getStudyId()); myArgument = aShapesOp->GetSubShape(myArgument, anIndex);
myArgument = aShapesOp->GetSubShape(myArgument, anIndex); }
} else {
else { myArgument = aFindedObject; // get Object from study
myArgument = aFindedObject; // get Object from study }
} }
} else {
else { if (aShape.ShapeType() != aNeedType) {
if (aShape.ShapeType() != aNeedType) { myArgument = GEOM::GEOM_Object::_nil();
myArgument = GEOM::GEOM_Object::_nil(); aName = "";
aName = ""; }
}
}
} }
} }
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);

View File

@ -307,11 +307,10 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) if ( !GEOMBase::IsShape(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -338,10 +338,9 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) if ( !GEOMBase::IsShape(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -353,9 +353,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; myStartLCS = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( CORBA::is_nil(myStartLCS) )
if (!testResult || CORBA::is_nil(myStartLCS))
return; return;
aName = GEOMBase::GetName(myStartLCS); aName = GEOMBase::GetName(myStartLCS);
@ -369,9 +368,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
if (aSelList.Extent() != 1) if (aSelList.Extent() != 1)
return; return;
Standard_Boolean testResult = Standard_False; myEndLCS = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( CORBA::is_nil(myEndLCS) )
if (!testResult || CORBA::is_nil(myEndLCS))
return; return;
aName = GEOMBase::GetName(myEndLCS); aName = GEOMBase::GetName(myEndLCS);
@ -385,9 +383,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
if (aSelList.Extent() != 1) if (aSelList.Extent() != 1)
return; return;
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( aSelectedObject->_is_nil() )
if (!testResult || aSelectedObject->_is_nil())
return; return;
aName = GEOMBase::GetName(myPath); aName = GEOMBase::GetName(myPath);

View File

@ -288,10 +288,9 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
aName = GEOMBase::GetName(aSelectedObject); aName = GEOMBase::GetName(aSelectedObject);

View File

@ -309,9 +309,8 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) if (aSelList.Extent() == 1)
{ {
Standard_Boolean testResult = Standard_False; aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( !CORBA::is_nil( aSelectedObject ) )
if (testResult)
{ {
aName = GEOMBase::GetName(aSelectedObject); aName = GEOMBase::GetName(aSelectedObject);

View File

@ -347,10 +347,9 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
return; return;
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
aName = GEOMBase::GetName(aSelectedObject); aName = GEOMBase::GetName(aSelectedObject);