- util.h: added updateChartInfo method in CHART_INFO struct

- qualitymapperdialog.h\cpp: added calls to updateChartInfo when transferfunction and histogram are drawn.

The size of TF and Histogram are wrong still (this trouble is probably due to missed event catch of QT QGraphicsView resizeEvent)
This commit is contained in:
Paolo Cignoni cignoni 2008-04-23 10:55:56 +00:00
parent 9aed6a2753
commit d5096e66fd
3 changed files with 18 additions and 7 deletions

View File

@ -67,7 +67,12 @@ struct CHART_INFO
CHART_INFO( int view_width=0, int view_height=0, float min_X=0.0f, float max_X=0.0f, float min_Y=0.0f, float max_Y=0.0f )
{
//assert(num_of_items != 0);
this->updateChartInfo(view_width, view_height, min_X, max_X, min_Y, max_Y);
}
void updateChartInfo( int view_width=0, int view_height=0, float min_X=0.0f, float max_X=0.0f, float min_Y=0.0f, float max_Y=0.0f )
{
assert(numOfItems != 0);
leftBorder = CANVAS_BORDER_DISTANCE;
rightBorder = view_width - CANVAS_BORDER_DISTANCE;

View File

@ -82,6 +82,7 @@ QualityMapperDialog::QualityMapperDialog(QWidget *parent, MeshModel& m, GLArea *
// toggling Trackball button
connect(this, SIGNAL(suspendEditToggle()),gla,SLOT(suspendEditToggle()) );
suspendEditToggle();
}
@ -368,7 +369,7 @@ bool QualityMapperDialog::initEqualizerHistogram()
connect(_equalizerHandles[MID_HANDLE], SIGNAL(handleReleased()), this, SLOT(meshColorPreview()));
connect(_equalizerHandles[RIGHT_HANDLE], SIGNAL(handleReleased()), this, SLOT(meshColorPreview()));
connect(ui.brightnessSlider, SIGNAL(sliderReleased()), this, SLOT(meshColorPreview()));
connect(ui.brightessSpinBox, SIGNAL(valueChanged(double)), this, SLOT(meshColorPreview()));
connect(ui.brightessSpinBox, SIGNAL(valueChanged(double)), this, SLOT(meshColorPreview()));
connect(ui.minSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
connect(ui.midSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
connect(ui.maxSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
@ -434,13 +435,14 @@ bool QualityMapperDialog::drawEqualizerHistogram(bool leftHandleIsInsideHistogra
QMessageBox::warning(this, tr("Quality Mapper"), tr("The model has no vertex quality"), QMessageBox::Ok);
return false;
}
//building histogram chart informations
int maxY = computeEqualizerMaxY(_equalizer_histogram, _equalizer_histogram->MinV(), _equalizer_histogram->MaxV());
_histogram_info = new CHART_INFO( ui.equalizerGraphicsView->width(), ui.equalizerGraphicsView->height(), _equalizer_histogram->MinV(), _equalizer_histogram->MaxV(), 0, maxY);
_histogram_info = new CHART_INFO( ui.equalizerGraphicsView->width(), ui.equalizerGraphicsView->height(), _equalizer_histogram->MinV(), _equalizer_histogram->MaxV(), 0, computeEqualizerMaxY(_equalizer_histogram, _equalizer_histogram->MinV(), _equalizer_histogram->MaxV()) );
}
else
{
//added by MAL 23/04/08
_transferFunction_info->updateChartInfo( ui.equalizerGraphicsView->width(), ui.equalizerGraphicsView->height(), _equalizer_histogram->MinV(), _equalizer_histogram->MaxV(), 0, computeEqualizerMaxY(_equalizer_histogram, _equalizer_histogram->MinV(), _equalizer_histogram->MaxV()) );
// if histogram doesn't need to be redrawn, return
if ( (leftHandleIsInsideHistogram && _leftHandleWasInsideHistogram) && (rightHandleIsInsideHistogram && _rightHandleWasInsideHistogram) )
return true;
@ -665,6 +667,9 @@ void QualityMapperDialog::drawTransferFunction()
//building transfer function chart informations
if ( _transferFunction_info == 0 )
_transferFunction_info = new CHART_INFO( ui.transferFunctionView->width(), ui.transferFunctionView->height(), /* _transferFunction->size(),*/ 0.0f, 1.0f, 0.0f, 1.0f );
else
// added by MAL 23/04/08
_transferFunction_info->updateChartInfo( ui.transferFunctionView->width(), ui.transferFunctionView->height(), /* _transferFunction->size(),*/ 0.0f, 1.0f, 0.0f, 1.0f );
//is necessary, initialize TF
if ( !_isTransferFunctionInitialized )
@ -714,7 +719,7 @@ void QualityMapperDialog::drawTransferFunction()
//fetching positions of handles
pos1 = handle1->scenePos();
pos2 = handle2->scenePos();
//hilighting line if it touches the currently selected handle
//highlighting line if it touches the currently selected handle
if (( handle1 == _currentTfHandle ) || (handle2 == _currentTfHandle) )
drawingPen.setColor( channelColor.lighter() );
else
@ -1410,4 +1415,4 @@ void QualityMapperDialog::on_midPercentageLine_editingFinished()
ui.midSpinBox->blockSignals( false );
_signalDir = UNKNOWN_DIRECTION;
}
}

View File

@ -219,6 +219,7 @@ private slots:
void drawGammaCorrection(void);
};
bool TfHandleCompare(TFHandle*h1, TFHandle*h2);
#endif // QUALITYMAPPERDIALOG_H