1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0024720: Some standard samples are not compiled after latest integration to visualisation

Fixed compilation errors in samples:
mfc/standard
qt/Tutorial
qt/IESample
This commit is contained in:
apl 2014-03-13 14:52:18 +04:00 committed by bugmaster
parent 7c8090aa6c
commit 9764ccbb78
12 changed files with 113 additions and 80 deletions

View File

@ -257,20 +257,20 @@ Handle_AIS_Shape OCCDemo_Presentation::drawShape
return aGraphicShape; return aGraphicShape;
} }
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc) void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
{ {
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView(); CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc); pView->GetViewAt (theX, theY, theZ);
} }
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc) void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{ {
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView(); CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc); pView->SetViewAt (theX, theY, theZ);
} }
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)

View File

@ -50,10 +50,10 @@ public:
void NextSample() {myIndex++;} void NextSample() {myIndex++;}
void PrevSample() {myIndex--;} void PrevSample() {myIndex--;}
virtual void DoSample() = 0; virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc); static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc); static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z); static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z); static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale(); static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef); static void SetViewScale(Quantity_Factor Coef);
static void ResetView(); static void ResetView();

View File

@ -1183,14 +1183,14 @@ void CViewer3dView::Reset()
} }
} }
void CViewer3dView::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc) void CViewer3dView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
{ {
myView->Center(Xc,Yc); myView->At (theX, theY, theZ);
} }
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc) void CViewer3dView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{ {
myView->SetCenter(Xc,Yc); myView->SetAt (theX, theY, theZ);
} }
void CViewer3dView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) void CViewer3dView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)

View File

@ -39,17 +39,17 @@ protected: // create from serialization only
DECLARE_DYNCREATE(CViewer3dView) DECLARE_DYNCREATE(CViewer3dView)
public: public:
CViewer3dDoc* GetDocument(); CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); }; void Redraw() { myView->Redraw(); };
void InitButtons(); void InitButtons();
void Reset(); void Reset();
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc); void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc); void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z); void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z); void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale(); Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef); void SetViewScale (const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); }; void FitAll() { myView->FitAll(); myView->ZFitAll(); };
// Overrides // Overrides

View File

@ -69,6 +69,7 @@ Convert_Presentation::Convert_Presentation()
myIndex = 0; myIndex = 0;
myNbFuncs = sizeof(SampleFuncs)/sizeof(PSampleFuncType); myNbFuncs = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
myNbSamples = myNbFuncs; myNbSamples = myNbFuncs;
FitMode = true;
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -84,7 +85,6 @@ void Convert_Presentation::DoSample()
(this->*SampleFuncs[myIndex])(); (this->*SampleFuncs[myIndex])();
} }
//================================================================ //================================================================
// Function : Convert_Presentation::drawSurfaceAndItsBSpline // Function : Convert_Presentation::drawSurfaceAndItsBSpline
// Purpose : // Purpose :
@ -332,7 +332,7 @@ void Convert_Presentation::sampleRevolSurface()
{ {
FitMode=false; FitMode=false;
ResetView(); ResetView();
SetViewCenter(176.84682,102.12892); TranslateView(-176.84682, -102.12892);
SetViewScale(0.69326); SetViewScale(0.69326);
getAISContext()->EraseAll(); getAISContext()->EraseAll();

View File

@ -257,20 +257,20 @@ Handle_AIS_Shape OCCDemo_Presentation::drawShape
return aGraphicShape; return aGraphicShape;
} }
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc) void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
{ {
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView(); COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc); pView->GetViewAt (theX, theY, theZ);
} }
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc) void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{ {
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView(); COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc); pView->SetViewAt (theX, theY, theZ);
} }
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
@ -311,4 +311,12 @@ void OCCDemo_Presentation::ResetView()
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView(); COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->Reset(); pView->Reset();
} }
void OCCDemo_Presentation::TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->Translate (theX, theY);
}

View File

@ -50,14 +50,14 @@ public:
void NextSample() {myIndex++;} void NextSample() {myIndex++;}
void PrevSample() {myIndex--;} void PrevSample() {myIndex--;}
virtual void DoSample() = 0; virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc); static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc); static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z); static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z); static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale(); static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef); static void SetViewScale(Quantity_Factor Coef);
static void ResetView(); static void ResetView();
static void TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY);
// place one-time initialization code in this function // place one-time initialization code in this function
virtual void Init() {} virtual void Init() {}

View File

@ -97,6 +97,8 @@ void COCCDemoView::OnInitialUpdate()
CView::OnInitialUpdate(); CView::OnInitialUpdate();
myView = GetDocument()->GetViewer()->CreateView(); myView = GetDocument()->GetViewer()->CreateView();
myView->SetViewMappingDefault();
myView->SetViewOrientationDefault();
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ()); Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
myView->SetWindow(aWNTWindow); myView->SetWindow(aWNTWindow);
@ -543,14 +545,14 @@ void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
pCmdUI->Enable (myVisMode != VIS_HLR); pCmdUI->Enable (myVisMode != VIS_HLR);
} }
void COCCDemoView::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc) void COCCDemoView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
{ {
myView->Center(Xc,Yc); myView->At (theX, theY, theZ);
} }
void COCCDemoView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc) void COCCDemoView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{ {
myView->SetCenter(Xc,Yc); myView->SetAt (theX, theY, theZ);
} }
void COCCDemoView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) void COCCDemoView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
@ -572,3 +574,8 @@ void COCCDemoView::SetViewScale(Quantity_Factor Coef)
{ {
myView->SetScale(Coef); myView->SetScale(Coef);
} }
void COCCDemoView::Translate (const Standard_Real theX, const Standard_Real theY)
{
myView->Panning (theX, theY);
}

