b311480e |
1 | -- Created on: 1996-12-05 |
2 | -- Created by: Jacques MINOT/Odile Olivier/Serguei ZARITCHNY |
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 Mon 12-january-98 |
7fd59977 |
22 | -- <odl@sacadox.paris1.matra-dtv.fr>, |
7fd59977 |
23 | |
24 | |
25 | class DiameterDimension from AIS inherits Relation from AIS |
26 | |
27 | |
28 | ---Purpose: A framework to display diameter dimensions. |
29 | -- A diameter is displayed with arrows and text. The |
30 | -- text gives the length of the diameter. |
31 | -- The algorithm takes a length along a face and |
32 | -- analyzes it as an arc. It then reconstructs the circle |
33 | -- corresponding to the arc and calculates the |
34 | -- diameter of this circle. This diameter serves as a |
35 | -- relational reference in 3d presentations of the surface. |
36 | |
37 | uses |
38 | |
39 | Shape from TopoDS, |
40 | Circ from gp, |
41 | Pnt from gp, |
42 | Pln from gp, |
43 | Plane from Geom, |
44 | Surface from Geom, |
45 | Presentation from Prs3d, |
46 | PresentationManager3d from PrsMgr, |
47 | Selection from SelectMgr, |
48 | Projector from Prs3d, |
128cc8df |
49 | Transformation from Geom, |
7fd59977 |
50 | ExtendedString from TCollection, |
51 | ArrowSide from DsgPrs, |
52 | KindOfSurface from AIS, |
53 | KindOfDimension from AIS |
54 | |
55 | raises ConstructionError from Standard |
56 | |
57 | is |
58 | Create (aShape : Shape from TopoDS; |
59 | aVal : Real from Standard; |
60 | aText : ExtendedString from TCollection) |
61 | ---Purpose: Constructs a diameter display object defined by the |
62 | -- shape aFShape, the dimension aVal and the text aText. |
63 | returns mutable DiameterDimension from AIS; |
64 | |
65 | Create (aShape : Shape from TopoDS; |
66 | aVal : Real from Standard; |
67 | aText : ExtendedString from TCollection; |
68 | aPosition : Pnt from gp; |
69 | aSymbolPrs : ArrowSide from DsgPrs; |
70 | aDiamSymbol : Boolean from Standard; |
71 | anArrowSize : Real from Standard = 0.0) |
72 | ---Purpose: Constructs a diameter display object defined by the |
73 | -- shape aFShape, the dimension aVal and the text |
74 | -- aText, the point of origin of the diameter aPosition, |
75 | -- and the type of arrow aSymbolPrs with the size anArrowSize. |
76 | -- If the Boolean aDiamSymbol is true. |
77 | returns mutable DiameterDimension from AIS; |
78 | |
79 | KindOfDimension(me) returns KindOfDimension from AIS |
80 | ---C++: inline |
81 | ---Purpose: |
82 | -- Indicates that we are concerned with a length. |
83 | is redefined; |
84 | |
85 | IsMovable(me) returns Boolean from Standard |
86 | ---C++: inline |
87 | ---Purpose: |
88 | -- Returns true if the diameter dimension is movable |
89 | is redefined; |
90 | |
91 | DiamSymbol(me: mutable) returns Boolean from Standard |
92 | ---C++: inline |
93 | ---Purpose: |
94 | -- Returns the symbol for diameter dimension. This will |
95 | -- be either arrow, text, or a combination of both. |
96 | is static; |
97 | |
98 | SetDiamSymbol(me: mutable;aDiamSymbol: Boolean from Standard) |
99 | ---C++: inline |
100 | ---Purpose: |
101 | -- Sets the symbol for diameter dimension aDiamSymbol. |
102 | -- This can be an arrow, a text or both. |
103 | is static; |
104 | |
105 | -- SetPlane(me: mutable; aPlane : Plane from Geom) |
106 | -- is static; |
107 | -- ---C++: inline |
108 | |
109 | -- Plane(me) returns any Plane from Geom |
110 | -- is static; |
111 | -- ---C++: inline |
112 | -- ---C++: return const & |
113 | |
114 | |
115 | -- Methods from PresentableObject |
116 | |
117 | Compute(me : mutable; |
118 | aPresentationManager: PresentationManager3d from PrsMgr; |
119 | aPresentation : mutable Presentation from Prs3d; |
120 | aMode : Integer from Standard= 0) |
121 | is redefined private; |
122 | |
123 | Compute(me:mutable; |
124 | aProjector: Projector from Prs3d; |
125 | aPresentation: mutable Presentation from Prs3d) |
126 | is redefined static private; |
7fd59977 |
127 | |
128 | Compute(me : mutable; |
129 | aProjector : Projector from Prs3d; |
130 | aTrsf : Transformation from Geom; |
131 | aPresentation : mutable Presentation from Prs3d) |
132 | is redefined; |
133 | ---Purpose: computes the presentation according to a point of view |
134 | -- given by <aProjector>. |
135 | -- To be Used when the associated degenerated Presentations |
136 | -- have been transformed by <aTrsf> which is not a Pure |
137 | -- Translation. The HLR Prs can't be deducted automatically |
138 | -- WARNING :<aTrsf> must be applied |
139 | -- to the object to display before computation !!! |
140 | |
141 | -- Methods from SelectableObject |
142 | |
143 | ComputeSelection(me : mutable; |
144 | aSelection : mutable Selection from SelectMgr; |
145 | aMode : Integer from Standard) |
146 | is redefined private; |
147 | |
148 | -- |
149 | -- Computation private methods |
150 | -- |
151 | |
152 | ComputeOneFaceDiameter(me: mutable; |
153 | aPresentation : mutable Presentation from Prs3d) |
154 | is private; |
155 | |
156 | ComputeOneCylFaceDiameter(me: mutable; |
157 | aPresentation : mutable Presentation from Prs3d; |
158 | aSurfType : KindOfSurface from AIS; |
159 | aSurf : Surface from Geom ) |
160 | is private; |
161 | |
162 | ComputeOnePlanarFaceDiameter(me: mutable; |
163 | aPresentation : mutable Presentation from Prs3d ) |
164 | is private; |
165 | |
166 | ComputeOneEdgeDiameter(me: mutable; |
167 | aPresentation : mutable Presentation from Prs3d) |
168 | is private; |
169 | |
170 | ComputeCircleDiameter(me: mutable; |
171 | aPresentation : mutable Presentation from Prs3d) |
172 | is private; |
173 | |
174 | ComputeArcDiameter(me: mutable; |
175 | aPresentation : mutable Presentation from Prs3d; |
176 | ptFirst : Pnt from gp; |
177 | ptend : Pnt from gp) |
178 | is private; |
179 | |
180 | ComputeArcSelection(me : mutable; |
181 | aSelection : mutable Selection from SelectMgr) |
182 | is private; |
183 | |
184 | fields |
185 | |
186 | myCircle : Circ from gp; |
187 | myIsAnArc : Boolean from Standard; |
188 | myDiamSymbol : Boolean from Standard; |
189 | myFirstPar : Real from Standard; |
190 | myLastPar : Real from Standard; |
191 | |
192 | end DiameterDimension; |