1 -- Created on: 1996-12-03
2 -- Created by: Arnaud BOUZY/Odile Olivier
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
22 class LengthDimension from AIS inherits Relation from AIS
24 ---Purpose: A framework to display lengths.
25 -- These can be lengths along a face or edge, or
26 -- between two faces or two edges.
27 -- The value of the length is given in a text figuring in this display.
29 uses Shape from TopoDS,
31 Presentation from Prs3d,
32 PresentationManager3d from PrsMgr,
33 Selection from SelectMgr,
37 Transformation from Geom,
38 PresentationManager2d from PrsMgr,
39 GraphicObject from Graphic2d,
40 ExtendedString from TCollection,
43 ArrowSide from DsgPrs,
44 KindOfDimension from AIS,
54 Create (aFirstFace : Face from TopoDS;
55 aSecondFace : Face from TopoDS;
56 aVal : Real from Standard; -- is defined while first compute, may be any Real
57 aText : ExtendedString from TCollection)
58 ---Purpose: Constructs a length display object defined by the first
59 -- face aFShape, the second face aSShape, the dimension aVal, and the text aText.
61 returns mutable LengthDimension from AIS;
63 Create (aFirstFace : Face from TopoDS;
64 aSecondFace : Face from TopoDS;
65 aVal : Real from Standard; -- is defined while first compute, may be any Real
66 aText : ExtendedString from TCollection;
67 aPosition : Pnt from gp;
68 aSymbolPrs : ArrowSide from DsgPrs;
69 anArrowSize : Real from Standard = 0.0)
70 ---Purpose: Constructs a length display object defined by the first
71 -- face aFShape, the second face aSShape, the
72 -- dimension aVal, the position aPosition, the arrow
73 -- aSymbolPrs with the size anArrowSize and the text aText.
74 returns mutable LengthDimension from AIS;
76 Create (Face : Face from TopoDS;
77 Edge : Edge from TopoDS;
78 Val : Real from Standard;
79 Text : ExtendedString from TCollection)
80 ---Purpose: Constructs a length display object defined by the first
81 -- edge or vertex aFShape, the second edge or vertex
82 -- aSShape, the dimension aVal,and the plane aPlane.
83 returns mutable LengthDimension from AIS;
85 Create (aFShape : Shape from TopoDS;
86 aSShape : Shape from TopoDS;
87 aPlane : Plane from Geom;
88 aVal : Real from Standard;
89 aText : ExtendedString from TCollection)
90 ---Purpose: -- Constructs a length display object defined by the first
91 -- edge or vertex aFShape, the second edge or vertex
92 -- aSShape, the dimension aVal,and the plane aPlane.
93 returns mutable LengthDimension from AIS;
95 Create (aFShape : Shape from TopoDS;
96 aSShape : Shape from TopoDS;
97 aPlane : Plane from Geom;
98 aVal : Real from Standard;
99 aText : ExtendedString from TCollection;
100 aPosition : Pnt from gp;
101 aSymbolPrs : ArrowSide from DsgPrs;
102 aTypeDist : TypeOfDist from AIS;
103 anArrowSize : Real from Standard = 0.0)
104 ---Purpose: Constructs a length display object defined by the first
105 -- edge or vertex aFShape, the second edge or vertex
106 -- aSShape, the dimension aVal, the position aPosition,
107 -- the type of distance aTypeDist, the type of arrow
108 -- aSymbolPrs with the size anArrowSize, and the plane aPlane.
109 returns mutable LengthDimension from AIS;
111 SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
114 SetSecondShape( me: mutable; aSShape : Shape from TopoDS )
118 returns KindOfDimension from AIS
120 ---Purpose: Indicates that we are concerned with a length.
122 IsMovable(me) returns Boolean from Standard
124 ---Purpose: Returns true if the length dimension is movable.
129 -- Returns the type of distance of the length primitive.
130 returns TypeOfDist from AIS
133 SetTypeOfDist(me: mutable;aTypeDist: TypeOfDist from AIS)
136 -- Returns true if the length dimension is movable.
140 -- Methods from PresentableObject
142 Compute(me : mutable;
143 aPresentationManager : PresentationManager3d from PrsMgr;
144 aPresentation : mutable Presentation from Prs3d;
145 aMode : Integer from Standard= 0)
146 is redefined private;
148 Compute(me : mutable;
149 aProjector : Projector from Prs3d;
150 aPresentation : mutable Presentation from Prs3d)
151 is redefined static private;
154 aPresentationManager: PresentationManager2d from PrsMgr;
155 aPresentation: mutable GraphicObject from Graphic2d;
156 aMode: Integer from Standard = 0)
157 is redefined static private;
159 Compute(me : mutable;
160 aProjector : Projector from Prs3d;
161 aTrsf : Transformation from Geom;
162 aPresentation : mutable Presentation from Prs3d)
164 ---Purpose: computes the presentation according to a point of view
165 -- given by <aProjector>.
166 -- To be Used when the associated degenerated Presentations
167 -- have been transformed by <aTrsf> which is not a Pure
168 -- Translation. The HLR Prs can't be deducted automatically
169 -- WARNING :<aTrsf> must be applied
170 -- to the object to display before computation !!!
173 -- Methods from SelectableObject
175 ComputeSelection(me : mutable;
176 aSelection : mutable Selection from SelectMgr;
177 aMode : Integer from Standard)
178 is redefined private;
182 -- Computation private methods
184 ComputeOneFaceLength(me : mutable;
185 aPresentation : mutable Presentation from Prs3d)
188 ComputeOneEdgeLength(me : mutable;
189 aPresentation : mutable Presentation from Prs3d)
192 ComputeTwoFacesLength(me: mutable;
193 aPresentation : mutable Presentation from Prs3d)
197 ComputeEdgeFaceLength (me: mutable;
198 aPresentation : mutable Presentation from Prs3d)
202 ComputeTwoEdgesLength (myclass;
203 aPresentation : mutable Presentation from Prs3d;
204 aDrawer : Drawer from AIS;
205 aText : ExtendedString from TCollection;
206 ArrowSize : Real from Standard;
207 FirstEdge : Edge from TopoDS;
208 SecondEdge : Edge from TopoDS;
209 Plane : Plane from Geom;
210 AutomaticPos : Boolean from Standard;
211 IsSetBndBox : Boolean from Standard;
212 BndBox : Box from Bnd;
213 ExtShape : out Integer from Standard;
214 Val : out Real from Standard;
215 DirAttach : out Dir from gp;
216 Position : out Pnt from gp;
217 FirstAttach : out Pnt from gp;
218 SecondAttach : out Pnt from gp;
219 SymbolPrs : out ArrowSide from DsgPrs );
221 ComputeOneEdgeOneVertexLength(myclass;
222 aPresentation : mutable Presentation from Prs3d;
223 aDrawer : Drawer from AIS;
224 aText : ExtendedString from TCollection;
225 ArrowSize : Real from Standard;
226 FirstShape : Shape from TopoDS;
227 SecondShape : Shape from TopoDS;
228 Plane : Plane from Geom;
229 AutomaticPos : Boolean from Standard;
230 IsSetBndBox : Boolean from Standard;
231 BndBox : Box from Bnd;
232 ExtShape : out Integer from Standard;
233 Val : out Real from Standard;
234 DirAttach : out Dir from gp;
235 Position : out Pnt from gp;
236 FirstAttach : out Pnt from gp;
237 SecondAttach : out Pnt from gp;
238 SymbolPrs : out ArrowSide from DsgPrs );
240 ComputeTwoVerticesLength(myclass;
241 aPresentation : mutable Presentation from Prs3d;
242 aDrawer : Drawer from AIS;
243 aText : ExtendedString from TCollection;
244 ArrowSize : Real from Standard;
245 FirstVertex : Vertex from TopoDS;
246 SecondVertex : Vertex from TopoDS;
247 Plane : Plane from Geom;
248 AutomaticPos : Boolean from Standard;
249 IsSetBndBox : Boolean from Standard;
250 BndBox : Box from Bnd;
251 TypeDist : TypeOfDist from AIS;
252 ExtShape : out Integer from Standard;
253 Val : out Real from Standard;
254 DirAttach : out Dir from gp;
255 Position : out Pnt from gp;
256 FirstAttach : out Pnt from gp;
257 SecondAttach : out Pnt from gp;
258 SymbolPrs : out ArrowSide from DsgPrs );
262 -- Computation Selection private methods
265 ComputeFaceSelection(me : mutable;
266 aSelection : mutable Selection from SelectMgr)
269 ComputeEdgeVertexSelection( me : mutable;
270 aSelection : mutable Selection from SelectMgr)
276 myNbShape : Integer from Standard;
277 myFAttach : Pnt from gp;
278 mySAttach : Pnt from gp;
279 myDirAttach: Dir from gp;
280 myTypeDist : TypeOfDist from AIS;