| 1 | -- Created on: 1997-07-23 |
| 2 | -- Created by: Henri JEANNIN |
| 3 | -- Copyright (c) 1997-1999 Matra Datavision |
| 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 5 | -- |
| 6 | -- This file is part of Open CASCADE Technology software library. |
| 7 | -- |
| 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 |
| 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. |
| 13 | -- |
| 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | -- commercial license or contractual agreement. |
| 16 | |
| 17 | package ViewerTest |
| 18 | |
| 19 | ---Purpose: |
| 20 | |
| 21 | uses |
| 22 | Draw, |
| 23 | TCollection, |
| 24 | TColStd, |
| 25 | TColgp, |
| 26 | TopAbs, |
| 27 | TopTools, |
| 28 | TopoDS, |
| 29 | V3d, |
| 30 | AIS, |
| 31 | NIS, |
| 32 | MMgt, |
| 33 | Quantity |
| 34 | |
| 35 | is |
| 36 | |
| 37 | class EventManager; |
| 38 | ---Purpose: used to manage mouse event (move,select,shiftselect) |
| 39 | -- By default the events are transmitted to interactive context. |
| 40 | |
| 41 | |
| 42 | class DoubleMapOfInteractiveAndName instantiates DoubleMap |
| 43 | from TCollection ( Transient from Standard, |
| 44 | AsciiString from TCollection, |
| 45 | MapTransientHasher from TColStd, |
| 46 | AsciiString from TCollection); |
| 47 | |
| 48 | |
| 49 | -- ---------------------------------------------------------------------- |
| 50 | -- Package methods |
| 51 | -- ---------------------------------------------------------------------- |
| 52 | |
| 53 | Factory (theDI : out Interpretor from Draw); |
| 54 | ---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin. |
| 55 | |
| 56 | ---Category: Create the viewer.... |
| 57 | |
| 58 | ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0; |
| 59 | thePxWidth, thePxHeight : Integer from Standard = 0; |
| 60 | theViewName : CString from Standard = ""; |
| 61 | theDisplayName : CString from Standard = "") |
| 62 | returns AsciiString from TCollection; |
| 63 | ---Purpose: Creates view with default or custom name |
| 64 | -- and add this name in map to manage muliple views |
| 65 | -- implemented in ViewerTest_ViewerCommands.cxx |
| 66 | |
| 67 | ---Category: Manage the name of views |
| 68 | RemoveViewName (theName: AsciiString from TCollection); |
| 69 | |
| 70 | InitViewName (theName: AsciiString from TCollection; |
| 71 | theView: View from V3d); |
| 72 | |
| 73 | GetCurrentViewName returns AsciiString from TCollection; |
| 74 | |
| 75 | ---Category: Delete the viewer.... |
| 76 | RemoveView (theViewName : AsciiString from TCollection; |
| 77 | theToRemoveContext : Boolean from Standard = Standard_True); |
| 78 | ---Purpose: Removes view and clear all maps |
| 79 | -- with information about its resources if neccessary |
| 80 | |
| 81 | ---Category: Delete the viewer.... |
| 82 | RemoveView (theView : View from V3d; |
| 83 | theToRemoveContext : Boolean from Standard = Standard_True); |
| 84 | ---Purpose: Removes view and clear all maps |
| 85 | -- with information about its resources if neccessary |
| 86 | |
| 87 | ---Category: Selection in the viewer.... |
| 88 | |
| 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); |
| 140 | OpenGlCommands(theCommands :in out Interpretor from Draw); |
| 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; |
| 149 | ---C++: return const & |
| 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; |
| 158 | ---C++: return const & |
| 159 | |
| 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 | |
| 187 | GetColorFromName(name: CString from Standard) |
| 188 | returns NameOfColor from Quantity; |
| 189 | |
| 190 | RedrawAllViews; |
| 191 | ---Purpose: redraws all defined views. |
| 192 | |
| 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>" |
| 200 | end; |