]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting on OCCT7.0.1: persistence
authorskv <skv@opencascade.com>
Fri, 29 Jul 2016 08:26:23 +0000 (11:26 +0300)
committerskv <skv@opencascade.com>
Fri, 29 Jul 2016 08:26:23 +0000 (11:26 +0300)
12 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/OCCViewer/CMakeLists.txt
src/OCCViewer/OCCViewer.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer.h [changed mode: 0755->0644]
src/OCCViewer/OCCViewer_EnvTextureDlg.cxx
src/OCCViewer/OCCViewer_EnvTextureDlg.h
src/OCCViewer/OCCViewer_LightSourceDlg.cxx
src/OCCViewer/OCCViewer_VService.cxx [changed mode: 0755->0644]
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewModel.cxx [changed mode: 0755->0644]
src/OCCViewer/OCCViewer_ViewWindow.cxx [changed mode: 0755->0644]

index 1ef75e6b88728322d627d0690b077aab426738af..e65f907d773096664b97da9d9879a4559ade7352 100755 (executable)
@@ -325,11 +325,18 @@ INCLUDE(CMakePackageConfigHelpers)
 # List of targets in this project we want to make visible to the rest of the world.
 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
 SET(_${PROJECT_NAME}_exposed_targets 
-    caf CAM CASCatch DDS Event LightApp LogWindow ObjBrowser
+    CAM CASCatch DDS Event LightApp LogWindow ObjBrowser
     QDS qtx SalomePrs SalomeStyle std SUITApp suit ViewerTools ViewerData
     ImageComposer
 )
 
+# CAF package (not compilable while TDocStd_Application::Formats is removed)
+MESSAGE( STATUS "CAS_VERSION_STR:         " ${CAS_VERSION_STR} )
+IF(CAS_VERSION_STR VERSION_LESS "7.0.1")
+  LIST(APPEND _${PROJECT_NAME}_exposed_targets 
+       caf)
+ENDIF()
+
 IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
        OpenGLUtils)
index d1ebdb03256eeec700a3c8d8e7f29b8425fc799c..f7161a9cc471f5fefb2c17e4659b75b19e7e10fc 100755 (executable)
@@ -32,7 +32,10 @@ ADD_SUBDIRECTORY(ObjBrowser)
 ADD_SUBDIRECTORY(SUIT)
 ADD_SUBDIRECTORY(SUITApp)
 ADD_SUBDIRECTORY(STD)
-ADD_SUBDIRECTORY(CAF)
+# CAF package (not compilable while TDocStd_Application::Formats is removed)
+IF(CAS_VERSION_STR VERSION_LESS "7.0.1")
+  ADD_SUBDIRECTORY(CAF)
+ENDIF()
 ADD_SUBDIRECTORY(CAM)
 ADD_SUBDIRECTORY(LogWindow)
 ADD_SUBDIRECTORY(Prs)
index 528be766b03d93cbaa81113940025828d9b08261..837b6f2c034370fb1338bb6a5288caa6b0810f3e 100755 (executable)
@@ -36,7 +36,6 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/ViewerData
   ${PROJECT_SOURCE_DIR}/src/ViewerTools
   ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
-  ${PROJECT_SOURCE_DIR}/src/CAF
 )
 
 # additional preprocessor / compiler flags
@@ -46,7 +45,7 @@ ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS})
 SET(_link_LIBRARIES
   ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo}
   ${CAS_TKTopAlgo} ${CAS_TKG2d} ${CAS_TKOpenGl}
-  CASCatch qtx suit ViewerTools ViewerData OpenGLUtils caf
+  CASCatch qtx suit ViewerTools ViewerData OpenGLUtils
 )
 
 # --- headers ---
@@ -159,6 +158,7 @@ QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
+  OCCViewer.cxx
   OCCViewer_AISSelector.cxx
   OCCViewer_AxialScaleDlg.cxx
   OCCViewer_ClippingDlg.cxx
diff --git a/src/OCCViewer/OCCViewer.cxx b/src/OCCViewer/OCCViewer.cxx
new file mode 100644 (file)
index 0000000..2293972
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2015-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// internal includes
+#include "OCCViewer.h"
+
+/*!
+  \brief Convert QColor object to Quantity_Color object.
+  \param c color object in Qt format
+  \return color object in OCC format
+*/
+Quantity_Color OCCViewer::color( const QColor& c )
+{
+  Quantity_Color aColor;
+  if ( c.isValid() )
+    aColor = Quantity_Color( c.red()   / 255., c.green() / 255.,
+                             c.blue()  / 255., Quantity_TOC_RGB );
+  return aColor;
+}
+
+/*!
+  \brief Convert Quantity_Color object to QColor object.
+  \param c color object in OCC format
+  \return color object in Qt format
+*/
+QColor OCCViewer::color( const Quantity_Color& c )
+{
+  return QColor ( int( c.Red()   * 255 ),
+                  int( c.Green() * 255 ),
+                  int( c.Blue()  * 255 ) );
+}
old mode 100755 (executable)
new mode 100644 (file)
index bafdba4..7a3139d
 #pragma warning ( disable: 4251 )
 #endif
 
