0024624: Lost word in license statement in source files
[occt.git] / src / Aspect / Aspect_WidthMapEntry.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15#include <Aspect_WidthMapEntry.ixx>
16#include <Aspect_Units.hxx>
17
18Aspect_WidthMapEntry::Aspect_WidthMapEntry() {
19
20 SetPredefinedStyle(Aspect_WOL_THIN);
21 MyIndexIsDef = Standard_True;
22 MyIndex = 0;
23
24}
25
26Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Standard_Integer index, const Aspect_WidthOfLine style) {
27
28 SetPredefinedStyle(style);
29 MyIndexIsDef = Standard_True;
30 MyIndex = index;
31
32}
33
34Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Standard_Integer index, const Quantity_Length width) {
35
36 if( width < 0. )
37 Aspect_BadAccess::Raise("Bad Line Width") ;
38
39 MyType = Aspect_WOL_USERDEFINED ;
40 MyTypeIsDef = Standard_True;
41 MyIndexIsDef = Standard_True;
42 MyIndex = index;
43 MyWidth = width;
44
45}
46
47Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Aspect_WidthMapEntry& entry) {
48
49 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
50 Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
51 }
52 else {
53 MyTypeIsDef = Standard_True;
54 MyIndexIsDef = Standard_True;
55 MyIndex = entry.MyIndex;
56 MyType = entry.MyType;
57 MyWidth = entry.MyWidth;
58 }
59}
60
61void Aspect_WidthMapEntry::SetValue (const Standard_Integer index, const Aspect_WidthOfLine style) {
62
63 SetPredefinedStyle(style);
64 MyIndexIsDef = Standard_True;
65 MyIndex = index;
66
67}
68
69void Aspect_WidthMapEntry::SetValue (const Standard_Integer index, const Quantity_Length width) {
70
71 if( width < 0. )
72 Aspect_BadAccess::Raise("Bad Line Width") ;
73
74 MyType = Aspect_WOL_USERDEFINED ;
75 MyTypeIsDef = Standard_True;
76 MyWidth = width ;
77 MyIndexIsDef = Standard_True;
78 MyIndex = index;
79
80}
81
82void Aspect_WidthMapEntry::SetValue (const Aspect_WidthMapEntry& entry) {
83
84 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
85 Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
86 }
87 else {
88 MyTypeIsDef = Standard_True;
89 MyIndexIsDef = Standard_True;
90 MyIndex = entry.MyIndex;
91 MyType = entry.MyType;
92 MyWidth = entry.MyWidth;
93 }
94
95}
96
97void Aspect_WidthMapEntry::SetType (const Aspect_WidthOfLine style) {
98
99 SetPredefinedStyle(style);
100
101}
102
103void Aspect_WidthMapEntry::SetWidth (const Quantity_Length width) {
104
105 if( width < 0. )
106 Aspect_BadAccess::Raise("Bad Line Width") ;
107
108 MyType = Aspect_WOL_USERDEFINED ;
109 MyTypeIsDef = Standard_True;
110 MyWidth = width ;
111
112}
113
114Aspect_WidthOfLine Aspect_WidthMapEntry::Type () const {
115
116 if ( !MyTypeIsDef || !MyIndexIsDef )
117 Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
118
119 return MyType;
120
121}
122
123Standard_Real Aspect_WidthMapEntry::Width () const {
124
125 if ( !MyTypeIsDef || !MyIndexIsDef )
126 Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
127
128 return MyWidth;
129
130}
131
132void Aspect_WidthMapEntry::SetIndex (const Standard_Integer index) {
133
134 MyTypeIsDef = Standard_True;
135 MyIndex = index;
136
137}
138
139Standard_Integer Aspect_WidthMapEntry::Index () const {
140
141 if ( !MyTypeIsDef || !MyIndexIsDef )
142 Aspect_BadAccess::Raise("Unallocated WidthMapEntry");
143
144 return MyIndex;
145
146}
147
148Standard_Boolean Aspect_WidthMapEntry::IsAllocated () const {
149
150 return ( MyTypeIsDef && MyIndexIsDef ) ;
151
152}
153
154void Aspect_WidthMapEntry::Free () {
155
156 MyTypeIsDef = Standard_False;
157 MyIndexIsDef = Standard_False;
158
159}
160
161void Aspect_WidthMapEntry::Dump () const {
162
163 cout << " Aspect_WidthMapEntry::Dump ()\n";
eb901da6
S
164 cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
165 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
7fd59977 166 cout << " TypeOfWidth : " << (Standard_Integer) MyType << "\n";//WNT
167 cout << " LineWidth : " << MyWidth << "\n";
168 cout << flush;
169}
170
171void Aspect_WidthMapEntry::SetPredefinedStyle(const Aspect_WidthOfLine Style) {
172
173 MyType = Style ;
174 MyTypeIsDef = Standard_True;
175 switch ( Style ) {
176 case Aspect_WOL_USERDEFINED :
177 Aspect_BadAccess::Raise("Bad Predefined Line Width Style") ;
178 case Aspect_WOL_THIN:
179 MyWidth = 0.25 MILLIMETER ;
180 break ;
181 case Aspect_WOL_MEDIUM :
182 MyWidth = 0.5 MILLIMETER ;
183 break ;
184 case Aspect_WOL_THICK :
185 MyWidth = 0.7 MILLIMETER ;
186 break ;
187 case Aspect_WOL_VERYTHICK :
188 MyWidth = 1.5 MILLIMETER ;
189 break ;
190 }
191}