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 | |
42cf5bc1 |
19 | #include <IGESBasic_HArray1OfHArray1OfInteger.hxx> |
20 | #include <IGESGraph_TextFontDef.hxx> |
21 | #include <Standard_DimensionMismatch.hxx> |
22 | #include <Standard_OutOfRange.hxx> |
23 | #include <Standard_Type.hxx> |
24 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
25 | |
92efcf78 |
26 | IMPLEMENT_STANDARD_RTTIEXT(IGESGraph_TextFontDef,IGESData_IGESEntity) |
27 | |
b311480e |
28 | IGESGraph_TextFontDef::IGESGraph_TextFontDef () { } |
7fd59977 |
29 | |
30 | |
31 | void IGESGraph_TextFontDef::Init |
32 | (const Standard_Integer aFontCode, |
33 | const Handle(TCollection_HAsciiString)& aFontName, |
34 | const Standard_Integer aSupersededFont, |
35 | const Handle(IGESGraph_TextFontDef)& aSupersededEntity, |
36 | const Standard_Integer aScale, |
37 | const Handle(TColStd_HArray1OfInteger)& allASCIICodes, |
38 | const Handle(TColStd_HArray1OfInteger)& allNextCharX, |
39 | const Handle(TColStd_HArray1OfInteger)& allNextCharY, |
40 | const Handle(TColStd_HArray1OfInteger)& allPenMotions, |
41 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allPenFlags, |
42 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToX, |
43 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToY) |
44 | { |
45 | Standard_Integer Len = allASCIICodes->Length(); |
46 | if (allASCIICodes->Lower() != 1 || |
47 | (allNextCharX->Lower() != 1 || allNextCharX->Length() != Len) || |
48 | (allNextCharY->Lower() != 1 || allNextCharY->Length() != Len) || |
49 | (allPenMotions->Lower() != 1 || allPenMotions->Length() != Len) || |
50 | (allPenFlags->Lower() != 1 || allPenFlags->Length() != Len) || |
51 | (allMovePenToX->Lower() != 1 || allMovePenToX->Length() != Len) || |
bd7ad48c |
52 | (allMovePenToY->Lower() != 1 || allMovePenToY->Length() != Len) ) |
9775fa61 |
53 | throw Standard_DimensionMismatch("IGESGraph_TextFontDef : Init"); |
7fd59977 |
54 | |
55 | theFontCode = aFontCode; |
56 | theFontName = aFontName; |
57 | theSupersededFontCode = aSupersededFont; |
58 | theSupersededFontEntity = aSupersededEntity; |
59 | theScale = aScale; |
60 | theASCIICodes = allASCIICodes; |
61 | theNextCharOriginX = allNextCharX; |
62 | theNextCharOriginY = allNextCharY; |
63 | theNbPenMotions = allPenMotions; |
64 | thePenMotions = allPenFlags; |
65 | thePenMovesToX = allMovePenToX; |
66 | thePenMovesToY = allMovePenToY; |
67 | InitTypeAndForm(310,0); |
68 | } |
69 | |
70 | Standard_Integer IGESGraph_TextFontDef::FontCode () const |
71 | { |
72 | return theFontCode; |
73 | } |
74 | |
75 | Handle(TCollection_HAsciiString) IGESGraph_TextFontDef::FontName () const |
76 | { |
77 | return theFontName; |
78 | } |
79 | |
80 | Standard_Boolean IGESGraph_TextFontDef::IsSupersededFontEntity () const |
81 | { |
82 | return (! theSupersededFontEntity.IsNull()); |
83 | } |
84 | |
85 | Standard_Integer IGESGraph_TextFontDef::SupersededFontCode () const |
86 | { |
87 | return theSupersededFontCode; |
88 | } |
89 | |
90 | Handle(IGESGraph_TextFontDef) IGESGraph_TextFontDef::SupersededFontEntity () const |
91 | { |
92 | return theSupersededFontEntity; |
93 | } |
94 | |
95 | Standard_Integer IGESGraph_TextFontDef::Scale () const |
96 | { |
97 | return theScale; |
98 | } |
99 | |
100 | Standard_Integer IGESGraph_TextFontDef::NbCharacters () const |
101 | { |
102 | return ( theASCIICodes->Length() ); |
103 | } |
104 | |
105 | Standard_Integer IGESGraph_TextFontDef::ASCIICode |
106 | (const Standard_Integer Chnum) const |
107 | { |
108 | return ( theASCIICodes->Value(Chnum) ); |
109 | } |
110 | |
111 | void IGESGraph_TextFontDef::NextCharOrigin |
112 | (const Standard_Integer Chnum, |
113 | Standard_Integer& NX, Standard_Integer& NY) const |
114 | { |
115 | NX = theNextCharOriginX->Value(Chnum); |
116 | NY = theNextCharOriginY->Value(Chnum); |
117 | } |
118 | |
119 | Standard_Integer IGESGraph_TextFontDef::NbPenMotions |
120 | (const Standard_Integer Chnum) const |
121 | { |
122 | return ( theNbPenMotions->Value(Chnum) ); |
123 | } |
124 | |
125 | Standard_Boolean IGESGraph_TextFontDef::IsPenUp |
126 | (const Standard_Integer Chnum, const Standard_Integer Motionnum) const |
127 | { |
128 | Handle(TColStd_HArray1OfInteger) MotionArr = thePenMotions->Value(Chnum); |
129 | Standard_Integer PenStatus = MotionArr->Value(Motionnum); |
130 | return ( PenStatus == 1 ); |
131 | } |
132 | |
133 | void IGESGraph_TextFontDef::NextPenPosition |
134 | (const Standard_Integer Chnum, const Standard_Integer Motionnum, |
135 | Standard_Integer& IX, Standard_Integer& IY) const |
136 | { |
137 | IX = thePenMovesToX->Value(Chnum)->Value(Motionnum); |
138 | IY = thePenMovesToY->Value(Chnum)->Value(Motionnum); |
139 | } |