38a5ca23986f0ef93f020a08b91cb2b0cccf2278
[occt.git] / src / SelectMgr / SelectMgr_EntityOwner.cdl
1 -- Created on: 1995-05-23
2 -- Created by: Robert COUBLANC
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 --Modified by rob October 25 97 store locations...
18 --                jun 17 98 : Add virtual methods HasShape, GetShape.
19 --                            by default return False and Null Shape...         
20
21
22
23
24 class EntityOwner from SelectMgr inherits EntityOwner from SelectBasics
25
26         ---Purpose: A framework to define classes of owners of sensitive primitives.
27         -- The owner is the link between application and
28         -- selection data structures.
29         -- For the application to make its own objects selectable,
30         -- it must define owner classes inheriting this framework.
31         --           
32
33 uses
34     SelectableObject       from SelectMgr,
35     SOPtr                  from SelectMgr,
36     NameOfColor            from Quantity,
37     Location               from TopLoc,
38     PresentationManager    from PrsMgr,
39     PresentationManager3d  from PrsMgr
40
41 raises
42     NoSuchObject from Standard
43 is
44
45     Create (aPriority: Integer = 0) returns EntityOwner from SelectMgr;
46         --- Purpose: Initializes the selection priority aPriority.  
47     Create (aSO      : SelectableObject;
48             aPriority : Integer=0)
49     returns EntityOwner from SelectMgr;
50         ---Purpose: Constructs a framework with the selectable object
51         -- anSO being attributed the selection priority aPriority.
52
53     Create (theOwner : EntityOwner from SelectMgr;
54             aPriority : Integer=0)
55       returns EntityOwner from SelectMgr;
56         ---Purpose: Constructs a framework from existing one
57         -- anSO being attributed the selection priority aPriority.
58         
59     HasSelectable(me) returns Boolean from Standard;
60         ---Purpose: Returns true if there is a selectable object to serve as an owner.
61
62     Selectable(me) returns any SelectableObject from SelectMgr
63         ---Purpose: Returns a selectable object detected in the working context.
64     raises NoSuchObject from Standard
65     is  virtual;
66     
67     Set(me:mutable; aSO : SelectableObject) is static;    
68         ---Purpose: Sets the selectable object anSO to be used by the
69         -- second constructor above.
70
71             ---Category: hilight of the owner when detected...
72             --           the following virtual methods have a default
73             --           implementation which acts on stored selectable
74             --           if it exists. else does nothing.
75             --           WARNING: if methods are redefined in inheriting
76             --           classes :
77             --            if the hilight methods don't use presentable objects
78             --            YOU MUST :
79             --            1) ask The presentationManager if it is in
80             --               immediate mode
81             --            2) if it is, add your presentation to 
82             --               the immediate list of presentation manager.
83             --           
84
85     Hilight(me:mutable) is virtual;    
86         ---Purpose: Provides a framework to highlight any selectable
87         -- object found subsequently which can serve as an
88         -- owner of a sensitive primitive.
89     IsHilighted (me  ;
90                  aPM   : PresentationManager from PrsMgr;
91                  aMode : Integer  from  Standard  =0)
92     returns Boolean from Standard is virtual;    
93         ---Purpose: Returns true if the presentation manager aPM
94         -- highlights selections corresponding to the selection mode aMode.
95
96     Hilight(me    : mutable;
97             aPM   : PresentationManager from PrsMgr;
98             aMode : Integer  from  Standard  =0) is virtual;    
99       ---Purpose: Highlights the owner of a detected selectable object in
100       -- the presentation manager aPM. This object could be
101       -- the owner of a sensitive primitive.
102       -- The display mode for the highlight is aMode; this has
103       -- the default value of 0, that is, wireframe mode.  
104     
105     HilightWithColor  (me    : mutable;
106                        aPM   : PresentationManager3d from PrsMgr;
107                        aColor: NameOfColor from Quantity;
108                        aMode : Integer  from  Standard  =0) is virtual;    
109
110     Unhilight(me    : mutable;
111               aPM   : PresentationManager from PrsMgr;
112               aMode : Integer  from  Standard  =0) is virtual;    
113         ---Purpose: Removes highlighting from the owner of a detected
114         -- selectable object in the presentation manager aPM.
115         -- This object could be the owner of a sensitive primitive.
116         -- The display mode for the highlight is aMode; this has
117         -- the default value of 0, that is, wireframe mode. 
118         
119     Clear(me: mutable;  
120           aPM   : PresentationManager from PrsMgr;
121           aMode : Integer  from  Standard  =0) is virtual;    
122         ---Purpose: Clears the owners matching the value of the selection
123         -- mode aMode from the presentation manager object aPM.
124
125     ---Category: internal methods for location on  objects...
126     --           Default implementations of HasLocation() and Location() rely on 
127     --           location obtained from <mySelectable> field, to minimize memory usage.
128     --           SetLocation() and ResetLocation() do nothing by default.
129     HasLocation(me) returns Boolean from Standard is redefined;
130     SetLocation(me:mutable; aLoc : Location from TopLoc) is redefined;
131     ResetLocation(me:mutable) is redefined;
132     Location(me) returns Location from TopLoc is redefined;
133
134     --very Internal method (to be used in selection process only...)
135
136     SetSelected(me:mutable;theIsSelected : Boolean from Standard);
137       ---C++: inline
138       ---Purpose:Set the state of the owner.
139       -- @param theIsSelected [in] shows if owner is selected.
140     IsSelected(me) returns Boolean from Standard;
141       ---C++: inline
142       ---Purpose: @return Standard_True if the owner is selected.
143
144     State(me:mutable;aStatus:Integer from Standard);
145     ---C++: inline
146     ---Purpose:Set the state of the owner.
147     -- The method is deprecated. Use SetSelected() instead.
148
149     State(me)  returns Integer from Standard;
150     ---C++: inline
151     -- @return 1 if the owner is selected and 0 otherwise.
152     -- The method is deprecated. Use IsSelected() instead.
153
154     IsAutoHilight ( me ) returns Boolean from Standard is virtual; 
155     ---Purpose: if owner is not auto hilighted, for group contains many such owners 
156     --          will be called one method HilightSelected of SelectableObject 
157
158     IsForcedHilight ( me ) returns Boolean from Standard is virtual; 
159     ---Purpose: if this method returns TRUE the owner will allways call method
160     --          Hilight for SelectableObject when the owner is detected. By default 
161     --          it always return FALSE.  
162
163     SetZLayer ( me         : mutable;
164                 thePrsMgr  : PresentationManager from PrsMgr;
165                 theLayerId : Integer from Standard )
166       is virtual;
167     ---Purpose: Set Z layer ID and update all presentations.
168
169 fields
170
171     mySelectable        : SOPtr;
172
173     myIsSelected : Boolean from Standard;
174     ---Purpose: Describes selection state of this owner:
175     -- Standard_False: the owner not selected
176     -- Standard_True: the owner is selected.
177     
178
179 end EntityOwner;