1 // Created on: 2001-01-09
2 // Created by: Sergey Altukhov
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
21 // Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
23 #include <AIS_InteractiveContext.jxx>
24 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
25 #include <AIS_GlobalStatus.hxx>
26 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
28 //=======================================================================
30 //purpose : display an interactive object from the collector.
31 //=======================================================================
32 void AIS_InteractiveContext::DisplayFromCollector(const Handle(AIS_InteractiveObject)& anIObj,
33 const Standard_Boolean updateviewer)
35 if ( !IsInCollector( anIObj ) ) return;
37 if ( !HasOpenedContext() ){
39 if ( DisplayStatus( anIObj ) == AIS_DS_Erased )
40 Display( anIObj,Standard_False);
44 if( !myCollectorVwr.IsNull() )
45 myCollectorVwr->Update();
50 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
52 //=======================================================================
53 //function : SetPolygonOffsets
55 //=======================================================================
56 void AIS_InteractiveContext::SetPolygonOffsets(
57 const Handle(AIS_InteractiveObject)& anObj,
58 const Standard_Integer aMode,
59 const Standard_ShortReal aFactor,
60 const Standard_ShortReal aUnits,
61 const Standard_Boolean updateviewer)
66 if( !anObj->HasInteractiveContext() )
67 anObj->SetContext( this );
69 anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
72 if( myObjects.IsBound( anObj ) ) {
73 Handle(AIS_GlobalStatus) STATUS = myObjects(anObj);
74 if ( STATUS->GraphicStatus() == AIS_DS_Displayed )
81 //=======================================================================
82 //function : HasPolygonOffsets
84 //=======================================================================
85 Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const
87 return ( !anObj.IsNull() && anObj->HasPolygonOffsets() );
90 //=======================================================================
91 //function : PolygonOffsets
93 //=======================================================================
94 void AIS_InteractiveContext::PolygonOffsets(
95 const Handle(AIS_InteractiveObject)& anObj,
96 Standard_Integer& aMode,
97 Standard_ShortReal& aFactor,
98 Standard_ShortReal& aUnits) const
100 if ( HasPolygonOffsets( anObj ) )
101 anObj->PolygonOffsets( aMode, aFactor, aUnits );
103 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets