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 );
if ( aList.Extent() == 1 ) {
Standard_Boolean aResult = Standard_False;
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 );
break;
}

View File

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

View File

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

View File

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

View File

@ -176,11 +176,10 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument()
return;
}
Standard_Boolean testResult = Standard_False;
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( "" );
processObject();
return;
@ -362,21 +361,16 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged()
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated;
TopoDS_Shape aSelShape;
TopoDS_Shape aSubShape;
TopTools_IndexedMapOfShape anIndices;
QStringList aSubShapeList;
QString aSubShapeName( "" );
Standard_CString aTypeString;
TopoDS_Shape 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++ ) {
aSubShapeName = "";
aSubShape = anIndices.FindKey(aObjLst[i]);
if ( GEOMBase::GetShapeTypeString( aSubShape, aTypeString ) )
aSubShapeName = QString( aTypeString ) + QString( "_" ) + QString::number( aObjLst[i] );
if ( !aSubShapeName.isEmpty() )
aSubShapeList.append( aSubShapeName );
TopoDS_Shape aSubShape = anIndices.FindKey( aObjLst[i] );
QString aType = GEOMBase::GetShapeTypeString( aSubShape );
if ( !aType.isEmpty() )
aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) );
}
}
myGrp->ListBox2->clear();

View File

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

View File

@ -171,11 +171,10 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
return;
// nbSel == 1
Standard_Boolean testResult = Standard_False;
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;
QString aName = GEOMBase::GetName(aSelectedObject);

View File

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

View File

@ -177,16 +177,13 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength,
//=================================================================================
SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs()
{
TopoDS_Shape aShape, aResult;
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 );
SALOME_Prs* prs = 0;
TopoDS_Shape shape;
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();
if (aSelList.Extent() > 0) {
Standard_Boolean testResult = Standard_False;
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult)
aSelectedObject = GEOM::GEOM_Object::_nil();
aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
}
if (aSelectedObject->_is_nil()) {

View File

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

View File

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

View File

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

View File

@ -345,11 +345,10 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
{
myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
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;
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
displayPreview();
@ -365,11 +364,10 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear();
else myFaces.Clear();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
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;
aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -204,11 +204,10 @@ void RepairGUI_FreeBoundDlg::onSelectionDone()
if ( aSelList.Extent() != 1 )
return;
Standard_Boolean isOk = Standard_False;
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;
else {
myObj = anObj;

View File

@ -239,11 +239,10 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
return;
}
Standard_Boolean isOk = Standard_False;
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( "" );
return;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -307,11 +307,10 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
return;
// nbSel == 1
Standard_Boolean testResult = Standard_False;;
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;
QString aName = GEOMBase::GetName(aSelectedObject);

View File

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

View File

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

View File

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

View File

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

View File

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