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