0027764: Visualization - add functionality for animation of 3D camera and interactive...
[occt.git] / src / AIS / AIS_InteractiveContext_3.cxx
1 // Created on: 2001-01-09
2 // Created by: Sergey Altukhov
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
17
18 #include <AIS_GlobalStatus.hxx>
19 #include <AIS_InteractiveContext.hxx>
20 #include <AIS_InteractiveObject.hxx>
21 #include <AIS_LocalContext.hxx>
22 #include <Prs3d_BasicAspect.hxx>
23 #include <Prs3d_LineAspect.hxx>
24 #include <Quantity_Color.hxx>
25 #include <SelectMgr_EntityOwner.hxx>
26 #include <SelectMgr_Filter.hxx>
27 #include <SelectMgr_OrFilter.hxx>
28 #include <SelectMgr_SelectionManager.hxx>
29 #include <Standard_Transient.hxx>
30 #include <TCollection_AsciiString.hxx>
31 #include <TCollection_ExtendedString.hxx>
32 #include <TopLoc_Location.hxx>
33 #include <TopoDS_Shape.hxx>
34 #include <V3d_View.hxx>
35 #include <V3d_Viewer.hxx>
36
37 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
38 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
39 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
40 //=======================================================================
41 //function : SetPolygonOffsets 
42 //purpose  : 
43 //======================================================================= 
44 void AIS_InteractiveContext::SetPolygonOffsets(
45                              const Handle(AIS_InteractiveObject)& anObj,
46                              const Standard_Integer               aMode,
47                              const Standard_ShortReal             aFactor,
48                              const Standard_ShortReal             aUnits,
49                              const Standard_Boolean               updateviewer) 
50 {
51   if ( anObj.IsNull() )
52     return;
53
54   setContextToObject (anObj);
55   anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
56
57   if ( updateviewer ) {
58     if( myObjects.IsBound( anObj ) ) {
59       Handle(AIS_GlobalStatus) STATUS = myObjects(anObj);
60       if ( STATUS->GraphicStatus() == AIS_DS_Displayed )
61         myMainVwr->Update();
62     }
63   }
64 }
65
66
67 //=======================================================================
68 //function : HasPolygonOffsets 
69 //purpose  : 
70 //=======================================================================
71 Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const
72 {
73   return ( !anObj.IsNull() && anObj->HasPolygonOffsets() );
74 }
75
76 //=======================================================================
77 //function : PolygonOffsets 
78 //purpose  : 
79 //=======================================================================
80 void AIS_InteractiveContext::PolygonOffsets(
81                              const Handle(AIS_InteractiveObject)& anObj,
82                              Standard_Integer&                    aMode,
83                              Standard_ShortReal&                  aFactor,
84                              Standard_ShortReal&                  aUnits) const 
85 {
86   if ( HasPolygonOffsets( anObj ) )
87     anObj->PolygonOffsets( aMode, aFactor, aUnits );
88 }
89 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets