X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FViewerTest%2FViewerTest_ViewerCommands.cxx;h=69beafb5496cc71f0a508de94e2854f4b940f793;hb=30a1b24e197e467e809128196a9708c5243c1af9;hpb=25333d45eacee8663f6d766fb192c650c44a3c37 diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 913cc34f32..69beafb549 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -8974,6 +8975,7 @@ static int VCamera (Draw_Interpretor& theDI, return 0; } + TCollection_AsciiString aPrsName; for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) { Standard_CString anArg = theArgVec[anArgIter]; @@ -9133,6 +9135,11 @@ static int VCamera (Draw_Interpretor& theDI, } theDI << aCamera->FOVy() << " "; } + else if (aPrsName.IsEmpty() + && !anArgCase.StartsWith ("-")) + { + aPrsName = anArg; + } else { std::cout << "Error: unknown argument '" << anArg << "'\n"; @@ -9140,8 +9147,41 @@ static int VCamera (Draw_Interpretor& theDI, } } - aView->AutoZFit(); - aView->Redraw(); + if (aPrsName.IsEmpty() + || theArgsNb > 2) + { + aView->AutoZFit(); + aView->Redraw(); + } + + if (!aPrsName.IsEmpty()) + { + Handle(AIS_CameraFrustum) aCameraFrustum; + if (GetMapOfAIS().IsBound2 (aPrsName)) + { + // find existing object + aCameraFrustum = Handle(AIS_CameraFrustum)::DownCast (GetMapOfAIS().Find2 (theArgVec[1])); + if (aCameraFrustum.IsNull()) + { + std::cout << "Error: object '" << aPrsName << "'is already defined and is not a camera frustum!\n"; + return 1; + } + } + + if (aCameraFrustum.IsNull()) + { + aCameraFrustum = new AIS_CameraFrustum(); + } + else + { + // not include displayed object of old camera frustum in the new one. + ViewerTest::GetAISContext()->Erase (aCameraFrustum, false); + aView->ZFitAll(); + } + aCameraFrustum->SetCameraFrustum (aView->Camera()); + + ViewerTest::Display (aPrsName, aCameraFrustum); + } return 0; } @@ -12404,13 +12444,14 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "vnbselected" "\n\t\t: Returns number of selected objects", __FILE__, VNbSelected, group); theCommands.Add ("vcamera", - "vcamera [-ortho] [-projtype]" + "vcamera [PrsName] [-ortho] [-projtype]" "\n\t\t: [-persp]" "\n\t\t: [-fovy [Angle]] [-distance [Distance]]" "\n\t\t: [-stereo] [-leftEye] [-rightEye]" "\n\t\t: [-iod [Distance]] [-iodType [absolute|relative]]" "\n\t\t: [-zfocus [Value]] [-zfocusType [absolute|relative]]" - "\n\t\t: Manage camera parameters." + "\n\t\t: Manages camera parameters." + "\n\t\t: Displays frustum when presntation name PrsName is specified." "\n\t\t: Prints current value when option called without argument." "\n\t\t: Orthographic camera:" "\n\t\t: -ortho activate orthographic projection"