1 // Created on: 1995-01-14
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
25 //-Design Declaration des variables specifiques aux Ensembles
28 //-Warning Une MarkMap est definie par un ensemble de MarkMapEntries
37 #include <Aspect_MarkMap.ixx>
41 //-Global data definitions
43 // mydata : SequenceOfMarkMapEntry from Aspect is protected
51 Aspect_MarkMap::Aspect_MarkMap( ) {
52 Aspect_MarkMapEntry theDefaultEntry;
54 AddEntry(theDefaultEntry);
57 void Aspect_MarkMap::AddEntry (const Aspect_MarkMapEntry& AnEntry) {
58 Standard_Integer i,index = AnEntry.Index();
59 Aspect_MarkMapEntry theEntry;
61 for( i=1 ; i<=mydata.Length() ; i++ ) {
62 theEntry = mydata.Value(i);
63 if( index == theEntry.Index() ) break;
66 if( i > mydata.Length() ) {
67 mydata.Append( AnEntry );
69 mydata.SetValue(i,AnEntry);
73 Standard_Integer Aspect_MarkMap::AddEntry (const Aspect_MarkerStyle &aStyle) {
74 Aspect_MarkMapEntry theEntry ;
75 Standard_Integer i,maxindex = 0 ;
77 for( i=1 ; i<=mydata.Length() ; i++ ) {
78 theEntry = mydata.Value(i) ;
79 maxindex = Max(maxindex,theEntry.Index()) ;
80 if( theEntry.Style() == aStyle ) return theEntry.Index() ;
84 theEntry.SetValue(maxindex,aStyle) ;
85 mydata.Append( theEntry ) ;
89 Standard_Integer Aspect_MarkMap::Size() const {
91 return mydata.Length() ;
94 Standard_Integer Aspect_MarkMap::Index(const Standard_Integer anIndex) const {
96 if( anIndex < 1 || anIndex > Size() ) {
97 Aspect_BadAccess::Raise ("Undefined markmap Index");
100 Aspect_MarkMapEntry theEntry = mydata.Value(anIndex) ;
102 return theEntry.Index() ;
105 Aspect_MarkMapEntry Aspect_MarkMap::Entry (const Standard_Integer AnIndex) const {
107 if( AnIndex < 1 || AnIndex > mydata.Length() )
108 Aspect_BadAccess::Raise ("Aspect_MarkMap::Entry Bad Index");
110 return mydata.Value(AnIndex);
113 void Aspect_MarkMap::Dump () const {
117 cout << "Markmap Dump-->\n" ;
119 for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
121 cout << "<--End Markmap Dump\n" ;