b311480e |
1 | -- Created on: 1996-12-03 |
2 | -- Created by: Jean-Pierre COMBE/Odile Olivier |
3 | -- Copyright (c) 1996-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 | -- modified by <SZY> feb-20-98 |
7fd59977 |
22 | |
23 | |
24 | class RadiusDimension from AIS inherits Relation from AIS |
25 | |
26 | ---Purpose: A framework to define display of radii. |
27 | -- These displays serve as relational references in 3D |
28 | -- presentations of surfaces, and are particularly useful |
29 | -- in viewing fillets. The display consists of arrows and |
30 | -- text giving the length of a radius. This display is |
31 | -- recalculated if the applicative owner shape changes |
32 | -- in dimension, and the text gives the modified length. |
33 | -- The algorithm analyzes a length along a face as an |
34 | -- arc. It then reconstructs the circle corresponding to |
35 | -- the arc and calculates the radius of this circle. |
36 | |
37 | uses Shape from TopoDS, |
38 | Presentation from Prs3d, |
39 | PresentationManager3d from PrsMgr, |
40 | Selection from SelectMgr, |
41 | Pnt from gp, |
42 | Lin from gp, |
43 | Circ from gp, |
44 | Projector from Prs3d, |
128cc8df |
45 | Transformation from Geom, |
7fd59977 |
46 | ExtendedString from TCollection, |
47 | ArrowSide from DsgPrs, |
48 | KindOfDimension from AIS |
49 | |
50 | is |
51 | Create (aShape : Shape from TopoDS; |
52 | aVal : Real from Standard; |
53 | aText : ExtendedString from TCollection) |
54 | ---Purpose: Constructs the radius display object defined by the |
55 | -- shape aShape, the dimension aVal, and the text aText. |
56 | |
57 | returns mutable RadiusDimension from AIS; |
58 | |
59 | Create (aShape : Shape from TopoDS; |
60 | aVal : Real from Standard; |
61 | aText : ExtendedString from TCollection; |
62 | aPosition : Pnt from gp; |
63 | aSymbolPrs : ArrowSide from DsgPrs; |
64 | anArrowSize : Real from Standard = 0.0) |
65 | ---Purpose: Constructs radius display object defined by the shape |
66 | -- aShape, the dimension aVal, the position aPosition, |
67 | -- the type of arrow aSymbolPrs, the arrow length |
68 | -- anArrowSize and the text aText. |
69 | returns mutable RadiusDimension from AIS; |
70 | |
71 | SetFirstShape( me: mutable; aFShape : Shape from TopoDS ) |
72 | is redefined static; |
73 | |
74 | KindOfDimension(me) |
75 | ---Purpose: Indicates that the dimension selected is a radius. |
76 | ---C++: inline |
77 | returns KindOfDimension from AIS |
78 | is redefined; |
79 | |
80 | IsMovable(me) returns Boolean from Standard |
81 | ---C++: inline |
82 | ---Purpose: Returns true if the radius selected is movable. |
83 | is redefined; |
84 | |
85 | DrawFromCenter(me) returns Boolean from Standard |
86 | ---Purpose: |
87 | -- Draws an arrowhead pointing towards the center of |
88 | -- the shape aShape defined at construction time if |
89 | -- false, and away from the center if true. |
90 | ---C++: inline |
91 | is static; |
92 | |
93 | SetDrawFromCenter(me: mutable; |
94 | drawfromcenter : Boolean from Standard) |
95 | ---C++: inline |
96 | ---Purpose: |
97 | -- Sets the Boolean drawfromcenter to true or false. |
98 | -- If drawfromcenter is false, the arrowhead will point |
99 | -- towards the center of the shape aShape defined at |
100 | -- construction time. |
101 | is static; |
102 | |
103 | -- Methods from PresentableObject |
104 | |
105 | Compute(me : mutable; |
106 | aPresentationManager: PresentationManager3d from PrsMgr; |
107 | aPresentation : mutable Presentation from Prs3d; |
108 | aMode : Integer from Standard= 0) |
109 | is redefined private; |
110 | |
111 | Compute(me:mutable; |
112 | aProjector: Projector from Prs3d; |
113 | aPresentation: mutable Presentation from Prs3d) |
114 | is redefined static private; |
7fd59977 |
115 | |
116 | Compute(me : mutable; |
117 | aProjector : Projector from Prs3d; |
118 | aTrsf : Transformation from Geom; |
119 | aPresentation : mutable Presentation from Prs3d) |
120 | is redefined; |
121 | ---Purpose: computes the presentation according to a point of view |
122 | -- given by <aProjector>. |
123 | -- To be Used when the associated degenerated Presentations |
124 | -- have been transformed by <aTrsf> which is not a Pure |
125 | -- Translation. The HLR Prs can't be deducted automatically |
126 | -- WARNING :<aTrsf> must be applied |
127 | -- to the object to display before computation !!! |
128 | |
129 | -- Methods from SelectableObject |
130 | |
131 | ComputeSelection(me : mutable; |
132 | aSelection : mutable Selection from SelectMgr; |
133 | aMode : Integer from Standard) |
134 | is redefined private; |
135 | |
136 | |
137 | -- |
138 | -- Computation private methods |
139 | -- |
140 | |
141 | ComputeRadius( me: mutable; aPresentation : mutable Presentation from Prs3d ) |
142 | is private; |
143 | |
144 | InitFirstShape( me: mutable) |
145 | is static private; |
146 | |
147 | fields |
148 | |
149 | myCircle : Circ from gp; |
150 | myFirstPar : Real from Standard; |
151 | myLastPar : Real from Standard; |
152 | myCenter : Pnt from gp; |
153 | myEndOfArrow : Pnt from gp; |
154 | myFirstLine : Lin from gp; |
155 | myLastLine : Lin from gp; |
156 | mydrawFromCenter : Boolean from Standard; |
157 | |
158 | end RadiusDimension; |