From: ouv Date: Tue, 15 Mar 2011 13:50:54 +0000 (+0000) Subject: Note 0009977 of the issue 0013178: EDF243 VISU : post_processing for fields at nodes X-Git-Tag: V6_3_0a1~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de26427bf9ab67b1551d592ebda964d19dfaedc0;p=modules%2Fgui.git Note 0009977 of the issue 0013178: EDF243 VISU : post_processing for fields at nodes --- diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.cxx b/src/VTKViewer/VTKViewer_MarkerDlg.cxx index 5484bad62..22c0549c9 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.cxx +++ b/src/VTKViewer/VTKViewer_MarkerDlg.cxx @@ -135,3 +135,8 @@ int VTKViewer_MarkerDlg::getCustomMarkerID() const { return myMarkerWidget->getCustomMarkerID(); } + +void VTKViewer_MarkerDlg::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap ) +{ + myMarkerWidget->addExtraStdMarker( theMarkerType, thePixmap ); +} diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.h b/src/VTKViewer/VTKViewer_MarkerDlg.h index 7e40c6131..beb67b116 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.h +++ b/src/VTKViewer/VTKViewer_MarkerDlg.h @@ -51,6 +51,8 @@ public: VTK::MarkerScale getStandardMarkerScale() const; int getCustomMarkerID() const; + void addExtraStdMarker( VTK::MarkerType, const QPixmap& ); + protected: void keyPressEvent( QKeyEvent* ); diff --git a/src/VTKViewer/VTKViewer_MarkerWidget.cxx b/src/VTKViewer/VTKViewer_MarkerWidget.cxx index 81a0754ae..4e59c0fdd 100644 --- a/src/VTKViewer/VTKViewer_MarkerWidget.cxx +++ b/src/VTKViewer/VTKViewer_MarkerWidget.cxx @@ -119,7 +119,8 @@ VTKViewer_MarkerWidget::VTKViewer_MarkerWidget( QWidget* theParent ) // --- connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), myWGStack, SLOT( setCurrentIndex( int ) ) ); - connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( browse() ) ); + connect( myStdTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onStdMarkerChanged( int ) ) ); + connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); // --- @@ -159,12 +160,13 @@ VTK::MarkerMap VTKViewer_MarkerWidget::getCustomMarkerMap() void VTKViewer_MarkerWidget::setStandardMarker( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale ) { - if ( theMarkerType > VTK::MT_NONE && theMarkerType < VTK::MT_USER ) { + if ( theMarkerType > VTK::MT_NONE && theMarkerType < VTK::MT_USER || + myExtraMarkerList.contains( theMarkerType ) ) { myTypeGroup->button( 0 )->setChecked( true ); myWGStack->setCurrentIndex( 0 ); - myStdTypeCombo->setCurrentIndex( (int)theMarkerType-1 ); + myStdTypeCombo->setCurrentId( theMarkerType ); int aMarkerScale = std::max( (int)VTK::MS_10, std::min( (int)VTK::MS_70, (int)theMarkerScale ) ); - myStdScaleCombo->setCurrentIndex( aMarkerScale-1 ); + myStdScaleCombo->setCurrentId( aMarkerScale ); } } @@ -193,6 +195,16 @@ int VTKViewer_MarkerWidget::getCustomMarkerID() const return myWGStack->currentIndex() == 1 ? myCustomTypeCombo->currentId() : 0; } +void VTKViewer_MarkerWidget::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap ) +{ + if( myExtraMarkerList.isEmpty() ) + myStdTypeCombo->insertSeparator( myStdTypeCombo->count() ); + myStdTypeCombo->addItem( thePixmap, QString() ); + myStdTypeCombo->setId( myStdTypeCombo->count()-1, theMarkerType ); + + myExtraMarkerList.append( theMarkerType ); +} + void VTKViewer_MarkerWidget::init() { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); @@ -236,7 +248,14 @@ QPixmap VTKViewer_MarkerWidget::markerFromData( const VTK::MarkerData& theMarker return QPixmap::fromImage( anImage ); } -void VTKViewer_MarkerWidget::browse() +void VTKViewer_MarkerWidget::onStdMarkerChanged( int index ) +{ + VTK::MarkerType aMarkerType = (VTK::MarkerType)myStdTypeCombo->id( index ); + bool anIsExtraMarker = myExtraMarkerList.contains( aMarkerType ); + myStdScaleCombo->setEnabled( !anIsExtraMarker ); +} + +void VTKViewer_MarkerWidget::onBrowse() { QStringList filters; filters << tr( "Texture files (*.dat)" ) << tr( "All files (*)" ); diff --git a/src/VTKViewer/VTKViewer_MarkerWidget.h b/src/VTKViewer/VTKViewer_MarkerWidget.h index bfa0186ac..b11710446 100644 --- a/src/VTKViewer/VTKViewer_MarkerWidget.h +++ b/src/VTKViewer/VTKViewer_MarkerWidget.h @@ -51,13 +51,16 @@ public: VTK::MarkerScale getStandardMarkerScale() const; int getCustomMarkerID() const; + void addExtraStdMarker( VTK::MarkerType, const QPixmap& ); + private: void init(); void addTexture( int, bool = false ); QPixmap markerFromData( const VTK::MarkerData& ); private slots: - void browse(); + void onStdMarkerChanged( int ); + void onBrowse(); private: QButtonGroup* myTypeGroup; @@ -67,6 +70,8 @@ private: QtxComboBox* myCustomTypeCombo; VTK::MarkerMap myCustomMarkerMap; + + QList myExtraMarkerList; }; #endif