X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FRepairGUI%2FRepairGUI_SuppressFacesDlg.cxx;h=44d3a862163c4f1271d1def7df6418d18f0075de;hb=09ece3edc1896e16a412b35810d76411f06d68ec;hp=f4276a9837efc86b2112a5cd73eb24e73f404585;hpb=5b3622aa2363853841fd5b4205c78a715bfee4a4;p=modules%2Fgeom.git diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index f4276a983..44d3a8621 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,16 +24,17 @@ #include "RepairGUI_SuppressFacesDlg.h" -#include -#include -#include +#include "DlgRef.h" +#include "GeometryGUI.h" +#include "GEOMBase.h" +#include "RepairGUI.h" #include #include #include #include #include -#include +#include // OCCT Includes #include @@ -217,29 +218,42 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject); TopExp::MapShapes(aMainShape, aMainMap); + SALOME_ListIO aSelListToShow; SALOME_ListIteratorOfListIO anIter (aSelList); for (int i = 0; anIter.More(); anIter.Next(), i++) { Handle(SALOME_InteractiveObject) anIO = anIter.Value(); QString anEntry = anIO->getEntry(); - _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData())); + if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue; GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); TopoDS_Shape aShape; if (GEOMBase::GetShape(aGeomObj, aShape)) { if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == TopAbs_FACE) { TopExp_Explorer anExp (aShape, TopAbs_FACE); + bool isInside = false; for (; anExp.More(); anExp.Next()) { TopoDS_Shape aSubShape = anExp.Current(); int anIndex = aMainMap.FindIndex(aSubShape); - if (anIndex >= 0) { + if (anIndex > 0) { aMap.Add(anIndex); anIds.Add(anIndex); + isInside = true; + aSelListToShow.Append(anIO); } } + if (!isInside) + { + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + aSelMgr->AddOrRemoveIndex(anIO, anIds, false); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } } } } + if (!aMap.IsEmpty()) { // highlight local faces, correspondent to OB selection disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); @@ -253,6 +267,11 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + SALOME_ListIteratorOfListIO anIter(aSelListToShow); + for (; anIter.More(); anIter.Next()) { + aSelMgr->AddOrRemoveIndex(anIter.Value(), anIds, false); + } + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -351,7 +370,7 @@ void RepairGUI_SuppressFacesDlg::enterEvent (QEvent*) //================================================================================= GEOM::GEOM_IOperations_ptr RepairGUI_SuppressFacesDlg::createOperation() { - return getGeomEngine()->GetIHealingOperations(getStudyId()); + return getGeomEngine()->GetIHealingOperations(); } //================================================================================= @@ -376,8 +395,11 @@ bool RepairGUI_SuppressFacesDlg::execute (ObjectList& objects) bool aResult = !anObj->_is_nil(); if (aResult) + { + if ( !IsPreview() ) + RepairGUI::ShowStatistics( anOper, this ); objects.push_back(anObj._retn()); - + } return aResult; } @@ -410,14 +432,25 @@ void RepairGUI_SuppressFacesDlg::initSelection() // function : restoreSubShapes // purpose : //================================================================================= -void RepairGUI_SuppressFacesDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject) +void RepairGUI_SuppressFacesDlg::restoreSubShapes (SALOMEDS::SObject_ptr theSObject) { if (mainFrame()->CheckBoxRestoreSS->isChecked()) { // empty list of arguments means that all arguments should be restored - getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + getGeomEngine()->RestoreSubShapesSO(theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_GetInPlace, /*theInheritFirstArg=*/true, mainFrame()->CheckBoxAddPrefix->isChecked()); } } + +//================================================================================= +// function : getSourceObjects +// purpose : virtual method to get source objects +//================================================================================= +QList RepairGUI_SuppressFacesDlg::getSourceObjects() +{ + QList res; + GEOM::GeomObjPtr aGeomObjPtr(myObject); + res << aGeomObjPtr; + return res; +}