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

0026209: Visualization - provide a method to fit view to the specific bounding box

Methods V3d_View::FitAll and NIS_View::FitAll3d now take arbitrary bounding box as a parameter;
Option -selected added to vfit command to fit only selected entities in Draw;
F key press now fits selected objects if any by default.
This commit is contained in:
vpa
2015-05-14 19:32:05 +03:00
committed by bugmaster
parent ab1c121bb9
commit b586500b1e
15 changed files with 301 additions and 43 deletions

View File

@@ -1345,8 +1345,15 @@ void VT_ProcessKeyPress (const char* buf_ret)
}
else if (!strcasecmp (buf_ret, "F"))
{
// FitAll
aView->FitAll();
if (ViewerTest::GetAISContext()->NbSelected() > 0)
{
ViewerTest::GetAISContext()->FitSelected (aView);
}
else
{
// FitAll
aView->FitAll();
}
}
else if (!strcasecmp (buf_ret, "H"))
{
@@ -2458,7 +2465,6 @@ static void OSWindowSetup()
}
//==============================================================================
//function : VFit
@@ -2466,11 +2472,49 @@ static void OSWindowSetup()
//Draw arg : No args
//==============================================================================
static int VFit(Draw_Interpretor& , Standard_Integer , const char** )
static int VFit (Draw_Interpretor& /*theDi*/, Standard_Integer theArgc, const char** theArgv)
{
if (theArgc > 2)
{
std::cout << "Wrong number of arguments! Use: vfit [-selected]" << std::endl;
}
const Handle(V3d_View) aView = ViewerTest::CurrentView();
<<<<<<< .mine
Handle(NIS_View) V = Handle(NIS_View)::DownCast (aView);
if (theArgc == 2)
{
TCollection_AsciiString anArg (theArgv[1]);
anArg.LowerCase();
if (anArg == "-selected")
{
ViewerTest::GetAISContext()->FitSelected (V.IsNull() ? aView : V);
return 0;
}
}
if (V.IsNull() == Standard_False) {
V->FitAll3d();
} else if (aView.IsNull() == Standard_False) {
=======
if (!aView.IsNull())
{
>>>>>>> .theirs
aView->FitAll();
}
return 0;
@@ -8413,7 +8457,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vpick : vpick X Y Z [shape subshape] ( all variables as string )",
VPick,group);
theCommands.Add("vfit" ,
"vfit or <F> : vfit",
"vfit or <F> [-selected]"
"\n\t\t: [-selected] fits the scene according to bounding box of currently selected objects",
__FILE__,VFit,group);
theCommands.Add ("vfitarea",
"vfitarea x1 y1 x2 y2"