]>
Commit | Line | Data |
---|---|---|
7fd59977 | 1 | // File: ViewerTest_EventManager.cxx |
2 | // Created: Thu Aug 27 14:20:19 1998 | |
3 | // Author: Robert COUBLANC | |
4 | // <rob@robox.paris1.matra-dtv.fr> | |
5 | ||
6 | ||
7 | #include <ViewerTest_EventManager.ixx> | |
8 | #include <AIS_InteractiveContext.hxx> | |
9 | #include <NIS_View.hxx> | |
10 | ||
11 | //======================================================================= | |
12 | //function : ViewerTest_EventManager | |
13 | //purpose : | |
14 | //======================================================================= | |
15 | ||
16 | ViewerTest_EventManager::ViewerTest_EventManager | |
17 | (const Handle(V3d_View)& aView, | |
18 | const Handle(AIS_InteractiveContext)& Ctx) | |
19 | : myView (aView), | |
20 | myCtx (Ctx), | |
21 | myX (-1), | |
22 | myY (-1) | |
23 | {} | |
24 | ||
25 | //======================================================================= | |
26 | //function : MoveTo | |
27 | //purpose : | |
28 | //======================================================================= | |
29 | ||
30 | void ViewerTest_EventManager::MoveTo(const Standard_Integer XPix, | |
31 | const Standard_Integer YPix) | |
32 | { | |
33 | if(!myCtx.IsNull() && !myView.IsNull()) | |
34 | myCtx->MoveTo(XPix,YPix,myView); | |
35 | myX = XPix; | |
36 | myY = YPix; | |
37 | const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView); | |
38 | if (!aView.IsNull()) | |
39 | aView->DynamicHilight (XPix, YPix); | |
40 | } | |
41 | ||
42 | //======================================================================= | |
43 | //function : Select | |
44 | //purpose : | |
45 | //======================================================================= | |
46 | ||
47 | void ViewerTest_EventManager::Select(const Standard_Integer XPMin, | |
48 | const Standard_Integer YPMin, | |
49 | const Standard_Integer XPMax, | |
50 | const Standard_Integer YPMax) | |
51 | { | |
52 | #define IS_FULL_INCLUSION Standard_True | |
53 | if(!myCtx.IsNull() && !myView.IsNull()) | |
54 | myCtx->Select(XPMin,YPMin,XPMax,YPMax,myView); | |
55 | const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView); | |
56 | if (!aView.IsNull()) | |
57 | aView->Select(XPMin,YPMin,XPMax,YPMax, Standard_False, IS_FULL_INCLUSION); | |
58 | } | |
59 | ||
60 | //======================================================================= | |
61 | //function : ShiftSelect | |
62 | //purpose : | |
63 | //======================================================================= | |
64 | ||
65 | void ViewerTest_EventManager::ShiftSelect(const Standard_Integer XPMin, | |
66 | const Standard_Integer YPMin, | |
67 | const Standard_Integer XPMax, | |
68 | const Standard_Integer YPMax) | |
69 | { | |
70 | if(!myCtx.IsNull() && !myView.IsNull()) | |
71 | myCtx->AIS_InteractiveContext::ShiftSelect(XPMin,YPMin,XPMax,YPMax,myView, | |
72 | Standard_True); | |
73 | const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView); | |
74 | if (!aView.IsNull()) | |
75 | aView->Select(XPMin,YPMin,XPMax,YPMax, Standard_True, IS_FULL_INCLUSION); | |
76 | } | |
77 | ||
78 | //======================================================================= | |
79 | //function : Select | |
80 | //purpose : | |
81 | //======================================================================= | |
82 | ||
83 | void ViewerTest_EventManager::Select() | |
84 | { | |
85 | if (!myCtx.IsNull() && !myView.IsNull()) | |
86 | myCtx->Select(); | |
87 | const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView); | |
88 | if (!aView.IsNull()) | |
89 | aView->Select(myX, myY); | |
90 | } | |
91 | ||
92 | //======================================================================= | |
93 | //function : ShiftSelect | |
94 | //purpose : | |
95 | //======================================================================= | |
96 | ||
97 | void ViewerTest_EventManager::ShiftSelect() | |
98 | { | |
99 | if(!myCtx.IsNull() && !myView.IsNull()) | |
100 | myCtx->ShiftSelect(Standard_True); | |
101 | const Handle(NIS_View) aView = Handle(NIS_View)::DownCast(myView); | |
102 | if (!aView.IsNull()) | |
103 | aView->Select(myX, myY, Standard_True); | |
104 | } |