b311480e |
1 | -- Created on: 1995-01-23 |
2 | -- Created by: Mister rmi |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public 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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | deferred class SensitiveEntity from SelectBasics inherits TShared from MMgt |
18 | |
19 | ---Purpose: root class ; the inheriting classes will be able to give |
20 | -- sensitive Areas for the dynamic selection algorithms |
21 | |
22 | uses |
23 | EntityOwner, |
24 | ListOfBox2d, |
4269bd1b |
25 | PickArgs, |
26 | Array1OfPnt2d from TColgp, |
7fd59977 |
27 | Box2d from Bnd |
28 | |
29 | is |
30 | |
31 | |
32 | Initialize (OwnerId : EntityOwner; |
33 | aSensitivityFactor : ShortReal from Standard =1); |
34 | |
35 | |
ac04d101 |
36 | Set (me:mutable ; TheOwnerId : EntityOwner) is virtual; |
7fd59977 |
37 | ---Level: Public |
38 | |
39 | |
40 | OwnerId(me) returns any EntityOwner is static; |
41 | ---Level: Public |
42 | ---C++: return const& |
43 | |
44 | |
45 | Areas(me:mutable; aresult : in out ListOfBox2d ) is deferred; |
46 | ---Level: Public |
47 | ---Purpose: to be implemented specifically by each type of |
48 | -- sensitive primitive . |
49 | -- |
4269bd1b |
50 | |
51 | Matches (me : mutable; |
52 | thePickArgs : PickArgs from SelectBasics; |
53 | theMatchDMin : out Real from Standard; |
54 | theMatchDepth : out Real from Standard) returns Boolean is deferred; |
55 | ---Level: Public |
56 | ---Purpose: Checks whether the sensitive entity matches the picking detection |
57 | -- area (close to the picking line). This method takes into account depth |
58 | -- limits produced by abstract view: far/near planes, clippings. |
59 | -- Please port existing implementations of your picking detection, which |
60 | -- were done at Matches (X, Y, Tol, DMin) method to this one, introducing |
61 | -- the depth checks. Please note that the previous method is suppressed |
62 | -- and the virtual implementations are not used by OCC selection framework. |
63 | -- The porting procedure for simple sensitives (or if you are not interested |
64 | -- in implementing full scale depth checks) can be simplified to writing the |
65 | -- following code snippet: |
66 | -- @code |
67 | -- { // example code for porting descendants of Select3D_SensitiveEntity |
68 | -- |
69 | -- // invoke implementation of obsolete matches method (if implemented)... |
70 | -- if (!Matches (thePickArgs.X(), thePickArgs.Y(), thePickArgs.Tolerance(), theMatchDMin)) |
71 | -- return Standard_False; |
72 | -- |
73 | -- // invoke your implementation of computing depth (if implemented)... |
74 | -- Standard_Real aDetectDepth = ComputeDepth (thePickArgs.PickLine()); |
75 | -- |
76 | -- return !thePickArgs.IsClipped(aDetectDepth); |
77 | -- } |
78 | -- @endcode |
79 | -- @param thePickArgs [in] the picking arguments. |
80 | -- @param theMatchDMin [out] the minimum distance on xy plane from point |
81 | -- of picking to center of gravity of the detected sub-part of sensitive |
82 | -- entity or the whole sensitive (e.g. used for resolving selection of |
83 | -- coinciding circles, selection will be set to the one whose center is |
84 | -- closest to the picking point). |
85 | -- @param theMatchDepth [out] the minimum detected depth: depth of the |
86 | -- closest detected sub-part of sensitive entity (or the whole sensitive). |
87 | -- @return True if the sensitive matches the detection area. |
88 | -- This method is an entry point for picking detection framework. |
89 | -- The method is triggered when it is required to compose list of |
90 | -- detected sensitive entities. The sensitives are filtered out from |
91 | -- detection result if returned value is False. The passed entities are |
92 | -- then can be sorted by "theDetectDist", "theDetectDepth" parameters. |
7fd59977 |
93 | |
94 | Matches (me :mutable; |
95 | XMin,YMin,XMax,YMax : Real from Standard; |
96 | aTol: Real from Standard) |
97 | returns Boolean |
98 | is deferred; |
99 | ---Level: Public |
100 | ---Purpose: returns True if the box (Xmin,YMin)------(Xmax,Ymax) |
101 | -- contains the SensitiveEntity. |
102 | -- Necessary for selection using elastic boxes,or segments. |
103 | |
104 | |
105 | Matches (me :mutable; |
106 | Polyline:Array1OfPnt2d from TColgp; |
107 | aBox:Box2d from Bnd; |
108 | aTol: Real from Standard) |
109 | returns Boolean |
110 | is deferred; |
111 | ---Level: Public |
112 | ---Purpose: returns True if the polyline xi,yi |
113 | -- contains the SensitiveEntity. |
114 | -- Necessary for selection using polyline selection |
115 | |
116 | NeedsConversion(me) returns Boolean is deferred ; |
117 | |
118 | Is3D(me) returns Boolean from Standard is deferred; |
119 | ---Purpose: returns True if able to give 3D information |
120 | -- (Depth,...). See Select3D |
121 | |
7fd59977 |
122 | MaxBoxes(me) returns Integer is deferred; |
123 | ---Purpose: returns the max number of boxes the entity is able to give |
124 | -- at a time |
125 | |
126 | |
127 | SetSensitivityFactor(me:mutable; aFactor:ShortReal from Standard); |
128 | ---C++: inline |
129 | |
130 | SensitivityFactor(me) returns ShortReal from Standard; |
131 | ---C++: inline |
132 | ---Purpose: allows a better sensitivity for |
133 | -- a specific entity in selection algorithms |
134 | -- useful for small sized entities. |
135 | |
136 | |
137 | fields |
138 | |
139 | myOwnerId : EntityOwner from SelectBasics is protected; |
140 | mySFactor : ShortReal from Standard; |
141 | end SensitiveEntity; |
142 | |
143 | |
144 | |
145 | |
146 | |