From: ouv Date: Tue, 20 Sep 2005 15:06:45 +0000 (+0000) Subject: Gauss Points Geometry presentation X-Git-Tag: BR-D5-38-2003_D2005-12-10~175 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bab102d4886894b63c756e18e39b43304b77e19c;p=modules%2Fvisu.git Gauss Points Geometry presentation --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 19fd0260..c666087f 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -43,6 +43,7 @@ vtkStandardNewMacro(VISU_GaussPointsPL); //---------------------------------------------------------------------------- VISU_GaussPointsPL ::VISU_GaussPointsPL(): + myRelativeSize(0.1), myRelativeMinSize(0.03), myRelativeMaxSize(0.30), myMagnificationIncrement(0.1) @@ -204,7 +205,7 @@ void VISU_GaussPointsPL ::SetClamp(float theClamp) { - cout << "VISU_GaussPointsPL::SetClamp " << theClamp << endl;; + //cout << "VISU_GaussPointsPL::SetClamp " << theClamp << endl;; myPSMapper->SetPointSpriteClamp( theClamp ); Modified(); @@ -226,6 +227,18 @@ VISU_GaussPointsPL return myPSMapper->GetMaximumSupportedSize(); } +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::SetRelativeSize(float theRelativeSize) +{ + myRelativeSize = theRelativeSize; + + myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * myRelativeSize ); + + Modified(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL @@ -238,6 +251,7 @@ VISU_GaussPointsPL cout << myRelativeMinSize << " * 1000.0 = "; cout << 1000.0 * myAverageCellSize * myRelativeMinSize << endl; */ + myPSMapper->SetPointSpriteSize( 0.0 ); myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myRelativeMinSize ); Modified(); @@ -255,6 +269,7 @@ VISU_GaussPointsPL cout << myRelativeMaxSize << " * 1000.0 = "; cout << 1000.0 * myAverageCellSize * myRelativeMaxSize << endl; */ + myPSMapper->SetPointSpriteSize( 0.0 ); myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myRelativeMaxSize ); Modified(); diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 5d3e8b93..da44167a 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -95,6 +95,15 @@ public: float GetMaximumSupportedSize(); + void + SetRelativeSize(float theRelativeSize); + + float + GetRelativeSize() + { + return myRelativeSize; + } + void SetRelativeMinSize(float theRelativeMinSize); @@ -146,6 +155,7 @@ protected: float mySourceScalarRange[2]; float myDeltaScalarRange; float myAverageCellSize; + float myRelativeSize; float myRelativeMinSize; float myRelativeMaxSize; float myMagnificationIncrement; diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 327ff5f9..a75c5465 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -126,6 +126,7 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper() #endif this->PointSpriteClamp = 100.0; + this->PointSpriteSize = 0.0; this->PointSpriteMinSize = 15.0; this->PointSpriteMaxSize = 50.0; this->PointSpriteMagnification = 1.0; @@ -215,7 +216,7 @@ GLhandleARB VISU_OpenGLPointSpriteMapper::InitShader() std::string fileName = std::string( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/Vertex_Program_ARB.txt"; - //std::string fileName = std::string( "/dn06/salome/ouv/SALOME3/VISU_SRC/resources/Vertex_Program_ARB.txt"); + //std::string fileName = std::string( "/dn06/salome/ouv/SALOME/VISU_SRC/resources/Vertex_Program_ARB.txt"); char* shader = readFromFile( fileName ); PFNGLSHADERSOURCEARBPROC glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)dlsym( this->OpenGLLibrary, "glShaderSourceARB" ); @@ -288,6 +289,14 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp ) #endif } //----------------------------------------------------------------------------- +void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize ) +{ + this->PointSpriteSize = theSize; +#ifdef GL_ARB_shader_objects + this->SetShaderVariable( "geomSize", theSize ); +#endif +} +//----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize ) { this->PointSpriteMinSize = theMinSize; @@ -366,7 +375,9 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions() this->SetShaderVariable( "attrib2", 1.0 ); this->SetShaderVariable( "attrib3", 1.0 ); this->SetShaderVariable( "clamp", this->PointSpriteClamp ); + this->SetShaderVariable( "geomSize", this->PointSpriteSize ); this->SetShaderVariable( "minSize", this->PointSpriteMinSize ); + this->SetShaderVariable( "attrib4", 1.0 ); this->SetShaderVariable( "maxSize", this->PointSpriteMaxSize ); this->SetShaderVariable( "magnification", this->PointSpriteMagnification ); #endif @@ -747,7 +758,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, vtkCellArray *cells, vtkRenderer *ren) { - this->XMLImageDataReader->SetFileName( "/dn06/salome/ouv/SALOME3/TextureAlphaChannel.vti" ); + this->XMLImageDataReader->SetFileName( "/dn06/salome/ouv/SALOME/TextureAlphaChannel.vti" ); vtkImageData* imageData = this->XMLImageDataReader->GetOutput(); this->InitTexture( imageData ); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index 52f7b73e..bdbea7cc 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -141,11 +141,13 @@ public: // Description: // Point Sprite size parameters vtkGetMacro(PointSpriteClamp, float); + vtkGetMacro(PointSpriteSize, float); vtkGetMacro(PointSpriteMinSize, float); vtkGetMacro(PointSpriteMaxSize, float); vtkGetMacro(PointSpriteMagnification, float); void SetPointSpriteClamp( float ); + void SetPointSpriteSize( float ); void SetPointSpriteMinSize( float ); void SetPointSpriteMaxSize( float ); void SetPointSpriteMagnification( float ); @@ -190,6 +192,7 @@ protected: #endif float PointSpriteClamp; + float PointSpriteSize; float PointSpriteMinSize; float PointSpriteMaxSize; float PointSpriteMagnification; diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 2b7f6e9c..ec671c94 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -135,12 +135,18 @@ msgstr "Gauss Points" msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB" msgstr "Scalar Bar" +msgid "VisuGUI_GaussPointsDlg::PRS_TITLE" +msgstr "Presentation" + +msgid "VisuGUI_GaussPointsDlg::RESULTS" +msgstr "Results" + +msgid "VisuGUI_GaussPointsDlg::GEOMETRY" +msgstr "Geometry" + msgid "VisuGUI_GaussPointsDlg::PRIMITIVE_TITLE" msgstr "Primitive" -msgid "VisuGUI_GaussPointsDlg::SIZE_TITLE" -msgstr "Size" - msgid "VisuGUI_GaussPointsDlg::POINT_SPRITE" msgstr "Point Sprite" @@ -162,6 +168,12 @@ msgstr "Main Texture (16x16) : " msgid "VisuGUI_GaussPointsDlg::ALPHA_CHANNEL_TEXTURE" msgstr "Alpha Channel Texture (16x16) : " +msgid "VisuGUI_GaussPointsDlg::SIZE_TITLE" +msgstr "Size" + +msgid "VisuGUI_GaussPointsDlg::SIZE" +msgstr "Size of points (%) : " + msgid "VisuGUI_GaussPointsDlg::MIN_SIZE" msgstr "Range values for min size (%) : " @@ -174,6 +186,12 @@ msgstr "Magnification (%) : " msgid "VisuGUI_GaussPointsDlg::INCREMENT" msgstr "Increment : " +msgid "VisuGUI_GaussPointsDlg::COLOR_TITLE" +msgstr "Color" + +msgid "VisuGUI_GaussPointsDlg::COLOR" +msgstr "Color : " + msgid "VisuGUI_GaussScalarBarPane::ACTIVE_BAR_GRP" msgstr "Active bar" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 26a5128c..65945aa6 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -35,7 +35,6 @@ #include "VISU_GaussPoints_i.hh" #include "VISU_GaussPointsPL.hxx" -//#include "VISU_ScalarMap_i.hh" #include "VISU_ScalarMapPL.hxx" #include "VISU_Convertor.hxx" @@ -708,6 +707,15 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool TopLayout->setMargin(11); + // Presentation + QButtonGroup* PrsGroup = new QButtonGroup( 2, Qt::Horizontal, tr( "PRS_TITLE" ), this, "PrimitiveTypeGroup" ); + PrsGroup->setRadioButtonExclusive( true ); + PrsGroup->layout()->setMargin( 11 ); + PrsGroup->layout()->setSpacing(6); + + myResultsButton = new QRadioButton( tr( "RESULTS" ), PrsGroup ); + myGeometryButton = new QRadioButton( tr( "GEOMETRY" ), PrsGroup ); + QTabWidget* aTabBox = new QTabWidget (this); // Gauss points pane @@ -716,18 +724,18 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool aBox->setSpacing(6); // Primitive - QGroupBox* TopGroup = new QGroupBox ( tr( "PRIMITIVE_TITLE" ), aBox, "TopGroup" ); - TopGroup->setColumnLayout(0, Qt::Vertical ); - TopGroup->layout()->setSpacing( 0 ); - TopGroup->layout()->setMargin( 0 ); + QGroupBox* PrimitiveGroup = new QGroupBox ( tr( "PRIMITIVE_TITLE" ), aBox, "PrimitiveGroup" ); + PrimitiveGroup->setColumnLayout(0, Qt::Vertical ); + PrimitiveGroup->layout()->setSpacing( 0 ); + PrimitiveGroup->layout()->setMargin( 0 ); - QGridLayout* TopGroupLayout = new QGridLayout (TopGroup->layout()); - TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - TopGroupLayout->setSpacing(6); - TopGroupLayout->setMargin(11); + QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout()); + PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + PrimitiveGroupLayout->setSpacing(6); + PrimitiveGroupLayout->setMargin(11); // Primitive Type - QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, TopGroup, "PrimitiveTypeGroup" ); + QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" ); aPrimitiveTypeGroup->setRadioButtonExclusive( true ); aPrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); aPrimitiveTypeGroup->layout()->setMargin( 0 ); @@ -741,98 +749,144 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QRadioButton* aGeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), aPrimitiveTypeGroup ); aGeometricalSphereButton->setEnabled( false ); - TopGroupLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); + PrimitiveGroupLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); // Clamp - QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), TopGroup ); - myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, TopGroup ); + QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); + myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myClampSpinBox->setValue( 200.0 ); - TopGroupLayout->addWidget( aClampLabel, 1, 0 ); - TopGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); + PrimitiveGroupLayout->addWidget( aClampLabel, 1, 0 ); + PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); // Main Texture - QLabel* aMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), TopGroup ); - myMainTextureLineEdit = new QLineEdit( TopGroup ); - QPushButton* aMainTextureButton = new QPushButton( TopGroup ); + QLabel* aMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup ); + myMainTextureLineEdit = new QLineEdit( PrimitiveGroup ); + QPushButton* aMainTextureButton = new QPushButton( PrimitiveGroup ); aMainTextureButton->setAutoDefault( false ); aMainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); connect( aMainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); - TopGroupLayout->addWidget( aMainTextureLabel, 2, 0 ); - TopGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); - TopGroupLayout->addWidget( aMainTextureButton, 2, 2 ); + PrimitiveGroupLayout->addWidget( aMainTextureLabel, 2, 0 ); + PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); + PrimitiveGroupLayout->addWidget( aMainTextureButton, 2, 2 ); // Alpha Channel Texture - QLabel* aAlphaChannelTextureLabel = new QLabel( tr( "ALPHA_CHANNEL_TEXTURE" ), TopGroup ); - myAlphaChannelTextureLineEdit = new QLineEdit( TopGroup ); - QPushButton* aAlphaChannelTextureButton = new QPushButton( TopGroup ); + 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() ) ); - TopGroupLayout->addWidget( aAlphaChannelTextureLabel, 3, 0 ); - TopGroupLayout->addWidget( myAlphaChannelTextureLineEdit, 3, 1 ); - TopGroupLayout->addWidget( aAlphaChannelTextureButton, 3, 2 ); + 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" ), TopGroup ); - QtxDblSpinBox* aAlphaChannelThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, TopGroup ); + 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 ); - TopGroupLayout->addWidget( aAlphaChannelThresholdLabel, 4, 0 ); - TopGroupLayout->addMultiCellWidget( aAlphaChannelThresholdSpinBox, 4, 4, 1, 2 ); - + PrimitiveGroupLayout->addWidget( aAlphaChannelThresholdLabel, 4, 0 ); + PrimitiveGroupLayout->addMultiCellWidget( aAlphaChannelThresholdSpinBox, 4, 4, 1, 2 ); // Size - QGroupBox* BottomGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "BottomGroup" ); - BottomGroup->setColumnLayout(0, Qt::Vertical ); - BottomGroup->layout()->setSpacing( 0 ); - BottomGroup->layout()->setMargin( 0 ); + QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "SizeGroup" ); + SizeGroup->setColumnLayout(0, Qt::Vertical ); + SizeGroup->layout()->setSpacing( 0 ); + SizeGroup->layout()->setMargin( 0 ); + + QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout()); + SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + SizeGroupLayout->setSpacing(6); + SizeGroupLayout->setMargin(11); + + // Geometry Size + mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup ); + mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + mySizeSpinBox->setValue( 10 ); - QGridLayout* BottomGroupLayout = new QGridLayout (BottomGroup->layout()); - BottomGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - BottomGroupLayout->setSpacing(6); - BottomGroupLayout->setMargin(11); + SizeGroupLayout->addWidget( mySizeLabel, 0, 0 ); + SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 ); // Min Size - QLabel* aMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), BottomGroup ); - myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, BottomGroup ); + myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); + myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myMinSizeSpinBox->setValue( 10 ); - BottomGroupLayout->addWidget( aMinSizeLabel, 0, 0 ); - BottomGroupLayout->addWidget( myMinSizeSpinBox, 0, 1 ); + SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); + SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 ); // Max Size - QLabel* aMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), BottomGroup ); - myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, BottomGroup ); + myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); + myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myMaxSizeSpinBox->setValue( 33 ); - BottomGroupLayout->addWidget( aMaxSizeLabel, 0, 2 ); - BottomGroupLayout->addWidget( myMaxSizeSpinBox, 0, 3 ); + SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); + SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 ); // Magnification - QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), BottomGroup ); - myMagnificationSpinBox = new QtxDblSpinBox( 50, 200, 10, BottomGroup ); + QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); + myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup ); myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myMagnificationSpinBox->setValue( 100 ); - BottomGroupLayout->addWidget( aMagnificationLabel, 1, 0 ); - BottomGroupLayout->addWidget( myMagnificationSpinBox, 1, 1 ); + SizeGroupLayout->addWidget( aMagnificationLabel, 2, 0 ); + SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 ); // Increment - QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), BottomGroup ); - myIncrementSpinBox = new QtxDblSpinBox( 5, 50, 5, BottomGroup ); + QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup ); + myIncrementSpinBox = new QtxDblSpinBox( 5, 50, 5, SizeGroup ); myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myIncrementSpinBox->setValue( 10 ); - BottomGroupLayout->addWidget( aIncrementLabel, 1, 2 ); - BottomGroupLayout->addWidget( myIncrementSpinBox, 1, 3 ); + SizeGroupLayout->addWidget( aIncrementLabel, 2, 2 ); + SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 ); + + + // Color + QGroupBox* ColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), aBox, "ColorGroup" ); + ColorGroup->setColumnLayout(0, Qt::Vertical ); + ColorGroup->layout()->setSpacing( 0 ); + ColorGroup->layout()->setMargin( 0 ); + + QGridLayout* ColorGroupLayout = new QGridLayout (ColorGroup->layout()); + ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); + ColorGroupLayout->setSpacing(6); + ColorGroupLayout->setMargin(11); + + QLabel* aColorLabel = new QLabel( tr( "COLOR" ), ColorGroup ); + myColorButton = new QPushButton( ColorGroup ); + myColorButton->setPaletteBackgroundColor( Qt::blue ); + myColorButton->setPaletteForegroundColor( Qt::blue ); + + ColorGroupLayout->addWidget( aColorLabel, 0, 0 ); + ColorGroupLayout->addWidget( myColorButton, 0, 1 ); + connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); + + connect( myGeometryButton, SIGNAL( toggled( bool ) ), ColorGroup, SLOT( setEnabled( bool ) ) ); + connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeLabel, SLOT( setEnabled( bool ) ) ); + connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeSpinBox, SLOT( setEnabled( bool ) ) ); + connect( myResultsButton, SIGNAL( toggled( bool ) ), myMinSizeLabel, SLOT( setEnabled( bool ) ) ); + connect( myResultsButton, SIGNAL( toggled( bool ) ), myMinSizeSpinBox, SLOT( setEnabled( bool ) ) ); + 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); @@ -861,7 +915,8 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); - TopLayout->addWidget(aTabBox); + TopLayout->addWidget( PrsGroup ); + TopLayout->addWidget( aTabBox ); TopLayout->addWidget( GroupButtons ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); @@ -870,9 +925,16 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) { + bool isResults = thePrs->IsColored(); + myResultsButton->setChecked( isResults ); + myGeometryButton->setChecked( !isResults ); + + myColorButton->setPaletteBackgroundColor( thePrs->GetColor() ); + myClampSpinBox->setMaxValue( thePrs->GetGaussPointsPL()->GetMaximumSupportedSize() ); myClampSpinBox->setValue( thePrs->GetGaussPointsPL()->GetClamp() ); + mySizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeSize() * 100.0 ); myMinSizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeMinSize() * 100.0 ); myMaxSizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeMaxSize() * 100.0 ); @@ -886,8 +948,18 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs ) { thePrs->GetGaussPointsPL()->SetClamp( myClampSpinBox->value() ); - thePrs->GetGaussPointsPL()->SetRelativeMinSize( myMinSizeSpinBox->value() / 100.0 ); - thePrs->GetGaussPointsPL()->SetRelativeMaxSize( myMaxSizeSpinBox->value() / 100.0 ); + bool isResults = myResultsButton->isChecked(); + if( isResults ) + { + thePrs->GetGaussPointsPL()->SetRelativeMinSize( myMinSizeSpinBox->value() / 100.0 ); + thePrs->GetGaussPointsPL()->SetRelativeMaxSize( myMaxSizeSpinBox->value() / 100.0 ); + } + else + { + thePrs->GetGaussPointsPL()->SetRelativeSize( mySizeSpinBox->value() / 100.0 ); + thePrs->SetColor( myColorButton->paletteBackgroundColor() ); + } + thePrs->ShowColored( isResults ); thePrs->GetGaussPointsPL()->SetMagnification( myMagnificationSpinBox->value() / 100.0 ); thePrs->GetGaussPointsPL()->SetMagnificationIncrement( myIncrementSpinBox->value() / 100.0 ); @@ -916,3 +988,10 @@ void VisuGUI_GaussPointsDlg::onBrowseAlphaChannelTexture() if( !aFileName.isNull() ) myAlphaChannelTextureLineEdit->setText( aFileName ); } + +void VisuGUI_GaussPointsDlg::onColorButtonPressed() +{ + QColor aColor = myColorButton->paletteBackgroundColor(); + aColor = QColorDialog::getColor( aColor, this ); + myColorButton->setPaletteBackgroundColor( aColor ); +} diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 9a9d7c4b..fdcda88c 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -132,6 +132,7 @@ protected slots: void onBrowseMainTexture(); void onBrowseAlphaChannelTexture(); + void onColorButtonPressed(); private: VisuGUI_GaussScalarBarPane* myScalarPane; @@ -141,11 +142,20 @@ private: QLineEdit* myMainTextureLineEdit; QLineEdit* myAlphaChannelTextureLineEdit; + QRadioButton* myResultsButton; + QRadioButton* myGeometryButton; + + QLabel* mySizeLabel; + QtxDblSpinBox* mySizeSpinBox; + QLabel* myMinSizeLabel; QtxDblSpinBox* myMinSizeSpinBox; + QLabel* myMaxSizeLabel; QtxDblSpinBox* myMaxSizeSpinBox; QtxDblSpinBox* myMagnificationSpinBox; QtxDblSpinBox* myIncrementSpinBox; + + QPushButton* myColorButton; }; #endif // VISUGUI_GAUSSPOINTSDLS_H diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 0c903097..7fa87b1d 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -89,7 +89,9 @@ GaussPoints_i(Result_i* theResult, PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), - myGaussPointsPL(NULL) + myGaussPointsPL(NULL), + myIsColored(true), + myColor(Qt::blue) { if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i"); } @@ -217,7 +219,20 @@ void VISU::GaussPoints_i ::UpdateActor(VISU_Actor* theActor) { - VISU::ScalarMap_i::UpdateActor(theActor); + if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ + if(IsColored()){ + anActor->SetBarVisibility(true); + myPipeLine->GetMapper()->SetScalarVisibility(1); + }else{ + anActor->SetBarVisibility(false); + myPipeLine->GetMapper()->SetScalarVisibility(0); + + anActor->GetProperty()->SetColor(myColor.red() / 255.0, + myColor.green() / 255.0, + myColor.blue() / 255.0); + } + VISU::ScalarMap_i::UpdateActor(theActor); + } } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 81737c2a..67d4427c 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -55,6 +55,12 @@ namespace VISU VISU_GaussPointsPL* GetGaussPointsPL(){ return myGaussPointsPL; } + QColor GetColor() { return myColor;} + void SetColor( const QColor& theColor ) { myColor = theColor; } + + bool IsColored() { return myIsColored; } + void ShowColored( bool theColored ) { myIsColored = theColored; } + protected: virtual void DoSetInput(Result_i* theResult); virtual void DoHook(); @@ -64,6 +70,8 @@ namespace VISU GetPipeLine(); VISU_GaussPointsPL *myGaussPointsPL; + QColor myColor; + bool myIsColored; public: static