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
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.
21 -- modified by <SZY> feb-20-98
24 class RadiusDimension from AIS inherits Relation from AIS
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.
37 uses Shape from TopoDS,
38 Presentation from Prs3d,
39 PresentationManager3d from PrsMgr,
40 Selection from SelectMgr,
45 Transformation from Geom,
46 ExtendedString from TCollection,
47 ArrowSide from DsgPrs,
48 KindOfDimension from AIS
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.
57 returns mutable RadiusDimension from AIS;
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;
71 SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
75 ---Purpose: Indicates that the dimension selected is a radius.
77 returns KindOfDimension from AIS
80 IsMovable(me) returns Boolean from Standard
82 ---Purpose: Returns true if the radius selected is movable.
85 DrawFromCenter(me) returns Boolean from Standard
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.
93 SetDrawFromCenter(me: mutable;
94 drawfromcenter : Boolean from Standard)
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.
103 -- Methods from PresentableObject
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;
112 aProjector: Projector from Prs3d;
113 aPresentation: mutable Presentation from Prs3d)
114 is redefined static private;
116 Compute(me : mutable;
117 aProjector : Projector from Prs3d;
118 aTrsf : Transformation from Geom;
119 aPresentation : mutable Presentation from Prs3d)
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 !!!
129 -- Methods from SelectableObject
131 ComputeSelection(me : mutable;
132 aSelection : mutable Selection from SelectMgr;
133 aMode : Integer from Standard)
134 is redefined private;
138 -- Computation private methods
141 ComputeRadius( me: mutable; aPresentation : mutable Presentation from Prs3d )
144 InitFirstShape( me: mutable)
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;