1 // Created on: 2001-01-09
2 // Created by: Sergey Altukhov
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
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_OrFilter.hxx>
27 #include <SelectMgr_SelectionManager.hxx>
28 #include <Standard_Transient.hxx>
29 #include <TCollection_AsciiString.hxx>
30 #include <TCollection_ExtendedString.hxx>
31 #include <TopLoc_Location.hxx>
32 #include <TopoDS_Shape.hxx>
33 #include <V3d_View.hxx>
34 #include <V3d_Viewer.hxx>
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 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
39 //=======================================================================
40 //function : SetPolygonOffsets
42 //=======================================================================
43 void AIS_InteractiveContext::SetPolygonOffsets(
44 const Handle(AIS_InteractiveObject)& anObj,
45 const Standard_Integer aMode,
46 const Standard_ShortReal aFactor,
47 const Standard_ShortReal aUnits,
48 const Standard_Boolean updateviewer)
53 setContextToObject (anObj);
54 anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
57 if( myObjects.IsBound( anObj ) ) {
58 Handle(AIS_GlobalStatus) STATUS = myObjects(anObj);
59 if ( STATUS->GraphicStatus() == AIS_DS_Displayed )
66 //=======================================================================
67 //function : HasPolygonOffsets
69 //=======================================================================
70 Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const
72 return ( !anObj.IsNull() && anObj->HasPolygonOffsets() );
75 //=======================================================================
76 //function : PolygonOffsets
78 //=======================================================================
79 void AIS_InteractiveContext::PolygonOffsets(
80 const Handle(AIS_InteractiveObject)& anObj,
81 Standard_Integer& aMode,
82 Standard_ShortReal& aFactor,
83 Standard_ShortReal& aUnits) const
85 if ( HasPolygonOffsets( anObj ) )
86 anObj->PolygonOffsets( aMode, aFactor, aUnits );
88 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
90 //=======================================================================
93 //=======================================================================
94 void AIS_InteractiveContext::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
96 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
98 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myObjects.Size())
100 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mgrSelector.get())
101 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainPM.get())
102 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainVwr.get())
103 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainSel.get())
104 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastActiveView)
106 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastPicked.get())
108 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToHilightSelected)
110 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelection.get())
111 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myFilters.get())
112 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDefaultDrawer.get())
114 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Selected])
115 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Dynamic])
116 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalSelected])
117 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalDynamic])
118 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_SubIntensity])
120 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedSeq.Size())
122 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurDetected)
123 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurHighlighted)
124 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPickingStrategy)
125 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight)
126 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoActivateSelMode)