1 -- Created by: Tanya COOL
2 -- Copyright (c) 2000-2012 OPEN CASCADE SAS
4 -- The content of this file is subject to the Open CASCADE Technology Public
5 -- License Version 6.5 (the "License"). You may not use the content of this file
6 -- except in compliance with the License. Please obtain a copy of the License
7 -- at http://www.opencascade.org and read it completely before using this file.
9 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 -- The Original Code and all software distributed under the License is
13 -- distributed on an "AS IS" basis, without warranty of any kind, and the
14 -- Initial Developer hereby disclaims all such warranties, including without
15 -- limitation, any warranties of merchantability, fitness for a particular
16 -- purpose or non-infringement. Please see the License for the specific terms
17 -- and conditions governing the rights and limitations under the License.
20 class Length from Prs2d inherits Dimension from Prs2d
22 ---Purpose: Constructs the primitive Length
26 Drawer from Graphic2d,
27 GraphicObject from Graphic2d,
30 ExtendedString from TCollection,
32 TypeOfDist from Prs2d,
33 TypeOfArrow from Prs2d,
37 Create( aGraphicObject: GraphicObject from Graphic2d;
38 anAttachPnt1 : Pnt2d from gp;
39 anAttachPnt2 : Pnt2d from gp;
40 aText : ExtendedString from TCollection;
41 aTxtScale : Real from Standard = 5.0;
42 aLength : Real from Standard = 0.0;
43 aTypeDist : TypeOfDist from Prs2d = Prs2d_TOD_AUTOMATIC;
44 anArrAngle : Real from Standard = 20.0;
45 anArrLength : Real from Standard = 25.0;
46 anArrType : TypeOfArrow from Prs2d = Prs2d_TOA_OPENED;
47 anArrow : ArrowSide from Prs2d = Prs2d_AS_BOTHAR;
48 IsReverseArrow: Boolean from Standard = Standard_False )
50 returns mutable Length from Prs2d;
52 ---Purpose: Initializes the length dimension between points
53 -- anAttachPnt1 and anAttachPnt2.
54 -- aLength is length of the attach lines
55 -- aTypeDist defines the orientation of the displayed length:
56 -- AIS2D_TOD_AUTOMATIC
58 -- AIS2D_TOD_HORIZONTAL
60 -- anArrow defines the number of arrows (one, two or none)
62 Create( aGraphicObject: GraphicObject from Graphic2d;
63 anAttachPnt : Pnt2d from gp;
64 anAttachLin : Lin2d from gp;
65 aText : ExtendedString from TCollection;
66 aTxtScale : Real from Standard = 10.0;
67 aLenAttachLin : Real from Standard = 0.0;
68 anArrAngle : Real from Standard = 20.0;
69 anArrLength : Real from Standard = 25.0;
70 anArrType : TypeOfArrow from Prs2d = Prs2d_TOA_OPENED;
71 anArrow : ArrowSide from Prs2d = Prs2d_AS_BOTHAR;
72 IsReverseArrow: Boolean from Standard = Standard_False )
74 returns mutable Length from Prs2d;
76 ---Purpose: Initializes the length dimension between point
77 -- anAttachPnt1 and line defined anAttachLin.
78 -- aLenAttachLin is length of the attach lines
80 Create( aGraphicObject: GraphicObject from Graphic2d;
81 anAttachLin1 : Lin2d from gp;
82 anAttachLin2 : Lin2d from gp;
83 aText : ExtendedString from TCollection;
84 aTxtScale : Real from Standard = 10.0;
85 aLenAttachLin : Real from Standard = 0.0;
86 anArrAngle : Real from Standard = 20.0;
87 anArrLength : Real from Standard = 25.0;
88 anArrType : TypeOfArrow from Prs2d = Prs2d_TOA_OPENED;
89 anArrow : ArrowSide from Prs2d = Prs2d_AS_BOTHAR;
90 IsReverseArrow: Boolean from Standard = Standard_False )
92 returns mutable Length from Prs2d;
94 ---Purpose: Initializes the length dimension between line
95 -- anAttachLin1 and line defined anAttachLin2.
96 -- aLenAttachLin is length of the attach lines
98 --------------------------
99 -- Category: Draw and Pick
100 --------------------------
102 Draw( me : mutable; aDrawer: Drawer from Graphic2d ) is static protected;
104 ---Purpose: Draws the length <me>.
106 DrawElement( me : mutable; aDrawer: Drawer from Graphic2d;
107 anIndex: Integer from Standard) is redefined protected;
109 ---Purpose: Draws element <anIndex> of the length <me>.
111 DrawVertex( me : mutable; aDrawer: Drawer from Graphic2d;
112 anIndex: Integer from Standard) is redefined protected;
114 ---Purpose: Draws vertex <anIndex> of the length <me>.
116 Pick( me : mutable; X, Y: ShortReal from Standard;
117 aPrecision: ShortReal from Standard;
118 aDrawer: Drawer from Graphic2d) returns Boolean from Standard
121 ---Purpose: Returns Standard_True if the length <me> is picked,
122 -- Standard_False if not.
124 GetPntProject( me: mutable; aLength: Real from Standard ) is private;
125 ComputeArrows( me: mutable; isnotPoints: Boolean from Standard ) is private;
127 --------------------------------------------
128 -- Category: Modification of the properties
129 --------------------------------------------
131 SetAttachLinLength( me: mutable; aLength: Real from Standard );
133 ---Purpose: Sets the length of attachment lines
135 Save( me; aFStream: in out FStream from Aspect ) is virtual;
137 CalcTxtPos(me:mutable; theFromAbs:
138 Boolean from Standard=Standard_False)
140 is redefined protected;
142 LineCoord( me ; aFirstPnt, aSecondPnt: in out Pnt2d from gp );
144 ---Purpose: returns coordinates of points, which are begining
147 CallOutCoord( me ; aFirstPnt, aSecondPnt: in out Pnt2d from gp );
149 ---Purpose: returns coordinates of points, which are begining
152 TypeOfDist(me) returns TypeOfDist;
158 myX1 : ShortReal from Standard;
159 myY1 : ShortReal from Standard;
160 myX2 : ShortReal from Standard;
161 myY2 : ShortReal from Standard;
162 myAX1 : ShortReal from Standard;
163 myAY1 : ShortReal from Standard;
164 myAX2 : ShortReal from Standard;
165 myAY2 : ShortReal from Standard;
166 myTypeDist : TypeOfDist from Prs2d;
167 myXT1 : ShortReal from Standard;
168 myYT1 : ShortReal from Standard;
169 myXT2 : ShortReal from Standard;
170 myYT2 : ShortReal from Standard;
172 end Length from Prs2d;