Skip to content

Commit

Permalink
Measures taken on the image used to compute image width.
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Jul 23, 2024
1 parent 84e66d0 commit c0862e3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions relight/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -639,6 +640,11 @@ void MainWindow::removeMeasure() {
delete marker;
}

void MainWindow::measureChanged() {
project.computePixelSize();

}

void MainWindow::removeAlign() {
auto marker = dynamic_cast<AlignMarker *>(QObject::sender());
project.aligns.erase(std::remove(project.aligns.begin(), project.aligns.end(), marker->align), project.aligns.end());
Expand All @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions relight/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public slots:
void setupMeasures();
void newMeasure();
void removeMeasure();
void measureChanged();

void setupAligns();
void newAlign();
Expand Down
1 change: 1 addition & 0 deletions relight/qmeasuremarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void MeasureMarker::askMeasure() {
return;

measure->length = length;
emit valueChanged();

if(!length) {
} else {
Expand Down
3 changes: 3 additions & 0 deletions relight/qmeasuremarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Project {
std::vector<Align *> aligns;
std::vector<White *> whites;
QRect crop;
float pixelSize = 0; //if computed from measures
float pixelSize = 0; //if computed from measures in mm

QString name;
std::vector<QString> authors;
Expand Down

0 comments on commit c0862e3

Please sign in to comment.