0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / Aspect / Aspect_TypeMapEntry.cxx
CommitLineData
b311480e 1// Created on: 1993-09-14
2// Created by: GG
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
7fd59977 22
23//-Version
24
25//-Design Declaration des variables specifiques aux Entries de
26// Types de trait
27
28//-Warning Une entry est definie par un index associee a un Line style
29
30//-References
31
32//-Language C++ 2.0
33
34//-Declarations
35
36// for the class
37#include <Aspect_TypeMapEntry.ixx>
38#include <TColQuantity_Array1OfLength.hxx>
39//-Aliases
40
41//-Global data definitions
42
43// MyType : LineStyle from Aspect
44// MyIndex : Integer from Standard
45// MyTypeIsDef : Boolean from Standard
46// MyIndexIsDef : Boolean from Standard
47
48//-Constructors
49
50//-Destructors
51
52//-Methods, in order
53
54Aspect_TypeMapEntry::Aspect_TypeMapEntry() {
55
56 MyTypeIsDef = Standard_True;
57 MyIndexIsDef = Standard_True;
58 MyIndex = 0;
59 MyType.SetValues (Aspect_TOL_SOLID);
60
61}
62
63Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Standard_Integer index, const Aspect_LineStyle &style) {
64
65 MyTypeIsDef = Standard_True;
66 MyIndexIsDef = Standard_True;
67 MyIndex = index;
68 MyType = style;
69
70}
71
72Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Aspect_TypeMapEntry& entry) {
73
74 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
75 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
76 }
77 else {
78 MyTypeIsDef = Standard_True;
79 MyIndexIsDef = Standard_True;
80 MyIndex = entry.MyIndex;
81 MyType = entry.MyType;
82 }
83}
84
85void Aspect_TypeMapEntry::SetValue (const Standard_Integer index, const Aspect_LineStyle &style) {
86
87 MyTypeIsDef = Standard_True;
88 MyIndexIsDef = Standard_True;
89 MyIndex = index;
90 MyType = style;
91
92}
93
94void Aspect_TypeMapEntry::SetValue (const Aspect_TypeMapEntry& entry) {
95
96 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
97 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
98 }
99 else {
100 MyTypeIsDef = Standard_True;
101 MyIndexIsDef = Standard_True;
102 MyIndex = entry.MyIndex;
103 MyType = entry.MyType;
104 }
105
106}
107
108void Aspect_TypeMapEntry::SetType (const Aspect_LineStyle &style) {
109
110 MyTypeIsDef = Standard_True;
111 MyType = style;
112
113}
114
115const Aspect_LineStyle& Aspect_TypeMapEntry::Type () const {
116
117 if ( !MyTypeIsDef || !MyIndexIsDef )
118 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
119
120 return MyType;
121
122}
123
124void Aspect_TypeMapEntry::SetIndex (const Standard_Integer index) {
125
126 MyTypeIsDef = Standard_True;
127 MyIndex = index;
128
129}
130
131Standard_Integer Aspect_TypeMapEntry::Index () const {
132
133 if ( !MyTypeIsDef || !MyIndexIsDef )
134 Aspect_BadAccess::Raise("Unallocated TypeMapEntry");
135
136 return MyIndex;
137
138}
139
140Standard_Boolean Aspect_TypeMapEntry::IsAllocated () const {
141
142 return ( MyTypeIsDef && MyIndexIsDef ) ;
143
144}
145
146void Aspect_TypeMapEntry::Free () {
147
148 MyTypeIsDef = Standard_False;
149 MyIndexIsDef = Standard_False;
150
151}
152
153void Aspect_TypeMapEntry::Dump () const {
154
155 Aspect_TypeOfLine style = MyType.Style() ;
156 Standard_Integer i,length = MyType.Length() ;
157
158 cout << " Aspect_TypeMapEntry::Dump ()\n";
eb901da6
S
159 cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
160 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
7fd59977 161 cout << " LineStyle : " << (Standard_Integer) style << " Length : " << length << "\n";//WNT
162 if( length ) {
163 for( i=(MyType.Values()).Lower() ; i<=(MyType.Values()).Upper() ; i++ )
164 cout << "\t\tvalue(" << i << ") : " << MyType.Values().Value(i) << "\n";
165 }
166 cout << flush;
167}