1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
18 #include <AIS2D_GlobalStatus.ixx>
19 #include <TColStd_ListIteratorOfListOfInteger.hxx>
21 static TColStd_ListIteratorOfListOfInteger It;
24 AIS2D_GlobalStatus::AIS2D_GlobalStatus():
26 myStatus( AIS2D_DS_None ),
30 myIsHighl( Standard_False ),
31 myHiCol( Quantity_NOC_WHITE ),
32 mySubInt( Standard_False )
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 ):
44 myLayerIndex( aLayerIndex ),
45 myIsHighl( Standard_False ),
47 mySubInt( Standard_False )
49 myDispModes.Append( DMode );
50 mySelModes.Append( SMode );
54 void AIS2D_GlobalStatus::RemoveDisplayMode( const Standard_Integer aMode ) {
56 for ( It.Initialize( myDispModes ); It.More(); It.Next() )
57 if ( It.Value() == aMode ) {
58 myDispModes.Remove( It );
63 void AIS2D_GlobalStatus::RemoveSelectionMode( const Standard_Integer aMode) {
65 for ( It.Initialize( mySelModes ); It.More(); It.Next() )
66 if ( It.Value() == aMode ) {
67 mySelModes.Remove( It );
72 void AIS2D_GlobalStatus::ClearSelectionModes() {
76 void AIS2D_GlobalStatus::AddSelectionMode( const Standard_Integer aMode ) {
77 if ( !IsSModeIn( aMode ) )
78 mySelModes.Append( aMode );
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;
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;
93 void AIS2D_GlobalStatus::AddDisplayMode( const Standard_Integer aMode ) {
94 if ( !IsDModeIn( aMode ) )
95 myDispModes.Append( aMode );