myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(myPipeLine);
ScalarMap_i::DoHook();
+
+ SetTextures( QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp",
+ QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp" );
}
UpdateActors();
}
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetTextures( const QString& theMainTexture,
+ const QString& theAlphaTexture )
+{
+ bool updateMainTexture = SetMainTexture( theMainTexture );
+ bool updateAlphaTexture = SetAlphaTexture( theAlphaTexture );
+ if( !updateMainTexture && !updateAlphaTexture )
+ return;
+
+ QString mainTextureFormat = theMainTexture.section( '.', -1 );
+ QString mainTextureVTI = theMainTexture.section( '.', 0, -2 ) + ".vti";
+ QString command1 = QString( "VISU_img2vti " ) + mainTextureFormat +
+ " " + theMainTexture + " " + mainTextureVTI;
+ //cout << command1.latin1() << endl;
+ bool convertMainTexture = system( command1.latin1() ) == 0;
+
+ QString alphaTextureFormat = theAlphaTexture.section( '.', -1 );
+ QString alphaTextureVTI = theAlphaTexture.section( '.', 0, -2 ) + ".vti";
+ QString command2 = QString( "VISU_img2vti " ) + alphaTextureFormat +
+ " " + theAlphaTexture + " " + alphaTextureVTI;
+ //cout << command2.latin1() << endl;
+ bool convertAlphaTexture = system( command2.latin1() ) == 0;
+
+ if( convertMainTexture && convertAlphaTexture )
+ MakeTexture( mainTextureVTI, alphaTextureVTI );
+}
+
+
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::MakeTexture( const QString& theMainTexture,
- const QString& theAlphaChannelTexture )
+ const QString& theAlphaTexture )
{
- if( theMainTexture.isNull() || theAlphaChannelTexture.isNull() )
+ if( theMainTexture.isNull() || theAlphaTexture.isNull() )
return;
vtkXMLImageDataReader* aMainReader = vtkXMLImageDataReader::New();
vtkXMLImageDataReader* anAlphaReader = vtkXMLImageDataReader::New();
aMainReader->SetFileName( theMainTexture );
- anAlphaReader->SetFileName( theAlphaChannelTexture );
+ anAlphaReader->SetFileName( theAlphaTexture );
aMainReader->Update();
anAlphaReader->Update();
void
ShowColored( bool theColored );
- void SetMainTexture( const QString& theMainTexture ) {
+ bool
+ SetMainTexture( const QString& theMainTexture ) {
+ bool update = myMainTexture != theMainTexture;
myMainTexture = theMainTexture;
+ return update;
}
QString GetMainTexture() { return myMainTexture; }
- void SetAlphaChannelTexture( const QString& theAlphaChannelTexture ) {
- myAlphaChannelTexture = theAlphaChannelTexture;
+ bool
+ SetAlphaTexture( const QString& theAlphaTexture ) {
+ bool update = myAlphaTexture != theAlphaTexture;
+ myAlphaTexture = theAlphaTexture;
+ return update;
}
- QString GetAlphaChannelTexture() { return myAlphaChannelTexture; }
+ QString
+ GetAlphaTexture() { return myAlphaTexture; }
- void MakeTexture( const QString& theMainTexture,
- const QString& theAlphaChannelTexture );
+ void
+ SetTextures( const QString& theMainTexture,
+ const QString& theAlphaTexture );
protected:
virtual
VISU_PipeLine*
GetPipeLine();
+ void
+ MakeTexture( const QString& theMainTexture,
+ const QString& theAlphaTexture );
+
VISU_GaussPointsPL *myGaussPointsPL;
bool myIsColored;
QColor myColor;
QString myMainTexture;
- QString myAlphaChannelTexture;
+ QString myAlphaTexture;
public:
static