1 // Created on: 1998-08-27
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <ViewerTest_EventManager.ixx>
24 #include <AIS_InteractiveContext.hxx>
25 #include <NIS_View.hxx>
27 //=======================================================================
28 //function : ViewerTest_EventManager
30 //=======================================================================
32 ViewerTest_EventManager::ViewerTest_EventManager
33 (const Handle(V3d_View)& aView,
34 const Handle(AIS_InteractiveContext)& Ctx)
41 //=======================================================================
44 //=======================================================================
46 void ViewerTest_EventManager::MoveTo(const Standard_Integer XPix,
47 const Standard_Integer YPix)
49 if(!myCtx.IsNull() && !myView.IsNull())
50 myCtx->MoveTo(XPix,YPix,myView);
53 const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView);
55 aView->DynamicHilight (XPix, YPix);
58 //=======================================================================
61 //=======================================================================
63 void ViewerTest_EventManager::Select(const Standard_Integer XPMin,
64 const Standard_Integer YPMin,
65 const Standard_Integer XPMax,
66 const Standard_Integer YPMax)
68 #define IS_FULL_INCLUSION Standard_True
69 if(!myCtx.IsNull() && !myView.IsNull())
70 myCtx->Select(XPMin,YPMin,XPMax,YPMax,myView);
71 const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView);
73 aView->Select(XPMin,YPMin,XPMax,YPMax, Standard_False, IS_FULL_INCLUSION);
76 //=======================================================================
77 //function : ShiftSelect
79 //=======================================================================
81 void ViewerTest_EventManager::ShiftSelect(const Standard_Integer XPMin,
82 const Standard_Integer YPMin,
83 const Standard_Integer XPMax,
84 const Standard_Integer YPMax)
86 if(!myCtx.IsNull() && !myView.IsNull())
87 myCtx->AIS_InteractiveContext::ShiftSelect(XPMin,YPMin,XPMax,YPMax,myView,
89 const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView);
91 aView->Select(XPMin,YPMin,XPMax,YPMax, Standard_True, IS_FULL_INCLUSION);
94 //=======================================================================
97 //=======================================================================
99 void ViewerTest_EventManager::Select()
101 if (!myCtx.IsNull() && !myView.IsNull())
103 const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView);
105 aView->Select(myX, myY);
108 //=======================================================================
109 //function : ShiftSelect
111 //=======================================================================
113 void ViewerTest_EventManager::ShiftSelect()
115 if(!myCtx.IsNull() && !myView.IsNull())
116 myCtx->ShiftSelect(Standard_True);
117 const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView);
119 aView->Select(myX, myY, Standard_True);