1 // Created on: 1995-01-14
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 //-Design Declaration des variables specifiques aux Ensembles
22 //-Warning Une MarkMap est definie par un ensemble de MarkMapEntries
31 #include <Aspect_MarkMap.ixx>
35 //-Global data definitions
37 // mydata : SequenceOfMarkMapEntry from Aspect is protected
45 Aspect_MarkMap::Aspect_MarkMap( ) {
46 Aspect_MarkMapEntry theDefaultEntry;
48 AddEntry(theDefaultEntry);
51 void Aspect_MarkMap::AddEntry (const Aspect_MarkMapEntry& AnEntry) {
52 Standard_Integer i,index = AnEntry.Index();
53 Aspect_MarkMapEntry theEntry;
55 for( i=1 ; i<=mydata.Length() ; i++ ) {
56 theEntry = mydata.Value(i);
57 if( index == theEntry.Index() ) break;
60 if( i > mydata.Length() ) {
61 mydata.Append( AnEntry );
63 mydata.SetValue(i,AnEntry);
67 Standard_Integer Aspect_MarkMap::AddEntry (const Aspect_MarkerStyle &aStyle) {
68 Aspect_MarkMapEntry theEntry ;
69 Standard_Integer i,maxindex = 0 ;
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() ;
78 theEntry.SetValue(maxindex,aStyle) ;
79 mydata.Append( theEntry ) ;
83 Standard_Integer Aspect_MarkMap::Size() const {
85 return mydata.Length() ;
88 Standard_Integer Aspect_MarkMap::Index(const Standard_Integer anIndex) const {
90 if( anIndex < 1 || anIndex > Size() ) {
91 Aspect_BadAccess::Raise ("Undefined markmap Index");
94 Aspect_MarkMapEntry theEntry = mydata.Value(anIndex) ;
96 return theEntry.Index() ;
99 Aspect_MarkMapEntry Aspect_MarkMap::Entry (const Standard_Integer AnIndex) const {
101 if( AnIndex < 1 || AnIndex > mydata.Length() )
102 Aspect_BadAccess::Raise ("Aspect_MarkMap::Entry Bad Index");
104 return mydata.Value(AnIndex);
107 void Aspect_MarkMap::Dump () const {
111 cout << "Markmap Dump-->\n" ;
113 for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
115 cout << "<--End Markmap Dump\n" ;