Calculate bounds on indexing

This commit is contained in:
2022-06-14 21:44:32 +02:00
parent 04e587b51c
commit 08e70cdb52
5 changed files with 83 additions and 25 deletions
+9 -7
View File
@@ -58,7 +58,9 @@ void WCSData::freeWCS()
wcs = nullptr;
}
WCSData::WCSData(char *header, int nrec)
WCSData::WCSData(int width, int height, char *header, int nrec) :
width(width),
height(height)
{
int stat[NWCSFIX];
int nreject = 0;
@@ -117,7 +119,7 @@ bool WCSData::worldToPixel(const SkyPoint &point, QPointF &pixel) const
return false;
}
void WCSData::calculateBounds(int w, int h, double &minRa, double &maxRa, double &minDec, double &maxDec)
void WCSData::calculateBounds(double &minRa, double &maxRa, double &minDec, double &maxDec) const
{
if(wcs == nullptr)return;
@@ -136,21 +138,21 @@ void WCSData::calculateBounds(int w, int h, double &minRa, double &maxRa, double
maxDec = std::max(maxDec, point.DEC());
};
for(int x=0; x<w; x++)
for(int x=0; x<width; x++)
{
update(QPointF(x, 0));
update(QPointF(x, h - 1));
update(QPointF(x, height - 1));
}
for(int y=0; y<h; y++)
for(int y=0; y<height; y++)
{
update(QPointF(0, y));
update(QPointF(w - 1, y));
update(QPointF(width - 1, y));
}
QPointF ncp;
QPointF scp;
QRectF s(0, 0, w - 1, h - 1);
QRectF s(0, 0, width - 1, height - 1);
if(worldToPixel(SkyPoint(0, 90), ncp))
{
if(s.contains(ncp))