diff --git a/src/AIS/AIS_InteractiveContext.hxx b/src/AIS/AIS_InteractiveContext.hxx index 2e4d57b5a0..64d536a927 100644 --- a/src/AIS/AIS_InteractiveContext.hxx +++ b/src/AIS/AIS_InteractiveContext.hxx @@ -1211,9 +1211,11 @@ protected: //! @name internal methods //! for AutoHighlight, e.g. is used for selection. Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner); - //! Helper function that highlights the owners with check - //! for AutoHighlight, e.g. is used for selection. - Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners); + //! Helper function that highlights the owners with check for AutoHighlight, e.g. is used for selection. + //! @param theOwners [in] list of owners to highlight + //! @param theStyle [in] highlight style to apply or NULL to apply selection style + Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners, + const Handle(Prs3d_Drawer)& theStyle); //! Helper function that highlights global owner of the object given with with check //! for AutoHighlight, e.g. is used for selection. diff --git a/src/AIS/AIS_InteractiveContext_1.cxx b/src/AIS/AIS_InteractiveContext_1.cxx index 7c9b44caab..c5bda00139 100644 --- a/src/AIS/AIS_InteractiveContext_1.cxx +++ b/src/AIS/AIS_InteractiveContext_1.cxx @@ -107,7 +107,7 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn { anOwners.Append (theOwner); } - highlightOwners (anOwners); + highlightOwners (anOwners, Handle(Prs3d_Drawer)()); } //======================================================================= @@ -148,7 +148,7 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject { anOwners.Append (aGlobOwner); } - highlightOwners (anOwners); + highlightOwners (anOwners, theStyle); } //======================================================================= @@ -725,7 +725,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate // In case of selection without using local context clearDynamicHighlight(); - highlightOwners (mySelection->Objects()); + highlightOwners (mySelection->Objects(), Handle(Prs3d_Drawer)()); if (theToUpdateViewer) UpdateCurrentViewer(); @@ -735,7 +735,8 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate //function : highlightOwners //purpose : //======================================================================= -void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners) +void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners, + const Handle(Prs3d_Drawer)& theStyle) { AIS_MapOfObjSelectedOwners anObjOwnerMap; for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next()) @@ -745,7 +746,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO if (anObj.IsNull()) continue; - const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner); + const Handle(Prs3d_Drawer)& anObjSelStyle = !theStyle.IsNull() ? theStyle : getSelStyle (anObj, anOwner); Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj); if (!aStatusPtr) { diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index ce18b49fd1..c8673911fa 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -139,58 +139,6 @@ static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/ return 0; } - // Remove as bad version of QAAddOrRemoveSelected from QADraw -//static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -//{ -// if( argc != 3) { -// di<<"Usage : " << argv[0] << " shape islocal\n"; -// return 1; -// } -// //get AIS_Shape: -// Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext(); -// -// // ViewerTest_DoubleMapOfInteractiveAndName& aMap = -// // ViewerTest::GetDataMapOfAIS (); -// ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); -// -// TCollection_AsciiString aName(argv[1]); -// Handle(AIS_InteractiveObject) AISObj; -// -// if(aMap.IsBound2(aName)) { -// AISObj = aMap.Find2(aName); -// if(AISObj.IsNull()){ -// di<<"No interactive object \n"; -// return 1; -// } -// -// Standard_Integer aNum = -1; -// -// if(Draw::Atoi(argv[2])) { -// aNum = anAISCtx->OpenLocalContext(); -// } -// -// if(anAISCtx->HasOpenedContext()){ -// anAISCtx->InitSelected(); -// anAISCtx->AddOrRemoveSelected(AISObj); -// } -// else { -// anAISCtx->InitCurrent(); -// anAISCtx->AddOrRemoveCurrentObject(AISObj); -// } -// -// if(aNum >= 0) { -// // anAISCtx->CloseLocalContext(aNum); -// } -// -// return 0; -// } -// //select this shape: -// else { -// di<<"Use 'vdisplay' before"; -// return 1; -// } -//} - static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/) { if(argc > 1){ @@ -3019,6 +2967,20 @@ static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, co return 0; } +// Test AIS_InteractiveContext::Hilight() call. +static Standard_Integer OCC31965 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec) +{ + if (theArgNb != 2) + { + theDI << "Syntax error: wrong number of arguments"; + return 1; + } + + Handle(AIS_InteractiveObject) aPrs = GetMapOfAIS().Find2 (theArgVec[1]); + ViewerTest::GetAISContext()->HilightWithColor (aPrs, ViewerTest::GetAISContext()->HighlightStyle (Prs3d_TypeOfHighlight_Dynamic), true); + return 0; +} + static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { if ((argc < 9) || (((argc-3) % 3) != 0)) @@ -5014,5 +4976,7 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) { theCommands.Add("OCC31189", "OCC31189: check stream buffer interface of Message_Messenger", __FILE__, OCC31189, group); theCommands.Add("OCC25748", "OCC25748 [-niter val] [-matsize val] [-progr] [-parallel]\n" "\t\ttest progress indicator in parallel execution", __FILE__, OCC25748, group); + + theCommands.Add("OCC31965", "OCC31965 object : tests AIS_InteractiveContext::Hilight()", __FILE__, OCC31965, group); return; } diff --git a/tests/bugs/vis/bug31965 b/tests/bugs/vis/bug31965 new file mode 100644 index 0000000000..00e7dc9dc2 --- /dev/null +++ b/tests/bugs/vis/bug31965 @@ -0,0 +1,14 @@ +puts "============" +puts "0031965: Visualization - AIS_InteractiveContext::HilightWithColor() ignores passed highlight style" +puts "============" +puts "" + +pload MODELING VISUALIZATION QAcommands +box b 1 2 3 +vdisplay -dispMode 1 b +vfit +vselprops dynHighlight -dispMode 1 -color RED +OCC31965 b + +if { [vreadpixel 200 200 -rgb -name] != "RED2" } { puts "Error: wrong highlight color" } +vdump ${imagedir}/${casename}.png