0024624: Lost word in license statement in source files
[occt.git] / src / Aspect / Aspect_MarkMap.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//
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 Ensembles
20// de Markers
21
22//-Warning Une MarkMap est definie par un ensemble de MarkMapEntries
23
24//-References
25
26//-Language C++ 2.0
27
28//-Declarations
29
30// for the class
31#include <Aspect_MarkMap.ixx>
32
33//-Aliases
34
35//-Global data definitions
36
37// mydata : SequenceOfMarkMapEntry from Aspect is protected
38
39//-Constructors
40
41//-Destructors
42
43//-Methods, in order
44
45Aspect_MarkMap::Aspect_MarkMap( ) {
46Aspect_MarkMapEntry theDefaultEntry;
47
48 AddEntry(theDefaultEntry);
49}
50
51void Aspect_MarkMap::AddEntry (const Aspect_MarkMapEntry& AnEntry) {
52Standard_Integer i,index = AnEntry.Index();
53Aspect_MarkMapEntry theEntry;
54
55 for( i=1 ; i<=mydata.Length() ; i++ ) {
56 theEntry = mydata.Value(i);
57 if( index == theEntry.Index() ) break;
58 }
59
60 if( i > mydata.Length() ) {
61 mydata.Append( AnEntry );
62 } else {
63 mydata.SetValue(i,AnEntry);
64 }
65}
66
67Standard_Integer Aspect_MarkMap::AddEntry (const Aspect_MarkerStyle &aStyle) {
68Aspect_MarkMapEntry theEntry ;
69Standard_Integer i,maxindex = 0 ;
70
71 for( i=1 ; i<=mydata.Length() ; i++ ) {
72 theEntry = mydata.Value(i) ;
73 maxindex = Max(maxindex,theEntry.Index()) ;
74 if( theEntry.Style() == aStyle ) return theEntry.Index() ;
75 }
76
77 maxindex++ ;
78 theEntry.SetValue(maxindex,aStyle) ;
79 mydata.Append( theEntry ) ;
80 return maxindex ;
81}
82
83Standard_Integer Aspect_MarkMap::Size() const {
84
85 return mydata.Length() ;
86}
87
88Standard_Integer Aspect_MarkMap::Index(const Standard_Integer anIndex) const {
89
90 if( anIndex < 1 || anIndex > Size() ) {
91 Aspect_BadAccess::Raise ("Undefined markmap Index");
92 }
93
94 Aspect_MarkMapEntry theEntry = mydata.Value(anIndex) ;
95
96 return theEntry.Index() ;
97}
98
99Aspect_MarkMapEntry Aspect_MarkMap::Entry (const Standard_Integer AnIndex) const {
100
101 if( AnIndex < 1 || AnIndex > mydata.Length() )
102 Aspect_BadAccess::Raise ("Aspect_MarkMap::Entry Bad Index");
103
104 return mydata.Value(AnIndex);
105}
106
107void Aspect_MarkMap::Dump () const {
108
109 Standard_Integer i ;
110
111 cout << "Markmap Dump-->\n" ;
112
113 for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
114
115 cout << "<--End Markmap Dump\n" ;
116}