+#include <Quantity_Color.hxx>
+
+#include <QColor>
+
+namespace OCCViewer
+{
+  OCCVIEWER_EXPORT Quantity_Color color( const QColor& );
+  OCCVIEWER_EXPORT QColor         color( const Quantity_Color& );
+};
+
 #endif //OCCVIEWER_H
index 958cb4870e92e04d46ca3716fe8aad61b9737d0d..b6e952481805b13c31f1469e388c348c3d292202 100644 (file)
@@ -169,7 +169,11 @@ void OCCViewer_EnvTextureDlg::onEnvTexture( bool theIsChecked )
     onTextureChanged();
   else {
     Handle(Graphic3d_TextureEnv) aTexture;
+#if OCC_VERSION_LARGE > 0x07000000
+    setEnvTexture( aTexture );
+#else
     setEnvTexture( aTexture, V3d_TEX_ALL );
+#endif
   }
 }
 
@@ -196,7 +200,11 @@ void OCCViewer_EnvTextureDlg::onTextureChanged()
                  << Graphic3d_NOT_ENV_LINES  << Graphic3d_NOT_ENV_ROAD;
     aTexture = new Graphic3d_TextureEnv( aTextures.at( myEnvTextureId->currentIndex() ) );
   }
+#if OCC_VERSION_LARGE > 0x07000000
+  setEnvTexture( aTexture );
+#else
   setEnvTexture( aTexture, V3d_TEX_ENVIRONMENT );
+#endif
 }
 
 /*!
@@ -224,13 +232,19 @@ void OCCViewer_EnvTextureDlg::ClickOnHelp()
 /*!
   Sets current texture environment for all view in the viewer
 */
+#if OCC_VERSION_LARGE > 0x07000000
+void OCCViewer_EnvTextureDlg::setEnvTexture( Handle(Graphic3d_TextureEnv) theTexture)
+#else
 void OCCViewer_EnvTextureDlg::setEnvTexture( Handle(Graphic3d_TextureEnv) theTexture, V3d_TypeOfSurfaceDetail theMode )
+#endif
 {
   for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) {
     if ( OCCViewer_ViewWindow* aViewWindow = myViewFrame->getView(i) ) {
       Handle(V3d_View) aView = aViewWindow->getViewPort()->getView();
       aView->SetTextureEnv( theTexture );
+#if OCC_VERSION_LARGE <= 0x07000000
       aView->SetSurfaceDetail( theMode );
+#endif
       aView->Redraw();
     }
   }
index db345a03abb2d8cdc5a9ee40444cc28ed764e6aa..d06c6798544e7026a16839e6e1695709b2e6f7a2 100644 (file)
@@ -23,6 +23,7 @@
 #include "OCCViewer.h"
 #include <QDialog>
 #include <V3d_View.hxx>
+#include <Basics_OCCTVersion.hxx>
 
 class OCCViewer_ViewWindow;
 class OCCViewer_ViewFrame;
@@ -50,7 +51,11 @@ private slots:
 
 private:
   void initParam();
+#if OCC_VERSION_LARGE > 0x07000000
+  void setEnvTexture( Handle(Graphic3d_TextureEnv) );
+#else
   void setEnvTexture( Handle(Graphic3d_TextureEnv), V3d_TypeOfSurfaceDetail );
+#endif
 
   OCCViewer_ViewFrame* myViewFrame;
   Handle(V3d_View) myView3d;
index 20afd9cb5450b14148d4ccc228a1f07b65769e45..2247273c53426763419147a138091ebe98b6a86c 100644 (file)
 
 // internal includes
 #include "OCCViewer_LightSourceDlg.h"
+#include "OCCViewer.h"
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewModel.h"
 
 // GUI includes
 #include <SUIT_Session.h>
-#include <CAF_Tools.h>
 #include <QtxDoubleSpinBox.h>
 #include <QtxColorButton.h>
 
