From 0ea7a257af8a1ccbf461da593d666606a12e37a4 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Mon, 3 Mar 2008 19:08:25 +0000 Subject: [PATCH] - fixed bug in xQualityLabel precision - fixed TfHandle bug: now the color band is updated when a new TfHandle is built by double-click - updated TfHandle behavior: when the user clicks on an handle the corresponding channel is moved forward - updated midHandle position in filter - other minor changes --- src/fgt/edit_quality/common/meshmethods.cpp | 1 - .../edit_quality/filter_quality/filterqualitymapper.cpp | 8 ++++++-- src/fgt/edit_quality/qualitymapperdialog.cpp | 9 +++++++++ src/fgt/edit_quality/tfhandle.cpp | 3 +++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/fgt/edit_quality/common/meshmethods.cpp b/src/fgt/edit_quality/common/meshmethods.cpp index 8616c429e..48c1fb22e 100644 --- a/src/fgt/edit_quality/common/meshmethods.cpp +++ b/src/fgt/edit_quality/common/meshmethods.cpp @@ -71,7 +71,6 @@ int loadEqualizerInfo(QString fileName, EQUALIZER_INFO *data) data->midQualityPercentage = splittedString[1].toFloat(); data->maxQualityVal = splittedString[2].toFloat(); data->brightness = splittedString[3].toFloat(); - break; } } while(!line.isNull()); diff --git a/src/fgt/edit_quality/filter_quality/filterqualitymapper.cpp b/src/fgt/edit_quality/filter_quality/filterqualitymapper.cpp index 72763c7bf..57dc5de12 100644 --- a/src/fgt/edit_quality/filter_quality/filterqualitymapper.cpp +++ b/src/fgt/edit_quality/filter_quality/filterqualitymapper.cpp @@ -114,7 +114,7 @@ bool QualityMapperFilter::applyFilter(QAction *filter, MeshModel &m, FilterParam eqData.minQualityVal = par.getFloat("minQualityVal"); eqData.midQualityPercentage = par.getFloat("midHandlePos"); eqData.maxQualityVal = par.getFloat("maxQualityVal"); - eqData.brightness = 1.0f; + eqData.brightness = par.getFloat("brightness"); if ( csvFileName != "" ) { @@ -128,8 +128,12 @@ bool QualityMapperFilter::applyFilter(QAction *filter, MeshModel &m, FilterParam //building new TF object from external file TransferFunction transferFunction( par.getString("csvFileName") ); + + //converting mid handle pos value to perc pos + float midHandlePerc = (eqData.maxQualityVal - eqData.minQualityVal) / (par.getFloat("midHandlePos") - eqData.minQualityVal); + // Applying colors - applyColorByVertexQuality(m, &transferFunction, par.getFloat("minQualityVal"), par.getFloat("maxQualityVal"), par.getFloat("midHandlePos"), par.getFloat("brightness")); + applyColorByVertexQuality(m, &transferFunction, par.getFloat("minQualityVal"), par.getFloat("maxQualityVal"), eqData.midQualityPercentage, par.getFloat("brightness")); } else { diff --git a/src/fgt/edit_quality/qualitymapperdialog.cpp b/src/fgt/edit_quality/qualitymapperdialog.cpp index 74b449cd2..cbf8bb831 100644 --- a/src/fgt/edit_quality/qualitymapperdialog.cpp +++ b/src/fgt/edit_quality/qualitymapperdialog.cpp @@ -75,6 +75,7 @@ QualityMapperDialog::QualityMapperDialog(QWidget *parent, MeshModel& m, GLArea * //building a catcher for double click in empty areas of transfer function view //and adding it to the scene _tfCatcher = new TFDoubleClickCatcher(_transferFunction_info); + _tfCatcher->setZValue(0); _transferFunctionScene.addItem(_tfCatcher); connect(_tfCatcher, SIGNAL(TFdoubleClicked(QPointF)), this, SLOT(on_TF_view_doubleClicked(QPointF))); @@ -1043,6 +1044,9 @@ void QualityMapperDialog::on_TfHandle_clicked(TFHandle *sender) ui.xSpinBox->setValue(_currentTfHandle->getRelativeX()); ui.ySpinBox->setValue(_currentTfHandle->getRelativeY()); + //moving handle channel in foreground + this->moveAheadChannel((TF_CHANNELS)sender->getChannel()); + this->updateXQualityLabel(_currentTfHandle->getRelativeX()); //applying preview if necessary if (ui.previewButton->isChecked()) //added by FB 07\02\08 @@ -1257,7 +1261,12 @@ void QualityMapperDialog::on_TF_view_doubleClicked(QPointF pos) _transferFunction->getChannel(channelCode).addKey(val); TFHandle *newHandle = this->addTfHandle(channelCode, pos, val, ((channelCode + 1)*2.0f) + 1 ); + if (_currentTfHandle) + _currentTfHandle->setCurrentlSelected( false ); + + //updating currentTfHandle to sender _currentTfHandle = newHandle; + _currentTfHandle->setCurrentlSelected( true ); //updating correct order among TF Handle objects this->updateTfHandlesOrder(newHandle->getChannel()); diff --git a/src/fgt/edit_quality/tfhandle.cpp b/src/fgt/edit_quality/tfhandle.cpp index 9712633aa..8c9f7fbda 100644 --- a/src/fgt/edit_quality/tfhandle.cpp +++ b/src/fgt/edit_quality/tfhandle.cpp @@ -40,6 +40,9 @@ TFHandle::TFHandle(CHART_INFO *environment_info, QColor color, QPointF position, _myKey = myKey; _currentlySelected = false; this->setZValue( zOrder ); + + //updating the position at logical state of the handle + this->updateTfHandlesState(position); } TFHandle::~TFHandle(void)