From 4ca4bbe8bdb0f54877396ef11b35ca08f3791628 Mon Sep 17 00:00:00 2001 From: isk Date: Wed, 12 Nov 2014 14:27:50 +0300 Subject: [PATCH] 0025436: Visualization - AIS_InteractiveContext::HilightPreviousDetected() should switch from first value in the list to the last --- src/AIS/AIS_LocalContext_1.cxx | 3 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 53 ++++++++++++++++++++ src/ViewerTest/ViewerTest_ViewerCommands.cxx | 10 ++++ tests/v3d/edge/A10 | 19 +++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 tests/v3d/edge/A10 diff --git a/src/AIS/AIS_LocalContext_1.cxx b/src/AIS/AIS_LocalContext_1.cxx index c2701f9fee..2301294576 100644 --- a/src/AIS/AIS_LocalContext_1.cxx +++ b/src/AIS/AIS_LocalContext_1.cxx @@ -1455,9 +1455,10 @@ Standard_Integer AIS_LocalContext::HilightPreviousDetected (const Handle(V3d_Vie return 0; } + const Standard_Integer aLen = myDetectedSeq.Length(); if (--myCurDetected < 1) { - myCurDetected = 1; + myCurDetected = aLen; } Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected)); if (anOwner.IsNull()) diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 427d134352..ef27aaccf1 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -4256,6 +4256,51 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/, return 0; } +//=============================================================================================== +//function : VSelectionNext +//purpose : +//=============================================================================================== +static Standard_Integer VSelectionNext(Draw_Interpretor& /*theDI*/, + Standard_Integer /*theArgsNb*/, + const char** /*theArgVec*/) +{ + // Check errors + Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext(); + Handle(V3d_View) aView = ViewerTest::CurrentView(); + + if (anAISContext.IsNull()) + { + std::cerr << "Call vinit before!" << std::endl; + return 1; + } + + anAISContext->HilightNextDetected(aView); + return 0; +} + +//=============================================================================================== +//function : VSelectionPrevious +//purpose : +//=============================================================================================== +static Standard_Integer VSelectionPrevious(Draw_Interpretor& /*theDI*/, + Standard_Integer /*theArgsNb*/, + const char** /*theArgVec*/) +{ + // Check errors + Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext(); + Handle(V3d_View) aView = ViewerTest::CurrentView(); + + if (anAISContext.IsNull()) + { + std::cerr << "Call vinit before!" << std::endl; + return 1; + } + + anAISContext->HilightPreviousDetected(aView); + return 0; +} + + //========================================================================== //class : Triangle //purpose : creates Triangle based on AIS_InteractiveObject. @@ -5983,6 +6028,14 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) " 0 if mode is to be switched off\n", __FILE__, VSetSelectionMode, group); + theCommands.Add("vselnext", + "vselnext : hilight next detected", + __FILE__, VSelectionNext, group); + + theCommands.Add("vselprev", + "vselnext : hilight previous detected", + __FILE__, VSelectionPrevious, group); + theCommands.Add("vtriangle", "vtriangle Name PointName PointName PointName", __FILE__, VTriangle,group); diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index a17dd12069..66c7c13e03 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -2013,6 +2013,16 @@ static LRESULT WINAPI ViewerWindowProc( HWND hwnd, { c[0] = THE_KEY_DELETE; } + // comma + else if (wParam == VK_OEM_COMMA) + { + c[0] = ','; + } + // dot + else if (wParam == VK_OEM_PERIOD) + { + c[0] = '.'; + } VT_ProcessKeyPress (c); } break; diff --git a/tests/v3d/edge/A10 b/tests/v3d/edge/A10 new file mode 100644 index 0000000000..273311bfcf --- /dev/null +++ b/tests/v3d/edge/A10 @@ -0,0 +1,19 @@ +puts "============" +puts "CR25436" +puts "Test case check work of the new commands vselnext and vselprev" +puts "============" +puts "" + +box b 10 10 10 +vdisplay b +vfit +vselmode 2 1 +vmoveto 30 101 + +vselnext +vselnext +vselnext + +vselprev +vselprev +vselprev -- 2.20.1