| 1 | -- Created on: 1995-02-20 |
| 2 | -- Created by: Mister rmi |
| 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 | deferred class SelectableObject from SelectMgr inherits PresentableObject from PrsMgr |
| 18 | |
| 19 | ---Purpose: A framework to supply the structure of the object to be |
| 20 | -- selected. At the first pick, this structure is created by |
| 21 | -- calling the appropriate algorithm and retaining this |
| 22 | -- framework for further picking. |
| 23 | -- This abstract framework is inherited in Application |
| 24 | -- Interactive Services (AIS), notably in AIS_InteractiveObject. |
| 25 | -- Consequently, 3D selection should be handled by the |
| 26 | -- relevant daughter classes and their member functions |
| 27 | -- in AIS. This is particularly true in the creation of new interactive objects. |
| 28 | |
| 29 | |
| 30 | uses |
| 31 | |
| 32 | SelectionManager from SelectMgr, |
| 33 | Selection from SelectMgr, |
| 34 | SequenceOfSelection from SelectMgr, |
| 35 | TypeOfPresentation3d from PrsMgr, |
| 36 | Presentation from Prs3d, |
| 37 | PresentationManager from PrsMgr, |
| 38 | PresentationManager3d from PrsMgr, |
| 39 | SequenceOfOwner from SelectMgr, |
| 40 | NameOfColor from Quantity, |
| 41 | EntityOwner from SelectMgr, |
| 42 | TransModeFlags from Graphic3d |
| 43 | |
| 44 | raises |
| 45 | NotImplemented from Standard |
| 46 | |
| 47 | is |
| 48 | |
| 49 | |
| 50 | ---Category: deferred Methods |
| 51 | |
| 52 | |
| 53 | Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView); |
| 54 | |
| 55 | ComputeSelection(me:mutable; aSelection : Selection from SelectMgr; |
| 56 | aMode : Integer) is deferred; |
| 57 | ---Purpose: Recovers and calculates any sensitive primitive, |
| 58 | -- aSelection, available in Shape mode, specified by |
| 59 | -- aMode. As a rule, these are sensitive faces. |
| 60 | -- This method is defined as virtual. This enables you to |
| 61 | -- implement it in the creation of a new class of AIS |
| 62 | -- Interactive Object. You need to do this and in so |
| 63 | -- doing, redefine this method, if you create a class |
| 64 | -- which enriches the list of signatures and types. |
| 65 | |
| 66 | NbPossibleSelection(me) returns Integer from Standard is virtual; |
| 67 | ---Level: Public |
| 68 | ---Purpose: defines the number of different modes of selection |
| 69 | -- (or decomposition) for an Object. |
| 70 | |
| 71 | |
| 72 | |
| 73 | ---Category: |
| 74 | |
| 75 | |
| 76 | UpdateSelection (me:mutable) is static; |
| 77 | ---Purpose: re-computes the sensitive primitives for all modes |
| 78 | |
| 79 | UpdateSelection (me:mutable; aMode: Integer from Standard) is static; |
| 80 | ---Purpose: re-computes the sensitive primitives which correspond to |
| 81 | -- the <amode>th selection mode. |
| 82 | |
| 83 | |
| 84 | AddSelection(me:mutable ;aSelection: Selection from SelectMgr; |
| 85 | aMode : Integer) |
| 86 | is static; |
| 87 | ---Purpose: Adds the selection aSelection with the selection mode |
| 88 | -- index aMode to this framework. |
| 89 | |
| 90 | |
| 91 | ClearSelections(me:mutable; update: Boolean from Standard = Standard_False) is static; |
| 92 | ---Level: Public |
| 93 | ---Purpose: Empties all the selections in the SelectableObject |
| 94 | -- <update> parameter defines whether all object's |
| 95 | -- selections should be flagged for further update or not. |
| 96 | -- This improved method can be used to recompute an |
| 97 | -- object's selection (without redisplaying the object |
| 98 | -- completely) when some selection mode is activated not for the first time. |
| 99 | |
| 100 | Selection(me;aMode : Integer) |
| 101 | returns any Selection from SelectMgr |
| 102 | is static; |
| 103 | ---C++: return const& |
| 104 | ---Purpose: Returns the selection Selection having the selection mode aMode. |
| 105 | |
| 106 | HasSelection(me; aMode: Integer) |
| 107 | returns Boolean from Standard is static ; |
| 108 | --- Purpose: Returns true if a selection corresponding to the |
| 109 | -- selection mode aMode is present in this framework. |
| 110 | |
| 111 | |
| 112 | |
| 113 | Init(me:mutable) is static; |
| 114 | ---Purpose: Begins the iteration scanning for sensitive primitives. |
| 115 | ---C++: inline |
| 116 | |
| 117 | |
| 118 | More(me) returns Boolean is static; |
| 119 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
| 120 | ---C++: inline |
| 121 | |
| 122 | |
| 123 | |
| 124 | Next(me:mutable) is static; |
| 125 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
| 126 | ---C++: inline |
| 127 | |
| 128 | |
| 129 | |
| 130 | CurrentSelection(me) returns any Selection from SelectMgr; |
| 131 | ---Purpose: Returns the current selection in this framework. |
| 132 | ---C++: return const& |
| 133 | ---C++: inline |
| 134 | |
| 135 | |
| 136 | ResetTransformation(me:mutable) is redefined static; |
| 137 | |
| 138 | UpdateTransformation(me:mutable) is redefined virtual; |
| 139 | ---Purpose: Recomputes the location of the selection aSelection. |
| 140 | |
| 141 | UpdateTransformation(me:mutable;aSelection: Selection from SelectMgr) is virtual protected; |
| 142 | ---Level: Internal |
| 143 | ---Purpose: Updates locations in all sensitive entities from <aSelection> |
| 144 | -- and in corresponding entity owners. |
| 145 | |
| 146 | HilightSelected ( me : mutable; PM : PresentationManager3d from PrsMgr; |
| 147 | Seq : SequenceOfOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
| 148 | ---Purpose: Method which draws selected owners ( for fast presentation draw ) |
| 149 | |
| 150 | ClearSelected ( me : mutable ) is virtual; |
| 151 | ---Purpose: Method which clear all selected owners belonging |
| 152 | -- to this selectable object ( for fast presentation draw ) |
| 153 | |
| 154 | HilightOwnerWithColor ( me : mutable; thePM : PresentationManager3d from PrsMgr; |
| 155 | theColor : NameOfColor from Quantity; |
| 156 | theOwner : EntityOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
| 157 | ---Purpose: Method which hilight an owner belonging to |
| 158 | -- this selectable object ( for fast presentation draw ) |
| 159 | |
| 160 | IsAutoHilight ( me ) returns Boolean from Standard is virtual; |
| 161 | ---Purpose: If returns True, the old mechanism for highlighting |
| 162 | -- selected objects is used (HilightSelected Method may be empty). |
| 163 | -- If returns False, the HilightSelected method will be |
| 164 | -- fully responsible for highlighting selected entity |
| 165 | -- owners belonging to this selectable object. |
| 166 | |
| 167 | SetAutoHilight ( me : mutable; newAutoHilight : Boolean from Standard ) is virtual; |
| 168 | ---Purpose: Set AutoHilight property to true or false |
| 169 | |
| 170 | -- SetTransformPersistence( me : mutable; |
| 171 | -- aFlag : TransModeFlags from Graphic3d ) is redefined; |
| 172 | ---Level: Public |
| 173 | ---Purpose: Sets up Transform Persistence Mode for this object |
| 174 | ---Category: Graphic attributes management |
| 175 | |
| 176 | GetHilightPresentation( me: mutable; |
| 177 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
| 178 | |
| 179 | GetSelectPresentation( me: mutable; |
| 180 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
| 181 | |
| 182 | SetZLayer ( me : mutable; |
| 183 | thePrsMgr : PresentationManager from PrsMgr; |
| 184 | theLayerId : Integer from Standard ) |
| 185 | is redefined virtual; |
| 186 | ---Purpose: Set Z layer ID and update all presentations of |
| 187 | -- the selectable object. The layer can be set only for displayed object. |
| 188 | -- If all object presentations are removed, the layer ID will be set to |
| 189 | -- default value when computing presentation. The layers mechanism allows |
| 190 | -- drawing objects in higher layers in overlay of objects in lower layers. |
| 191 | |
| 192 | fields |
| 193 | |
| 194 | myselections : SequenceOfSelection is protected; |
| 195 | mycurrent : Integer; |
| 196 | myAutoHilight : Boolean from Standard; |
| 197 | |
| 198 | mySelectionPrs : Presentation from Prs3d; |
| 199 | myHilightPrs : Presentation from Prs3d; |
| 200 | |
| 201 | friends |
| 202 | class SelectionManager from SelectMgr |
| 203 | |
| 204 | end SelectableObject; |
| 205 | |
| 206 | |
| 207 | |