diff --git a/src/meshlabplugins/edit_quality/common/transferfunction.cpp b/src/meshlabplugins/edit_quality/common/transferfunction.cpp index cacae5fc5..55f94bf81 100644 --- a/src/meshlabplugins/edit_quality/common/transferfunction.cpp +++ b/src/meshlabplugins/edit_quality/common/transferfunction.cpp @@ -214,6 +214,15 @@ bool TfChannel::isTail(TF_KEY *key) return ( key->x == 1.0f ); } +void TfChannel::flip() +{ + for (KEY_LISTiterator it = KEYS.begin(); it != KEYS.end(); it++) + (*it)->x = 1.0 - (*it)->x; + + this->updateKeysOrder(); +} + + //this method is called by TFHandle and is used to update the TfHandle position from graphics to logical level. //When the key value is updated, the keys list must be checked to restore the sorting and the right alternation of LEFT\RIGHT JUNCTION SIDE keys void TfChannel::updateKeysOrder() @@ -541,6 +550,15 @@ Color4b TransferFunction::getColorByQuality (float absoluteQuality, float minQua return currentColor; } +void TransferFunction::flipRamp() +{ + //for each channel... + for (size_t i = 0; iflipRamp(); + + //preparing TF to work + this->initTF(); + + //drawing new TF + this->drawTransferFunction(); + + //applying preview if necessary + if (ui.previewButton->isChecked()) + on_applyButton_clicked(); +} + //callback for save button click void QualityMapperDialog::on_savePresetButton_clicked() { diff --git a/src/meshlabplugins/edit_quality/qualitymapperdialog.h b/src/meshlabplugins/edit_quality/qualitymapperdialog.h index 50c51f68e..ccd9f1bca 100644 --- a/src/meshlabplugins/edit_quality/qualitymapperdialog.h +++ b/src/meshlabplugins/edit_quality/qualitymapperdialog.h @@ -215,6 +215,7 @@ private slots: void on_redButton_toggled(bool checked); void on_presetComboBox_currentTextChanged(const QString &); + void on_flipButton_clicked(); void on_loadPresetButton_clicked(); void on_savePresetButton_clicked(); diff --git a/src/meshlabplugins/edit_quality/qualitymapperdialog.ui b/src/meshlabplugins/edit_quality/qualitymapperdialog.ui index ccf07be6d..5873d5a60 100644 --- a/src/meshlabplugins/edit_quality/qualitymapperdialog.ui +++ b/src/meshlabplugins/edit_quality/qualitymapperdialog.ui @@ -234,34 +234,6 @@ - - - - - - - 10 - - - - x-quality - - - - - - - - 10 - - - - quality - - - - - @@ -274,51 +246,81 @@ - Load Preset + Preset Ramps - + - - - Transfer Functions list + + + 0 - - true - - + + + + Transfer Functions list + + + true + + + + - - - - 30 - 16777215 - + + + 5 - - click to load a Transfer Function file - - - - :/images/opentf.png:/images/opentf.png - - - - - - - - 30 - 16777215 - - - - Add/Save preset - - - + - - + + + + + 30 + 16777215 + + + + Flip Current Ramp Direction + + + Flip + + + + + + + + 30 + 16777215 + + + + click to load a Transfer Function file + + + + :/images/opentf.png:/images/opentf.png + + + + + + + + 30 + 16777215 + + + + Add/Save preset + + + + + + + +