Add support for WCS

This commit is contained in:
2022-06-13 18:02:58 +02:00
parent 701a425cc7
commit 6b9ea5e4b9
7 changed files with 162 additions and 13 deletions
+25 -9
View File
@@ -85,7 +85,7 @@ ImageWidget::~ImageWidget()
makeCurrent();
}
void ImageWidget::setImage(std::shared_ptr<RawImage> &image, int index)
void ImageWidget::setImage(std::shared_ptr<RawImage> image, int index)
{
if(image == nullptr)return;
@@ -112,6 +112,11 @@ void ImageWidget::setImage(std::shared_ptr<RawImage> &image, int index)
update();
}
void ImageWidget::setWCS(std::shared_ptr<WCSData> wcs)
{
m_wcs = wcs;
}
void ImageWidget::setScale(float scale)
{
m_scale = scale;
@@ -456,12 +461,19 @@ void ImageWidget::mouseMoveEvent(QMouseEvent *event)
QVector2D pos = QVector2D(event->pos());
QVector2D pix = (pos + offset) / m_scale;
QVector3D rgb;
SkyPoint sky;
if(m_wcs)
{
sky = m_wcs->pixelToWorld(QPointF(pix.x(), pix.y()));
}
if(m_rawImage->pixel(pix.x(), pix.y(), rgb))
{
if(m_bwImg)
emit status(tr("L: %1").arg(rgb.x()));
emit status(tr("L:%1 %2 X:%3 Y:%4").arg(rgb.x()).arg(sky.toString()).arg((int)pix.x()).arg((int)pix.y()));
else
emit status(tr("R: %1 G: %2 B: %3").arg(rgb.x()).arg(rgb.y()).arg(rgb.z()));
emit status(tr("R:%1 G:%2 B:%3 %4 X:%5 Y:%6").arg(rgb.x()).arg(rgb.y()).arg(rgb.z()).arg(sky.toString()).arg((int)pix.x()).arg((int)pix.y()));
}
}
}
@@ -551,13 +563,17 @@ ImageScrollAreaGL::~ImageScrollAreaGL()
}
void ImageScrollAreaGL::setImage(std::shared_ptr<RawImage> image, int index)
void ImageScrollAreaGL::setImage(Image *image)
{
m_imageWidget->setImage(image, index);
m_imgWidth = image->width();
m_imgHeight = image->height();
if(m_bestFit)bestFit();
updateScrollbars();
if(image && image->rawImage())
{
m_imageWidget->setImage(image->rawImage(), image->number());
m_imageWidget->setWCS(image->info().wcs);
m_imgWidth = image->rawImage()->width();
m_imgHeight = image->rawImage()->height();
if(m_bestFit)bestFit();
updateScrollbars();
}
}
ImageWidget *ImageScrollAreaGL::imageWidget()