From 2e6cd847150af3a8522e2544c8c6a177004370b4 Mon Sep 17 00:00:00 2001 From: apl Date: Fri, 14 Mar 2014 18:51:21 +0400 Subject: [PATCH] GEOM_Displayer - Loading textures with non-ansi paths. (OCCT 6.7.0 compatibility) --- src/GEOMGUI/GEOM_Displayer.cxx | 24 ++++++++++++++++++------ src/GEOMGUI/GEOM_Displayer.h | 4 +++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 11db53e92..16131193c 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -138,6 +138,7 @@ // Hard-coded value of shape deflection coefficient for VTK viewer const double VTK_MIN_DEFLECTION = 0.001; +#if OCC_VERSION_LARGE > 0x06070000 // Pixmap caching support namespace { @@ -258,6 +259,7 @@ namespace } } } +#endif //================================================================ // Function : getActiveStudy @@ -873,15 +875,23 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap aImagePath = propMap.value( GEOM::propertyName( GEOM::Texture ) ).toString(); } - Handle(Image_PixMap) aPixmap; - if ( !aImagePath.isEmpty() ) - aPixmap = cacheTextureFor( aImagePath, AISShape ); + if ( !aImagePath.isEmpty() ) { +#if OCC_VERSION_LARGE > 0x06070000 + Handle(Image_PixMap) aPixmap = cacheTextureFor( aImagePath, AISShape ); - // apply image to shape - if ( !aPixmap.IsNull() ) { - AISShape->SetTexturePixMap( aPixmap ); + // apply image to shape + if ( !aPixmap.IsNull() ) { + AISShape->SetTexturePixMap( aPixmap ); + AISShape->SetTextureMapOn(); + AISShape->DisableTextureModulate(); + } + else + AISShape->SetTextureMapOff(); +#else + AISShape->SetTextureFileName( TCollection_AsciiString( aImagePath.toUtf8().constData() ) ); AISShape->SetTextureMapOn(); AISShape->DisableTextureModulate(); +#endif } else AISShape->SetTextureMapOff(); @@ -1948,11 +1958,13 @@ void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p ) UpdateColorScale(false,false); } +#if OCC_VERSION_LARGE > 0x06070000 void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p ) { LightApp_Displayer::BeforeErase( v, p ); releaseTextures( p ); } +#endif void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p ) { diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index c610239de..257b4494e 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -45,7 +45,7 @@ class SALOME_OCCViewType; #include #include #include - +#include #include #include @@ -175,7 +175,9 @@ public: virtual void Update( SALOME_VTKPrs* ); virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ); virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ); +#if OCC_VERSION_LARGE > 0x06070000 virtual void BeforeErase ( SALOME_View*, const SALOME_OCCPrs* ); +#endif virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ); /* This methos is used for activisation/deactivisation of objects to be displayed*/ -- 2.39.2