- 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
This commit is contained in:
Paolo Cignoni cignoni 2008-03-03 19:08:25 +00:00
parent d6549b3570
commit 0ea7a257af
4 changed files with 18 additions and 3 deletions

View File

@ -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());

View File

@ -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
{

View File

@ -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());

View File

@ -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)