c46a03d66b995f22f403cd15714b98ae9b1767c1
[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-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 jul/ 21/ 97 : inserting locations ...
18 -- modified by rob jan/ 29/ 98 : Sort by deph-> add a field to be able
19 --                               to compute a depth
20 --                               -> Virtual methods rather than
21 --                               Deferred for Project
22 --                               WARNING : Must be redefined for
23 --                               each kind of sensitive entity
24
25
26 deferred class SensitiveEntity from Select3D inherits
27     SensitiveEntity from SelectBasics
28
29         ---Purpose:  Abstract framework to define 3D sensitive entities.
30         -- As the selection process uses the principle of a
31         -- projection of 3D shapes onto a 2D view where
32         -- nearness to a rectangle determines whether a shape
33         -- is picked or not, all 3D shapes need to be converted
34         -- into 2D ones in order to be selected.
35
36
37 uses
38
39     Projector   from Select3D,
40     EntityOwner from SelectBasics,
41     Location    from TopLoc,
42     Lin         from gp,
43     Box2d       from Bnd,
44     Array1OfPnt2d from TColgp
45
46 is
47
48     Initialize(OwnerId : EntityOwner from SelectBasics);
49
50     NeedsConversion(me) returns Boolean is redefined static;
51     ---Level: Public
52     ---Purpose: Returns true if this framework needs conversion.
53     ---C++: inline
54
55     Is3D(me) returns Boolean from Standard is redefined static;
56     ---Purpose: Returns true if this framework provides 3D information.
57
58     Project (me:mutable;aProjector : Projector from Select3D) is deferred;
59     ---Level: Public
60     ---Purpose: In classes inheriting this framework, you must
61     -- redefine this function in order to get a sensitive 2D
62     -- rectangle from a 3D entity. This rectangle is the
63     -- sensitive zone which makes the 3D entity selectable.
64
65     MaxBoxes(me) returns Integer is redefined virtual;
66     ---Level: Public
67     ---Purpose: Returns the max number of sensitive areas returned
68     --          by this class is 1 by default.
69     --          Else on must redefine this method.
70
71
72     GetConnected(me:mutable;aLocation: Location from TopLoc)
73     returns SensitiveEntity from Select3D is virtual;
74     ---Purpose: Originally this method intended to return sensitive 
75     -- entity with new location aLocation, but currently sensitive 
76     -- entities do not hold a location, instead HasLocation() and 
77     -- Location() methods call corresponding entity owner's methods. 
78     -- Thus all entities returned by GetConnected() share the same 
79     -- location propagated from corresponding selectable object. 
80     -- You must redefine this function for any type of
81     -- sensitive entity which can accept another connected
82     -- sensitive entity.//can be connected to another sensitive entity.
83
84     Matches (me  :mutable;
85              XMin,YMin,XMax,YMax : Real from Standard;
86              aTol: Real from Standard)
87     returns Boolean from Standard is redefined virtual;
88     ---Purpose: Matches the box defined by the coordinates Xmin,
89     -- Ymin, Xmax, Ymax with the entity found at that point
90     -- within the tolerance aTol.
91     -- Xmin, YMin define the minimum point in the lower left
92     -- hand corner of the box, and   XMax, YMax define the
93     -- maximum point in the upper right hand corner of the box.
94     -- You must redefine this function for every inheriting entity.
95     -- You will have to call this framework inside the redefined function.
96
97     Matches (me  :mutable;
98              Polyline:Array1OfPnt2d from TColgp;
99              aBox:Box2d from Bnd;
100              aTol: Real from Standard)
101     returns Boolean from Standard is redefined virtual;
102     ---Purpose: prevents from hiding virtual methods...
103
104     ---Category: Location of sensitive entities...
105     --           Default implementations of HasLocation() and Location() rely on
106     --           location obtained from the entity owner, to minimize memory usage.
107     --           SetLocation() and ResetLocation() do nothing by default.
108
109     HasLocation(me) returns Boolean from Standard is virtual;
110     ---Purpose: Returns true if this framework has a location defined.
111
112     Location(me) returns Location from TopLoc is virtual;
113     ---C++: return const&
114
115     ResetLocation(me:mutable) is virtual;
116     ---Purpose: sets the location to Identity
117
118     SetLocation(me:mutable;aLoc :Location from TopLoc) is virtual;
119
120     Dump(me; S: in out OStream;FullDump : Boolean from Standard = Standard_True) is virtual;
121     ---Purpose: 2 options :
122     --          <FullDump> = False -> general information
123     --          <FullDump> = True  -> whole informtion 3D +2d ...
124
125     DumpBox(myclass; S: in out OStream;abox:Box2d from Bnd) ;
126
127     UpdateLocation(me:mutable;aLoc:Location from TopLoc);
128
129 end SensitiveEntity;
130
131
132
133
134
135