0032160: Coding Rules - merge AIS_InteractiveContext_*.cxx into single file
[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 <Prs3d_BasicAspect.hxx>
22 #include <Prs3d_LineAspect.hxx>
23 #include <Quantity_Color.hxx>
24 #include <SelectMgr_EntityOwner.hxx>
25 #include <SelectMgr_Filter.hxx>
26 #include <SelectMgr_SelectionManager.hxx>
27 #include <Standard_Transient.hxx>
28 #include <TCollection_AsciiString.hxx>
29 #include <TCollection_ExtendedString.hxx>
30 #include <TopLoc_Location.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <V3d_View.hxx>
33 #include <V3d_Viewer.hxx>
34
35 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
36 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
37 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
38 //=======================================================================
39 //function : SetPolygonOffsets 
40 //purpose  : 
41 //======================================================================= 
42 void AIS_InteractiveContext::SetPolygonOffsets(
43                              const Handle(AIS_InteractiveObject)& anObj,
44                              const Standard_Integer               aMode,
45                              const Standard_ShortReal             aFactor,
46                              const Standard_ShortReal             aUnits,
47                              const Standard_Boolean               updateviewer) 
48 {
49   if ( anObj.IsNull() )
50     return;
51
52   setContextToObject (anObj);
53   anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
54
55   const Handle(AIS_GlobalStatus)* aStatus = updateviewer ? myObjects.Seek (anObj) : NULL;
56   if (aStatus != NULL
57    && anObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
58   {
59     myMainVwr->Update();
60   }
61 }
62
63
64 //=======================================================================
65 //function : HasPolygonOffsets 
66 //purpose  : 
67 //=======================================================================
68 Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const
69 {
70   return ( !anObj.IsNull() && anObj->HasPolygonOffsets() );
71 }
72
73 //=======================================================================
74 //function : PolygonOffsets 
75 //purpose  : 
76 //=======================================================================
77 void AIS_InteractiveContext::PolygonOffsets(
78                              const Handle(AIS_InteractiveObject)& anObj,
79                              Standard_Integer&                    aMode,
80                              Standard_ShortReal&                  aFactor,
81                              Standard_ShortReal&                  aUnits) const 
82 {
83   if ( HasPolygonOffsets( anObj ) )
84     anObj->PolygonOffsets( aMode, aFactor, aUnits );
85 }
86 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets 
87
88 //=======================================================================
89 //function : DumpJson
90 //purpose  : 
91 //=======================================================================
92 void AIS_InteractiveContext::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
93 {
94   OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
95
96   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myObjects.Size())
97
98   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mgrSelector.get())
99   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainPM.get())
100   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainVwr.get())
101   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainSel.get())
102   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastActiveView)
103
104   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastPicked.get())
105
106   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToHilightSelected)
107
108   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelection.get())
109   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myFilters.get())
110   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDefaultDrawer.get())
111
112   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Selected])
113   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Dynamic])
114   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalSelected])
115   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalDynamic])
116   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_SubIntensity])
117
118   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedSeq.Size())
119
120   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurDetected)
121   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurHighlighted)
122   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPickingStrategy)
123   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight)
124   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoActivateSelMode)
125 }