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