Avoid redisplaying of the shape after Apply action.

This commit is contained in:
rnv 2012-06-09 08:30:26 +00:00
parent ed2c8fe24c
commit 2c2a70a69a

View File

@ -297,6 +297,7 @@ void GroupGUI_GroupDlg::ClickOnOk()
setIsApplyAndClose(true); setIsApplyAndClose(true);
if (ClickOnApply()) if (ClickOnApply())
ClickOnCancel(); ClickOnCancel();
setIsApplyAndClose(false);
} }
//================================================================================= //=================================================================================
@ -305,9 +306,15 @@ void GroupGUI_GroupDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool GroupGUI_GroupDlg::ClickOnApply() bool GroupGUI_GroupDlg::ClickOnApply()
{ {
if (!onAccept(myMode == CreateGroup, true)) if(!isApplyAndClose())
setIsDisableBrowsing( true );
if (!onAccept(myMode == CreateGroup, true,isApplyAndClose()))
return false; return false;
if(!isApplyAndClose())
setIsDisableBrowsing( false );
if (myMode == CreateGroup) if (myMode == CreateGroup)
{ {
initName(); initName();
@ -827,7 +834,9 @@ void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType)
//================================================================================= //=================================================================================
void GroupGUI_GroupDlg::activateSelection() void GroupGUI_GroupDlg::activateSelection()
{ {
erasePreview(false); bool isApply = ((QPushButton*)sender() == buttonApply());
if(!isApply)
erasePreview(false);
// local selection // local selection
if (!myMainObj->_is_nil() && if (!myMainObj->_is_nil() &&
@ -853,70 +862,71 @@ void GroupGUI_GroupDlg::activateSelection()
} }
} }
} }
if(!isApply) {
int prevDisplayMode = aDisplayer->SetDisplayMode(0);
int prevDisplayMode = aDisplayer->SetDisplayMode(0); SUIT_ViewWindow* aViewWindow = 0;
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
if (activeStudy)
aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
if (aViewWindow == 0) return;
SUIT_ViewWindow* aViewWindow = 0; SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
if (activeStudy) aViewManager->getType() != SVTK_Viewer::Type())
aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); return;
if (aViewWindow == 0) return;
SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
if (aViewManager->getType() != OCCViewer_Viewer::Type() && SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
aViewManager->getType() != SVTK_Viewer::Type()) if (aView == 0) return;
return;
SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel); TopoDS_Shape aRestrictionShape;
if (aView == 0) return;
TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); if (subSelectionWay() == ALL_SUBSHAPES) {
TopoDS_Shape aRestrictionShape; aRestrictionShape = aMainShape;
if (subSelectionWay() == ALL_SUBSHAPES) { TopTools_IndexedMapOfShape aSubShapesMap;
aRestrictionShape = aMainShape; TopExp::MapShapes(aMainShape, aSubShapesMap);
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
QString anEntryBase = aMainEntry.in();
TopTools_IndexedMapOfShape aSubShapesMap; TopExp_Explorer anExp (aRestrictionShape, getShapeType());
TopExp::MapShapes(aMainShape, aSubShapesMap); for (; anExp.More(); anExp.Next()) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); TopoDS_Shape aSubShape = anExp.Current();
QString anEntryBase = aMainEntry.in(); int index = aSubShapesMap.FindIndex(aSubShape);
QString anEntry = anEntryBase + QString("_%1").arg(index);
TopExp_Explorer anExp (aRestrictionShape, getShapeType()); SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
for (; anExp.More(); anExp.Next()) { if (aPrs) {
TopoDS_Shape aSubShape = anExp.Current(); displayPreview(aPrs, true, false); // append, do not update
int index = aSubShapesMap.FindIndex(aSubShape); // TODO: map or delete Prs
QString anEntry = anEntryBase + QString("_%1").arg(index); }
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) {
displayPreview(aPrs, true, false); // append, do not update
// TODO: map or delete Prs
} }
} }
} else if (!myInPlaceObj->_is_nil()) {
else if (!myInPlaceObj->_is_nil()) { TopTools_IndexedMapOfShape aSubShapesMap;
TopTools_IndexedMapOfShape aSubShapesMap; TopExp::MapShapes(aMainShape, aSubShapesMap);
TopExp::MapShapes(aMainShape, aSubShapesMap); CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); QString anEntryBase = aMainEntry.in();
QString anEntryBase = aMainEntry.in();
TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices); TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices);
for (; aM2IPit.More(); aM2IPit.Next()) { for (; aM2IPit.More(); aM2IPit.Next()) {
int index = aM2IPit.Key(); int index = aM2IPit.Key();
TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index); TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
QString anEntry = anEntryBase + QString("_%1").arg(index); QString anEntry = anEntryBase + QString("_%1").arg(index);
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) { if (aPrs) {
displayPreview(aPrs, true, false); // append, do not update displayPreview(aPrs, true, false); // append, do not update
}
} }
} }
} else ;
else ;
aDisplayer->UpdateViewer(); aDisplayer->UpdateViewer();
aDisplayer->SetDisplayMode(prevDisplayMode); aDisplayer->SetDisplayMode(prevDisplayMode);
}
} }
globalSelection(GEOM_ALLSHAPES); globalSelection(GEOM_ALLSHAPES);