0024394: Visualization - implement more general way for rendering of immediate objects
[occt.git] / src / SelectMgr / SelectMgr_SelectableObject.cdl
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     ZLayerId              from Graphic3d
44
45 raises 
46     NotImplemented from Standard
47
48 is
49
50
51     ---Category: deferred Methods 
52
53
54     Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
55
56     ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
57                                  aMode      : Integer) is deferred;
58         ---Purpose: Recovers and calculates any sensitive primitive,
59         -- aSelection, available in Shape mode, specified by
60         -- aMode. As a rule, these are sensitive faces.
61         -- This method is defined as virtual. This enables you to
62         -- implement it in the creation of a new class of AIS
63         -- Interactive Object. You need to do this and in so
64         -- doing, redefine this method, if you create a class
65         -- which enriches the list of signatures and types.  
66     
67     NbPossibleSelection(me) returns Integer from Standard is virtual;
68         ---Level: Public 
69         ---Purpose: defines the number of different modes of selection
70         --          (or decomposition) for an Object.
71     
72
73
74     ---Category: 
75     
76     
77     UpdateSelection (me:mutable) is static;
78         ---Purpose: re-computes the sensitive primitives for all modes
79     
80     UpdateSelection (me:mutable; aMode: Integer from Standard) is static;
81         ---Purpose: re-computes the sensitive primitives which correspond to
82         --          the <amode>th selection mode.   
83
84
85     AddSelection(me:mutable ;aSelection: Selection from SelectMgr;
86                              aMode : Integer) 
87     is static;
88         ---Purpose: Adds the selection aSelection with the selection mode
89         -- index aMode to this framework.
90
91
92     ClearSelections(me:mutable; update: Boolean from Standard = Standard_False) is static;
93         ---Level: Public 
94         ---Purpose: Empties all the selections in the SelectableObject
95         --          <update> parameter defines whether all object's
96         -- selections should be flagged for further update or not.
97         -- This improved method can be used to recompute an
98         -- object's selection (without redisplaying the object
99         -- completely) when some selection mode is activated not for the first time.
100
101     Selection(me;aMode : Integer) 
102     returns any Selection from SelectMgr 
103     is  static;
104         ---C++:  return const& 
105         ---Purpose: Returns the selection Selection having the selection mode aMode.
106
107     HasSelection(me; aMode: Integer) 
108     returns Boolean from Standard is static ;
109         --- Purpose: Returns true if a selection corresponding to the
110         -- selection mode aMode is present in this framework.   
111
112
113     
114     Init(me:mutable) is static;
115     ---Purpose: Begins the iteration scanning for sensitive primitives.
116     ---C++: inline
117
118
119     More(me) returns Boolean is static;
120     ---Purpose: Continues the iteration scanning for sensitive primitives.
121     ---C++: inline
122     
123
124
125     Next(me:mutable) is static;
126     ---Purpose: Continues the iteration scanning for sensitive primitives.
127     ---C++: inline
128     
129
130
131     CurrentSelection(me) returns any Selection from SelectMgr;
132     ---Purpose: Returns the current selection in this framework. 
133     ---C++: return const&
134     ---C++: inline
135     
136
137     ResetTransformation(me:mutable) is redefined static;
138     
139     UpdateTransformation(me:mutable) is redefined virtual;
140         ---Purpose: Recomputes the location of the selection aSelection.
141
142     UpdateTransformations(me:mutable;aSelection: Selection from SelectMgr) is virtual;
143     ---Level: Public
144     ---Purpose: Updates locations in all sensitive entities from <aSelection> 
145     --          and in corresponding entity owners.
146         
147     HilightSelected       ( me : mutable; PM : PresentationManager3d from PrsMgr; 
148                             Seq : SequenceOfOwner from SelectMgr ) raises NotImplemented from Standard is virtual;
149     ---Purpose: Method which draws selected owners ( for fast presentation draw )
150
151     ClearSelected         ( me : mutable ) is virtual;
152         ---Purpose: Method which clear all selected owners belonging
153         -- to this selectable object ( for fast presentation draw )
154
155     HilightOwnerWithColor ( me : mutable; thePM : PresentationManager3d from PrsMgr;
156                             theColor  : NameOfColor from Quantity;
157                             theOwner  : EntityOwner from SelectMgr ) raises NotImplemented from Standard is virtual;
158         ---Purpose: Method which hilight an owner belonging to
159         -- this selectable object  ( for fast presentation draw )
160
161     IsAutoHilight  ( me ) returns Boolean from Standard is virtual;
162         ---Purpose: If returns True, the old mechanism for highlighting
163         -- selected objects is used (HilightSelected Method may be empty).
164         -- If returns False, the HilightSelected method will be
165         -- fully responsible for highlighting selected entity
166         -- owners belonging to this selectable object.
167
168     SetAutoHilight ( me : mutable; newAutoHilight : Boolean from Standard ) is virtual;
169         ---Purpose: Set AutoHilight property to true or false 
170      
171    -- SetTransformPersistence(  me     :  mutable; 
172    --                         aFlag  :  TransModeFlags  from  Graphic3d ) is redefined; 
173    ---Level:    Public 
174    ---Purpose:  Sets  up  Transform  Persistence Mode  for  this  object 
175       ---Category: Graphic attributes management
176      
177     GetHilightPresentation(  me: mutable;
178                              TheMgr:  PresentationManager3d from PrsMgr )  returns Presentation from Prs3d  is  static; 
179     
180     GetSelectPresentation(   me: mutable;
181                              TheMgr:  PresentationManager3d from PrsMgr )  returns Presentation from Prs3d  is  static; 
182
183    SetZLayer ( me         : mutable;
184                theLayerId : ZLayerId from Graphic3d )
185      is redefined virtual;
186    ---Purpose: Set Z layer ID and update all presentations of the selectable object.
187    -- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
188
189 fields
190
191     myselections        : SequenceOfSelection is protected;
192     mycurrent           : Integer;
193     myAutoHilight       : Boolean from Standard;
194
195     mySelectionPrs      : Presentation from Prs3d;
196     myHilightPrs        : Presentation from Prs3d;
197
198 end SelectableObject;