summaryrefslogtreecommitdiff
path: root/src/Aspect/Aspect_TypeMapEntry.cxx
blob: 7c33e8406fda06ec4a0e4e3139b7fb923478bccc (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

// File         Aspect_TypeMapEntry.cxx
// Created      Septembre 1993
// Author       GG

//-Copyright    MatraDatavision 1991,1992

//-Version

//-Design       Declaration des variables specifiques aux Entries de 
//		Types de trait

//-Warning      Une entry est definie par un index associee a un Line style

//-References

//-Language     C++ 2.0

//-Declarations

// for the class
#include <Aspect_TypeMapEntry.ixx>
#include <TColQuantity_Array1OfLength.hxx>
//-Aliases

//-Global data definitions

//      MyType      		: LineStyle from Aspect
//      MyIndex   		: Integer from Standard
//      MyTypeIsDef		: Boolean from Standard
//      MyIndexIsDef		: Boolean from Standard

//-Constructors

//-Destructors

//-Methods, in order

Aspect_TypeMapEntry::Aspect_TypeMapEntry() {

	MyTypeIsDef	= Standard_True;
	MyIndexIsDef	= Standard_True;
	MyIndex		= 0;
	MyType.SetValues (Aspect_TOL_SOLID);

}

Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Standard_Integer index, const Aspect_LineStyle &style) {

	MyTypeIsDef	= Standard_True;
	MyIndexIsDef	= Standard_True;
	MyIndex		= index;
	MyType		= style;

}

Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Aspect_TypeMapEntry& entry) {

	if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
		Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
	}
	else {
		MyTypeIsDef	= Standard_True;
		MyIndexIsDef	= Standard_True;
		MyIndex		= entry.MyIndex;
		MyType		= entry.MyType;
	}
}

void Aspect_TypeMapEntry::SetValue (const Standard_Integer index, const Aspect_LineStyle &style) {

	MyTypeIsDef	= Standard_True;
	MyIndexIsDef	= Standard_True;
	MyIndex		= index;
	MyType		= style;

}

void Aspect_TypeMapEntry::SetValue (const Aspect_TypeMapEntry& entry) {

	if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
		Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
	}
	else {
		MyTypeIsDef	= Standard_True;
		MyIndexIsDef	= Standard_True;
		MyIndex		= entry.MyIndex;
		MyType		= entry.MyType;
	}

}

void Aspect_TypeMapEntry::SetType (const Aspect_LineStyle &style) {

	MyTypeIsDef	= Standard_True;
	MyType		= style;

}

const Aspect_LineStyle& Aspect_TypeMapEntry::Type () const {

	if ( !MyTypeIsDef || !MyIndexIsDef ) 
		Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;

	return MyType;

}

void Aspect_TypeMapEntry::SetIndex (const Standard_Integer index) {

	MyTypeIsDef	= Standard_True;
	MyIndex		= index;

}

Standard_Integer Aspect_TypeMapEntry::Index () const {

	if ( !MyTypeIsDef || !MyIndexIsDef ) 
		Aspect_BadAccess::Raise("Unallocated TypeMapEntry");

	return MyIndex;

}

Standard_Boolean Aspect_TypeMapEntry::IsAllocated () const {

	return ( MyTypeIsDef && MyIndexIsDef ) ; 

}

void Aspect_TypeMapEntry::Free () {

	MyTypeIsDef	= Standard_False;
	MyIndexIsDef	= Standard_False;

}

void Aspect_TypeMapEntry::Dump () const {

  Aspect_TypeOfLine style = MyType.Style() ;
  Standard_Integer i,length = MyType.Length() ;

  cout << " Aspect_TypeMapEntry::Dump ()\n";
  cout << "      MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
  cout << "      MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
  cout << "      LineStyle : " << (Standard_Integer) style << " Length : " << length << "\n";//WNT
  if( length ) {
    for( i=(MyType.Values()).Lower() ; i<=(MyType.Values()).Upper() ; i++ ) 
	cout << "\t\tvalue(" << i << ") : " << MyType.Values().Value(i) << "\n";
  }
  cout << flush;
}