Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1997-05-15 |

2 | -- Created by: Robert COUBLANC | |

3 | -- Copyright (c) 1997-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 | ||

7fd59977 | 21 | |

22 | ||

23 | class SensitiveTriangulation from Select3D | |

24 | inherits SensitiveEntity from Select3D | |

25 | ||

26 | ---Purpose: A framework to define selection of a sensitive entity made of a set of triangles. | |

27 | ||

28 | uses | |

29 | EntityOwner from SelectBasics, | |

30 | Projector from Select3D, | |

31 | Lin from gp, | |

32 | Trsf from gp, | |

33 | ListOfBox2d from SelectBasics, | |

4269bd1b | 34 | PickArgs from SelectBasics, |

7fd59977 | 35 | Array1OfPnt from TColgp, |

36 | Array1OfPnt2d from TColgp, | |

37 | HArray1OfInteger from TColStd, | |

38 | Box2d from Bnd, | |

39 | SensitiveTriangle from Select3D, | |

40 | ListOfSensitiveTriangle from Select3D, | |

41 | XYZ from gp, | |

42 | XY from gp, | |

43 | Pnt from gp, | |

44 | Pnt2d from gp, | |

45 | Triangulation from Poly, | |

46 | Location from TopLoc | |

47 | is | |

48 | ||

49 | Create(OwnerId : EntityOwner from SelectBasics; | |

50 | aTriangulation: Triangulation from Poly; | |

51 | aLoc : Location from TopLoc; | |

52 | InteriorFlag : Boolean from Standard = Standard_True) | |

53 | returns mutable SensitiveTriangulation from Select3D; | |

54 | ||

55 | ---Purpose: Constructs a sensitive triangulation object defined by | |

56 | -- the owner OwnerId, the triangulation aTriangulation, | |

57 | -- the location aLoc, and the flag InteriorFlag. | |

58 | ||

59 | Create(OwnerId : EntityOwner from SelectBasics; | |

60 | aTriangulation: Triangulation from Poly; | |

61 | aLoc : Location from TopLoc; | |

62 | thefreeedges : HArray1OfInteger from TColStd; | |

63 | theCDG : Pnt from gp; | |

64 | InteriorFlag : Boolean from Standard) | |

65 | returns mutable SensitiveTriangulation from Select3D; | |

66 | ---Purpose: Constructs a sensitive triangulation object defined by | |

67 | -- the owner OwnerId, the triangulation aTriangulation, | |

68 | -- the location aLoc, the array of free edges | |

69 | -- thefreeedges, the center of gravity theCDG, and the flag InteriorFlag. | |

70 | -- As free edges and the center of gravity do not have | |

71 | -- to be computed later, this syntax reduces computation time. | |

72 | ||

73 | ||

74 | Project (me:mutable;aProjector : Projector from Select3D) is redefined static; | |

75 | ---Level: Public | |

76 | ---Purpose: projection of the sensitive primitive in order to | |

77 | -- get 2D boxes for the Sort Algorithm | |

78 | ||

79 | Areas (me:mutable ; boxes : in out ListOfBox2d from SelectBasics) is redefined static; | |

80 | ---Level: Public | |

81 | ---Purpose: stores in <boxes> the 2D Boxes which represent the sensitive face | |

82 | -- in the selection algorithm. | |

83 | ||

84 | GetConnected(me:mutable;aLocation: Location from TopLoc) | |

85 | returns SensitiveEntity from Select3D is redefined static; | |

86 | ||

4269bd1b | 87 | Matches (me : mutable; |

88 | thePickArgs : PickArgs from SelectBasics; | |

89 | theMatchDMin, theMatchDepth : out Real from Standard) | |

7fd59977 | 90 | returns Boolean |

91 | is redefined virtual; | |

4269bd1b | 92 | ---Level: Public |

93 | ---Purpose: Checks whether the sensitive entity matches the picking | |

94 | -- detection area (close to the picking line). | |

95 | -- For details please refer to base class declaration. | |

7fd59977 | 96 | |

97 | Matches (me :mutable; | |

98 | XMin,YMin,XMax,YMax : Real from Standard; | |

99 | aTol: Real from Standard) | |

100 | returns Boolean | |

101 | is redefined virtual; | |

102 | ---Level: Public | |

103 | ||

104 | Matches (me :mutable; | |

105 | Polyline:Array1OfPnt2d from TColgp; | |

106 | aBox:Box2d from Bnd; | |

107 | aTol: Real from Standard) | |

