1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023649: Visualization, AIS_LocalContext - make highlighting of already selected objects consistent with and without Shift modifier

1) Add SelectMgr_EntityOwner::IsSelected() and  SelectMgr_EntityOwner::SetSelected() methods to determine if corresponding  entity is selected.
    They replace functionality of SelectMgr_EntityOwner::State() methods that are deprecated now.
2) AIS_InteractiveContext::ToHilightSelected() and AIS_InteractiveContext::SetToHilightSelected() is to be used to enable highlighting of selected objects.
3) By default selected objects are highlighted (new behavior)
4) Add ViewerTest_ViewerCommands: vhighlightselected command to enable/disable 'highlight selected objects' mode.
5) AIS_LocalContext, AIS_InteractiveContext : style changes in Select and ShiftSelect methods.
6) Add test cases /bugs/vis bug23649_1 and  /bugs/vis bug23649_2 to test highlighting of selected objects in local context.
7) Add test cases /bugs/vis bug23649_3 and  /bugs/vis bug23649_4  to test highlighting of selected objects in neutral point.

Updated test case
This commit is contained in:
aba
2014-08-14 12:20:09 +04:00
committed by bugmaster
parent 5b98e25d8e
commit c398b00ed8
17 changed files with 803 additions and 570 deletions

View File

@@ -49,6 +49,9 @@ is
---C++: inline
---C++: return const&
GetCurrentPosition (me; theXPix, theYPix: out Integer from Standard);
---Purpose: Gets current mouse position. It tracks change of mouse position
-- with mouse drugging or with DRAW command call (vmoveto).
fields
myCtx : InteractiveContext from AIS;

View File

@@ -242,3 +242,9 @@ void ViewerTest_EventManager::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyli
}
myView->Redraw();
}
void ViewerTest_EventManager::GetCurrentPosition (Standard_Integer& theXPix, Standard_Integer& theYPix) const
{
theXPix = myX;
theYPix = myY;
}

View File

@@ -6649,6 +6649,70 @@ static int VFrustumCulling (Draw_Interpretor& theDI,
return 0;
}
//=======================================================================
//function : VHighlightSelected
//purpose :
//=======================================================================
static int VHighlightSelected (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
if (ViewerTest::GetAISContext().IsNull())
{
std::cout << theArgVec[0] << " error : Context is not created. Please call vinit before.\n";
return 1;
}
const Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (theArgNb < 2)
{
theDI << (aContext->ToHilightSelected() ? "on" : "off");
return 0;
}
if (theArgNb != 2)
{
std::cout << theArgVec[0] << " error : wrong number of parameters."
<< "Type 'help" << theArgVec[0] << "' for more information.";
return 1;
}
// Parse parameter
TCollection_AsciiString aMode (theArgVec[1]);
aMode.LowerCase();
Standard_Boolean toEnable = Standard_False;
if (aMode.IsEqual ("on"))
{
toEnable = Standard_True;
}
else if (aMode.IsEqual ("off"))
{
toEnable = Standard_False;
}
else
{
toEnable = Draw::Atoi (theArgVec[1]) != 0;
}
if (toEnable != aContext->ToHilightSelected())
{
aContext->SetToHilightSelected (toEnable);
// Move cursor to null position and back to process updating of detection
// and highlighting of selected object immediatly.
Standard_Integer aPixX = 0;
Standard_Integer aPixY = 0;
const Handle(ViewerTest_EventManager)& anEventManager = ViewerTest::CurrentEventManager();
anEventManager->GetCurrentPosition (aPixX, aPixY);
anEventManager->MoveTo (0, 0);
anEventManager->MoveTo (aPixX, aPixY);
}
return 0;
}
//=======================================================================
//function : ViewerCommands
//purpose :
@@ -7017,4 +7081,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
theCommands.Add("vfrustumculling",
"vfrustumculling [toEnable]: enables/disables objects clipping",
__FILE__,VFrustumCulling,group);
theCommands.Add("vhighlightselected",
"vhighlightselected [0|1] or vhighlightselected [on|off]: enables/disables highlighting of selected objects.\n"
"Without arguments it shows if highlighting of selected objects is enabled now.",
__FILE__,VHighlightSelected,group);
}