mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0022016: Incorrect selection color after displaying a selected object
Small correction
This commit is contained in:
parent
ba38396ea1
commit
e1b01c7341
@ -523,7 +523,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
if (aStatus->IsHilighted())
|
if (aStatus->IsHilighted())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
||||||
myMainPM->Highlight (theIObj, aHiMod);
|
myMainPM->Color (theIObj, aStatus->HilightColor(), aHiMod);
|
||||||
}
|
}
|
||||||
if (theSelectionMode != -1)
|
if (theSelectionMode != -1)
|
||||||
{
|
{
|
||||||
|
@ -414,10 +414,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
|||||||
anOwner->State (0);
|
anOwner->State (0);
|
||||||
if (anOwner == anObject->GlobalSelOwner())
|
if (anOwner == anObject->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus) aStatus = myObjects (anObject);
|
myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
|
||||||
aStatus->SetHilightStatus (Standard_False);
|
|
||||||
aStatus->SetHilightColor (Quantity_NOC_WHITE);
|
|
||||||
anObject->State (0);
|
|
||||||
}
|
}
|
||||||
if (!anOwner->IsAutoHilight())
|
if (!anOwner->IsAutoHilight())
|
||||||
{
|
{
|
||||||
@ -762,7 +759,9 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
|||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
anObj->State (1);
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
||||||
|
aState->SetHilightStatus (Standard_True);
|
||||||
|
aState->SetHilightColor (mySelectionColor);
|
||||||
}
|
}
|
||||||
anOwner->State (1);
|
anOwner->State (1);
|
||||||
if (!anOwner->IsAutoHilight())
|
if (!anOwner->IsAutoHilight())
|
||||||
@ -823,7 +822,7 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
|||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
anObj->State (0);
|
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||||
}
|
}
|
||||||
anOwner->State (0);
|
anOwner->State (0);
|
||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
|
||||||
@ -861,7 +860,7 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
|||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
anObj->State (0);
|
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||||
}
|
}
|
||||||
anOwner->State (0);
|
anOwner->State (0);
|
||||||
if (!anOwner->IsAutoHilight())
|
if (!anOwner->IsAutoHilight())
|
||||||
@ -923,7 +922,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
if (theObject->HasSelection (0))
|
if (theObject->HasSelection (0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (NbSelected() == 1 && theObject->State() == 1)
|
if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
|
||||||
{
|
{
|
||||||
Quantity_NameOfColor aHiCol;
|
Quantity_NameOfColor aHiCol;
|
||||||
Standard_Boolean hasHiCol = Standard_False;
|
Standard_Boolean hasHiCol = Standard_False;
|
||||||
@ -950,7 +949,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
Unhilight (aSelectable, Standard_False);
|
Unhilight (aSelectable, Standard_False);
|
||||||
anOwner->State (0);
|
anOwner->State (0);
|
||||||
aSelectable->State (0);
|
if (anOwner == aSelectable->GlobalSelOwner())
|
||||||
|
{
|
||||||
|
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// added to avoid untimely viewer update...
|
// added to avoid untimely viewer update...
|
||||||
@ -961,8 +963,13 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
Handle(SelectMgr_EntityOwner) anOwner =
|
Handle(SelectMgr_EntityOwner) anOwner =
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
|
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
|
||||||
AIS_Selection::ClearAndSelect (anOwner);
|
AIS_Selection::ClearAndSelect (anOwner);
|
||||||
theObject->State (1);
|
|
||||||
anOwner->State (1);
|
anOwner->State (1);
|
||||||
|
if (anOwner == theObject->GlobalSelOwner())
|
||||||
|
{
|
||||||
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (theObject);
|
||||||
|
aState->SetHilightStatus (Standard_True);
|
||||||
|
aState->SetHilightColor (mySelectionColor);
|
||||||
|
}
|
||||||
Quantity_NameOfColor aHiCol;
|
Quantity_NameOfColor aHiCol;
|
||||||
Standard_Boolean hasHiCol = Standard_False;
|
Standard_Boolean hasHiCol = Standard_False;
|
||||||
if (IsHilighted (theObject, hasHiCol, aHiCol))
|
if (IsHilighted (theObject, hasHiCol, aHiCol))
|
||||||
@ -1034,6 +1041,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
|||||||
anObjToClear.Add (anInteractive);
|
anObjToClear.Add (anInteractive);
|
||||||
}
|
}
|
||||||
anOwner->State (0);
|
anOwner->State (0);
|
||||||
|
if (theOwner == anObject->GlobalSelOwner())
|
||||||
|
{
|
||||||
|
myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (!anObjToClear.IsEmpty())
|
while (!anObjToClear.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -1050,6 +1061,13 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
|||||||
highlightSelected (theOwner, mySelectionColor);
|
highlightSelected (theOwner, mySelectionColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theOwner == anObject->GlobalSelOwner())
|
||||||
|
{
|
||||||
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
||||||
|
aState->SetHilightStatus (Standard_True);
|
||||||
|
aState->SetHilightColor (mySelectionColor);
|
||||||
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
UpdateCurrentViewer();
|
UpdateCurrentViewer();
|
||||||
}
|
}
|
||||||
@ -1130,9 +1148,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
|||||||
const Handle(AIS_InteractiveObject) anObj =
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
|
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
|
||||||
if (isGlobal)
|
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
|
||||||
anObj->State (aState);
|
|
||||||
const Handle(AIS_GlobalStatus)& aStatus = myObjects (anObj);
|
|
||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
||||||
if (aState == 1)
|
if (aState == 1)
|
||||||
{
|
{
|
||||||
@ -1184,7 +1200,7 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
|||||||
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated)
|
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return theObj->State() == 1;
|
return myObjects (theObj)->IsHilighted();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
27
tests/bugs/vis/bug22016
Normal file
27
tests/bugs/vis/bug22016
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC22016"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#########################################################################################
|
||||||
|
# Incorrect selection color after displaying a selected object
|
||||||
|
#########################################################################################
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
box b1 0 0 0 1 2 3
|
||||||
|
box b2 3 0 0 2 3 1
|
||||||
|
vinit View1
|
||||||
|
vclear
|
||||||
|
vaxo
|
||||||
|
vdisplay -noupdate b1 b2
|
||||||
|
vaspects b1 b2 -setWidth 4
|
||||||
|
vfit
|
||||||
|
vselect 0 0 500 500
|
||||||
|
vdisplay b2
|
||||||
|
set aColor1 [vreadpixel 104 32 rgb name]
|
||||||
|
set aColor2 [vreadpixel 255 350 rgb name]
|
||||||
|
|
||||||
|
if {$aColor1 != "GRAY80" || $aColor2 != "GRAY80" } {
|
||||||
|
puts "ERROR: OCC22016 is reproduced. Incorrect selection color after displaying a selected object."
|
||||||
|
}
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}.png
|
Loading…
x
Reference in New Issue
Block a user