0024624: Lost word in license statement in source files
[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
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17//-Version
18
19//-Design Declaration des variables specifiques aux Entries de
20// Types de trait
21
22//-Warning Une entry est definie par un index associee a un Line style
23
24//-References
25
26//-Language C++ 2.0
27
28//-Declarations
29
30// for the class
31#include <Aspect_TypeMapEntry.ixx>
32#include <TColQuantity_Array1OfLength.hxx>
33//-Aliases
34
35//-Global data definitions
36
37// MyType : LineStyle from Aspect
38// MyIndex : Integer from Standard
39// MyTypeIsDef : Boolean from Standard
40// MyIndexIsDef : Boolean from Standard
41
42//-Constructors
43
44//-Destructors
45
46//-Methods, in order
47
48Aspect_TypeMapEntry::Aspect_TypeMapEntry() {
49
50 MyTypeIsDef = Standard_True;
51 MyIndexIsDef = Standard_True;
52 MyIndex = 0;
53 MyType.SetValues (Aspect_TOL_SOLID);
54
55}
56
57Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Standard_Integer index, const Aspect_LineStyle &style) {
58
59 MyTypeIsDef = Standard_True;
60 MyIndexIsDef = Standard_True;
61 MyIndex = index;
62 MyType = style;
63
64}
65
66Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Aspect_TypeMapEntry& entry) {
67
68 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
69 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
70 }
71 else {
72 MyTypeIsDef = Standard_True;
73 MyIndexIsDef = Standard_True;
74 MyIndex = entry.MyIndex;
75 MyType = entry.MyType;
76 }
77}
78
79void Aspect_TypeMapEntry::SetValue (const Standard_Integer index, const Aspect_LineStyle &style) {
80
81 MyTypeIsDef = Standard_True;
82 MyIndexIsDef = Standard_True;
83 MyIndex = index;
84 MyType = style;
85
86}
87
88void Aspect_TypeMapEntry::SetValue (const Aspect_TypeMapEntry& entry) {
89
90 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
91 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
92 }
93 else {
94 MyTypeIsDef = Standard_True;
95 MyIndexIsDef = Standard_True;
96 MyIndex = entry.MyIndex;
97 MyType = entry.MyType;
98 }
99
100}
101
102void Aspect_TypeMapEntry::SetType (const Aspect_LineStyle &style) {
103
104 MyTypeIsDef = Standard_True;
105 MyType = style;
106
107}
108
109const Aspect_LineStyle& Aspect_TypeMapEntry::Type () const {
110
111 if ( !MyTypeIsDef || !MyIndexIsDef )
112 Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
113
114 return MyType;
115
116}
117
118void Aspect_TypeMapEntry::SetIndex (const Standard_Integer index) {
119
120 MyTypeIsDef = Standard_True;
121 MyIndex = index;
122
123}
124
125Standard_Integer Aspect_TypeMapEntry::Index () const {
126
127 if ( !MyTypeIsDef || !MyIndexIsDef )
128 Aspect_BadAccess::Raise("Unallocated TypeMapEntry");
129
130 return MyIndex;
131
132}
133
134Standard_Boolean Aspect_TypeMapEntry::IsAllocated () const {
135
136 return ( MyTypeIsDef && MyIndexIsDef ) ;
137
138}
139
140void Aspect_TypeMapEntry::Free () {
141
142 MyTypeIsDef = Standard_False;
143 MyIndexIsDef = Standard_False;
144
145}
146
147void Aspect_TypeMapEntry::Dump () const {
148
149 Aspect_TypeOfLine style = MyType.Style() ;
150 Standard_Integer i,length = MyType.Length() ;
151
152 cout << " Aspect_TypeMapEntry::Dump ()\n";
eb901da6
S
153 cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
154 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
7fd59977 155 cout << " LineStyle : " << (Standard_Integer) style << " Length : " << length << "\n";//WNT
156 if( length ) {
157 for( i=(MyType.Values()).Lower() ; i<=(MyType.Values()).Upper() ; i++ )
158 cout << "\t\tvalue(" << i << ") : " << MyType.Values().Value(i) << "\n";
159 }
160 cout << flush;
161}