From: inv Date: Mon, 28 Jan 2013 08:34:00 +0000 (+0000) Subject: Porting to dev version of OCCT X-Git-Tag: V6_main_FINAL~57 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff5f03116bceb2e1973f0ac0f99fe859ad5ac233;p=modules%2Fgui.git Porting to dev version of OCCT --- diff --git a/src/OCCViewer/OCCViewer_VService.cxx b/src/OCCViewer/OCCViewer_VService.cxx index 5614fa63b..86181d953 100755 --- a/src/OCCViewer/OCCViewer_VService.cxx +++ b/src/OCCViewer/OCCViewer_VService.cxx @@ -21,66 +21,18 @@ // #include "OCCViewer_VService.h" + #include #include -#include - -#include -#include -#include #ifdef WNT #include #include -#include -#include -#include #else #include #include -#include -//#include -#include #endif -// For 2d -#define LOPTIM -#ifdef WNT -#ifndef LOPTIM -static Handle(WNT_GraphicDevice) XServiceDefault2dDevice; -static Handle(WNT_GraphicDevice) XServiceImageDevice; -#else -static Handle(WNT_GraphicDevice)& _XServiceDefault2dDevice() { -static Handle(WNT_GraphicDevice) XServiceDefault2dDevice; -return XServiceDefault2dDevice; -} -#define XServiceDefault2dDevice _XServiceDefault2dDevice() - -static Handle(WNT_GraphicDevice)& _XServiceImageDevice() { -static Handle(WNT_GraphicDevice) XServiceImageDevice; -return XServiceImageDevice; -} -#define XServiceImageDevice _XServiceImageDevice() -#endif // LOPTIM -#else -#ifndef LOPTIM -static Handle(Xw_GraphicDevice) XServiceDefault2dDevice; -static Handle(Xw_GraphicDevice) XServiceImageDevice; -#else -static Handle(Xw_GraphicDevice)& _XServiceDefault2dDevice() { -static Handle(Xw_GraphicDevice) XServiceDefault2dDevice; -return XServiceDefault2dDevice; -} -#define XServiceDefault2dDevice _XServiceImageDevice() - -static Handle(Xw_GraphicDevice)& _XServiceImageDevice() { -static Handle(Xw_GraphicDevice) XServiceImageDevice; -return XServiceImageDevice; -} -#define XServiceImageDevice _XServiceImageDevice() -#endif // LOPTIM -#endif // WNT - /*! Create native view window for CasCade view [ static ] */ @@ -114,21 +66,21 @@ void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view, Magnifies 'view' based on previous view [ static ] */ void OCCViewer_VService::SetMagnify( const Handle(V3d_View)& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Handle(V3d_View)& prevView, - const Standard_Integer x1, - const Standard_Integer y1, - const Standard_Integer x2, - const Standard_Integer y2, - const Xw_WindowQuality aQuality ) + const Standard_Integer hiwin, + const Standard_Integer lowin, + const Handle(V3d_View)& prevView, + const Standard_Integer x1, + const Standard_Integer y1, + const Standard_Integer x2, + const Standard_Integer y2, + const Xw_WindowQuality aQuality ) { #ifdef WNT Handle(WNT_Window) w = - new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); + new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); #else Handle(Xw_Window) w = - new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, aQuality ); + new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, aQuality ); #endif view->SetMagnify( w, prevView, x1, y1, x2, y2 ); } @@ -137,180 +89,26 @@ void OCCViewer_VService::SetMagnify( const Handle(V3d_View)& view, Creates viewer 3d [ static ] */ Handle(V3d_Viewer) OCCViewer_VService::Viewer3d( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain, - const Standard_Real ViewSize , - const V3d_TypeOfOrientation ViewProj, - const Standard_Boolean ComputedMode, - const Standard_Boolean aDefaultComputedMode ) + const Standard_ExtString aName, + const Standard_CString aDomain, + const Standard_Real ViewSize , + const V3d_TypeOfOrientation ViewProj, + const Standard_Boolean ComputedMode, + const Standard_Boolean aDefaultComputedMode ) { #ifndef WNT - static Handle(Graphic3d_GraphicDevice) defaultdevice; - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_GraphicDevice( aDisplay ); - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - ComputedMode, aDefaultComputedMode, V3d_TEX_NONE ); + static Handle(Graphic3d_GraphicDevice) defaultdevice; + if ( defaultdevice.IsNull() ) + defaultdevice = new Graphic3d_GraphicDevice( aDisplay ); + return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, + Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, + ComputedMode, aDefaultComputedMode, V3d_TEX_NONE ); #else - static Handle(Graphic3d_WNTGraphicDevice) defaultdevice; - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_WNTGraphicDevice(); - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - ComputedMode, aDefaultComputedMode, V3d_TEX_NONE); + static Handle(Graphic3d_WNTGraphicDevice) defaultdevice; + if ( defaultdevice.IsNull() ) + defaultdevice = new Graphic3d_WNTGraphicDevice(); + return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, + Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, + ComputedMode, aDefaultComputedMode, V3d_TEX_NONE); #endif // WNT } - -/*! - Creates view 2D and maps it to the window [ static ] -*/ -/*Handle(V2d_View) OCCViewer_VService::View2d( const Handle(V2d_Viewer)& aViewer, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality aQuality, - const Standard_Boolean Update, - const Quantity_NameOfColor BackColor ) -{ -#ifdef WNT - Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device()); - Handle(WNT_Window) W = new WNT_Window( GD, hiwin, lowin, BackColor ); - Handle(WNT_WDriver) D = new WNT_WDriver( W ); -#else - Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device()); - Handle(Xw_Window) W = new Xw_Window( GD, hiwin, lowin, aQuality, BackColor ); - Handle(Xw_Driver) D = new Xw_Driver( W ); -#endif - Handle(V2d_View) V = new V2d_View( D, aViewer ); - if ( Update ) - V->Update(); - return V; -}*/ - -/*! - Creates view 2D and maps it to the window [ static ] -*/ -/*Handle(V2d_View) OCCViewer_VService::dpsView2d( const Handle(V2d_Viewer)& aViewer, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality aQuality, - const Standard_Boolean Update, - const Quantity_NameOfColor BackColor ) -{ -#ifdef WNT - Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device()); - Handle(WNT_Window) W = new WNT_Window( GD, hiwin, lowin, BackColor ); - W->SetBackground( BackColor ); - Handle(WNT_WDriver) D = new WNT_WDriver( W ); -#else - Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device()); - Handle(Xw_Window) W = new Xw_Window( GD, hiwin, lowin, aQuality, BackColor ); - Handle(Xdps_Driver) D = new Xdps_Driver( W ); -#endif - Handle(V2d_View) V = new V2d_View( D, aViewer ); - if ( Update ) - V->Update(); - return V; -}*/ - -/*! - Creates viewer 2D [ static ] -*/ -/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); -#endif - return new V2d_Viewer( XServiceDefault2dDevice, aName, aDomain ); -}*/ - -/*! - Creates viewer 2D [ static ] -*/ -/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay, - const Handle(Graphic2d_View)& aView, - const Standard_ExtString aName, - const Standard_CString aDomain ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); -#endif - return new V2d_Viewer( XServiceDefault2dDevice, aView, aName, aDomain ); -}*/ - -/*! - Creates window driver [ static ] -*/ -Handle(Aspect_WindowDriver) OCCViewer_VService::WindowDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceDefault2dDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceDefault2dDevice, ahiwin, alowin, Xw_WQ_DRAWINGQUALITY , aColor ); - return new Xw_Driver( W ); -#endif -} - -/*! - Creates Xdps window driver [ static ] - On Win32 the same as OCCViewer_VService::WindowDriver() -*/ -/* -Handle(Aspect_WindowDriver) OCCViewer_VService::XdpsDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceDefault2dDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceDefault2dDevice, ahiwin, alowin, - Xw_WQ_DRAWINGQUALITY, aColor ); - return new Xdps_Driver( W ); -#endif -} -*/ -/*! - Creates Xw window driver [ static ] - On Win32 the same as OCCViewer_VService::WindowDriver() -*/ -Handle(Aspect_WindowDriver) OCCViewer_VService::ImageDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceImageDevice.IsNull() ) - XServiceImageDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceImageDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceImageDevice.IsNull() ) - XServiceImageDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceImageDevice, ahiwin, alowin, - Xw_WQ_PICTUREQUALITY, aColor ); - return new Xw_Driver( W ); -#endif -} diff --git a/src/OCCViewer/OCCViewer_VService.h b/src/OCCViewer/OCCViewer_VService.h index 06af9e043..73dfcff45 100755 --- a/src/OCCViewer/OCCViewer_VService.h +++ b/src/OCCViewer/OCCViewer_VService.h @@ -23,59 +23,16 @@ #ifndef OCCVIEWER_VSERVICE_H #define OCCVIEWER_VSERVICE_H -#ifndef _Handle_V3d_View_HeaderFile +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Xw_WindowQuality_HeaderFile -#include -#endif -#ifndef _Handle_V3d_Viewer_HeaderFile #include -#endif -#ifndef _Standard_CString_HeaderFile +#include #include -#endif -#ifndef _Standard_ExtString_HeaderFile #include -#endif -#ifndef _Quantity_Length_HeaderFile +#include #include -#endif -#ifndef _Quantity_NameOfColor_HeaderFile -#include -#endif -#ifndef _V3d_TypeOfOrientation_HeaderFile +#include #include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_Graphic2d_View_HeaderFile -#include -#endif -#ifndef _Handle_Aspect_WindowDriver_HeaderFile -#include -#endif -#ifndef _Handle_Aspect_Window_HeaderFile -#include -#endif - -class V3d_View; -class V2d_View; -class V3d_Viewer; -class V2d_Viewer; -class Graphic2d_View; -class Aspect_WindowDriver; - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif class Standard_EXPORT OCCViewer_VService { @@ -122,24 +79,6 @@ public: const V3d_TypeOfOrientation ViewProj = V3d_XposYnegZpos, const Standard_Boolean ComputedMode = Standard_True, const Standard_Boolean DefaultComputedMode = Standard_True ); - - static Handle_Aspect_WindowDriver - WindowDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - /*static Handle_Aspect_WindowDriver - XdpsDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - */ - static Handle_Aspect_WindowDriver - ImageDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - }; #endif