PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 );
PrimitiveGroupLayout->addWidget( aMainTextureButton, 2, 2 );
- // Alpha Channel Texture
- QLabel* aAlphaChannelTextureLabel = new QLabel( tr( "ALPHA_CHANNEL_TEXTURE" ), PrimitiveGroup );
- myAlphaChannelTextureLineEdit = new QLineEdit( PrimitiveGroup );
- QPushButton* aAlphaChannelTextureButton = new QPushButton( PrimitiveGroup );
- aAlphaChannelTextureButton->setAutoDefault( false );
- aAlphaChannelTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
- connect( aAlphaChannelTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaChannelTexture() ) );
-
- PrimitiveGroupLayout->addWidget( aAlphaChannelTextureLabel, 3, 0 );
- PrimitiveGroupLayout->addWidget( myAlphaChannelTextureLineEdit, 3, 1 );
- PrimitiveGroupLayout->addWidget( aAlphaChannelTextureButton, 3, 2 );
-
- // Alpha Channel Threshold
- QLabel* aAlphaChannelThresholdLabel = new QLabel( tr( "ALPHA_CHANNEL_THRESHOLD" ), PrimitiveGroup );
- QtxDblSpinBox* aAlphaChannelThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup );
- aAlphaChannelThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- aAlphaChannelThresholdSpinBox->setValue( 0.1 );
-
- PrimitiveGroupLayout->addWidget( aAlphaChannelThresholdLabel, 4, 0 );
- PrimitiveGroupLayout->addMultiCellWidget( aAlphaChannelThresholdSpinBox, 4, 4, 1, 2 );
+ // Alpha Texture
+ QLabel* aAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup );
+ myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup );
+ QPushButton* aAlphaTextureButton = new QPushButton( PrimitiveGroup );
+ aAlphaTextureButton->setAutoDefault( false );
+ aAlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+ connect( aAlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) );
+
+ PrimitiveGroupLayout->addWidget( aAlphaTextureLabel, 3, 0 );
+ PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 );
+ PrimitiveGroupLayout->addWidget( aAlphaTextureButton, 3, 2 );
+
+ // Alpha Threshold
+ QLabel* aAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup );
+ myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup );
+ myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myAlphaThresholdSpinBox->setValue( 0.0 );
+
+ PrimitiveGroupLayout->addWidget( aAlphaThresholdLabel, 4, 0 );
+ PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 );
// Size
QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "SizeGroup" );
mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup );
mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- mySizeSpinBox->setValue( 10 );
+ //mySizeSpinBox->setValue( 10 );
SizeGroupLayout->addWidget( mySizeLabel, 0, 0 );
SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 );
myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup );
myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myMinSizeSpinBox->setValue( 10 );
+ //myMinSizeSpinBox->setValue( 10 );
SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 );
SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 );
myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup );
myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myMaxSizeSpinBox->setValue( 33 );
+ //myMaxSizeSpinBox->setValue( 33 );
SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 );
SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 );
QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup );
myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup );
myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myMagnificationSpinBox->setValue( 100 );
+ //myMagnificationSpinBox->setValue( 100 );
SizeGroupLayout->addWidget( aMagnificationLabel, 2, 0 );
SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 );
QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup );
myIncrementSpinBox = new QtxDblSpinBox( 5, 50, 5, SizeGroup );
myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myIncrementSpinBox->setValue( 10 );
+ //myIncrementSpinBox->setValue( 10 );
SizeGroupLayout->addWidget( aIncrementLabel, 2, 2 );
SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 );
ColorGroupLayout->setSpacing(6);
ColorGroupLayout->setMargin(11);
- QLabel* aColorLabel = new QLabel( tr( "COLOR" ), ColorGroup );
+ myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup );
myColorButton = new QPushButton( ColorGroup );
myColorButton->setPaletteBackgroundColor( Qt::blue );
myColorButton->setPaletteForegroundColor( Qt::blue );
- ColorGroupLayout->addWidget( aColorLabel, 0, 0 );
+ ColorGroupLayout->addWidget( myColorLabel, 0, 0 );
ColorGroupLayout->addWidget( myColorButton, 0, 1 );
connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
connect( myResultsButton, SIGNAL( toggled( bool ) ), myMaxSizeLabel, SLOT( setEnabled( bool ) ) );
connect( myResultsButton, SIGNAL( toggled( bool ) ), myMaxSizeSpinBox, SLOT( setEnabled( bool ) ) );
- bool isResults = myResultsButton->isChecked();
- ColorGroup->setEnabled( !isResults );
- mySizeLabel->setEnabled( !isResults );
- mySizeSpinBox->setEnabled( !isResults );
- myMinSizeLabel->setEnabled( isResults );
- myMinSizeSpinBox->setEnabled( isResults );
- myMaxSizeLabel->setEnabled( isResults );
- myMaxSizeSpinBox->setEnabled( isResults );
-
myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref);
myScalarPane->setMargin(5);
myResultsButton->setChecked( isResults );
myGeometryButton->setChecked( !isResults );
+ myColorLabel->setEnabled( !isResults );
+ myColorButton->setEnabled( !isResults );
+ mySizeLabel->setEnabled( !isResults );
+ mySizeSpinBox->setEnabled( !isResults );
+ myMinSizeLabel->setEnabled( isResults );
+ myMinSizeSpinBox->setEnabled( isResults );
+ myMaxSizeLabel->setEnabled( isResults );
+ myMaxSizeSpinBox->setEnabled( isResults );
+
myColorButton->setPaletteBackgroundColor( thePrs->GetColor() );
myClampSpinBox->setMaxValue( thePrs->GetGaussPointsPL()->GetMaximumSupportedSize() );
myIncrementSpinBox->setValue( thePrs->GetGaussPointsPL()->GetMagnificationIncrement() * 100.0 );
myMainTextureLineEdit->setText( thePrs->GetMainTexture().section( '/', -1 ) );
- myAlphaChannelTextureLineEdit->setText( thePrs->GetAlphaChannelTexture().section( '/', -1 ) );
+ myAlphaTextureLineEdit->setText( thePrs->GetAlphaTexture().section( '/', -1 ) );
+ myAlphaThresholdSpinBox->setValue( thePrs->GetGaussPointsPL()->GetAlphaThreshold() );
myScalarPane->initFromPrsObject(thePrs);
}
thePrs->GetGaussPointsPL()->SetMagnification( myMagnificationSpinBox->value() / 100.0 );
thePrs->GetGaussPointsPL()->SetMagnificationIncrement( myIncrementSpinBox->value() / 100.0 );
- myScalarPane->storeToPrsObject(thePrs);
+ myMainTexture = myMainTexture.isNull() ? thePrs->GetMainTexture() : myMainTexture;
+ myAlphaTexture = myAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : myAlphaTexture;
+ thePrs->SetTextures( myMainTexture, myAlphaTexture );
- // Texture
- if( myMainTexture.isNull() || myAlphaChannelTexture.isNull() )
- {
- myMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
- myAlphaChannelTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
- }
-
- QString mainTextureImage = myMainTexture;
- QString mainTextureFormat = mainTextureImage.section( '.', -1 );
- QString mainTextureVTI = mainTextureImage.section( '.', 0, -2 ) + ".vti";
-
- QString command1 = QString( "VISU_img2vti " ) + mainTextureFormat + " " + mainTextureImage + " " + mainTextureVTI;
- if(system(command1.latin1()) == 0){
- QString alphaTextureImage = myAlphaChannelTexture;
- QString alphaTextureFormat = alphaTextureImage.section( '.', -1 );
- QString alphaTextureVTI = alphaTextureImage.section( '.', 0, -2 ) + ".vti";
-
- QString command2 = QString( "VISU_img2vti " ) + alphaTextureFormat + " " + alphaTextureImage + " " + alphaTextureVTI;
- if(system(command2.latin1()) == 0){
- thePrs->SetMainTexture( mainTextureImage );
- thePrs->SetAlphaChannelTexture( alphaTextureImage );
- thePrs->MakeTexture( mainTextureVTI, alphaTextureVTI );
- return true;
- }
- }
+ thePrs->GetGaussPointsPL()->SetAlphaThreshold( myAlphaThresholdSpinBox->value() );
- return false;
+ return myScalarPane->storeToPrsObject(thePrs);
}
void VisuGUI_GaussPointsDlg::accept()
myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) );
}
-void VisuGUI_GaussPointsDlg::onBrowseAlphaChannelTexture()
+void VisuGUI_GaussPointsDlg::onBrowseAlphaTexture()
{
QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this );
if( aFileName.isNull() )
return;
- myAlphaChannelTexture = aFileName;
- myAlphaChannelTextureLineEdit->setText( aFileName.section( '/', -1 ) );
+ myAlphaTexture = aFileName;
+ myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) );
}
void VisuGUI_GaussPointsDlg::onColorButtonPressed()
{
- QColor aColor = myColorButton->paletteBackgroundColor();
- aColor = QColorDialog::getColor( aColor, this );
- myColorButton->setPaletteBackgroundColor( aColor );
+ QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this );
+ if( aColor.isValid() )
+ myColorButton->setPaletteBackgroundColor( aColor );
}