1 -- Created on: 1995-01-24
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
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
24 -- -> Virtual methods rather than
25 -- Deferred for Project
26 -- WARNING : Must be redefined for
27 -- each kind of sensitive entity
30 deferred class SensitiveEntity from Select3D inherits
31 SensitiveEntity from SelectBasics
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.
43 Projector from Select3D,
44 EntityOwner from SelectBasics,
48 Array1OfPnt2d from TColgp
52 Initialize(OwnerId : EntityOwner from SelectBasics);
54 NeedsConversion(me) returns Boolean is redefined static;
56 ---Purpose: Returns true if this framework needs conversion.
59 Is3D(me) returns Boolean from Standard is redefined static;
60 ---Purpose: Returns true if this framework provides 3D information.
62 Project (me:mutable;aProjector : Projector from Select3D) is virtual;
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.
71 MaxBoxes(me) returns Integer is redefined virtual;
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.
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.
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.
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.
113 Matches (me :mutable;
114 Polyline:Array1OfPnt2d from TColgp;
116 aTol: Real from Standard)
117 returns Boolean from Standard is redefined virtual;
118 ---Purpose: prevents from hiding virtual methods...
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.
124 ComputeDepth(me;EyeLine : Lin from gp) returns Real from Standard
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.
135 Depth(me) returns Real from Standard is redefined;
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.
142 HasLocation(me) returns Boolean from Standard is virtual;
143 ---Purpose: Returns true if this framework has a location defined.
145 Location(me) returns Location from TopLoc is virtual;
146 ---C++: return const&
148 ResetLocation(me:mutable) is virtual;
149 ---Purpose: sets the location to Identity
151 SetLocation(me:mutable;aLoc :Location from TopLoc) is virtual;
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 ...
158 DumpBox(myclass; S: in out OStream;abox:Box2d from Bnd) ;
160 UpdateLocation(me:mutable;aLoc:Location from TopLoc);
163 SetLastPrj(me:mutable;aPrj:Projector from Select3D) is virtual;
165 SetLastDepth(me:mutable; aDepth: Real from Standard) is protected;
169 mylastprj : Projector from Select3D is protected;
170 mylastdepth : ShortReal from Standard;