7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESGraph_TextFontDef.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESGraph_TextFontDef.ixx> |
11 | |
12 | |
13 | IGESGraph_TextFontDef::IGESGraph_TextFontDef () { } |
14 | |
15 | |
16 | void IGESGraph_TextFontDef::Init |
17 | (const Standard_Integer aFontCode, |
18 | const Handle(TCollection_HAsciiString)& aFontName, |
19 | const Standard_Integer aSupersededFont, |
20 | const Handle(IGESGraph_TextFontDef)& aSupersededEntity, |
21 | const Standard_Integer aScale, |
22 | const Handle(TColStd_HArray1OfInteger)& allASCIICodes, |
23 | const Handle(TColStd_HArray1OfInteger)& allNextCharX, |
24 | const Handle(TColStd_HArray1OfInteger)& allNextCharY, |
25 | const Handle(TColStd_HArray1OfInteger)& allPenMotions, |
26 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allPenFlags, |
27 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToX, |
28 | const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToY) |
29 | { |
30 | Standard_Integer Len = allASCIICodes->Length(); |
31 | if (allASCIICodes->Lower() != 1 || |
32 | (allNextCharX->Lower() != 1 || allNextCharX->Length() != Len) || |
33 | (allNextCharY->Lower() != 1 || allNextCharY->Length() != Len) || |
34 | (allPenMotions->Lower() != 1 || allPenMotions->Length() != Len) || |
35 | (allPenFlags->Lower() != 1 || allPenFlags->Length() != Len) || |
36 | (allMovePenToX->Lower() != 1 || allMovePenToX->Length() != Len) || |
37 | (allMovePenToX->Lower() != 1 || allMovePenToX->Length() != Len) ) |
38 | Standard_DimensionMismatch::Raise("IGESGraph_TextFontDef : Init"); |
39 | |
40 | theFontCode = aFontCode; |
41 | theFontName = aFontName; |
42 | theSupersededFontCode = aSupersededFont; |
43 | theSupersededFontEntity = aSupersededEntity; |
44 | theScale = aScale; |
45 | theASCIICodes = allASCIICodes; |
46 | theNextCharOriginX = allNextCharX; |
47 | theNextCharOriginY = allNextCharY; |
48 | theNbPenMotions = allPenMotions; |
49 | thePenMotions = allPenFlags; |
50 | thePenMovesToX = allMovePenToX; |
51 | thePenMovesToY = allMovePenToY; |
52 | InitTypeAndForm(310,0); |
53 | } |
54 | |
55 | Standard_Integer IGESGraph_TextFontDef::FontCode () const |
56 | { |
57 | return theFontCode; |
58 | } |
59 | |
60 | Handle(TCollection_HAsciiString) IGESGraph_TextFontDef::FontName () const |
61 | { |
62 | return theFontName; |
63 | } |
64 | |
65 | Standard_Boolean IGESGraph_TextFontDef::IsSupersededFontEntity () const |
66 | { |
67 | return (! theSupersededFontEntity.IsNull()); |
68 | } |
69 | |
70 | Standard_Integer IGESGraph_TextFontDef::SupersededFontCode () const |
71 | { |
72 | return theSupersededFontCode; |
73 | } |
74 | |
75 | Handle(IGESGraph_TextFontDef) IGESGraph_TextFontDef::SupersededFontEntity () const |
76 | { |
77 | return theSupersededFontEntity; |
78 | } |
79 | |
80 | Standard_Integer IGESGraph_TextFontDef::Scale () const |
81 | { |
82 | return theScale; |
83 | } |
84 | |
85 | Standard_Integer IGESGraph_TextFontDef::NbCharacters () const |
86 | { |
87 | return ( theASCIICodes->Length() ); |
88 | } |
89 | |
90 | Standard_Integer IGESGraph_TextFontDef::ASCIICode |
91 | (const Standard_Integer Chnum) const |
92 | { |
93 | return ( theASCIICodes->Value(Chnum) ); |
94 | } |
95 | |
96 | void IGESGraph_TextFontDef::NextCharOrigin |
97 | (const Standard_Integer Chnum, |
98 | Standard_Integer& NX, Standard_Integer& NY) const |
99 | { |
100 | NX = theNextCharOriginX->Value(Chnum); |
101 | NY = theNextCharOriginY->Value(Chnum); |
102 | } |
103 | |
104 | Standard_Integer IGESGraph_TextFontDef::NbPenMotions |
105 | (const Standard_Integer Chnum) const |
106 | { |
107 | return ( theNbPenMotions->Value(Chnum) ); |
108 | } |
109 | |
110 | Standard_Boolean IGESGraph_TextFontDef::IsPenUp |
111 | (const Standard_Integer Chnum, const Standard_Integer Motionnum) const |
112 | { |
113 | Handle(TColStd_HArray1OfInteger) MotionArr = thePenMotions->Value(Chnum); |
114 | Standard_Integer PenStatus = MotionArr->Value(Motionnum); |
115 | return ( PenStatus == 1 ); |
116 | } |
117 | |
118 | void IGESGraph_TextFontDef::NextPenPosition |
119 | (const Standard_Integer Chnum, const Standard_Integer Motionnum, |
120 | Standard_Integer& IX, Standard_Integer& IY) const |
121 | { |
122 | IX = thePenMovesToX->Value(Chnum)->Value(Motionnum); |
123 | IY = thePenMovesToY->Value(Chnum)->Value(Motionnum); |
124 | } |