0024720: Some standard samples are not compiled after latest integration to visualisation
authorapl <apl@opencascade.com>
Thu, 13 Mar 2014 10:52:18 +0000 (14:52 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 13 Mar 2014 13:41:37 +0000 (17:41 +0400)
Fixed compilation errors in samples:
mfc/standard
qt/Tutorial
qt/IESample

12 files changed:
samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.cpp
samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.h
samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp
samples/mfc/standard/04_Viewer3d/src/Viewer3dView.h
samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp
samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.cpp
samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.h
samples/mfc/standard/10_Convert/src/WNT/OCCDemoView.cpp
samples/mfc/standard/10_Convert/src/WNT/OCCDemoView.h
samples/mfc/standard/Common/OCC_StereoConfigDlg.cpp
samples/qt/Common/src/DocumentCommon.cxx
samples/qt/Common/src/DocumentCommon.h

index a0b2baa..d49d65f 100755 (executable)
@@ -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)
index b523d79..7a19f5e 100755 (executable)
@@ -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();
index 32489d8..2930111 100755 (executable)
@@ -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)
index 2cd175e..f634a7d 100755 (executable)
@@ -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
index 4b01dd3..bd3383c 100755 (executable)
@@ -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();
index 391571d..ea8b4d0 100755 (executable)
@@ -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();
-}
\ No newline at end of file
+}
+
+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);
+}
index 61e219e..e79086f 100755 (executable)
@@ -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() {}
index 7195257..3cd62d5 100755 (executable)
@@ -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);
+}
index d385c43..6bfa56e 100755 (executable)
@@ -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
index 6251b0d..4a73d16 100644 (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 = 
index 64d428c..6673766 100755 (executable)
 #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()
index 8d05a6a..150de48 100755 (executable)
@@ -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;