| 1 | -- Created on: 1995-01-25 |
| 2 | -- Created by: Jean-Louis Frenkel |
| 3 | -- Copyright (c) 1995-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 | class PresentationManager from PrsMgr |
| 18 | inherits TShared from MMgt |
| 19 | |
| 20 | ---Purpose: A framework to manage 3D displays, graphic entities and their updates. |
| 21 | -- Used in the AIS package (Application Interactive Services), to enable the advanced user to define the |
| 22 | -- default display mode of a new interactive object which extends the list of signatures and types. |
| 23 | -- Definition of new display types is handled by calling the presentation algorithms provided by the StdPrs package. |
| 24 | |
| 25 | uses |
| 26 | |
| 27 | StructureManager from Graphic3d, |
| 28 | PresentableObject from PrsMgr, |
| 29 | ListOfPresentations from PrsMgr, |
| 30 | Length,NameOfColor from Quantity, |
| 31 | Transformation from Geom, |
| 32 | NameOfMaterial from Graphic3d, |
| 33 | Presentation from PrsMgr, |
| 34 | Presentation3d from PrsMgr, |
| 35 | View from V3d, |
| 36 | ShadingAspect from Prs3d, |
| 37 | Presentation from Prs3d |
| 38 | |
| 39 | raises |
| 40 | |
| 41 | NoSuchObject from Standard |
| 42 | |
| 43 | is |
| 44 | |
| 45 | Create (theStructureManager : StructureManager from Graphic3d) |
| 46 | returns mutable PresentationManager from PrsMgr; |
| 47 | ---Purpose: |
| 48 | -- Creates a framework to manage displays and graphic entities with the 3D view theStructureManager. |
| 49 | |
| 50 | Display (me : mutable; |
| 51 | thePrsObject : mutable PresentableObject from PrsMgr; |
| 52 | theMode : Integer from Standard = 0) |
| 53 | ---Purpose: Displays the presentation of the object in the given Presentation manager with the given mode. |
| 54 | -- The mode should be enumerated by the object which inherits PresentableObject. |
| 55 | is static; |
| 56 | |
| 57 | Erase (me : mutable; |
| 58 | thePrsObject : PresentableObject from PrsMgr; |
| 59 | theMode : Integer from Standard = 0) |
| 60 | ---Level: public |
| 61 | ---Purpose: erases the presentation of the object in the given |
| 62 | -- Presentation manager with the given mode. |
| 63 | is static; |
| 64 | |
| 65 | Clear (me : mutable; |
| 66 | thePrsObject : PresentableObject from PrsMgr; |
| 67 | theMode : Integer from Standard = 0) |
| 68 | is virtual; |
| 69 | ---Purpose: |
| 70 | -- Clears the presentation of the presentable object thePrsObject in this framework with the display mode theMode. |
| 71 | |
| 72 | SetVisibility (me : mutable; |
| 73 | thePrsObject : PresentableObject from PrsMgr; |
| 74 | theMode : Integer from Standard; |
| 75 | theValue : Boolean from Standard); |
| 76 | ---Purpose: Sets the visibility of presentable object. |
| 77 | |
| 78 | Highlight (me : mutable; |
| 79 | thePrsObject : mutable PresentableObject from PrsMgr; |
| 80 | theMode : Integer from Standard = 0) |
| 81 | ---Purpose: Highlights the presentation of the presentable object |
| 82 | -- thePrsObject in this framework with the display mode theMode. |
| 83 | is static; |
| 84 | |
| 85 | Unhighlight (me : mutable; |
| 86 | thePrsObject : PresentableObject from PrsMgr; |
| 87 | theMode : Integer from Standard = 0) |
| 88 | ---Purpose: Removes highlighting from the presentation of the |
| 89 | -- presentable object thePrsObject in this framework with the display mode theMode. |
| 90 | is static; |
| 91 | |
| 92 | SetDisplayPriority (me; |
| 93 | thePrsObject : PresentableObject from PrsMgr; |
| 94 | theMode : Integer from Standard; |
| 95 | theNewPrior : Integer from Standard); |
| 96 | ---Purpose: |
| 97 | -- Sets the display priority theNewPrior of the |
| 98 | -- presentable object thePrsObject in this framework with the display mode theMode. |
| 99 | |
| 100 | DisplayPriority (me; |
| 101 | thePrsObject : PresentableObject from PrsMgr; |
| 102 | theMode : Integer from Standard) |
| 103 | returns Integer from Standard; |
| 104 | ---Purpose: |
| 105 | -- Returns the display priority of the presentable object |
| 106 | -- thePrsObject in this framework with the display mode theMode. |
| 107 | |
| 108 | SetZLayer (me : mutable; |
| 109 | thePrsObject : PresentableObject from PrsMgr; |
| 110 | theLayerId : Integer from Standard) |
| 111 | is static; |
| 112 | ---Purpose: Set Z layer ID for all presentations of the object. |
| 113 | |
| 114 | GetZLayer (me; |
| 115 | thePrsObject : PresentableObject from PrsMgr) |
| 116 | returns Integer from Standard is static; |
| 117 | ---Purpose: Get Z layer ID assigned to all presentations of the object. |
| 118 | -- Method returns -1 value if object has no presentations and is |
| 119 | -- impossible to get layer index. |
| 120 | |
| 121 | IsDisplayed (me; |
| 122 | thePrsObject : PresentableObject from PrsMgr; |
| 123 | theMode: Integer from Standard = 0) |
| 124 | --Purpose: Returns true if the presentation of the presentable |
| 125 | -- object thePrsObject in this framework with the display mode theMode is displayed. |
| 126 | returns Boolean from Standard |
| 127 | is static; |
| 128 | |
| 129 | IsHighlighted (me; |
| 130 | thePrsObject : PresentableObject from PrsMgr; |
| 131 | theMode: Integer from Standard = 0) |
| 132 | ---Purpose: Returns true if the presentation of the presentable |
| 133 | -- object thePrsObject in this framework with the display mode theMode is highlighted. |
| 134 | returns Boolean from Standard |
| 135 | is static; |
| 136 | |
| 137 | Update (me; |
| 138 | thePrsObject : PresentableObject from PrsMgr; |
| 139 | theMode : Integer from Standard = 0) |
| 140 | ---Purpose: Updates the presentation of the presentable object |
| 141 | -- thePrsObject in this framework with the display mode theMode. |
| 142 | is static; |
| 143 | |
| 144 | ---Category: Immediate display methods. |
| 145 | |
| 146 | BeginImmediateDraw (me : mutable); |
| 147 | ---Purpose: Resets the transient list of presentations previously displayed in immediate mode |
| 148 | -- and begins accumulation of new list by following AddToImmediateList()/Color()/Highlight() calls. |
| 149 | |
| 150 | ClearImmediateDraw (me : mutable); |
| 151 | ---Purpose: Resets the transient list of presentations previously displayed in immediate mode. |
| 152 | |
| 153 | AddToImmediateList (me : mutable; |
| 154 | thePrs : Presentation from Prs3d); |
| 155 | ---Purpose: Stores thePrs in the transient list of presentations to be displayed in immediate mode. |
| 156 | -- Will be taken in account in EndImmediateDraw method. |
| 157 | |
| 158 | EndImmediateDraw (me : mutable; |
| 159 | theView : View from V3d); |
| 160 | ---Purpose: Allows rapid drawing of the view theView by avoiding an update of the whole background. |
| 161 | |
| 162 | IsImmediateModeOn (me) returns Boolean from Standard; |
| 163 | ---C++: inline |
| 164 | ---Purpose: Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode. |
| 165 | |
| 166 | ---Category: Hilighting methods. |
| 167 | |
| 168 | Color (me : mutable; |
| 169 | thePrsObject : mutable PresentableObject from PrsMgr; |
| 170 | theColor : NameOfColor from Quantity = Quantity_NOC_YELLOW; |
| 171 | theMode : Integer from Standard = 0) |
| 172 | ---Purpose: Highlights the graphic object thePrsObject in the color theColor. |
| 173 | -- thePrsObject has the display mode theMode; |
| 174 | -- this has the default value of 0, that is, the wireframe display mode. |
| 175 | is static; |
| 176 | |
| 177 | BoundBox (me : mutable; |
| 178 | thePrsObject : mutable PresentableObject from PrsMgr; |
| 179 | theMode : Integer from Standard = 0) |
| 180 | ---Purpose: highlights the boundbox of the presentation |
| 181 | is static; |
| 182 | |
| 183 | ---Category: references to other presentation. |
| 184 | |
| 185 | Connect (me : mutable; |
| 186 | thePrsObject : PresentableObject from PrsMgr; |
| 187 | theOtherObject : mutable PresentableObject from PrsMgr; |
| 188 | theMode : Integer from Standard = 0; |
| 189 | theOtherMode : Integer from Standard = 0) |
| 190 | is static; |
| 191 | |
| 192 | ---Category: Transformation methods. |
| 193 | |
| 194 | Transform (me : mutable; |
| 195 | thePrsObject : PresentableObject from PrsMgr; |
| 196 | theTransformation : Transformation from Geom; |
| 197 | theMode : Integer from Standard = 0) |
| 198 | ---Purpose: |
| 199 | -- Sets the transformation theTransformation for the presentable object thePrsObject. |
| 200 | -- thePrsObject has the display mode theMode; this has the default value of 0, that is, the wireframe display mode. |
| 201 | is static; |
| 202 | |
| 203 | Place (me : mutable; |
| 204 | thePrsObject : PresentableObject from PrsMgr; |
| 205 | X, Y, Z : Length from Quantity; |
| 206 | theMode : Integer from Standard = 0) |
| 207 | ---Purpose: |
| 208 | -- Sets a position to move the presentable object |
| 209 | -- aPresentableObject to. This position is defined by the |
| 210 | -- lengths along the x, y and z axes: X, Y and Z respectively. |
| 211 | -- aPresentableObject has the display mode aMode; |
| 212 | -- this has the default value of 0, that is, the wireframe display mode. |
| 213 | is static; |
| 214 | |
| 215 | Multiply (me : mutable; |
| 216 | thePrsObject : PresentableObject from PrsMgr; |
| 217 | theTransformation : Transformation from Geom; |
| 218 | theMode : Integer from Standard = 0) |
| 219 | ---Purpose: |
| 220 | -- Defines the transformation theTransformation for the presentable object thePrsObject. |
| 221 | -- thePrsObject has the display mode aMode; this has the default value of 0, that is, the wireframe display mode. |
| 222 | is static; |
| 223 | |
| 224 | Move (me : mutable; |
| 225 | thePrsObject : PresentableObject from PrsMgr; |
| 226 | X, Y, Z : Length from Quantity; |
| 227 | theMode : Integer from Standard = 0) |
| 228 | ---Purpose: |
| 229 | -- Sets a position to move the presentable object thePrsObject to. This position is defined by the lengths along the x, y and z axes: X, Y and Z respectively. |
| 230 | -- thePrsObject has the display mode aMode; this has the default value of 0, that is, the wireframe display mode. |
| 231 | is static; |
| 232 | |
| 233 | StructureManager (me) returns mutable StructureManager from Graphic3d |
| 234 | is static; |
| 235 | ---C++: inline |
| 236 | ---C++: return const& |
| 237 | ---Purpose: Returns the structure manager. |
| 238 | |
| 239 | SetShadingAspect (me : mutable; |
| 240 | thePrsObject : PresentableObject from PrsMgr; |
| 241 | theColor : NameOfColor from Quantity; |
| 242 | theMaterial : NameOfMaterial from Graphic3d; |
| 243 | theMode : Integer from Standard = 0) |
| 244 | ---Purpose: this method will change the color and the aspect of the presentations containing shaded structures. |
| 245 | is static; |
| 246 | |
| 247 | SetShadingAspect (me : mutable; |
| 248 | thePrsObject : PresentableObject from PrsMgr; |
| 249 | theShadingAspect : ShadingAspect from Prs3d; |
| 250 | theMode : Integer from Standard = 0) |
| 251 | ---Purpose: this method will change the color and the aspect of the presentations containing shaded structures. |
| 252 | is static; |
| 253 | |
| 254 | CastPresentation (me; |
| 255 | thePrsObject : PresentableObject from PrsMgr; |
| 256 | theMode : Integer from Standard = 0) |
| 257 | returns mutable Presentation3d from PrsMgr |
| 258 | is static; |
| 259 | |
| 260 | ---Category: Private & deferred methods. |
| 261 | |
| 262 | HasPresentation (me; |
| 263 | thePrsObject : PresentableObject from PrsMgr; |
| 264 | theMode : Integer from Standard = 0) |
| 265 | returns Boolean from Standard |
| 266 | is static; |
| 267 | ---Purpose: Returns true if there is a presentation of the |
| 268 | -- presentable object thePrsObject in this framework, thePrsObject having the display mode theMode. |
| 269 | |
| 270 | Presentation (me; |
| 271 | thePrsObject : PresentableObject from PrsMgr; |
| 272 | theMode : Integer from Standard = 0) |
| 273 | returns mutable Presentation from PrsMgr |
| 274 | raises NoSuchObject from Standard |
| 275 | is static; |
| 276 | ---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework. thePrsObject has the display mode theMode. |
| 277 | |
| 278 | AddPresentation (me : mutable; |
| 279 | thePrsObject : PresentableObject from PrsMgr; |
| 280 | theMode : Integer from Standard = 0) |
| 281 | ---Purpose: Adds a presentation of the presentable object thePrsObject to this framework. |
| 282 | -- thePrsObject has the display mode theMode. |
| 283 | is protected; |
| 284 | |
| 285 | RemovePresentation (me : mutable; |
| 286 | thePrsObject : PresentableObject from PrsMgr; |
| 287 | theMode : Integer from Standard = 0) |
| 288 | ---Purpose: Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode. |
| 289 | is protected; |
| 290 | |
| 291 | fields |
| 292 | |
| 293 | myStructureManager : StructureManager from Graphic3d is protected; |
| 294 | myImmediateModeOn : Integer from Standard is protected; |
| 295 | myImmediateList : ListOfPresentations from PrsMgr is protected; |
| 296 | myImmediateView : View from V3d is protected; |
| 297 | |
| 298 | end PresentationManager from PrsMgr; |