diff --git a/relight/mainwindow.cpp b/relight/mainwindow.cpp index ad4b900b..66e9f312 100644 --- a/relight/mainwindow.cpp +++ b/relight/mainwindow.cpp @@ -598,6 +598,7 @@ void MainWindow::newMeasure() { ui->markerList->addItem(marker); ui->markerList->setSelected(marker); connect(marker, SIGNAL(removed()), this, SLOT(removeMeasure())); + connect(marker, SIGNAL(valueChanged()), this, SLOT(measureChanged())); marker->startMeasure(); } @@ -639,6 +640,11 @@ void MainWindow::removeMeasure() { delete marker; } +void MainWindow::measureChanged() { + project.computePixelSize(); + +} + void MainWindow::removeAlign() { auto marker = dynamic_cast(QObject::sender()); project.aligns.erase(std::remove(project.aligns.begin(), project.aligns.end(), marker->align), project.aligns.end()); @@ -664,6 +670,7 @@ void MainWindow::setupMeasures() { for(auto m: project.measures) { auto marker = new MeasureMarker(m, ui->graphicsView, ui->markerList); connect(marker, SIGNAL(removed()), this, SLOT(removeMeasure())); + connect(marker, SIGNAL(valueChanged()), this, SLOT(measureChanged())); ui->markerList->addItem(marker); } } diff --git a/relight/mainwindow.h b/relight/mainwindow.h index 1fe34790..c06c4c90 100644 --- a/relight/mainwindow.h +++ b/relight/mainwindow.h @@ -140,6 +140,7 @@ public slots: void setupMeasures(); void newMeasure(); void removeMeasure(); + void measureChanged(); void setupAligns(); void newAlign(); diff --git a/relight/qmeasuremarker.cpp b/relight/qmeasuremarker.cpp index eea4ff51..ea59b39e 100644 --- a/relight/qmeasuremarker.cpp +++ b/relight/qmeasuremarker.cpp @@ -109,6 +109,7 @@ void MeasureMarker::askMeasure() { return; measure->length = length; + emit valueChanged(); if(!length) { } else { diff --git a/relight/qmeasuremarker.h b/relight/qmeasuremarker.h index ef9d9f05..8917719a 100644 --- a/relight/qmeasuremarker.h +++ b/relight/qmeasuremarker.h @@ -28,6 +28,9 @@ class MeasureMarker: public Marker { public slots: virtual void onEdit(); +signals: + void valueChanged(); + protected: //waiting for first point, waiting for second point, all done. diff --git a/src/project.cpp b/src/project.cpp index fd162bcd..f4e7daa7 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -438,6 +438,7 @@ void Project::computePixelSize() { count++; } pixelSize /= count; + dome.imageWidth = pixelSize * imgsize.width()/10.0; //pixel size in mm, imageWIdth in cm (ugh). } Sphere *Project::newSphere() { diff --git a/src/project.h b/src/project.h index 32796a92..4d0bace9 100644 --- a/src/project.h +++ b/src/project.h @@ -36,7 +36,7 @@ class Project { std::vector aligns; std::vector whites; QRect crop; - float pixelSize = 0; //if computed from measures + float pixelSize = 0; //if computed from measures in mm QString name; std::vector authors;