108 | returns Boolean | |

109 | is redefined virtual; | |

110 | ---Level: Public | |

4269bd1b | 111 | |

112 | ComputeDepth (me; | |

113 | thePickLine : Lin from gp; | |

114 | theTriangle : Integer from Standard) | |

115 | returns Real from Standard; | |

116 | ---Level: Public | |

117 | ---Purpose: Compute precise depth of detected triangle. | |

118 | -- @param thePickLine [in] the picking line. | |

119 | -- @param theTriangle [in] the index of detected triangle. | |

120 | -- @return depth on the picking line. | |

7fd59977 | 121 | |

122 | DetectedTriangle(me) returns Integer from Standard; | |

123 | ---Purpose: Returns the detected three nodes P1, P2, P3 constituting a triangle. | |

124 | -- This triangle is a component of the overall sensitive | |

125 | -- triangulation created at construction time. | |

126 | ---C++: inline | |

127 | ||

128 | Triangulation(me) returns any Triangulation from Poly; | |

129 | ---Purpose: Returns the triangulation used at the time of construction. | |

130 | ---C++: inline | |

131 | ---C++: return const & | |

132 | ||

133 | CDG3D(me) returns Pnt from gp; | |

134 | ---Purpose: Returns the 3D center of gravity used at the time of construction. | |

135 | ---C++: inline | |

136 | ---C++: return const & | |

137 | ||

138 | CDG2D(me) returns Pnt2d from gp; | |

139 | ---Purpose: Returns the 2D center of gravity used at the time of construction. | |

140 | ---C++: inline | |

141 | ---C++: return const & | |

142 | ||

143 | ||

144 | IsFree(me; | |

145 | IndexOfTriangle : Integer from Standard; | |

146 | IndexinFree : out Integer from Standard) | |

147 | returns Boolean is static private; | |

148 | ||

149 | Status (me; | |

150 | p0,p1,p2: XY from gp ; | |

151 | aPoint : XY from gp ; | |

152 | aTol : Real from Standard; | |

153 | Dmin : out Real from Standard) returns Integer from Standard; | |

154 | ---Purpose: Dmin gives the distance between the cdg and aPoint | |

155 | ||

156 | ||

157 | ---Category: TheLocations.... | |

158 | ||

159 | HasInitLocation(me) returns Boolean from Standard; | |

160 | ---C++: inline | |

161 | ||

162 | GetInitLocation(me) returns Location from TopLoc; | |

163 | ---C++: inline | |

164 | ---C++: return const & | |

165 | ||

166 | ||

167 | ResetLocation(me:mutable) is redefined virtual; | |

168 | ||

169 | SetLocation(me:mutable;aLoc :Location from TopLoc) is redefined virtual; | |

170 | ||

171 | ||

172 | ||

173 | Dump(me; S: in out OStream;FullDump : Boolean from Standard = Standard_True) is redefined virtual; | |

174 | ||

175 | ||

176 | DetectedTriangle(me;P1,P2,P3 : out Pnt from gp) | |

177 | returns Boolean from Standard; | |

178 | ---Purpose: gives the vertices of detected triangle... | |

179 | ||

180 | ||

181 | DetectedTriangle2d(me;P1,P2,P3 : out Pnt2d from gp) | |

182 | returns Boolean from Standard; | |

183 | ---Purpose: Gets 2D nodes computed by entity using 3D nodes and viewer | |

184 | -- parameters (see Project() method) | |

185 | ||

186 | ComputeTotalTrsf(me:mutable) is static private; | |

187 | ||

188 | ||

189 | fields | |

190 | ||

191 | ||

192 | myTriangul : Triangulation from Poly; | |

193 | myiniloc : Location from TopLoc; | |

194 | myTrsf : Trsf from gp; | |

195 | ||

196 | myCDG3D : Pnt from gp; | |

197 | myFreeEdges: HArray1OfInteger from TColStd; | |

198 | myIntFlag : Boolean from Standard; | |

199 | ||

200 | myNodes2d : Array1OfPnt2d from TColgp; | |

201 | myCDG2D : Pnt2d from gp; | |

202 | mybox2d : Box2d from Bnd; | |

203 | ||

204 | ||

205 | myDetectedTr: Integer from Standard; | |

206 | ||

207 | end SensitiveTriangulation; |