b311480e |
1 | // Created on: 2001-01-09 |
2 | // Created by: Sergey Altukhov |
3 | // Copyright (c) 2001-2012 OPEN CASCADE SAS |
4 | // |
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. |
9 | // |
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. |
12 | // |
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. |
19 | |
7fd59977 |
20 | |
21 | // Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets |
22 | |
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 |
27 | |
7fd59977 |
28 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |
29 | |
30 | //======================================================================= |
31 | //function : SetPolygonOffsets |
32 | //purpose : |
33 | //======================================================================= |
34 | void AIS_InteractiveContext::SetPolygonOffsets( |
35 | const Handle(AIS_InteractiveObject)& anObj, |
36 | const Standard_Integer aMode, |
60be1f9b |
37 | const Standard_ShortReal aFactor, |
38 | const Standard_ShortReal aUnits, |
7fd59977 |
39 | const Standard_Boolean updateviewer) |
40 | { |
41 | if ( anObj.IsNull() ) |
42 | return; |
43 | |
44 | if( !anObj->HasInteractiveContext() ) |
45 | anObj->SetContext( this ); |
46 | |
47 | anObj->SetPolygonOffsets( aMode, aFactor, aUnits ); |
48 | |
49 | if ( updateviewer ) { |
50 | if( myObjects.IsBound( anObj ) ) { |
51 | Handle(AIS_GlobalStatus) STATUS = myObjects(anObj); |
52 | if ( STATUS->GraphicStatus() == AIS_DS_Displayed ) |
53 | myMainVwr->Update(); |
54 | } |
55 | } |
56 | } |
57 | |
58 | |
59 | //======================================================================= |
60 | //function : HasPolygonOffsets |
61 | //purpose : |
62 | //======================================================================= |
63 | Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const |
64 | { |
65 | return ( !anObj.IsNull() && anObj->HasPolygonOffsets() ); |
66 | } |
67 | |
68 | //======================================================================= |
69 | //function : PolygonOffsets |
70 | //purpose : |
71 | //======================================================================= |
72 | void AIS_InteractiveContext::PolygonOffsets( |
73 | const Handle(AIS_InteractiveObject)& anObj, |
74 | Standard_Integer& aMode, |
60be1f9b |
75 | Standard_ShortReal& aFactor, |
76 | Standard_ShortReal& aUnits) const |
7fd59977 |
77 | { |
78 | if ( HasPolygonOffsets( anObj ) ) |
79 | anObj->PolygonOffsets( aMode, aFactor, aUnits ); |
80 | } |
81 | // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets |