mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0025340: Visualization, AIS_InteractiveContext - properly apply selection filters at Neutral point
Do not use myMainSel->OnePicked() in AIS_InteractiveContext::MoveTo(). Test-case for issue #25340
This commit is contained in:
@@ -157,6 +157,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
|
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
|
||||||
// (the objects must be AIS_Shapes)
|
// (the objects must be AIS_Shapes)
|
||||||
const Standard_Integer aDetectedNb = myMainSel->NbPicked();
|
const Standard_Integer aDetectedNb = myMainSel->NbPicked();
|
||||||
|
Standard_Integer aNewDetected = 0;
|
||||||
for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
|
for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aDetIter);
|
Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aDetIter);
|
||||||
@@ -166,6 +167,10 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aNewDetected < 1)
|
||||||
|
{
|
||||||
|
aNewDetected = aDetIter;
|
||||||
|
}
|
||||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (!anObj.IsNull())
|
if (!anObj.IsNull())
|
||||||
{
|
{
|
||||||
@@ -173,11 +178,11 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myMainSel->Init();
|
if (aNewDetected >= 1)
|
||||||
if (myMainSel->More())
|
|
||||||
{
|
{
|
||||||
// does nothing if previously detected object is equal to the current one
|
// does nothing if previously detected object is equal to the current one
|
||||||
if (myMainSel->OnePicked()->Selectable() == myLastPicked)
|
Handle(SelectMgr_EntityOwner) aNewPickedOwner = myMainSel->Picked (aNewDetected);
|
||||||
|
if (aNewPickedOwner->Selectable() == myLastPicked)
|
||||||
{
|
{
|
||||||
return myLastPicked->State() == 1
|
return myLastPicked->State() == 1
|
||||||
? AIS_SOD_Selected
|
? AIS_SOD_Selected
|
||||||
@@ -205,7 +210,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize myLastPicked field with currently detected object
|
// initialize myLastPicked field with currently detected object
|
||||||
myLastPicked = Handle(AIS_InteractiveObject)::DownCast (myMainSel->OnePicked()->Selectable());
|
myLastPicked = Handle(AIS_InteractiveObject)::DownCast (aNewPickedOwner->Selectable());
|
||||||
myLastinMain = myLastPicked;
|
myLastinMain = myLastPicked;
|
||||||
|
|
||||||
// highlight detected object if it is not selected or myToHilightSelected flag is true
|
// highlight detected object if it is not selected or myToHilightSelected flag is true
|
||||||
|
@@ -2882,6 +2882,22 @@ static Standard_Integer OCC7570 (Draw_Interpretor& di, Standard_Integer n, const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <AIS_TypeFilter.hxx>
|
||||||
|
static Standard_Integer OCC25340 (Draw_Interpretor& /*theDI*/,
|
||||||
|
Standard_Integer /*theArgNb*/,
|
||||||
|
const char** /*theArgVec*/)
|
||||||
|
{
|
||||||
|
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
|
||||||
|
if (aCtx.IsNull())
|
||||||
|
{
|
||||||
|
std::cerr << "Error: No opened viewer!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Handle(AIS_TypeFilter) aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
|
||||||
|
aCtx->AddFilter (aFilter);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include <GeomAPI_IntSS.hxx>
|
#include <GeomAPI_IntSS.hxx>
|
||||||
@@ -2978,5 +2994,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
|
theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
|
||||||
theCommands.Add ("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group);
|
theCommands.Add ("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group);
|
||||||
theCommands.Add ("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group);
|
theCommands.Add ("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group);
|
||||||
|
theCommands.Add ("OCC25340", "OCC25340", __FILE__, OCC25340, group);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
36
tests/bugs/vis/bug25340
Normal file
36
tests/bugs/vis/bug25340
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25340"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#############################################################################################
|
||||||
|
# Visualization, AIS_InteractiveContext - properly apply selection filters at Neutral point
|
||||||
|
#############################################################################################
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
vinit
|
||||||
|
|
||||||
|
box b 1 2 3
|
||||||
|
vdisplay b
|
||||||
|
vfit
|
||||||
|
vtrihedron t
|
||||||
|
set color_1 [vreadpixel 87 25]
|
||||||
|
|
||||||
|
OCC25340
|
||||||
|
vselect 87 25
|
||||||
|
set color_2 [vreadpixel 87 25]
|
||||||
|
|
||||||
|
if {$color_2 != $color_1} {
|
||||||
|
puts "ERROR: OCC25340 is reproduced"
|
||||||
|
puts " initial color of trihedron is: $color_1"
|
||||||
|
puts " final color of trihedron is: $color_2"
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$color_2 != "0.43137255311012268 0.48235294222831726 0.54509806632995605 1"} {
|
||||||
|
puts "ERROR: OCC25340 is reproduced"
|
||||||
|
puts " additional investigation is needed"
|
||||||
|
puts " expected color is: 0.43137255311012268 0.48235294222831726 0.54509806632995605 1"
|
||||||
|
puts " current color is: $_color_2"
|
||||||
|
}
|
||||||
|
|
||||||
|
set only_screen 1
|
Reference in New Issue
Block a user