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 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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 | |
7fd59977 |
19 | #include <gp_GTrsf.hxx> |
42cf5bc1 |
20 | #include <gp_Pnt.hxx> |
21 | #include <IGESDimen_GeneralNote.hxx> |
22 | #include <IGESGraph_TextFontDef.hxx> |
23 | #include <Standard_DimensionMismatch.hxx> |
24 | #include <Standard_OutOfRange.hxx> |
25 | #include <Standard_Type.hxx> |
26 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
27 | |
92efcf78 |
28 | IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_GeneralNote,IGESData_IGESEntity) |
29 | |
b311480e |
30 | IGESDimen_GeneralNote::IGESDimen_GeneralNote () { } |
7fd59977 |
31 | |
32 | void IGESDimen_GeneralNote::Init |
33 | (const Handle(TColStd_HArray1OfInteger)& nbChars, |
34 | const Handle(TColStd_HArray1OfReal)& widths, |
35 | const Handle(TColStd_HArray1OfReal)& heights, |
36 | const Handle(TColStd_HArray1OfInteger)& fontCodes, |
37 | const Handle(IGESGraph_HArray1OfTextFontDef)& fonts, |
38 | const Handle(TColStd_HArray1OfReal)& slants, |
39 | const Handle(TColStd_HArray1OfReal)& rotations, |
40 | const Handle(TColStd_HArray1OfInteger)& mirrorFlags, |
41 | const Handle(TColStd_HArray1OfInteger)& rotFlags, |
42 | const Handle(TColgp_HArray1OfXYZ)& start, |
43 | const Handle(Interface_HArray1OfHAsciiString)& texts) |
44 | { |
45 | Standard_Integer num = nbChars->Length(); |
46 | |
47 | if ( nbChars->Lower() != 1 || |
48 | (widths->Lower() != 1 || widths->Length() != num) || |
49 | (heights->Lower() != 1 || heights->Length() != num) || |
50 | (fontCodes->Lower() != 1 || fontCodes->Length() != num) || |
51 | (fonts->Lower() != 1 || fonts->Length() != num) || |
52 | (slants->Lower() != 1 || slants->Length() != num) || |
53 | (rotations->Lower() != 1 || rotations->Length() != num) || |
54 | (mirrorFlags->Lower() != 1 || mirrorFlags->Length() != num) || |
55 | (rotFlags->Lower() != 1 || rotFlags->Length() != num) || |
56 | (start->Lower() != 1 || start->Length() != num) || |
57 | (texts->Lower() != 1 || texts->Length() != num) ) |
9775fa61 |
58 | throw Standard_DimensionMismatch("IGESDimen_GeneralNote : Init"); |
7fd59977 |
59 | |
60 | theNbChars = nbChars; |
61 | theBoxWidths = widths; |
62 | theBoxHeights = heights; |
63 | theFontCodes = fontCodes; |
64 | theFontEntities = fonts; |
65 | theSlantAngles = slants; |
66 | theRotationAngles = rotations; |
67 | theMirrorFlags = mirrorFlags; |
68 | theRotateFlags = rotFlags; |
69 | theStartPoints = start; |
70 | theTexts = texts; |
71 | InitTypeAndForm(212,FormNumber()); |
72 | // FormNumber for Graphical Representation |
73 | } |
74 | |
75 | void IGESDimen_GeneralNote::SetFormNumber (const Standard_Integer form) |
76 | { |
77 | if ((form < 0 || form > 8) && (form < 100 || form > 102) && form != 105) |
9775fa61 |
78 | throw Standard_OutOfRange("IGESDimen_GeneralNote : SetFormNumber"); |
7fd59977 |
79 | InitTypeAndForm(212,form); |
80 | } |
81 | |
82 | |
83 | Standard_Integer IGESDimen_GeneralNote::NbStrings () const |
84 | { |
85 | return theNbChars->Length(); |
86 | } |
87 | |
88 | Standard_Integer IGESDimen_GeneralNote::NbCharacters |
89 | (const Standard_Integer Index) const |
90 | { |
91 | return theNbChars->Value(Index); |
92 | } |
93 | |
94 | Standard_Real IGESDimen_GeneralNote::BoxWidth |
95 | (const Standard_Integer Index) const |
96 | { |
97 | return theBoxWidths->Value(Index); |
98 | } |
99 | |
100 | Standard_Real IGESDimen_GeneralNote::BoxHeight |
101 | (const Standard_Integer Index) const |
102 | { |
103 | return theBoxHeights->Value(Index); |
104 | } |
105 | |
106 | Standard_Boolean IGESDimen_GeneralNote::IsFontEntity |
107 | (const Standard_Integer Index) const |
108 | { |
109 | return (! (theFontEntities->Value(Index)).IsNull()); |
110 | } |
111 | |
112 | Standard_Integer IGESDimen_GeneralNote::FontCode |
113 | (const Standard_Integer Index) const |
114 | { |
115 | return theFontCodes->Value(Index); |
116 | } |
117 | |
118 | Handle(IGESGraph_TextFontDef) IGESDimen_GeneralNote::FontEntity |
119 | (const Standard_Integer Index) const |
120 | { |
121 | return theFontEntities->Value(Index); |
122 | } |
123 | |
124 | Standard_Real IGESDimen_GeneralNote::SlantAngle |
125 | (const Standard_Integer Index) const |
126 | { |
127 | return theSlantAngles->Value(Index); |
128 | } |
129 | |
130 | Standard_Real IGESDimen_GeneralNote::RotationAngle |
131 | (const Standard_Integer Index) const |
132 | { |
133 | return theRotationAngles->Value(Index); |
134 | } |
135 | |
136 | Standard_Integer IGESDimen_GeneralNote::MirrorFlag |
137 | (const Standard_Integer Index) const |
138 | { |
139 | return theMirrorFlags->Value(Index); |
140 | } |
141 | |
142 | Standard_Integer IGESDimen_GeneralNote::RotateFlag |
143 | (const Standard_Integer Index) const |
144 | { |
145 | return theRotateFlags->Value(Index); |
146 | } |
147 | |
148 | gp_Pnt IGESDimen_GeneralNote::StartPoint |
149 | (const Standard_Integer Index) const |
150 | { |
151 | gp_Pnt point(theStartPoints->Value(Index)); |
152 | return point; |
153 | } |
154 | |
155 | gp_Pnt IGESDimen_GeneralNote::TransformedStartPoint |
156 | (const Standard_Integer Index) const |
157 | { |
158 | gp_XYZ point = (theStartPoints->Value(Index)); |
159 | if (HasTransf()) Location().Transforms(point); |
160 | return gp_Pnt(point); |
161 | } |
162 | |
163 | Standard_Real IGESDimen_GeneralNote::ZDepthStartPoint |
164 | (const Standard_Integer Index) const |
165 | { |
166 | return ((theStartPoints->Value(Index)).Z()); |
167 | } |
168 | |
169 | Handle(TCollection_HAsciiString) IGESDimen_GeneralNote::Text |
170 | (const Standard_Integer Index) const |
171 | { |
172 | return theTexts->Value(Index); |
173 | } |