1 -- File: Select3D_SensitiveEntity.cdl
2 -- Created: Tue Jan 24 09:30:34 1995
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
7 -- -> Virtual methods rather than
8 -- Deferred for Project
9 -- WARNING : Must be redefined for
10 -- each kind of sensitive entity
12 ---Copyright: Matra Datavision 1995
15 deferred class SensitiveEntity from Select3D inherits
16 SensitiveEntity from SelectBasics
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.
28 Projector from Select3D,
29 EntityOwner from SelectBasics,
33 Array1OfPnt2d from TColgp
37 Initialize(OwnerId : EntityOwner from SelectBasics);
39 NeedsConversion(me) returns Boolean is redefined static;
41 ---Purpose: Returns true if this framework needs conversion.
44 Is3D(me) returns Boolean from Standard is redefined static;
45 ---Purpose: Returns true if this framework provides 3D information.
47 Project (me:mutable;aProjector : Projector from Select3D) is virtual;
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.
56 MaxBoxes(me) returns Integer is redefined virtual;
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.
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.
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.
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.
99 Polyline:Array1OfPnt2d from TColgp;
101 aTol: Real from Standard)
102 returns Boolean from Standard is redefined virtual;
103 ---Purpose: prevents from hiding virtual methods...
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.
109 ComputeDepth(me;EyeLine : Lin from gp) returns Real from Standard
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.
120 Depth(me) returns Real from Standard is redefined;
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.
127 HasLocation(me) returns Boolean from Standard is virtual;
128 ---Purpose: Returns true if this framework has a location defined.
130 Location(me) returns Location from TopLoc is virtual;
131 ---C++: return const&
133 ResetLocation(me:mutable) is virtual;
134 ---Purpose: sets the location to Identity
136 SetLocation(me:mutable;aLoc :Location from TopLoc) is virtual;
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 ...
143 DumpBox(myclass; S: in out OStream;abox:Box2d from Bnd) ;
145 UpdateLocation(me:mutable;aLoc:Location from TopLoc);
148 SetLastPrj(me:mutable;aPrj:Projector from Select3D) is virtual;
150 SetLastDepth(me:mutable; aDepth: Real from Standard) is protected;
154 mylastprj : Projector from Select3D is protected;
155 mylastdepth : ShortReal from Standard;