X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=00ebe2234d32a54caa06dded0c7a4d5fc56869eb;hb=3692e4ddfe1d709b235b6f1a8b96218ead1a45c5;hp=b486fcd5ef53e7ba3a374237da117a15dcd522c9;hpb=c53720ca78f12ec6333ca44c8dc2bb6b7a9a5294;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index b486fcd5e..00ebe2234 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,6 @@ #include #include #include -#include #include @@ -57,6 +56,10 @@ #include #endif +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #define OPTIMIZATION_LEVEL 50 @@ -107,6 +110,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { + myLastSelectionPlace = ModuleBase_ISelection::Browser; QList aSelectedPrs = myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); @@ -132,49 +136,24 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() } } aDisplayer->setSelected(aSelectedPrs); - myWorkshop->viewer()->setColorScaleShown(false); - if (aSelectedPrs.size() == 1) { - FieldStepPtr aStep = - std::dynamic_pointer_cast - (aSelectedPrs.first()->object()); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - if (aStep.get() && aDisplayer->isVisible(aStep)) { - XGUI_ViewerProxy* aViewer = myWorkshop->viewer(); - AISObjectPtr aAisPtr = aDisplayer->getAISObject(aStep); - Handle(AIS_InteractiveObject) aIO = aAisPtr->impl(); - ModuleBase_IStepPrs* aPrs = dynamic_cast(aIO.get()); - if (aPrs) { - ModelAPI_AttributeTables::ValueType aType = aPrs->dataType(); - if ((aType == ModelAPI_AttributeTables::DOUBLE) || - (aType == ModelAPI_AttributeTables::INTEGER) || - (aType == ModelAPI_AttributeTables::BOOLEAN)) { - aViewer->setupColorScale(); - if (aType == ModelAPI_AttributeTables::BOOLEAN) { - aViewer->setColorScaleIntervals(2); - aViewer->setColorScaleRange(0., 1.); - } - else { - double aMin, aMax; - aPrs->dataRange(aMin, aMax); - aViewer->setColorScaleRange(aMin, aMax); - } - aViewer->setColorScaleTitle(aStep->name().c_str()); - aViewer->setColorScaleShown(true); - } - } - } - } + myWorkshop->updateColorScaleVisibility(); emit selectionChanged(); } //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { + myLastSelectionPlace = ModuleBase_ISelection::Viewer; QList aValues; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - if (!aContext.IsNull()) + if (!aContext.IsNull()) { aValues = selection()->getSelected(ModuleBase_ISelection::Viewer); - + // Update is necessary for OCCT 7.4.0: when it is clears selection it doesn't updates viewer +#if OCC_VERSION_HEX == 0x070400 + if (aValues.isEmpty()) + aContext->UpdateCurrentViewer(); +#endif + } QObjectPtrList anObjects; convertToObjectBrowserSelection(aValues, anObjects); myWorkshop->objectBrowser()->setObjectsSelected(anObjects); @@ -198,7 +177,7 @@ void XGUI_SelectionMgr::deselectPresentation(const Handle(AIS_InteractiveObject) NCollection_List::Iterator anOwnersIt (aResultOwners); Handle(SelectMgr_EntityOwner) anOwner; for (; anOwnersIt.More(); anOwnersIt.Next()) { - anOwner = Handle(SelectMgr_EntityOwner)::DownCast(anOwnersIt.Value()); + anOwner = anOwnersIt.Value(); if (!anOwner.IsNull()) aContext->AddOrRemoveSelected(anOwner, false); } @@ -274,9 +253,9 @@ void XGUI_SelectionMgr::convertToObjectBrowserSelection( aFeature = anActiveDocument->producedByFeature(aResult, aShape); if (aFeature.get()) { QList aResList = findAllShapes(aResult); - foreach(TopoDS_Shape aShape, aResList) { - if (!aShapeMap.Contains(aShape)) - aShapeMap.Add(aShape); + foreach(TopoDS_Shape aResShape, aResList) { + if (!aShapeMap.Contains(aResShape)) + aShapeMap.Add(aResShape); } } }