7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESDimen_FlagNote.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESDimen_FlagNote.ixx> |
11 | #include <Standard_DimensionMismatch.hxx> |
12 | #include <gp_GTrsf.hxx> |
13 | |
14 | |
15 | IGESDimen_FlagNote::IGESDimen_FlagNote () { } |
16 | |
17 | void IGESDimen_FlagNote::Init |
18 | (const gp_XYZ& leftCorner, const Standard_Real anAngle, |
19 | const Handle(IGESDimen_GeneralNote)& aNote, |
20 | const Handle(IGESDimen_HArray1OfLeaderArrow)& someLeaders) |
21 | { |
22 | if (!someLeaders.IsNull()) |
23 | if (someLeaders->Lower() != 1) |
24 | Standard_DimensionMismatch::Raise("IGESDimen_FlagNote : Init"); |
25 | theLowerLeftcorner = leftCorner; |
26 | theAngle = anAngle; |
27 | theNote = aNote; |
28 | theLeaders = someLeaders; |
29 | InitTypeAndForm(208,0); |
30 | } |
31 | |
32 | gp_Pnt IGESDimen_FlagNote::LowerLeftCorner () const |
33 | { |
34 | gp_Pnt lowerleft(theLowerLeftcorner); |
35 | return lowerleft; |
36 | } |
37 | |
38 | gp_Pnt IGESDimen_FlagNote::TransformedLowerLeftCorner () const |
39 | { |
40 | gp_XYZ tempXYZ = theLowerLeftcorner; |
41 | if (HasTransf()) Location().Transforms(tempXYZ); |
42 | return gp_Pnt(tempXYZ); |
43 | } |
44 | |
45 | Standard_Real IGESDimen_FlagNote::Angle () const |
46 | { |
47 | return theAngle; |
48 | } |
49 | |
50 | Handle(IGESDimen_GeneralNote) IGESDimen_FlagNote::Note () const |
51 | { |
52 | return theNote; |
53 | } |
54 | |
55 | Standard_Integer IGESDimen_FlagNote::NbLeaders () const |
56 | { |
57 | return (theLeaders.IsNull() ? 0 : theLeaders->Length() ); |
58 | } |
59 | |
60 | Handle(IGESDimen_LeaderArrow) IGESDimen_FlagNote::Leader |
61 | (const Standard_Integer Index) const |
62 | { |
63 | return theLeaders->Value(Index); |
64 | } |
65 | |
66 | Standard_Real IGESDimen_FlagNote::Height () const |
67 | { |
68 | return (2 * CharacterHeight()); |
69 | } |
70 | |
71 | Standard_Real IGESDimen_FlagNote::CharacterHeight () const |
72 | { |
73 | Standard_Real Max = theNote->BoxHeight(1); |
74 | for(Standard_Integer i = 2; i <= theNote->NbStrings(); i++) |
75 | { |
76 | if (Max < theNote->BoxHeight(i)) |
77 | Max = theNote->BoxHeight(i); |
78 | } |
79 | return (Max); |
80 | } |
81 | |
82 | Standard_Real IGESDimen_FlagNote::Length () const |
83 | { |
84 | return (TextWidth() + (0.4 * CharacterHeight())); |
85 | } |
86 | |
87 | Standard_Real IGESDimen_FlagNote::TextWidth () const |
88 | { |
89 | Standard_Real width = 0; |
90 | for(Standard_Integer i = 1; i <= theNote->NbStrings(); i++) |
91 | width += theNote->BoxWidth(i); |
92 | return (width); |
93 | } |
94 | |
95 | Standard_Real IGESDimen_FlagNote::TipLength () const |
96 | { |
c6541a0c |
97 | return (0.5 * (Height()/Tan((35./180.)*M_PI))); |
7fd59977 |
98 | } |