summaryrefslogtreecommitdiff
path: root/src/Prs2d/Prs2d_AspectText.cxx
blob: 9f6af2351d507d145ee1958ecfd51c9e77b9e309 (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
#include <Prs2d_AspectText.ixx>
#include <Prs2d_AspectName.hxx>
#include <Aspect_GenericColorMap.hxx> 
#include <Aspect_FontMap.hxx> 

Prs2d_AspectText::Prs2d_AspectText( const Quantity_NameOfColor aColor,
		    	const Standard_CString aFont,
			    const Quantity_Length aSize,
			    const Aspect_TypeOfText aType,
			    const Standard_Boolean isUnderlined )
  : 
    Prs2d_AspectRoot( Prs2d_AN_TEXT ),
    myColor( aColor ),
    myFont( aFont, aSize ),
    myRelativeSlant(0.),
    myType( aType ),
    myIsUnderlined( isUnderlined ),
    myFontIndex( 0 ),
	myColorIndex( 0 )
{ }

Prs2d_AspectText::Prs2d_AspectText( const Quantity_Color& aColor,
		    	const Aspect_FontStyle&  aFont,
  			    const Aspect_TypeOfText aType,
			    const Standard_Boolean isUnderlined)
  : 
    Prs2d_AspectRoot( Prs2d_AN_TEXT ),
    myColor( aColor ),
    myFont( aFont ),
    myRelativeSlant(0.),
    myType( aType ),
    myIsUnderlined( isUnderlined ),
    myFontIndex( 0 ),
	myColorIndex( 0 )
{ }

void Prs2d_AspectText::SetColor( const Quantity_NameOfColor aColor ) {

    SetColor(Quantity_Color(aColor));
}

void Prs2d_AspectText::SetColor( const Quantity_Color& aColor ) {

    if( myColor != aColor ) {
      myColor = aColor;
      myColorIndex = 0;
    }
}

void Prs2d_AspectText::SetFont( const Aspect_TypeOfFont aFont ) {

    if( myFont.Style() != aFont ) {
      myFont = Aspect_FontStyle(aFont,myFont.Size(),
				myFont.Slant(),myFont.CapsHeight());
      myFontIndex = 0;
    }
}

void Prs2d_AspectText::SetFont( const Aspect_FontStyle& aFont ) {

    if( myFont != aFont ) {
      myFont = aFont;
      myFontIndex = 0;
    }
}

void Prs2d_AspectText::SetRelativeSlant( const Quantity_PlaneAngle aSlant ) {

    myRelativeSlant = aSlant; 
}

void Prs2d_AspectText::SetHeight( const Quantity_Length anHeight,
			        const Standard_Boolean isCapsHeight ) {

    if( myFont.Size() != anHeight || myFont.CapsHeight() != isCapsHeight ) {
      myFont = Aspect_FontStyle(myFont.Style(),anHeight,
				myFont.Slant(),isCapsHeight);
      myFontIndex = 0;
    }
}

void Prs2d_AspectText::SetType( const Aspect_TypeOfText aType ) {
    myType = aType;
}

void Prs2d_AspectText::SetUnderlined( const Standard_Boolean anIsUnderline ) {
    myIsUnderlined = anIsUnderline;
}

void Prs2d_AspectText::Values( Quantity_Color& aColor,
		                       Aspect_FontStyle& aFont,
		                       Quantity_PlaneAngle& aSlant,
		                       Aspect_TypeOfText& aType,
		                       Standard_Boolean& isUnderlined) const {
    aColor = myColor;
    aFont = myFont;
    aSlant = myRelativeSlant + myFont.Slant();
    aType = myType;
    isUnderlined = myIsUnderlined;
}

Standard_Integer Prs2d_AspectText :: FontIndex (  ) const {

  return myFontIndex;
}  // end Standard_Integer Prs2d_AspectText :: FontIndex

Standard_Integer Prs2d_AspectText :: ColorIndex (  ) const {

 return myColorIndex;

}  // end Standard_Integer Prs2d_AspectText :: ColorIndex

void Prs2d_AspectText :: SetFontIndex ( const Standard_Integer anInd )  {

   myFontIndex = anInd;

}  // end void Prs2d_AspectText :: SetFontIndex

void Prs2d_AspectText :: SetColorIndex ( const Standard_Integer anInd )  {

  myColorIndex = anInd;

}  // end void Prs2d_AspectText :: SetColorIndex