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
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.
45 ---Purpose: to build a context and set a given context as current
51 ---Purpose: used to manage mouse event (move,select,shiftselect)
52 -- By default the events are transmitted to interactive context.
55 class DoubleMapOfInteractiveAndName instantiates DoubleMap
56 from TCollection ( Transient from Standard,
57 AsciiString from TCollection,
58 MapTransientHasher from TColStd,
59 AsciiString from TCollection);
62 -- ----------------------------------------------------------------------
64 -- ----------------------------------------------------------------------
66 Factory (theDI : out Interpretor from Draw);
67 ---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin.
69 ---Category: Create the viewer....
71 ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0;
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
80 ---Category: Manage the name of views
81 RemoveViewName (theName: AsciiString from TCollection);
83 InitViewName (theName: AsciiString from TCollection;
84 theView: View from V3d);
86 GetCurrentViewName returns AsciiString from TCollection;
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
94 ---Category: Selection in the viewer....
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.
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
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>
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>
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>
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);
147 OpenGlCommands(theCommands :in out Interpretor from Draw);
149 GetMousePosition(xpix,ypix: out Integer from Standard);
151 GetViewerFromContext returns Viewer from V3d;
153 GetCollectorFromContext returns Viewer from V3d;
155 GetAISContext returns InteractiveContext from AIS;
156 ---C++: return const &
157 GetNISContext returns InteractiveContext from NIS;
160 SetAISContext (aContext: InteractiveContext from AIS);
162 SetNISContext (aContext: InteractiveContext from NIS);
164 CurrentView returns View from V3d;
165 ---C++: return const &
167 CurrentView (aViou:View from V3d);
171 ---Category: Change behaviour on move,select,... events.
173 SetEventManager (aMgr:EventManager from ViewerTest);
174 ---Purpose: puts <aMgr> as current eventmanager (the
175 -- move,select,...will be applied to <aMgr>
178 ---Purpose: removes the last EventManager from the list.
181 ---Purpose: clear the list of EventManagers and
182 -- sets the default EventManager as current
184 CurrentEventManager returns EventManager from ViewerTest;
187 ---Category: privateMethods...
192 StandardModeActivation(Mode : Integer from Standard);
194 GetColorFromName(name: CString from Standard)
195 returns NameOfColor from Quantity;
198 ---Purpose: redraws all defined views.
200 SplitParameter (theString : AsciiString from TCollection;
201 theName : out AsciiString from TCollection;
202 theValue : out AsciiString from TCollection)
203 returns Boolean from Standard;
204 ---Purpose: Splits "parameter=value" string into separate
205 -- parameter and value strings.
206 -- @return TRUE if the string matches pattern "<string>=<empty or string>"