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

0026159: Visualization - revise tolerance implementation for selection

Max tolerance is now applied to all objects and entities by default;
if there is an entity with a lower tolerance, selecting frustum will be recalculated for it.
The ability to set sensitivity for each entity individually is moved to protected section of SelectBasics_SensitiveEntity
SetPixelTolerance from AIS_InteractiveContext now sets custom tolerance that is applied to all sensitives.
Added -unset option to vselprecision command to disable custom tolerances.
Test case for issue #26159
This commit is contained in:
vpa
2015-05-06 15:35:36 +03:00
committed by abv
parent fe3a29bc9a
commit 28ee613b27
15 changed files with 362 additions and 79 deletions

View File

@@ -749,7 +749,7 @@ static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char
{
if( argc > 2 )
{
di << "Use: " << argv[0] << " [tolerance_value]\n";
di << "Wrong parameters! Must be: " << argv[0] << " [-unset] [tolerance]\n";
return 1;
}
@@ -760,14 +760,20 @@ static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char
if( argc == 1 )
{
Standard_Real aPixelTolerance = aContext->PixelTolerance();
di << "Precision mode : 0 (window)\n";
di << "Pixel tolerance : " << aPixelTolerance << "\n";
}
else if (argc == 2)
{
Standard_Integer aPixelTolerance = Draw::Atoi (argv[1]);
aContext->SetPixelTolerance (aPixelTolerance);
TCollection_AsciiString anArg = TCollection_AsciiString (argv[1]);
anArg.LowerCase();
if (anArg == "-unset")
{
aContext->SetPixelTolerance (-1.0);
}
else
{
aContext->SetPixelTolerance (anArg.RealValue());
}
}
return 0;
@@ -5275,7 +5281,9 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
__FILE__,VClearSensi,group);
theCommands.Add("vselprecision",
"vselprecision : vselprecision [tolerance_value]",
"vselprecision [-unset] [tolerance_value]"
"\n\t\t Manages selection precision or prints current value if no parameter is passed."
"\n\t\t -unset - restores default selection tolerance behavior, based on individual entity tolerance",
__FILE__,VSelPrecision,group);
theCommands.Add("vperf",