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