b311480e |
1 | -- Created on: 1995-03-08 |
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 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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. |
b311480e |
16 | |
7fd59977 |
17 | -- Fri Apr 10 98 : rob : Add Boolean for automatic |
18 | -- Triangulation on faces... |
7fd59977 |
19 | |
20 | |
21 | |
22 | class BRepSelectionTool from StdSelect |
23 | |
24 | ---Purpose: Tool to create specific selections (sets of primitives) |
25 | -- for Shapes from Topology. |
26 | -- These Selections may be used in dynamic selection |
27 | -- Mechanism |
28 | -- Given a Shape and a mode of selection |
29 | -- (selection of vertices, |
30 | -- edges,faces ...) , This Tool Computes corresponding sensitive primitives, |
31 | -- puts them in an entity called Selection (see package SelectMgr) and returns it. |
32 | -- |
33 | -- |
34 | -- A Priority for the decomposed pickable objects can be given ; |
35 | -- by default There is A Preset Hierachy: |
36 | -- Vertex priority : 5 |
37 | -- Edge priority : 4 |
38 | -- Wire priority : 3 |
39 | -- Face priority : 2 |
40 | -- Shell,solid,shape priority : 1 |
41 | -- the default priority in the following methods has no sense - it's only taken in account |
42 | -- when the user gives a value between 0 and 10. |
43 | -- IMPORTANT : This decomposition creates BRepEntityOwner instances (from StdSelect). |
44 | -- which are stored in the Sensitive Entities coming from The Decomposition. |
45 | -- |
46 | -- the result of picking in a ViewerSelector return EntityOwner from SelectMgr; |
47 | -- to know what kind of object was picked : |
48 | -- |
49 | -- ENTITY_OWNER -> Selectable() gives the selectableobject which |
50 | -- was decomposed into pickable elements. |
51 | -- Handle(StdSelect_BRepOwner)::DownCast(ENTITY_OWNER) -> Shape() |
52 | -- gives the real picked shape (edge,vertex,shape...) |
53 | -- |
54 | |
55 | uses |
56 | Selection from SelectMgr, |
57 | Shape from TopoDS, |
58 | Face from TopoDS, |
59 | ShapeEnum from TopAbs, |
60 | SelectableObject from SelectMgr, |
61 | BRepOwner from StdSelect, |
62 | SensitiveEntity from Select3D, |
63 | ListOfSensitive from Select3D |
64 | is |
65 | |
66 | Load(myclass; |
6e33d3ce |
67 | aSelection : Selection from SelectMgr; |
7fd59977 |
68 | aShape : Shape from TopoDS; |
69 | aType : ShapeEnum from TopAbs; |
70 | theDeflection : Real from Standard; |
71 | theDeviationAngle : Real from Standard; |
72 | AutoTriangulation : Boolean from Standard = Standard_True; |
73 | aPriority : Integer =-1; |
74 | NbPOnEdge : Integer = 9; |
75 | MaximalParameter : Real from Standard = 500); |
76 | ---Level: Public |
77 | ---Purpose: Decomposition of <aShape> into sensitive entities following |
78 | -- a mode of decomposition <aType>. These entities are stored in <aSelection>. |
79 | -- BrepOwners are created to store the identity of the picked shapes |
80 | -- during the selection process. |
81 | -- In those BRepOwners is also stored the original shape. |
82 | -- But One can't get the selectable object which was decomposed to give |
83 | -- the sensitive entities. |
84 | -- maximal parameter is used for infinite objects, to limit the sensitive Domain.... |
85 | -- If AutoTriangulation = True, a Triangulation will be |
86 | -- computed for faces which have no existing one. |
87 | -- if AutoTriangulation = False the old algorithm will be |
88 | -- called to compute sensitive entities on faces. |
89 | |
90 | |
91 | |
92 | Load(myclass; |
6e33d3ce |
93 | aSelection : Selection from SelectMgr; |
7fd59977 |
94 | Origin : SelectableObject from SelectMgr; |
95 | aShape : Shape from TopoDS; |
96 | aType : ShapeEnum from TopAbs; |
97 | theDeflection : Real from Standard; |
98 | theDeviationAngle : Real from Standard; |
99 | AutoTriangulation : Boolean from Standard = Standard_True; |
100 | aPriority : Integer =-1; |
101 | NbPOnEdge : Integer = 9; |
102 | MaximalParameter : Real from Standard = 500); |
103 | ---Purpose: Same functionnalities ; the only |
104 | -- difference is that the selectable object from which the |
105 | -- selection comes is stored in each Sensitive EntityOwner; |
106 | |
107 | |
108 | -- Load(myclass; |
6e33d3ce |
109 | -- aSelection : Selection from SelectMgr; |
7fd59977 |
110 | -- Users : SequenceOfAddress from SelectBasics; |
111 | -- aShape : Shape from TopoDS; |
112 | -- aType : ShapeEnum from TopAbs; |
113 | -- AutoTriangulation : Boolean from Standard = Standard_True; |
114 | -- aPriority : Integer =-1; |
115 | -- NbPOnEdge : Integer = 9; |
116 | -- MaximalParameter : Real from Standard = 500); |
117 | ---Level: Public |
118 | ---Purpose:decomposition of <aShape> into sensitive entities following |
119 | -- a mode of decomposition <aType>. These entities are stored in <aSelection> |
120 | -- The Major difference is that the known users are first inserted in the |
121 | -- BRepOwners. the original shape is the last user... |
122 | -- (see EntityOwner from SelectBasics and BrepOwner)... |
123 | |
124 | |
125 | GetStandardPriority(myclass; |
126 | aShap: Shape from TopoDS; |
127 | aType: ShapeEnum from TopAbs) |
128 | returns Integer from Standard; |
129 | ---Purpose: Returns the standard priority of the shape aShap having the type aType. |
130 | -- This priority is passed to a StdSelect_BRepOwner object. |
131 | -- You can use the function Load to modify the |
132 | -- selection priority of an owner to make one entity |
133 | -- more selectable than another one. |
134 | |
135 | ComputeSensitive(myclass; |
136 | aShape : Shape from TopoDS; |
137 | anOwner : BRepOwner from StdSelect; |
6e33d3ce |
138 | aSelection : Selection from SelectMgr; |
7fd59977 |
139 | theDeflection : Real from Standard; |
140 | theDeviationAngle : Real from Standard; |
141 | NbPOnEdge : Integer; |
142 | MaximalParameter : Real from Standard; |
143 | AutoTriangulation : Boolean from Standard = Standard_True) ; |
144 | ---Purpose: Computes the sensitive primitives corresponding to |
145 | -- the subshape aShape with the owner anOwner. |
146 | -- Stores them in the SelectMgr_Selection object, and returns this object. |
147 | -- The number NbPOnEdge is used to define edges and wires. |
148 | -- In the case of infinite objects, the value |
149 | -- MaximalParameter serves to limit computation time |
150 | -- by limiting the sensitive area. The default value is 500. |
151 | -- If AutoTriangulation is true, triangulation will be |
152 | -- computed for the faces which have none. If it is false, |
153 | -- sensitive entities on these faces will be calculated. |
154 | |
155 | GetEdgeSensitive(myclass; |
156 | aShape : Shape from TopoDS; |
157 | anOwner : BRepOwner from StdSelect; |
6e33d3ce |
158 | aSelection : Selection from SelectMgr; |
7fd59977 |
159 | theDeflection : Real from Standard; |
160 | theDeflectionAngle : Real from Standard; |
161 | NbPOnEdge : Integer; |
162 | MaximalParameter : Real from Standard; |
163 | aSensitive : in out SensitiveEntity from Select3D) |
164 | is private; |
165 | ---Level: Internal |
166 | ---Purpose: |
167 | |
168 | |
169 | GetSensitiveForFace(myclass; |
170 | aFace : Face from TopoDS; |
171 | anOwner : BRepOwner from StdSelect; |
172 | OutList : in out ListOfSensitive from Select3D; |
173 | AutoTriangulation : Boolean from Standard = Standard_True; |
174 | NbPOnEdge : Integer = 9; |
175 | MaxiParam : Real from Standard =500; |
176 | InteriorFlag : Boolean from Standard = Standard_True) |
177 | returns Boolean from Standard; |
178 | ---Purpose: appends to <OutList> the 3D |
179 | -- sensitive entities created for selection of <aFace> |
180 | -- if<InteriorFlag> = False the face will be sensitive only on its boundary |
181 | |
182 | |
183 | |
184 | end BRepSelectionTool; |
185 | |
186 | |
187 | |
188 | |