7fd59977 |
1 | // File: AIS_InteractiveContext_3.cxx |
2 | // Created: Tue Jan 09 17:21:39 2001 |
3 | // Author: Sergey Altukhov |
4 | // <s-altukhov@nnov.matra-dtv.fr> |
5 | |
6 | // Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets |
7 | |
8 | #include <AIS_InteractiveContext.jxx> |
9 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |
10 | #include <AIS_GlobalStatus.hxx> |
11 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |
12 | |
13 | //======================================================================= |
14 | //function : Erase |
15 | //purpose : display an interactive object from the collector. |
16 | //======================================================================= |
17 | void AIS_InteractiveContext::DisplayFromCollector(const Handle(AIS_InteractiveObject)& anIObj, |
18 | const Standard_Boolean updateviewer) |
19 | { |
20 | if ( !IsInCollector( anIObj ) ) return; |
21 | |
22 | if ( !HasOpenedContext() ){ |
23 | |
24 | if ( DisplayStatus( anIObj ) == AIS_DS_Erased ) |
25 | Display( anIObj,Standard_False); |
26 | |
27 | if( updateviewer ){ |
28 | myMainVwr->Update(); |
29 | if( !myCollectorVwr.IsNull() ) |
30 | myCollectorVwr->Update(); |
31 | } |
32 | } |
33 | } |
34 | |
35 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |
36 | |
37 | //======================================================================= |
38 | //function : SetPolygonOffsets |
39 | //purpose : |
40 | //======================================================================= |
41 | void AIS_InteractiveContext::SetPolygonOffsets( |
42 | const Handle(AIS_InteractiveObject)& anObj, |
43 | const Standard_Integer aMode, |
44 | const Standard_Real aFactor, |
45 | const Standard_Real aUnits, |
46 | const Standard_Boolean updateviewer) |
47 | { |
48 | if ( anObj.IsNull() ) |
49 | return; |
50 | |
51 | if( !anObj->HasInteractiveContext() ) |
52 | anObj->SetContext( this ); |
53 | |
54 | anObj->SetPolygonOffsets( aMode, aFactor, aUnits ); |
55 | |
56 | if ( updateviewer ) { |
57 | if( myObjects.IsBound( anObj ) ) { |
58 | Handle(AIS_GlobalStatus) STATUS = myObjects(anObj); |
59 | if ( STATUS->GraphicStatus() == AIS_DS_Displayed ) |
60 | myMainVwr->Update(); |
61 | } |
62 | } |
63 | } |
64 | |
65 | |
66 | //======================================================================= |
67 | //function : HasPolygonOffsets |
68 | //purpose : |
69 | //======================================================================= |
70 | Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const |
71 | { |
72 | return ( !anObj.IsNull() && anObj->HasPolygonOffsets() ); |
73 | } |
74 | |
75 | //======================================================================= |
76 | //function : PolygonOffsets |
77 | //purpose : |
78 | //======================================================================= |
79 | void AIS_InteractiveContext::PolygonOffsets( |
80 | const Handle(AIS_InteractiveObject)& anObj, |
81 | Standard_Integer& aMode, |
82 | Standard_Real& aFactor, |
83 | Standard_Real& aUnits) const |
84 | { |
85 | if ( HasPolygonOffsets( anObj ) ) |
86 | anObj->PolygonOffsets( aMode, aFactor, aUnits ); |
87 | } |
88 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |