// commercial license or contractual agreement.
#include <Graphic3d_GraphicDriver.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_TransformError.hxx>
-#include <Quantity_Color.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
+// =======================================================================
+// function : Graphic3d_GraphicDriver
+// purpose :
+// =======================================================================
Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
-: MyTraceLevel (0),
- myDisplayConnection (theDisp),
+: myDisplayConnection (theDisp),
myDeviceLostFlag (Standard_False)
{
//
}
-//-Internal methods, in order
-
-void Graphic3d_GraphicDriver::PrintBoolean (const Standard_CString AComment, const Standard_Boolean AValue) const {
-
- cout << "\t" << AComment << " : "
- << (AValue ? "True" : "False") << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintCLight (const Graphic3d_CLight& theCLight,
- const Standard_Integer theField) const
-{
- if (theField)
- {
- switch (theCLight.Type) {
- case 0 :
- cout << "\tlight type : ambient\n";
- break;
- case 1 :
- cout << "\tlight type : directional\n";
- break;
- case 2 :
- cout << "\tlight type : positional\n";
- break;
- case 3 :
- cout << "\tlight type : spot\n";
- break;
- default :
- cout << "\tlight type : undefined, error\n";
- break;
- }
- cout << flush;
- }
-}
-
-void Graphic3d_GraphicDriver::PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const {
-
- if (AField) {
- cout << "\tstruct id " << ACStructure.Id << "\n";
- cout << flush;
- }
-
-}
-
-void Graphic3d_GraphicDriver::PrintCView (const Graphic3d_CView& ACView, const Standard_Integer AField) const {
-
- if (AField) {
- cout << "view id " << ACView.Identification() << "\n";
- cout << "\tXwindow id " << (ACView.Window().IsNull() ? 0 : ACView.Window()->NativeHandle()) << ", "
- << "activity " << ACView.IsActive() << "\n";
- cout << flush;
- }
-
-}
-
-void Graphic3d_GraphicDriver::PrintFunction (const Standard_CString AFunc) const {
-
- cout << AFunc << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintInteger (const Standard_CString AComment, const Standard_Integer AValue) const {
-
- cout << "\t" << AComment << " : " << AValue << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintIResult (const Standard_CString AFunc, const Standard_Integer AResult) const {
-
- cout << AFunc << " = " << AResult << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintMatrix (const Standard_CString AComment, const TColStd_Array2OfReal& AMatrix) const {
-
- Standard_Integer lr, ur, lc, uc;
- Standard_Integer i, j;
-
- lr = AMatrix.LowerRow ();
- ur = AMatrix.UpperRow ();
- lc = AMatrix.LowerCol ();
- uc = AMatrix.UpperCol ();
-
- if ( (ur - lr + 1 != 4) || (uc - lc + 1 != 4) )
- Graphic3d_TransformError::Raise
- ("PrintMatrix : not a 4x4 matrix");
-
- cout << "\t" << AComment << " :\n";
- for (i=lr; i<=ur; i++) {
- for (j=lc; j<=uc; j++) {
- cout << AMatrix (i, j) << " ";
- }
- cout << "\n";
- }
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintShortReal (const Standard_CString AComment, const Standard_ShortReal AValue) const {
-
- cout << "\t" << AComment << " : " << AValue << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::PrintString (const Standard_CString AComment, const Standard_CString AString) const {
-
- cout << "\t" << AComment << " : " << AString << "\n";
- cout << flush;
-
-}
-
-void Graphic3d_GraphicDriver::SetTrace (const Standard_Integer ALevel) {
-
- MyTraceLevel = ALevel;
-
-}
-
-Standard_Integer Graphic3d_GraphicDriver::Trace () const {
-
- return MyTraceLevel;
-
-}
-
+// =======================================================================
+// function : GetDisplayConnection
+// purpose :
+// =======================================================================
const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConnection() const
{
return myDisplayConnection;
}
+// =======================================================================
+// function : IsDeviceLost
+// purpose :
+// =======================================================================
Standard_Boolean Graphic3d_GraphicDriver::IsDeviceLost() const
{
return myDeviceLostFlag;
}
+// =======================================================================
+// function : ResetDeviceLostFlag
+// purpose :
+// =======================================================================
void Graphic3d_GraphicDriver::ResetDeviceLostFlag()
{
myDeviceLostFlag = Standard_False;
//! Returns Standard_True if the view associated to the window exists.
virtual Standard_Boolean ViewExists (const Handle(Aspect_Window)& theWindow, Handle(Graphic3d_CView)& theView) = 0;
- Standard_EXPORT void PrintBoolean (const Standard_CString AComment, const Standard_Boolean AValue) const;
-
- Standard_EXPORT void PrintCLight (const Graphic3d_CLight& ACLight, const Standard_Integer AField) const;
-
- Standard_EXPORT void PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const;
-
- Standard_EXPORT void PrintCView (const Graphic3d_CView& ACView, const Standard_Integer AField) const;
-
- Standard_EXPORT void PrintFunction (const Standard_CString AFunc) const;
-
- Standard_EXPORT void PrintInteger (const Standard_CString AComment, const Standard_Integer AValue) const;
-
- Standard_EXPORT void PrintIResult (const Standard_CString AFunc, const Standard_Integer AResult) const;
-
- Standard_EXPORT void PrintShortReal (const Standard_CString AComment, const Standard_ShortReal AValue) const;
-
- Standard_EXPORT void PrintMatrix (const Standard_CString AComment, const TColStd_Array2OfReal& AMatrix) const;
-
- Standard_EXPORT void PrintString (const Standard_CString AComment, const Standard_CString AString) const;
-
- Standard_EXPORT void SetTrace (const Standard_Integer ALevel);
-
- Standard_EXPORT Standard_Integer Trace() const;
-
//! returns Handle to display connection
Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const;
//! Initializes the Driver
Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
- Standard_Integer MyTraceLevel;
Handle(Aspect_DisplayConnection) myDisplayConnection;
Standard_Boolean myDeviceLostFlag;