1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +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;
}
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;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
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;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)

View File

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

View File

@ -39,17 +39,17 @@ protected: // create from serialization only
DECLARE_DYNCREATE(CViewer3dView)
public:
CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc);
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();
void SetViewScale(const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
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();
void SetViewScale (const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
// Overrides

View File

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

View File

@ -257,20 +257,20 @@ Handle_AIS_Shape OCCDemo_Presentation::drawShape
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;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
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;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewAt (theX, theY, theZ);
}
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();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
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 PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
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 GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
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 SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void ResetView();
static void TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY);
// place one-time initialization code in this function
virtual void Init() {}

View File

@ -97,6 +97,8 @@ void COCCDemoView::OnInitialUpdate()
CView::OnInitialUpdate();
myView = GetDocument()->GetViewer()->CreateView();
myView->SetViewMappingDefault();
myView->SetViewOrientationDefault();
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
myView->SetWindow(aWNTWindow);
@ -543,14 +545,14 @@ void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
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)
@ -572,3 +574,8 @@ void COCCDemoView::SetViewScale(Quantity_Factor 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
public:
COCCDemoDoc* GetDocument();
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
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 FitAll()
{
myView->FitAll();
myView->ZFitAll();
};
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();
void SetViewScale(const Quantity_Factor Coef);
void Translate (const V3d_Coordinate theX, const V3d_Coordinate theY);
// Operations

View File

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

View File

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

View File

@ -48,13 +48,12 @@ public slots:
void onTransparency( int );
private:
Handle(V3d_Viewer) Viewer( 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 );
Handle(V3d_Viewer) Viewer (const Standard_ExtString theName,
const Standard_CString theDomain,
const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode );
protected:
ApplicationCommonWindow* myApp;