0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one...
[occt.git] / src / Select3D / Select3D_SensitiveEntity.cdl
1 -- File:        Select3D_SensitiveEntity.cdl
2 -- Created:     Tue Jan 24 09:30:34 1995
3 -- Author:      Rob
4 -- modified by rob jul/ 21/ 97 : inserting locations ...
5 -- modified by rob jan/ 29/ 98 : Sort by deph-> add a field to be able
6 --                               to compute a depth
7 --                               -> Virtual methods rather than
8 --                               Deferred for Project
9 --                               WARNING : Must be redefined for
10 --                               each kind of sensitive entity
11 --
12 ---Copyright:    Matra Datavision 1995
13
14
15 deferred class SensitiveEntity from Select3D inherits
16     SensitiveEntity from SelectBasics
17
18         ---Purpose:  Abstract framework to define 3D sensitive entities.
19         -- As the selection process uses the principle of a
20         -- projection of 3D shapes onto a 2D view where
21         -- nearness to a rectangle determines whether a shape
22         -- is picked or not, all 3D shapes need to be converted
23         -- into 2D ones in order to be selected.
24
25
26 uses
27
28     Projector   from Select3D,
29     EntityOwner from SelectBasics,
30     Location    from TopLoc,
31     Lin         from gp,
32     Box2d       from Bnd,
33     Array1OfPnt2d from TColgp
34
35 is
36
37     Initialize(OwnerId : EntityOwner from SelectBasics);
38
39     NeedsConversion(me) returns Boolean is redefined static;
40     ---Level: Public
41     ---Purpose: Returns true if this framework needs conversion.
42     ---C++: inline
43
44     Is3D(me) returns Boolean from Standard is redefined static;
45     ---Purpose: Returns true if this framework provides 3D information.
46
47     Project (me:mutable;aProjector : Projector from Select3D) is virtual;
48     ---Level: Public
49         ---Purpose:Returns the projector aProjector.
50         --       In classes inheriting this framework, you must
51         -- redefine this function in order to get a sensitive 2D
52         -- rectangle from a 3D entity. This rectangle is the
53         -- sensitive zone which makes the 3D entity selectable.
54
55
56     MaxBoxes(me) returns Integer is redefined virtual;
57     ---Level: Public
58     ---Purpose: Returns the max number of sensitive areas returned
59     --          by this class is 1 by default.
60     --          Else on must redefine this method.
61
62
63     GetConnected(me:mutable;aLocation: Location from TopLoc)
64     returns SensitiveEntity from Select3D is virtual;
65     ---Purpose: Originally this method intended to return sensitive 
66     -- entity with new location aLocation, but currently sensitive 
67     -- entities do not hold a location, instead HasLocation() and 
68     -- Location() methods call corresponding entity owner's methods. 
69     -- Thus all entities returned by GetConnected() share the same 
70     -- location propagated from corresponding selectable object. 
71     -- You must redefine this function for any type of
72     -- sensitive entity which can accept another connected
73     -- sensitive entity.//can be connected to another sensitive entity.
74
75     Matches(me  :mutable;
76             X,Y : Real from Standard;
77             aTol: Real from Standard;
78             DMin: out Real from Standard)
79     returns Boolean is redefined virtual;
80     ---Purpose: Matches the coordinates X, Y with the entity found at
81     -- that point within the tolerance aTol and the minimum depth DMin.
82     -- You must redefine this function for every inheriting entity.
83     -- You will have to call this framework inside the redefined function.
84
85     Matches (me  :mutable;
86              XMin,YMin,XMax,YMax : Real from Standard;
87              aTol: Real from Standard)
88     returns Boolean from Standard is redefined virtual;
89     ---Purpose: Matches the box defined by the coordinates Xmin,
90     -- Ymin, Xmax, Ymax with the entity found at that point
91     -- within the tolerance aTol.
92     -- Xmin, YMin define the minimum point in the lower left
93     -- hand corner of the box, and   XMax, YMax define the
94     -- maximum point in the upper right hand corner of the box.
95     -- You must redefine this function for every inheriting entity.
96     -- You will have to call this framework inside the redefined function.
97
98     Matches (me  :mutable;
99              Polyline:Array1OfPnt2d from TColgp;
100              aBox:Box2d from Bnd;
101              aTol: Real from Standard)
102     returns Boolean from Standard is redefined virtual;
103     ---Purpose: prevents from hiding virtual methods...
104
105
106     GetEyeLine(me; X,Y : Real from Standard) returns Lin from gp;
107     ---Purpose: Returns the eye line for the point defined by the coordinates X,Y.
108
109     ComputeDepth(me;EyeLine : Lin from gp) returns Real from Standard
110     is deferred;
111     ---Purpose: Returns the depth of this object on the line EyeLine.
112     -- EyeLine goes through the eye towards a point
113     -- defined by the coordinates X,Y in the function GetEyeLine.
114     ---Purpose: gives an abcissa on <aLin> .
115     --          <aLin> represents the line going through
116     --          the eye towards an X,Y point on the screen. This Method
117     --          must return a mean Depth on this line.
118
119
120     Depth(me) returns Real from Standard is redefined;
121
122     ---Category: Location of sensitive entities...
123     --           Default implementations of HasLocation() and Location() rely on
124     --           location obtained from the entity owner, to minimize memory usage.
125     --           SetLocation() and ResetLocation() do nothing by default.
126
127     HasLocation(me) returns Boolean from Standard is virtual;
128     ---Purpose: Returns true if this framework has a location defined.
129
130     Location(me) returns Location from TopLoc is virtual;
131     ---C++: return const&
132
133     ResetLocation(me:mutable) is virtual;
134     ---Purpose: sets the location to Identity
135
136     SetLocation(me:mutable;aLoc :Location from TopLoc) is virtual;
137
138     Dump(me; S: in out OStream;FullDump : Boolean from Standard = Standard_True) is virtual;
139     ---Purpose: 2 options :
140     --          <FullDump> = False -> general information
141     --          <FullDump> = True  -> whole informtion 3D +2d ...
142
143     DumpBox(myclass; S: in out OStream;abox:Box2d from Bnd) ;
144
145     UpdateLocation(me:mutable;aLoc:Location from TopLoc);
146
147
148     SetLastPrj(me:mutable;aPrj:Projector from Select3D) is virtual;
149
150     SetLastDepth(me:mutable; aDepth: Real from Standard) is protected;
151
152 fields
153
154     mylastprj     : Projector from Select3D  is protected;
155     mylastdepth   : ShortReal from Standard;
156 end SensitiveEntity;
157
158
159
160
161
162