View File

@ -27,13 +27,18 @@ protected: // create from serialization only
// Attributes // Attributes
public: public:
COCCDemoDoc* GetDocument(); COCCDemoDoc* GetDocument();
void FitAll() { myView->FitAll(); myView->ZFitAll(); }; void FitAll()
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc); {
void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc); myView->FitAll();
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z); myView->ZFitAll();
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z); };
void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale(); Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef); void SetViewScale(const Quantity_Factor Coef);
void Translate (const V3d_Coordinate theX, const V3d_Coordinate theY);
// Operations // Operations

View File

@ -105,9 +105,11 @@ void OCC_StereoConfigDlg::OnHScroll(UINT theSBCode, UINT thePos, CScrollBar* the
void OCC_StereoConfigDlg::UpdateCamera() void OCC_StereoConfigDlg::UpdateCamera()
{ {
// update camera properties and redraw view // update camera properties and redraw view
Handle(Graphic3d_Camera)& aCamera = myView->Camera(); const Handle(Graphic3d_Camera)& aCamera = myView->Camera();
if (aCamera.IsNull()) if (aCamera.IsNull())
{
return; return;
}
// change IOD // change IOD
Graphic3d_Camera::IODType aIODType = Graphic3d_Camera::IODType aIODType =

View File

@ -16,13 +16,16 @@
#include <OpenGl_GraphicDriver.hxx> #include <OpenGl_GraphicDriver.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString /*aDisplay*/, // =======================================================================
const Standard_ExtString aName, // function : Viewer
const Standard_CString aDomain, // purpose :
const Standard_Real ViewSize, // =======================================================================
const V3d_TypeOfOrientation ViewProj, Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString theName,
const Standard_Boolean ComputedMode, const Standard_CString theDomain,
const Standard_Boolean aDefaultComputedMode ) const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode )
{ {
static Handle(OpenGl_GraphicDriver) aGraphicDriver; static Handle(OpenGl_GraphicDriver) aGraphicDriver;
@ -30,14 +33,23 @@ Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString /*aDisplay*/,
{ {
Handle(Aspect_DisplayConnection) aDisplayConnection; Handle(Aspect_DisplayConnection) aDisplayConnection;
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) #if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
aDisplayConnection = new Aspect_DisplayConnection (aDisplay); aDisplayConnection = new Aspect_DisplayConnection (qgetenv ("DISPLAY").constData());
#endif #endif
aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection); aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection);
} }
return new V3d_Viewer(aGraphicDriver,aName,aDomain,ViewSize,ViewProj, return new V3d_Viewer (aGraphicDriver,
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT, theName,
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE); theDomain,
theViewSize,
theViewProj,
Quantity_NOC_GRAY30,
V3d_ZBUFFER,
V3d_GOURAUD,
V3d_WAIT,
theComputedMode,
theDefaultComputedMode,
V3d_TEX_NONE);
} }
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app ) DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )
@ -47,13 +59,13 @@ myIndex( theIndex ),
myNbViews( 0 ) myNbViews( 0 )
{ {
TCollection_ExtendedString a3DName ("Visu3D"); TCollection_ExtendedString a3DName ("Visu3D");
myViewer = Viewer (qgetenv ("DISPLAY").constData(),
a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
myViewer->SetDefaultLights(); myViewer = Viewer (a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
myViewer->SetLightOn();
myContext = new AIS_InteractiveContext (myViewer); myViewer->SetDefaultLights();
myViewer->SetLightOn();
myContext = new AIS_InteractiveContext (myViewer);
} }
DocumentCommon::~DocumentCommon() DocumentCommon::~DocumentCommon()

View File

@ -48,13 +48,12 @@ public slots:
void onTransparency( int ); void onTransparency( int );
private: private:
Handle(V3d_Viewer) Viewer( const Standard_CString aDisplay, Handle(V3d_Viewer) Viewer (const Standard_ExtString theName,
const Standard_ExtString aName, const Standard_CString theDomain,
const Standard_CString aDomain, const Standard_Real theViewSize,
const Standard_Real ViewSize, const V3d_TypeOfOrientation theViewProj,
const V3d_TypeOfOrientation ViewProj, const Standard_Boolean theComputedMode,
const Standard_Boolean ComputedMode, const Standard_Boolean theDefaultComputedMode );
const Standard_Boolean aDefaultComputedMode );
protected: protected:
ApplicationCommonWindow* myApp; ApplicationCommonWindow* myApp;