summaryrefslogtreecommitdiff
path: root/src/Aspect/Aspect_ColorMapEntry.cxx
blob: 7e1a868c590f87e74b3d6f91de661453c2af328e (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
#include <Aspect_ColorMapEntry.ixx>

Aspect_ColorMapEntry::Aspect_ColorMapEntry() {

	myColorIsDef	= Standard_True;
	myIndexIsDef	= Standard_True;
	allocated	= myColorIsDef && myIndexIsDef;
	myindex		= 0;
	mycolor.SetValues (0., 0., 0., Quantity_TOC_RGB);

}

Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Standard_Integer index, const Quantity_Color &color) {

	myColorIsDef	= Standard_True;
	myIndexIsDef	= Standard_True;
	allocated	= myColorIsDef && myIndexIsDef;
	myindex		= index;
	mycolor		= color;

}

Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Aspect_ColorMapEntry& entry) {

	if (entry.allocated == Standard_False) {
		Aspect_BadAccess::Raise
("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
	}
	else {
		myColorIsDef	= Standard_True;
		myIndexIsDef	= Standard_True;
		allocated	= myColorIsDef && myIndexIsDef;
		myindex		= entry.myindex;
		mycolor		= entry.mycolor;
	}
}

void Aspect_ColorMapEntry::SetValue (const Standard_Integer index, const Quantity_Color &color) {

	myColorIsDef	= Standard_True;
	myIndexIsDef	= Standard_True;
	allocated	= myColorIsDef && myIndexIsDef;
	myindex		= index;
	mycolor		= color;

}

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

	if (entry.allocated == Standard_False) {
		Aspect_BadAccess::Raise
("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
	}
	else {
		myColorIsDef	= Standard_True;
		myIndexIsDef	= Standard_True;
		allocated	= myColorIsDef && myIndexIsDef;
		myindex		= entry.myindex;
		mycolor		= entry.mycolor;
	}

}

void Aspect_ColorMapEntry::SetColor (const Quantity_Color &color) {

	myColorIsDef	= Standard_True;
	allocated	= myColorIsDef && myIndexIsDef;
	mycolor		= color;

}

const Quantity_Color& Aspect_ColorMapEntry::Color () const {

	if (allocated == Standard_False)
		Aspect_BadAccess::Raise
		("Aspect_ColorMapEntry::Color Unallocated ColorMapEntry");

	return mycolor;

}

void Aspect_ColorMapEntry::SetIndex (const Standard_Integer index) {

	myColorIsDef	= Standard_True;
	allocated	= myColorIsDef && myIndexIsDef;
	myindex		= index;

}

Standard_Integer Aspect_ColorMapEntry::Index () const {

	if (allocated == Standard_False)
		Aspect_BadAccess::Raise
		("Aspect_ColorMapEntry::Index Unallocated ColorMapEntry");

	return myindex;

}

Standard_Boolean Aspect_ColorMapEntry::IsAllocated () const {

	return allocated;

}

void Aspect_ColorMapEntry::Free () {

	myColorIsDef	= Standard_False;
	myIndexIsDef	= Standard_False;
	allocated	= myColorIsDef && myIndexIsDef;

}

void Aspect_ColorMapEntry::Dump () const {

  Standard_Real r,g,b ;

  mycolor.Values( r,g,b, Quantity_TOC_RGB ) ;

  cout	<< flush;
  cout	<< "myColorIsDef : " << (myColorIsDef ? "True " : "False") << " , "
	<< "myIndexIsDef : " << (myIndexIsDef ? "True " : "False") << " , "
	<< "allocated : "    << (allocated ? "True " : "False") << "\n";
  cout	<< "myindex : " << myindex << " myColor : ( "
	<< r << ", " << g << ", " << g << " )\n";
  cout	<< flush;
}