# 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)
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)
${PROJECT_SOURCE_DIR}/src/ViewerData
${PROJECT_SOURCE_DIR}/src/ViewerTools
${PROJECT_SOURCE_DIR}/src/OpenGLUtils
- ${PROJECT_SOURCE_DIR}/src/CAF
)
# additional preprocessor / compiler flags
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 ---
# sources / static
SET(_other_SOURCES
+ OCCViewer.cxx
OCCViewer_AISSelector.cxx
OCCViewer_AxialScaleDlg.cxx
OCCViewer_ClippingDlg.cxx
--- /dev/null
+// 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 ) );
+}
#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
onTextureChanged();
else {
Handle(Graphic3d_TextureEnv) aTexture;
+#if OCC_VERSION_LARGE > 0x07000000
+ setEnvTexture( aTexture );
+#else
setEnvTexture( aTexture, V3d_TEX_ALL );
+#endif
}
}
<< 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
}
/*!
/*!
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();
}
}
#include "OCCViewer.h"
#include <QDialog>
#include <V3d_View.hxx>
+#include <Basics_OCCTVersion.hxx>
class OCCViewer_ViewWindow;
class OCCViewer_ViewFrame;
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;
// 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>
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 );
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 );
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 );
}
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();
#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
}
// set environment texture parameters
aView->SetTextureEnv( aMainView->TextureEnv() );
+#if OCC_VERSION_LARGE <= 0x07000000
aView->SetSurfaceDetail( aMainView->SurfaceDetail() );
+#endif
}
void OCCViewer_ViewFrame::splitSubViews()
//
#include "OCCViewer_ViewModel.h"
+#include "OCCViewer.h"
#include "OCCViewer_ViewWindow.h"
#include "OCCViewer_ViewFrame.h"
#include "OCCViewer_VService.h"
#include "ViewerData_AISShape.hxx"
-#include "CAF_Tools.h"
-
#include <Basics_OCCTVersion.hxx>
#include "QtxActionToolMgr.h"
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*)));
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 );
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" )