b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
19 | #include <IGESDimen_GeneralNote.ixx> |
20 | #include <Standard_OutOfRange.hxx> |
21 | #include <gp_GTrsf.hxx> |
22 | |
23 | |
b311480e |
24 | IGESDimen_GeneralNote::IGESDimen_GeneralNote () { } |
7fd59977 |
25 | |
26 | void IGESDimen_GeneralNote::Init |
27 | (const Handle(TColStd_HArray1OfInteger)& nbChars, |
28 | const Handle(TColStd_HArray1OfReal)& widths, |
29 | const Handle(TColStd_HArray1OfReal)& heights, |
30 | const Handle(TColStd_HArray1OfInteger)& fontCodes, |
31 | const Handle(IGESGraph_HArray1OfTextFontDef)& fonts, |
32 | const Handle(TColStd_HArray1OfReal)& slants, |
33 | const Handle(TColStd_HArray1OfReal)& rotations, |
34 | const Handle(TColStd_HArray1OfInteger)& mirrorFlags, |
35 | const Handle(TColStd_HArray1OfInteger)& rotFlags, |
36 | const Handle(TColgp_HArray1OfXYZ)& start, |
37 | const Handle(Interface_HArray1OfHAsciiString)& texts) |
38 | { |
39 | Standard_Integer num = nbChars->Length(); |
40 | |
41 | if ( nbChars->Lower() != 1 || |
42 | (widths->Lower() != 1 || widths->Length() != num) || |
43 | (heights->Lower() != 1 || heights->Length() != num) || |
44 | (fontCodes->Lower() != 1 || fontCodes->Length() != num) || |
45 | (fonts->Lower() != 1 || fonts->Length() != num) || |
46 | (slants->Lower() != 1 || slants->Length() != num) || |
47 | (rotations->Lower() != 1 || rotations->Length() != num) || |
48 | (mirrorFlags->Lower() != 1 || mirrorFlags->Length() != num) || |
49 | (rotFlags->Lower() != 1 || rotFlags->Length() != num) || |
50 | (start->Lower() != 1 || start->Length() != num) || |
51 | (texts->Lower() != 1 || texts->Length() != num) ) |
52 | Standard_DimensionMismatch::Raise("IGESDimen_GeneralNote : Init"); |
53 | |
54 | theNbChars = nbChars; |
55 | theBoxWidths = widths; |
56 | theBoxHeights = heights; |
57 | theFontCodes = fontCodes; |
58 | theFontEntities = fonts; |
59 | theSlantAngles = slants; |
60 | theRotationAngles = rotations; |
61 | theMirrorFlags = mirrorFlags; |
62 | theRotateFlags = rotFlags; |
63 | theStartPoints = start; |
64 | theTexts = texts; |
65 | InitTypeAndForm(212,FormNumber()); |
66 | // FormNumber for Graphical Representation |
67 | } |
68 | |
69 | void IGESDimen_GeneralNote::SetFormNumber (const Standard_Integer form) |
70 | { |
71 | if ((form < 0 || form > 8) && (form < 100 || form > 102) && form != 105) |
72 | Standard_OutOfRange::Raise("IGESDimen_GeneralNote : SetFormNumber"); |
73 | InitTypeAndForm(212,form); |
74 | } |
75 | |
76 | |
77 | Standard_Integer IGESDimen_GeneralNote::NbStrings () const |
78 | { |
79 | return theNbChars->Length(); |
80 | } |
81 | |
82 | Standard_Integer IGESDimen_GeneralNote::NbCharacters |
83 | (const Standard_Integer Index) const |
84 | { |
85 | return theNbChars->Value(Index); |
86 | } |
87 | |
88 | Standard_Real IGESDimen_GeneralNote::BoxWidth |
89 | (const Standard_Integer Index) const |
90 | { |
91 | return theBoxWidths->Value(Index); |
92 | } |
93 | |
94 | Standard_Real IGESDimen_GeneralNote::BoxHeight |
95 | (const Standard_Integer Index) const |
96 | { |
97 | return theBoxHeights->Value(Index); |
98 | } |
99 | |
100 | Standard_Boolean IGESDimen_GeneralNote::IsFontEntity |
101 | (const Standard_Integer Index) const |
102 | { |
103 | return (! (theFontEntities->Value(Index)).IsNull()); |
104 | } |
105 | |
106 | Standard_Integer IGESDimen_GeneralNote::FontCode |
107 | (const Standard_Integer Index) const |
108 | { |
109 | return theFontCodes->Value(Index); |
110 | } |
111 | |
112 | Handle(IGESGraph_TextFontDef) IGESDimen_GeneralNote::FontEntity |
113 | (const Standard_Integer Index) const |
114 | { |
115 | return theFontEntities->Value(Index); |
116 | } |
117 | |
118 | Standard_Real IGESDimen_GeneralNote::SlantAngle |
119 | (const Standard_Integer Index) const |
120 | { |
121 | return theSlantAngles->Value(Index); |
122 | } |
123 | |
124 | Standard_Real IGESDimen_GeneralNote::RotationAngle |
125 | (const Standard_Integer Index) const |
126 | { |
127 | return theRotationAngles->Value(Index); |
128 | } |
129 | |
130 | Standard_Integer IGESDimen_GeneralNote::MirrorFlag |
131 | (const Standard_Integer Index) const |
132 | { |
133 | return theMirrorFlags->Value(Index); |
134 | } |
135 | |
136 | Standard_Integer IGESDimen_GeneralNote::RotateFlag |
137 | (const Standard_Integer Index) const |
138 | { |
139 | return theRotateFlags->Value(Index); |
140 | } |
141 | |
142 | gp_Pnt IGESDimen_GeneralNote::StartPoint |
143 | (const Standard_Integer Index) const |
144 | { |
145 | gp_Pnt point(theStartPoints->Value(Index)); |
146 | return point; |
147 | } |
148 | |
149 | gp_Pnt IGESDimen_GeneralNote::TransformedStartPoint |
150 | (const Standard_Integer Index) const |
151 | { |
152 | gp_XYZ point = (theStartPoints->Value(Index)); |
153 | if (HasTransf()) Location().Transforms(point); |
154 | return gp_Pnt(point); |
155 | } |
156 | |
157 | Standard_Real IGESDimen_GeneralNote::ZDepthStartPoint |
158 | (const Standard_Integer Index) const |
159 | { |
160 | return ((theStartPoints->Value(Index)).Z()); |
161 | } |
162 | |
163 | Handle(TCollection_HAsciiString) IGESDimen_GeneralNote::Text |
164 | (const Standard_Integer Index) const |
165 | { |
166 | return theTexts->Value(Index); |
167 | } |