0024428: Implementation of LGPL license
[occt.git] / src / Aspect / Aspect_MarkMapEntry.cxx
CommitLineData
b311480e 1// Created on: 1995-01-14
2// Created by: GG
3// Copyright (c) 1995-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//
973c2be1 8// This library is free software; you can redistribute it and / or modify it
9// under the terms of the GNU Lesser General Public version 2.1 as published
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// Markers
21
22//-Warning Une entry est definie par un index associee a un Marker style
23
24//-References
25
26//-Language C++ 2.0
27
28//-Declarations
29
30// for the class
31#include <Aspect_MarkMapEntry.ixx>
32#include <TColQuantity_Array1OfLength.hxx>
33//-Aliases
34
35//-Global data definitions
36
37// MyStyle : MarkerStyle from Aspect
38// MyIndex : Integer from Standard
39// MyStyleIsDef : Boolean from Standard
40// MyIndexIsDef : Boolean from Standard
41
42//-Constructors
43
44//-Destructors
45
46//-Methods, in order
47
48Aspect_MarkMapEntry::Aspect_MarkMapEntry() :
49MyStyle(),MyIndex(0),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
50}
51
52Aspect_MarkMapEntry::Aspect_MarkMapEntry (const Standard_Integer index, const Aspect_MarkerStyle &style) :
53MyStyle(style),MyIndex(index),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
54}
55
56Aspect_MarkMapEntry::Aspect_MarkMapEntry (const Aspect_MarkMapEntry& entry) :
57MyStyle(entry.MyStyle),MyIndex(entry.MyIndex),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
58
59 if ( !entry.MyStyleIsDef || !entry.MyIndexIsDef ) {
60 Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
61 }
62}
63
64void Aspect_MarkMapEntry::SetValue (const Standard_Integer index, const Aspect_MarkerStyle &style) {
65
66 MyStyleIsDef = Standard_True;
67 MyIndexIsDef = Standard_True;
68 MyIndex = index;
69 MyStyle = style;
70
71}
72
73void Aspect_MarkMapEntry::SetValue (const Aspect_MarkMapEntry& entry) {
74
75 if ( !entry.MyStyleIsDef || !entry.MyIndexIsDef ) {
76 Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
77 }
78 else {
79 MyStyleIsDef = Standard_True;
80 MyIndexIsDef = Standard_True;
81 MyIndex = entry.MyIndex;
82 MyStyle = entry.MyStyle;
83 }
84
85}
86
87void Aspect_MarkMapEntry::SetStyle (const Aspect_MarkerStyle &style) {
88
89 MyStyleIsDef = Standard_True;
90 MyStyle = style;
91
92}
93
94const Aspect_MarkerStyle& Aspect_MarkMapEntry::Style () const {
95
96 if ( !MyStyleIsDef || !MyIndexIsDef )
97 Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
98
99 return MyStyle;
100
101}
102
103void Aspect_MarkMapEntry::SetIndex (const Standard_Integer index) {
104
105 MyStyleIsDef = Standard_True;
106 MyIndex = index;
107
108}
109
110Standard_Integer Aspect_MarkMapEntry::Index () const {
111
112 if ( !MyStyleIsDef || !MyIndexIsDef )
113 Aspect_BadAccess::Raise("Unallocated MarkMapEntry");
114
115 return MyIndex;
116
117}
118
119Standard_Boolean Aspect_MarkMapEntry::IsAllocated () const {
120
121 return ( MyStyleIsDef && MyIndexIsDef ) ;
122
123}
124
125void Aspect_MarkMapEntry::Free () {
126
127 MyStyleIsDef = Standard_False;
128 MyIndexIsDef = Standard_False;
129
130}
131
132void Aspect_MarkMapEntry::Dump () const {
133
134 Aspect_TypeOfMarker type = MyStyle.Type() ;
135 Standard_Integer i,length = MyStyle.Length() ;
136 Standard_Boolean draw = Standard_False ;
eb901da6 137 Standard_Real X(0),Y(0);
7fd59977 138
139 cout << " Aspect_MarkMapEntry::Dump ()\n";
eb901da6
S
140 cout << " MyStyleIsDef : " << (MyStyleIsDef ? "True\n" : "False\n");
141 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
7fd59977 142 cout << " MarkerStyle : " << (Standard_Integer) type << " Length : " << length << "\n";//WNT
143 if( length ) {
144 for( i=1 ; i<=length ; i++ )
145 draw = MyStyle.Values(i,X,Y);
146 cout << " value("<< i << ") : " << X << "," << Y << "," << draw << "\n";
147 }
148 cout << flush;
149}