b311480e |
1 | -- Created on: 1997-07-23 |
2 | -- Created by: Henri JEANNIN |
3 | -- Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | package ViewerTest |
18 | |
19 | ---Purpose: |
20 | |
21 | uses |
22 | Draw, |
23 | TCollection, |
24 | TColStd, |
4754e164 |
25 | TColgp, |
7fd59977 |
26 | TopAbs, |
27 | TopTools, |
28 | TopoDS, |
29 | V3d, |
30 | AIS, |
31 | NIS, |
792c785c |
32 | MMgt, |
33 | Quantity |
7fd59977 |
34 | |
35 | is |
36 | |
37 | class Tool; |
38 | ---Purpose: to build a context and set a given context as current |
39 | -- for ViewerTest. |
40 | |
41 | |
42 | |
43 | class EventManager; |
44 | ---Purpose: used to manage mouse event (move,select,shiftselect) |
45 | -- By default the events are transmitted to interactive context. |
46 | |
47 | |
48 | class DoubleMapOfInteractiveAndName instantiates DoubleMap |
49 | from TCollection ( Transient from Standard, |
50 | AsciiString from TCollection, |
51 | MapTransientHasher from TColStd, |
52 | AsciiString from TCollection); |
53 | |
54 | |
55 | -- ---------------------------------------------------------------------- |
56 | -- Package methods |
57 | -- ---------------------------------------------------------------------- |
58 | |
59 | Factory (theDI : out Interpretor from Draw); |
60 | ---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin. |
61 | |
62 | ---Category: Create the viewer.... |
63 | |
64 | ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0; |
18d715bd |
65 | thePxWidth, thePxHeight : Integer from Standard = 0; |
66 | theViewName : CString from Standard = ""; |
67 | theDisplayName : CString from Standard = "") |
68 | returns AsciiString from TCollection; |
69 | ---Purpose: Creates view with default or custom name |
70 | -- and add this name in map to manage muliple views |
71 | -- implemented in ViewerTest_ViewerCommands.cxx |
72 | |
73 | ---Category: Manage the name of views |
74 | RemoveViewName (theName: AsciiString from TCollection); |
75 | |
76 | InitViewName (theName: AsciiString from TCollection; |
77 | theView: View from V3d); |
78 | |
79 | GetCurrentViewName returns AsciiString from TCollection; |
80 | |
81 | ---Category: Delete the viewer.... |
82 | RemoveView (theViewName:AsciiString from TCollection; |
83 | isContextRemoved:Boolean from Standard= Standard_True); |
84 | ---Purpose: Removes view and clear all maps |
85 | -- with information about its resources if neccessary |
7fd59977 |
86 | |
87 | ---Category: Selection in the viewer.... |
88 | |
7fd59977 |
89 | WClass returns TShared from MMgt is private; |
90 | ---C++: return const & |
91 | ---Purpose: Returns a window class that implements standard behavior of |
92 | -- all windows of the ViewerTest. This includes usual Open CASCADE |
93 | -- view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom, |
94 | -- Ctrl+MB2 for pan, etc) and keyboard shortcuts. |
95 | -- This method is relevant for MS Windows only and respectively |
96 | -- returns WNT_WClass handle. |
97 | |
98 | PickShape (aType : ShapeEnum from TopAbs; |
99 | MaxPick : Integer from Standard = 5) returns Shape from TopoDS; |
100 | ---Purpose: waits until a shape of type <aType> is picked in the AIS Viewer and returns it. |
101 | -- if <aType> == TopAbs_Shape, any shape can be picked... |
102 | -- MaxPick is the Max number before exiting, if no pick is successfull |
103 | |
104 | |
105 | PickShapes (aType : ShapeEnum from TopAbs; |
106 | thepicked : in out HArray1OfShape from TopTools; |
107 | MaxPick : Integer from Standard = 5) |
108 | returns Boolean from Standard; |
109 | ---Purpose: wait until the array is filled with picked shapes. |
110 | -- returns True if the array is filled. |
111 | -- exit if number of unsuccesfull picks = <MaxPick> |
112 | |
113 | PickObject(Type : KindOfInteractive from AIS = AIS_KOI_None; |
114 | Signature : Integer from Standard = -1; |
115 | MaxPick : Integer from Standard = 5) |
116 | returns InteractiveObject from AIS; |
117 | ---Purpose: waits until an interactive object of a given Type |
118 | -- and signature is picked (defaut values authorize |
119 | -- selection of any Interactive Object) |
120 | -- exit if number of unsuccesfull picks = <MaxPick> |
121 | |
122 | PickObjects(thepicked : in out HArray1OfTransient from TColStd; |
123 | Type : KindOfInteractive from AIS = AIS_KOI_None; |
124 | Signature : Integer from Standard = -1; |
125 | MaxPick : Integer from Standard = 5) |
126 | returns Boolean from Standard; |
127 | ---Purpose: selection of several interactive objects. Number is given |
128 | -- by the size of <thepicked> |
129 | -- exit if number of unsuccesfull picks = <MaxPick> |
130 | |
131 | |
132 | Commands (theCommands : in out Interpretor from Draw); |
133 | AviCommands(theCommands :in out Interpretor from Draw); |
134 | ViewerCommands(theCommands :in out Interpretor from Draw); |
135 | MyCommands (theCommands : in out Interpretor from Draw); -- My Own Com-s |
136 | RelationCommands(theCommands :in out Interpretor from Draw); |
137 | ObjectCommands(theCommands :in out Interpretor from Draw); |
138 | FilletCommands(theCommands :in out Interpretor from Draw); |
139 | VoxelCommands(theCommands :in out Interpretor from Draw); |
3946774d |
140 | OpenGlCommands(theCommands :in out Interpretor from Draw); |
7fd59977 |
141 | |
142 | GetMousePosition(xpix,ypix: out Integer from Standard); |
143 | |
144 | GetViewerFromContext returns Viewer from V3d; |
145 | |
146 | GetCollectorFromContext returns Viewer from V3d; |
147 | |
148 | GetAISContext returns InteractiveContext from AIS; |
24de79c3 |
149 | ---C++: return const & |
7fd59977 |
150 | GetNISContext returns InteractiveContext from NIS; |
151 | ---C++: return & |
152 | |
153 | SetAISContext (aContext: InteractiveContext from AIS); |
154 | |
155 | SetNISContext (aContext: InteractiveContext from NIS); |
156 | |
157 | CurrentView returns View from V3d; |
24de79c3 |
158 | ---C++: return const & |
159 | |
7fd59977 |
160 | CurrentView (aViou:View from V3d); |
161 | |
162 | Clear ; |
163 | |
164 | ---Category: Change behaviour on move,select,... events. |
165 | |
166 | SetEventManager (aMgr:EventManager from ViewerTest); |
167 | ---Purpose: puts <aMgr> as current eventmanager (the |
168 | -- move,select,...will be applied to <aMgr> |
169 | |
170 | UnsetEventManager; |
171 | ---Purpose: removes the last EventManager from the list. |
172 | |
173 | ResetEventManager; |
174 | ---Purpose: clear the list of EventManagers and |
175 | -- sets the default EventManager as current |
176 | |
177 | CurrentEventManager returns EventManager from ViewerTest; |
178 | |
179 | |
180 | ---Category: privateMethods... |
181 | |
182 | |
183 | RemoveSelected; |
184 | |
185 | StandardModeActivation(Mode : Integer from Standard); |
186 | |
792c785c |
187 | GetColorFromName(name: CString from Standard) |
188 | returns NameOfColor from Quantity; |
189 | |
4269bd1b |
190 | RedrawAllViews; |
191 | ---Purpose: redraws all defined views. |
7fd59977 |
192 | |
1d7ca641 |
193 | SplitParameter (theString : AsciiString from TCollection; |
194 | theName : out AsciiString from TCollection; |
195 | theValue : out AsciiString from TCollection) |
196 | returns Boolean from Standard; |
197 | ---Purpose: Splits "parameter=value" string into separate |
198 | -- parameter and value strings. |
199 | -- @return TRUE if the string matches pattern "<string>=<empty or string>" |
7fd59977 |
200 | end; |