File: Aspect_Driver.cxx

package info (click to toggle)
opencascade 6.3.0.dfsg.1-6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 461,280 kB
  • ctags: 279,351
  • sloc: cpp: 1,323,935; ansic: 170,847; tcl: 31,077; java: 20,275; makefile: 13,109; sh: 8,093; cs: 2,033; lisp: 649; csh: 362; perl: 15
file content (123 lines) | stat: -rw-r--r-- 3,495 bytes parent folder | download
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
/***********************************************************************

     FONCTION :
     ----------
        Classe Aspect_Driver :

     HISTORIQUE DES MODIFICATIONS   :
     --------------------------------

      14-05-98 : GG ; Disable using MFT when the symbol
			CSF_MDTVFontDirectory is not defined.
		      See dirMFTisDefined changes. 

      30-01-98 : GG ; SPEC_MFT
              L'utilisation des polices MFT devient parametrable.
	      Le driver doit utiliser la methode UseMFT() pour
	      savoir s'il doit utiliser ou non les polices
	      MDTV a la place des polices system.

		-> Modifications dans SetFontMap()
		-> Nouvelle methode UseMFT()

***********************************************************************/

#include <Aspect_Driver.ixx>
#include <OSD_Environment.hxx>

static Standard_Boolean dirMFTisDefined = Standard_False;

Aspect_Driver::Aspect_Driver () {

  OSD_Environment CSF_MDTVFontDirectory ;

  char *fontdir , *casroot ;
  fontdir =  getenv("CSF_MDTVFontDirectory" );
  if ( !fontdir) {
    casroot  = getenv("CASROOT");
    if ( !casroot ) {
      casroot = "/usr/share/opencascade/6.3.0";
    }
    TCollection_AsciiString CasRootString (casroot);
    CasRootString += "/src/FontMFT" ; 
    CSF_MDTVFontDirectory = OSD_Environment(CasRootString.ToCString());
  } else {
    CSF_MDTVFontDirectory = OSD_Environment("CSF_MDTVFontDirectory");
  }
  TCollection_AsciiString dir(CSF_MDTVFontDirectory.Value());

  dirMFTisDefined = (dir.Length() > 0);
  myUseMFT = Standard_True;
  myColorMapIsDefined = Standard_False;   
  myWidthMapIsDefined = Standard_False;   
  myTypeMapIsDefined  = Standard_False;   
  myFontMapIsDefined  = Standard_False;   
}


void Aspect_Driver::SetColorMap (const Handle(Aspect_ColorMap)& aColorMap) 
 {
   myColorMap = aColorMap;
   this->InitializeColorMap(aColorMap);
   myColorMapIsDefined = Standard_True;
}
Handle(Aspect_ColorMap) Aspect_Driver::ColorMap () const {

  Aspect_UndefinedMap_Raise_if(!myColorMapIsDefined,"ColorMap");
  return myColorMap;
}


void Aspect_Driver::SetTypeMap (const Handle(Aspect_TypeMap)& aTypeMap) 
 {
   myTypeMap = aTypeMap;
   this->InitializeTypeMap(aTypeMap);
   myTypeMapIsDefined = Standard_True;
}
Handle(Aspect_TypeMap) Aspect_Driver::TypeMap () const {

  Aspect_UndefinedMap_Raise_if(!myTypeMapIsDefined,"TypeMap");
  return myTypeMap;
}

void Aspect_Driver::SetWidthMap (const Handle(Aspect_WidthMap)& aWidthMap) 
 {
   myWidthMap = aWidthMap;
   this->InitializeWidthMap(aWidthMap);
   myWidthMapIsDefined = Standard_True;
}
Handle(Aspect_WidthMap) Aspect_Driver::WidthMap () const {

  Aspect_UndefinedMap_Raise_if(!myWidthMapIsDefined,"WidthMap");
  return myWidthMap;
}

void Aspect_Driver::SetFontMap (const Handle(Aspect_FontMap)& aFontMap,
				const Standard_Boolean useMFT) 
 {
   myUseMFT = useMFT;
   myFontMap = aFontMap;
   this->InitializeFontMap(aFontMap);
   myFontMapIsDefined = Standard_True;
}
Handle(Aspect_FontMap) Aspect_Driver::FontMap () const {

  Aspect_UndefinedMap_Raise_if(!myFontMapIsDefined,"FontMap");
  return myFontMap;
}

void Aspect_Driver::SetMarkMap (const Handle(Aspect_MarkMap)& aMarkMap) 
 {
   myMarkMap = aMarkMap;
   this->InitializeMarkMap(aMarkMap);
   myMarkMapIsDefined = Standard_True;
}
Handle(Aspect_MarkMap) Aspect_Driver::MarkMap () const {

  Aspect_UndefinedMap_Raise_if(!myMarkMapIsDefined,"MarkMap");
  return myMarkMap;
}

Standard_Boolean Aspect_Driver::UseMFT () const {
  return myUseMFT & dirMFTisDefined;
}