const_types.h:

- added new macro to denote the desplacement of all TF's items (lines, handles and bg)

qualitymapperdialog.cpp:
- added calls to clearItems before the building a new TF to collect old data
- fixed bug about Tf lines storing (now working properly)
This commit is contained in:
Paolo Cignoni cignoni 2008-02-02 16:56:22 +00:00
parent 5dc88aecd4
commit d268a7e8b8
2 changed files with 12 additions and 3 deletions

View File

@ -20,9 +20,10 @@ typedef unsigned int UINT32;
#define MARKERS_RADIUS 2.0f
#define REMOVE_TF_HANDLE 0x00000001
#define REMOVE_EQ_HANDLE 0x00000010
#define REMOVE_TF_BG 0x00000100
#define REMOVE_TF_LINES 0x00001000
#define REMOVE_TF_BG 0x00000010
#define REMOVE_TF_LINES 0x00000100
#define REMOVE_TF_ALL (REMOVE_TF_HANDLE | REMOVE_TF_BG | REMOVE_TF_LINES)
#define REMOVE_EQ_HANDLE 0x00001000
#define REMOVE_HISTOGRAM 0x00010000
#define DELETE_REMOVED_ITEMS 0x00100000
#define DO_NOT_DELETE_REMOVED_ITEMS 0x11011111

View File

@ -183,6 +183,7 @@ GRAPHICS_ITEMS_LIST* QualityMapperDialog::clearItems(int toClear)
_transferFunctionScene.removeItem( item );
_removed_items << item;
}
_transferFunctionLines.clear();
}
if ((toClear & REMOVE_HISTOGRAM) == REMOVE_HISTOGRAM)
@ -600,11 +601,13 @@ void QualityMapperDialog::drawTransferFunction()
{
current_item = _transferFunctionScene.addLine(previousPoint.x(), previousPoint.y(), pointToRepresentLeft.x(), pointToRepresentLeft.y(), drawingPen);
current_item->setZValue( zValue );
_transferFunctionLines << current_item;
if ( pointToRepresentLeft.y() != pointRectRight.y() )
{
current_item = _transferFunctionScene.addLine( pointToRepresentLeft.x(), pointToRepresentLeft.y(), pointToRepresentRight.x(), pointToRepresentRight.y(), drawingPen );
current_item->setZValue( zValue);
_transferFunctionLines << current_item;
}
}
@ -680,6 +683,8 @@ void QualityMapperDialog::on_savePresetButton_clicked()
KNOWN_EXTERNAL_TFS newTF( tfPath, tfName );
_knownExternalTFs << newTF;
_isTransferFunctionInitialized = false;
this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS );
this->initTF();
ui.presetComboBox->setCurrentIndex( 0 );
}
@ -708,6 +713,7 @@ void QualityMapperDialog::on_loadPresetButton_clicked()
_knownExternalTFs << newTF;
_isTransferFunctionInitialized = false;
this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS );
this->initTF();
ui.presetComboBox->setCurrentIndex( 0 );
this->drawTransferFunction();
@ -726,6 +732,7 @@ void QualityMapperDialog::on_presetComboBox_textChanged(const QString &newValue)
delete _transferFunction;
_transferFunction = new TransferFunction( (DEFAULT_TRANSFER_FUNCTIONS)i );
this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS );
this->drawTransferFunction();
return ;
}
@ -743,6 +750,7 @@ void QualityMapperDialog::on_presetComboBox_textChanged(const QString &newValue)
delete _transferFunction;
_transferFunction = new TransferFunction( (DEFAULT_TRANSFER_FUNCTIONS)i );
this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS );
this->drawTransferFunction();
return ;
}