1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and / or modify it
7 // under the terms of the GNU Lesser General Public version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <Aspect_ColorMapEntry.ixx>
17 Aspect_ColorMapEntry::Aspect_ColorMapEntry() {
19 myColorIsDef = Standard_True;
20 myIndexIsDef = Standard_True;
21 allocated = myColorIsDef && myIndexIsDef;
23 mycolor.SetValues (0., 0., 0., Quantity_TOC_RGB);
27 Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Standard_Integer index, const Quantity_Color &color) {
29 myColorIsDef = Standard_True;
30 myIndexIsDef = Standard_True;
31 allocated = myColorIsDef && myIndexIsDef;
37 Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Aspect_ColorMapEntry& entry) {
39 if (entry.allocated == Standard_False) {
40 Aspect_BadAccess::Raise
41 ("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
44 myColorIsDef = Standard_True;
45 myIndexIsDef = Standard_True;
46 allocated = myColorIsDef && myIndexIsDef;
47 myindex = entry.myindex;
48 mycolor = entry.mycolor;
52 void Aspect_ColorMapEntry::SetValue (const Standard_Integer index, const Quantity_Color &color) {
54 myColorIsDef = Standard_True;
55 myIndexIsDef = Standard_True;
56 allocated = myColorIsDef && myIndexIsDef;
62 void Aspect_ColorMapEntry::SetValue (const Aspect_ColorMapEntry& entry) {
64 if (entry.allocated == Standard_False) {
65 Aspect_BadAccess::Raise
66 ("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
69 myColorIsDef = Standard_True;
70 myIndexIsDef = Standard_True;
71 allocated = myColorIsDef && myIndexIsDef;
72 myindex = entry.myindex;
73 mycolor = entry.mycolor;
78 void Aspect_ColorMapEntry::SetColor (const Quantity_Color &color) {
80 myColorIsDef = Standard_True;
81 allocated = myColorIsDef && myIndexIsDef;
86 const Quantity_Color& Aspect_ColorMapEntry::Color () const {
88 if (allocated == Standard_False)
89 Aspect_BadAccess::Raise
90 ("Aspect_ColorMapEntry::Color Unallocated ColorMapEntry");
96 void Aspect_ColorMapEntry::SetIndex (const Standard_Integer index) {
98 myColorIsDef = Standard_True;
99 allocated = myColorIsDef && myIndexIsDef;
104 Standard_Integer Aspect_ColorMapEntry::Index () const {
106 if (allocated == Standard_False)
107 Aspect_BadAccess::Raise
108 ("Aspect_ColorMapEntry::Index Unallocated ColorMapEntry");
114 Standard_Boolean Aspect_ColorMapEntry::IsAllocated () const {
120 void Aspect_ColorMapEntry::Free () {
122 myColorIsDef = Standard_False;
123 myIndexIsDef = Standard_False;
124 allocated = myColorIsDef && myIndexIsDef;
128 void Aspect_ColorMapEntry::Dump () const {
130 Standard_Real r,g,b ;
132 mycolor.Values( r,g,b, Quantity_TOC_RGB ) ;
135 cout << "myColorIsDef : " << (myColorIsDef ? "True " : "False") << " , "
136 << "myIndexIsDef : " << (myIndexIsDef ? "True " : "False") << " , "
137 << "allocated : " << (allocated ? "True " : "False") << "\n";
138 cout << "myindex : " << myindex << " myColor : ( "
139 << r << ", " << g << ", " << g << " )\n";