summaryrefslogtreecommitdiff
path: root/src/IGESGraph/IGESGraph_TextFontDef.cxx
blob: 30184da619d29f60b74f9024dd49a9f52efec423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//--------------------------------------------------------------------
//
//  File Name : IGESGraph_TextFontDef.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESGraph_TextFontDef.ixx>


    IGESGraph_TextFontDef::IGESGraph_TextFontDef ()    {  }


    void IGESGraph_TextFontDef::Init
  (const Standard_Integer                             aFontCode,
   const Handle(TCollection_HAsciiString)&            aFontName,
   const Standard_Integer                             aSupersededFont,
   const Handle(IGESGraph_TextFontDef)&               aSupersededEntity,
   const Standard_Integer                             aScale,
   const Handle(TColStd_HArray1OfInteger)&            allASCIICodes,
   const Handle(TColStd_HArray1OfInteger)&            allNextCharX,
   const Handle(TColStd_HArray1OfInteger)&            allNextCharY,
   const Handle(TColStd_HArray1OfInteger)&            allPenMotions,
   const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allPenFlags,
   const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToX,
   const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allMovePenToY)
{
  Standard_Integer Len  = allASCIICodes->Length();
  if (allASCIICodes->Lower()  != 1 ||
      (allNextCharX->Lower()  != 1 || allNextCharX->Length()  != Len) ||
      (allNextCharY->Lower()  != 1 || allNextCharY->Length()  != Len) ||
      (allPenMotions->Lower() != 1 || allPenMotions->Length() != Len) ||
      (allPenFlags->Lower()   != 1 || allPenFlags->Length()   != Len) ||
      (allMovePenToX->Lower() != 1 || allMovePenToX->Length() != Len) ||
      (allMovePenToX->Lower() != 1 || allMovePenToX->Length() != Len) )
    Standard_DimensionMismatch::Raise("IGESGraph_TextFontDef : Init");

  theFontCode             = aFontCode;           
  theFontName             = aFontName; 
  theSupersededFontCode   = aSupersededFont;
  theSupersededFontEntity = aSupersededEntity;
  theScale                = aScale;
  theASCIICodes           = allASCIICodes; 
  theNextCharOriginX      = allNextCharX;
  theNextCharOriginY      = allNextCharY;
  theNbPenMotions         = allPenMotions;
  thePenMotions           = allPenFlags; 
  thePenMovesToX          = allMovePenToX;
  thePenMovesToY          = allMovePenToY;
  InitTypeAndForm(310,0);
}

    Standard_Integer IGESGraph_TextFontDef::FontCode () const
{
  return theFontCode;
}

    Handle(TCollection_HAsciiString) IGESGraph_TextFontDef::FontName () const
{
  return theFontName;
}

    Standard_Boolean IGESGraph_TextFontDef::IsSupersededFontEntity () const
{
  return (! theSupersededFontEntity.IsNull());
}

    Standard_Integer IGESGraph_TextFontDef::SupersededFontCode () const
{   
  return theSupersededFontCode;
}

    Handle(IGESGraph_TextFontDef) IGESGraph_TextFontDef::SupersededFontEntity () const
{   
  return theSupersededFontEntity;
}

    Standard_Integer IGESGraph_TextFontDef::Scale () const
{
  return theScale;
}

    Standard_Integer IGESGraph_TextFontDef::NbCharacters () const
{
  return ( theASCIICodes->Length() );
}

    Standard_Integer IGESGraph_TextFontDef::ASCIICode
  (const Standard_Integer Chnum) const
{
  return ( theASCIICodes->Value(Chnum) ); 
}

    void IGESGraph_TextFontDef::NextCharOrigin
  (const Standard_Integer Chnum,
   Standard_Integer& NX, Standard_Integer& NY) const
{
  NX = theNextCharOriginX->Value(Chnum);
  NY = theNextCharOriginY->Value(Chnum);
}

    Standard_Integer IGESGraph_TextFontDef::NbPenMotions
  (const Standard_Integer Chnum) const
{
  return ( theNbPenMotions->Value(Chnum) ); 
}

    Standard_Boolean IGESGraph_TextFontDef::IsPenUp
  (const Standard_Integer Chnum, const Standard_Integer Motionnum) const
{
  Handle(TColStd_HArray1OfInteger) MotionArr = thePenMotions->Value(Chnum);
  Standard_Integer PenStatus =     MotionArr->Value(Motionnum);
  return ( PenStatus == 1 );
}

    void IGESGraph_TextFontDef::NextPenPosition
  (const Standard_Integer Chnum, const Standard_Integer Motionnum,
   Standard_Integer& IX, Standard_Integer& IY) const
{
  IX = thePenMovesToX->Value(Chnum)->Value(Motionnum);
  IY = thePenMovesToY->Value(Chnum)->Value(Motionnum);
}