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