0023024: Update headers of OCCT files
[occt.git] / src / AIS2D / AIS2D_GlobalStatus.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <AIS2D_GlobalStatus.ixx>
19 #include <TColStd_ListIteratorOfListOfInteger.hxx>
20
21 static TColStd_ListIteratorOfListOfInteger It;
22
23
24 AIS2D_GlobalStatus::AIS2D_GlobalStatus():
25   
26    myStatus( AIS2D_DS_None ),
27    myDispModes(),
28    mySelModes(),
29    myLayerIndex( 0 ),
30    myIsHighl( Standard_False ),
31    myHiCol( Quantity_NOC_WHITE ),
32    mySubInt( Standard_False )
33 {
34 }
35
36 AIS2D_GlobalStatus::AIS2D_GlobalStatus( 
37                                    const AIS2D_DisplayStatus DS,
38                                    const Standard_Integer DMode,
39                                    const Standard_Integer SMode,
40                                    const Standard_Boolean /*isHighlight*/,
41                                    const Quantity_NameOfColor aHighlCol,
42                                    const Standard_Integer aLayerIndex ):
43    myStatus( DS ),
44    myLayerIndex( aLayerIndex ),
45    myIsHighl( Standard_False ),
46    myHiCol( aHighlCol ),
47    mySubInt( Standard_False )
48 {
49    myDispModes.Append( DMode );
50    mySelModes.Append( SMode );
51 }
52
53
54 void AIS2D_GlobalStatus::RemoveDisplayMode( const Standard_Integer aMode ) {
55
56   for ( It.Initialize( myDispModes ); It.More(); It.Next() )
57     if ( It.Value() == aMode ) { 
58                 myDispModes.Remove( It );
59             return;
60         }
61 }
62
63 void AIS2D_GlobalStatus::RemoveSelectionMode( const Standard_Integer aMode) {
64   
65   for ( It.Initialize( mySelModes ); It.More(); It.Next() ) 
66     if ( It.Value() == aMode ) { 
67                 mySelModes.Remove( It );
68                 return;
69         }
70 }
71
72 void AIS2D_GlobalStatus::ClearSelectionModes() {
73   mySelModes.Clear();
74 }
75
76 void AIS2D_GlobalStatus::AddSelectionMode( const Standard_Integer aMode ) {
77   if ( !IsSModeIn( aMode ) )
78         mySelModes.Append( aMode );
79 }
80
81 Standard_Boolean AIS2D_GlobalStatus::IsDModeIn( const Standard_Integer aMode) const {
82   for ( It.Initialize( myDispModes ); It.More(); It.Next() )
83     if ( It.Value() == aMode ) return Standard_True;
84   return Standard_False;
85 }
86
87 Standard_Boolean AIS2D_GlobalStatus::IsSModeIn( const Standard_Integer aMode) const {
88   for ( It.Initialize( mySelModes ); It.More(); It.Next() )
89     if ( It.Value() == aMode ) return Standard_True;
90   return Standard_False;
91 }
92
93 void AIS2D_GlobalStatus::AddDisplayMode( const Standard_Integer aMode ) {
94   if ( !IsDModeIn( aMode ) ) 
95          myDispModes.Append( aMode );
96 }
97