@@ -304,7 +304,7 @@ void OCCViewer_LightSourceDlg::initParam( bool theIsDefault )
   double aX, aY, aZ;
   Quantity_Color aColor = aLight->Color();
   if( myDirType->isChecked() ) {
-    myDirColor->setColor( CAF_Tools::color( aColor ) );
+    myDirColor->setColor( OCCViewer::color( aColor ) );
     myDirLight->Direction( aX, aY, aZ );
     myDx->setValue( aX );
     myDy->setValue( aY );
@@ -312,7 +312,7 @@ void OCCViewer_LightSourceDlg::initParam( bool theIsDefault )
     myDirHeadLight->setChecked( myDirLight->Headlight() );
   }
   else if( myPosType->isChecked() ) {
-    myPosColor->setColor( CAF_Tools::color( aColor ) );
+    myPosColor->setColor( OCCViewer::color( aColor ) );
     myPosLight->Position( aX, aY, aZ );
     myX->setValue( aX );
     myY->setValue( aY );
@@ -356,7 +356,7 @@ void OCCViewer_LightSourceDlg::onDirChanged()
   myModel->getViewer3d()->SetLightOff( myDirLight );
   if ( !( myDx->value() == 0 && myDy->value() == 0 && myDz->value() == 0 ) ) {
     myDirLight->SetDirection( myDx->value(), myDy->value(), myDz->value() );
-    myDirLight->SetColor( CAF_Tools::color( myDirColor->color() ) );
+    myDirLight->SetColor( OCCViewer::color( myDirColor->color() ) );
     myDirLight->SetHeadlight( myDirHeadLight->isChecked() );
     myModel->getViewer3d()->SetLightOn( myDirLight );
   }
@@ -372,7 +372,7 @@ void OCCViewer_LightSourceDlg::onPosChanged()
     return;
   myModel->getViewer3d()->SetLightOff( myPosLight );
   myPosLight->SetPosition( myX->value(), myY->value(), myZ->value() );
-  myPosLight->SetColor( CAF_Tools::color( myPosColor->color() ) );
+  myPosLight->SetColor( OCCViewer::color( myPosColor->color() ) );
   myPosLight->SetHeadlight( myPosHeadLight->isChecked() );
   myModel->getViewer3d()->SetLightOn( myPosLight );
   myModel->getViewer3d()->UpdateLights();
old mode 100755 (executable)
new mode 100644 (file)
index c6c1bf9..ec09bc0
@@ -87,7 +87,13 @@ Handle(V3d_Viewer) OCCViewer_VService::CreateViewer( const Standard_ExtString na
 #endif
   }
 
+#if OCC_VERSION_LARGE > 0x07000000
+  return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection,
+                        Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
+                        computedMode, defaultComputedMode );
+#else
   return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection,
                         Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
                         computedMode, defaultComputedMode, V3d_TEX_NONE );
+#endif
 }
index 1b5fb4daa672d3a56af91e2ffb49cfe321c2af11..222a292bc4c7dc0b97da84fc91ebfd9a2476b7bc 100644 (file)
@@ -186,7 +186,9 @@ void OCCViewer_ViewFrame::setSubViewParams( OCCViewer_ViewWindow* theView )
 
   // set environment texture parameters
   aView->SetTextureEnv( aMainView->TextureEnv() );
+#if OCC_VERSION_LARGE <= 0x07000000
   aView->SetSurfaceDetail( aMainView->SurfaceDetail() );
+#endif
 }
 
 void OCCViewer_ViewFrame::splitSubViews()
old mode 100755 (executable)
new mode 100644 (file)
index 706d232..2aee704
@@ -21,6 +21,7 @@
 //
 
 #include "OCCViewer_ViewModel.h"
+#include "OCCViewer.h"
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewFrame.h"
 #include "OCCViewer_VService.h"
@@ -36,8 +37,6 @@
 
 #include "ViewerData_AISShape.hxx"
 
-#include "CAF_Tools.h"
-
 #include <Basics_OCCTVersion.hxx>
 
 #include "QtxActionToolMgr.h"
@@ -263,7 +262,9 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
     OCCViewer_ViewPort3d* vp3d = view->getViewPort();
     if ( vp3d )
     {
+#if OCC_VERSION_LARGE <= 0x07000000
       vp3d->getView()->SetSurfaceDetail(V3d_TEX_ALL);
+#endif
       // connect signal from viewport
       connect(vp3d, SIGNAL(vpClosed(OCCViewer_ViewPort3d*)), this, SLOT(onViewClosed(OCCViewer_ViewPort3d*)));
       connect(vp3d, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewMapped(OCCViewer_ViewPort3d*)));
@@ -1109,7 +1110,7 @@ void OCCViewer_Viewer::setDefaultLights()
   double aDz = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dz", -1.0 );
 
   Handle(V3d_DirectionalLight) aLight =
-    new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, CAF_Tools::color( aColor ).Name(), Standard_True );
+    new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, OCCViewer::color( aColor ).Name(), Standard_True );
   if( !( aDx == 0 && aDy == 0 && aDz == 0 ) )
     aLight->SetDirection( aDx, aDy, aDz );
   myV3dViewer->SetLightOn( aLight );
old mode 100755 (executable)
new mode 100644 (file)
index 704fe69..7a1ae07
@@ -2785,7 +2785,9 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
             aTexture = new Graphic3d_TextureEnv( TCollection_AsciiString( et_paramValue.toStdString().c_str() ) );
           Handle(V3d_View) aView = this->getViewPort()->getView();
           aView->SetTextureEnv( aTexture );
+#if OCC_VERSION_LARGE <= 0x07000000
           aView->SetSurfaceDetail( V3d_TEX_ENVIRONMENT );
+#endif
         }
       }
       else if ( paramName == "lightSource" )