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: Returns the sensitive entity found at the location aLocation.
66 -- You must redefine this function for any type of
67 -- sensitive entity which can accept another connected
68 -- sensitive entity.//can be connected to another sensitive entity.
71 X,Y : Real from Standard;
72 aTol: Real from Standard;
73 DMin: out Real from Standard)
74 returns Boolean is redefined virtual;
75 ---Purpose: Matches the coordinates X, Y with the entity found at
76 -- that point within the tolerance aTol and the minimum depth DMin.
77 -- You must redefine this function for every inheriting entity.
78 -- You will have to call this framework inside the redefined function.
81 XMin,YMin,XMax,YMax : Real from Standard;
82 aTol: Real from Standard)
83 returns Boolean from Standard is redefined virtual;
84 ---Purpose: Matches the box defined by the coordinates Xmin,
85 -- Ymin, Xmax, Ymax with the entity found at that point
86 -- within the tolerance aTol.
87 -- Xmin, YMin define the minimum point in the lower left
88 -- hand corner of the box, and XMax, YMax define the
89 -- maximum point in the upper right hand corner of the box.
90 -- You must redefine this function for every inheriting entity.
91 -- You will have to call this framework inside the redefined function.
94 Polyline:Array1OfPnt2d from TColgp;
96 aTol: Real from Standard)
97 returns Boolean from Standard is redefined virtual;
98 ---Purpose: prevents from hiding virtual methods...
101 GetEyeLine(me; X,Y : Real from Standard) returns Lin from gp;
102 ---Purpose: Returns the eye line for the point defined by the coordinates X,Y.
104 ComputeDepth(me;EyeLine : Lin from gp) returns Real from Standard
106 ---Purpose: Returns the depth of this object on the line EyeLine.
107 -- EyeLine goes through the eye towards a point
108 -- defined by the coordinates X,Y in the function GetEyeLine.
109 ---Purpose: gives an abcissa on <aLin> .
110 -- <aLin> represents the line going through
111 -- the eye towards an X,Y point on the screen. This Method
112 -- must return a mean Depth on this line.
115 Depth(me) returns Real from Standard is redefined;
117 ---Category: Location of sensitive entities...
118 -- Default implementations of HasLocation() and Location() rely on
119 -- location obtained from the entity owner, to minimize memory usage.
120 -- SetLocation() and ResetLocation() do nothing by default.
122 HasLocation(me) returns Boolean from Standard is virtual;
123 ---Purpose: Returns true if this framework has a location defined.
125 Location(me) returns Location from TopLoc is virtual;
126 ---C++: return const&
128 ResetLocation(me:mutable) is virtual;
129 ---Purpose: sets the location to Identity
131 SetLocation(me:mutable;aLoc :Location from TopLoc) is virtual;
133 Dump(me; S: in out OStream;FullDump : Boolean from Standard = Standard_True) is virtual;
134 ---Purpose: 2 options :
135 -- <FullDump> = False -> general information
136 -- <FullDump> = True -> whole informtion 3D +2d ...
138 DumpBox(myclass; S: in out OStream;abox:Box2d from Bnd) ;
140 UpdateLocation(me:mutable;aLoc:Location from TopLoc);
143 SetLastPrj(me:mutable;aPrj:Projector from Select3D) is virtual;
145 SetLastDepth(me:mutable; aDepth: Real from Standard) is protected;
149 mylastprj : Projector from Select3D is protected;
150 mylastdepth : ShortReal from Standard;