diff --git a/kde/applications/kstars/kstars-3.3.7-20191112.diff b/kde/applications/kstars/kstars-3.3.7-20191112.diff new file mode 100644 index 00000000..7ce9acaf --- /dev/null +++ b/kde/applications/kstars/kstars-3.3.7-20191112.diff @@ -0,0 +1,261 @@ +diff --git a/kstars/ekos/align/align.cpp b/kstars/ekos/align/align.cpp +index aec4de9df..2aa859cec 100644 +--- a/kstars/ekos/align/align.cpp ++++ b/kstars/ekos/align/align.cpp +@@ -3188,8 +3188,9 @@ void Align::solverFinished(double orientation, double ra, double dec, double pix + if (solverFlippedPA < -180) + solverFlippedPA += 360; + solverFOV->setCenter(alignCoord); +- sensorFOV->setPA(solverFlippedPA); ++ solverFOV->setPA(solverFlippedPA); + solverFOV->setImageDisplay(Options::astrometrySolverOverlay()); ++ // Sensor FOV as well + sensorFOV->setPA(solverFlippedPA); + + QString ra_dms, dec_dms; +@@ -5353,7 +5354,7 @@ void Align::setPAHRefreshComplete() + + void Align::processPAHStage(double orientation, double ra, double dec, double pixscale) + { +- QString newWCSFile = QDir::tempPath() + QString("/fitswcs%1").arg(QUuid::createUuid().toString().remove(QRegularExpression("[-{}]"))); ++ //QString newWCSFile = QDir::tempPath() + QString("/fitswcs%1").arg(QUuid::createUuid().toString().remove(QRegularExpression("[-{}]"))); + + if (pahStage == PAH_FIND_CP) + { +@@ -5381,7 +5382,7 @@ void Align::processPAHStage(double orientation, double ra, double dec, double pi + { + appendLogText(i18n("Please wait while WCS data is processed...")); + connect(alignView, &AlignView::wcsToggled, this, &Ekos::Align::setWCSToggled, Qt::UniqueConnection); +- alignView->createWCSFile(newWCSFile, orientation, ra, dec, pixscale); ++ alignView->injectWCS(orientation, ra, dec, pixscale); + return; + } + +@@ -5409,7 +5410,7 @@ void Align::processPAHStage(double orientation, double ra, double dec, double pi + { + appendLogText(i18n("Please wait while WCS data is processed...")); + connect(alignView, &AlignView::wcsToggled, this, &Ekos::Align::setWCSToggled, Qt::UniqueConnection); +- alignView->createWCSFile(newWCSFile, orientation, ra, dec, pixscale); ++ alignView->injectWCS(orientation, ra, dec, pixscale); + return; + } + +@@ -5434,7 +5435,7 @@ void Align::processPAHStage(double orientation, double ra, double dec, double pi + + appendLogText(i18n("Please wait while WCS data is processed...")); + connect(alignView, &AlignView::wcsToggled, this, &Ekos::Align::setWCSToggled, Qt::UniqueConnection); +- alignView->createWCSFile(newWCSFile, orientation, ra, dec, pixscale); ++ alignView->injectWCS(orientation, ra, dec, pixscale); + return; + } + } +diff --git a/kstars/ekos/align/alignview.cpp b/kstars/ekos/align/alignview.cpp +index 0f2e3de69..b9268241d 100644 +--- a/kstars/ekos/align/alignview.cpp ++++ b/kstars/ekos/align/alignview.cpp +@@ -40,9 +40,9 @@ void AlignView::drawOverlay(QPainter *painter) + drawLine(painter); + } + +-bool AlignView::createWCSFile(const QString &newWCSFile, double orientation, double ra, double dec, double pixscale) ++bool AlignView::injectWCS(double orientation, double ra, double dec, double pixscale) + { +- bool rc = imageData->createWCSFile(newWCSFile, orientation, ra, dec, pixscale); ++ bool rc = imageData->injectWCS(orientation, ra, dec, pixscale); + // If file fails to load, then no WCS data + if (rc == false) + { +diff --git a/kstars/ekos/align/alignview.h b/kstars/ekos/align/alignview.h +index 401f62a40..29acccbab 100644 +--- a/kstars/ekos/align/alignview.h ++++ b/kstars/ekos/align/alignview.h +@@ -24,7 +24,7 @@ class AlignView : public FITSView + explicit AlignView(QWidget *parent = nullptr, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE); + + /* Calculate WCS header info and update WCS info */ +- bool createWCSFile(const QString &newWCSFile, double orientation, double ra, double dec, double pixscale); ++ bool injectWCS(double orientation, double ra, double dec, double pixscale); + + void drawOverlay(QPainter *) override; + +diff --git a/kstars/fitsviewer/fitsdata.cpp b/kstars/fitsviewer/fitsdata.cpp +index e1696f10b..5d5975cab 100644 +--- a/kstars/fitsviewer/fitsdata.cpp ++++ b/kstars/fitsviewer/fitsdata.cpp +@@ -153,14 +153,15 @@ QFuture FITSData::loadFITS(const QString &inFilename, bool silent) + loadCommon(inFilename); + qCInfo(KSTARS_FITS) << "Loading FITS file " << m_Filename; + QFuture result = QtConcurrent::run( +- this, &FITSData::privateLoad, nullptr, 0, silent); ++ this, &FITSData::privateLoad, nullptr, 0, silent); + + return result; + } + +-namespace { ++namespace ++{ + // Common code for reporting fits read errors. Always returns false. +-bool fitsOpenError(int status, const QString& message, bool silent) ++bool fitsOpenError(int status, const QString &message, bool silent) + { + char error_status[512]; + fits_report_error(stderr, status); +@@ -213,9 +214,9 @@ bool FITSData::privateLoad(void *fits_buffer, size_t fits_buffer_size, bool sile + // Use open diskfile as it does not use extended file names which has problems opening + // files with [ ] or ( ) in their names. + if (fits_open_diskfile(&fptr, m_Filename.toLatin1(), READONLY, &status)) +- return fitsOpenError(status, i18n("Error opening fits file %1", m_Filename), silent); ++ return fitsOpenError(status, i18n("Error opening fits file %1", m_Filename), silent); + else +- stats.size = QFile(m_Filename).size(); ++ stats.size = QFile(m_Filename).size(); + } + else + { +@@ -224,16 +225,16 @@ bool FITSData::privateLoad(void *fits_buffer, size_t fits_buffer_size, bool sile + size_t temp_size = fits_buffer_size; + if (fits_open_memfile(&fptr, m_Filename.toLatin1().data(), READONLY, + &temp_buffer, &temp_size, 0, nullptr, &status)) +- return fitsOpenError(status, i18n("Error reading fits buffer."), silent); ++ return fitsOpenError(status, i18n("Error reading fits buffer."), silent); + else +- stats.size = fits_buffer_size; ++ stats.size = fits_buffer_size; + } +- ++ + if (fits_movabs_hdu(fptr, 1, IMAGE_HDU, &status)) +- return fitsOpenError(status, i18n("Could not locate image HDU."), silent); ++ return fitsOpenError(status, i18n("Could not locate image HDU."), silent); + + if (fits_get_img_param(fptr, 3, &(stats.bitpix), &(stats.ndim), naxes, &status)) +- return fitsOpenError(status, i18n("FITS file open error (fits_get_img_param)."), silent); ++ return fitsOpenError(status, i18n("FITS file open error (fits_get_img_param)."), silent); + + if (stats.ndim < 2) + { +@@ -328,7 +329,7 @@ bool FITSData::privateLoad(void *fits_buffer, size_t fits_buffer_size, bool sile + long nelements = stats.samples_per_channel * m_Channels; + + if (fits_read_img(fptr, m_DataType, 1, nelements, nullptr, m_ImageBuffer, &anynull, &status)) +- return fitsOpenError(status, i18n("Error reading image."), silent); ++ return fitsOpenError(status, i18n("Error reading image."), silent); + + parseHeader(); + +@@ -415,11 +416,11 @@ int FITSData::saveFITS(const QString &newFilename) + return status; + } + +- if (fits_movabs_hdu(fptr, 1, &exttype, &status)) +- { +- fits_report_error(stderr, status); +- return status; +- } ++ // if (fits_movabs_hdu(fptr, 1, &exttype, &status)) ++ // { ++ // fits_report_error(stderr, status); ++ // return status; ++ // } + + if (fits_copy_header(fptr, new_fptr, &status)) + { +@@ -3894,7 +3895,8 @@ bool FITSData::ImageToFITS(const QString &filename, const QString &format, QStri + return true; + } + +-bool FITSData::createWCSFile(const QString &newWCSFile, double orientation, double ra, double dec, double pixscale) ++#if 0 ++bool FITSData::injectWCS(const QString &newWCSFile, double orientation, double ra, double dec, double pixscale) + { + int status = 0, exttype = 0; + long nelements; +@@ -4082,6 +4084,63 @@ bool FITSData::createWCSFile(const QString &newWCSFile, double orientation, doub + + return true; + } ++#endif ++ ++bool FITSData::injectWCS(double orientation, double ra, double dec, double pixscale) ++{ ++ int status = 0; ++ ++ fits_update_key(fptr, TDOUBLE, "OBJCTRA", &ra, "Object RA", &status); ++ fits_update_key(fptr, TDOUBLE, "OBJCTDEC", &dec, "Object DEC", &status); ++ ++ int epoch = 2000; ++ ++ fits_update_key(fptr, TINT, "EQUINOX", &epoch, "Equinox", &status); ++ ++ fits_update_key(fptr, TDOUBLE, "CRVAL1", &ra, "CRVAL1", &status); ++ fits_update_key(fptr, TDOUBLE, "CRVAL2", &dec, "CRVAL1", &status); ++ ++ char radecsys[8] = "FK5"; ++ char ctype1[16] = "RA---TAN"; ++ char ctype2[16] = "DEC--TAN"; ++ ++ fits_update_key(fptr, TSTRING, "RADECSYS", radecsys, "RADECSYS", &status); ++ fits_update_key(fptr, TSTRING, "CTYPE1", ctype1, "CTYPE1", &status); ++ fits_update_key(fptr, TSTRING, "CTYPE2", ctype2, "CTYPE2", &status); ++ ++ double crpix1 = width() / 2.0; ++ double crpix2 = height() / 2.0; ++ ++ fits_update_key(fptr, TDOUBLE, "CRPIX1", &crpix1, "CRPIX1", &status); ++ fits_update_key(fptr, TDOUBLE, "CRPIX2", &crpix2, "CRPIX2", &status); ++ ++ // Arcsecs per Pixel ++ double secpix1 = pixscale; ++ double secpix2 = pixscale; ++ ++ fits_update_key(fptr, TDOUBLE, "SECPIX1", &secpix1, "SECPIX1", &status); ++ fits_update_key(fptr, TDOUBLE, "SECPIX2", &secpix2, "SECPIX2", &status); ++ ++ double degpix1 = secpix1 / 3600.0; ++ double degpix2 = secpix2 / 3600.0; ++ ++ fits_update_key(fptr, TDOUBLE, "CDELT1", °pix1, "CDELT1", &status); ++ fits_update_key(fptr, TDOUBLE, "CDELT2", °pix2, "CDELT2", &status); ++ ++ // Rotation is CW, we need to convert it to CCW per CROTA1 definition ++ double rotation = 360 - orientation; ++ if (rotation > 360) ++ rotation -= 360; ++ ++ fits_update_key(fptr, TDOUBLE, "CROTA1", &rotation, "CROTA1", &status); ++ fits_update_key(fptr, TDOUBLE, "CROTA2", &rotation, "CROTA2", &status); ++ ++ WCSLoaded = false; ++ ++ qCDebug(KSTARS_FITS) << "Finished update WCS info."; ++ ++ return true; ++} + + bool FITSData::contains(const QPointF &point) const + { +diff --git a/kstars/fitsviewer/fitsdata.h b/kstars/fitsviewer/fitsdata.h +index c9ffa5881..49093fa21 100644 +--- a/kstars/fitsviewer/fitsdata.h ++++ b/kstars/fitsviewer/fitsdata.h +@@ -350,16 +350,14 @@ class FITSData : public QObject + bool pixelToWCS(const QPointF &wcsPixelPoint, SkyPoint &wcsCoord); + + /** +- * @brief createWCSFile Create a new FITS file given the WCS information supplied. Construct the necessary WCS keywords and save the +- * new file as the current active file +- * @param newWCSFile New file name ++ * @brief injectWCS Add WCS keywords to file + * @param orientation Solver orientation, degrees E of N. + * @param ra J2000 Right Ascension + * @param dec J2000 Declination + * @param pixscale Pixel scale in arcsecs per pixel +- * @return True if file is successfully created and saved, false otherwise. ++ * @return True if file is successfully updated with WCS info. + */ +- bool createWCSFile(const QString &newWCSFile, double orientation, double ra, double dec, double pixscale); ++ bool injectWCS(double orientation, double ra, double dec, double pixscale); + + // Debayer + bool hasDebayer() diff --git a/kde/applications/kstars/kstars.py b/kde/applications/kstars/kstars.py index d2088862..efb10877 100644 --- a/kde/applications/kstars/kstars.py +++ b/kde/applications/kstars/kstars.py @@ -1,83 +1,85 @@ import info class subinfo(info.infoclass): def setTargets(self): self.versionInfo.setDefaultValues() #self.patchToApply["3.3.6"] = [("kstars-3.3.6-20190912.diff", 1)] #self.patchLevel["3.3.6"] = 1 self.patchToApply["3.3.7"] = [("kstars-3.3.7-20191110.diff", 1)] - self.patchLevel["3.3.7"] = 1 + self.patchToApply["3.3.7"] = [("kstars-3.3.7-20191112.diff", 2)] + + self.patchLevel["3.3.7"] = 2 self.description = 'a desktop planetarium' for ver in ['3.3.7']: self.targets[ver] = 'http://download.kde.org/stable/kstars/kstars-%s.tar.xz' % ver self.targetInstSrc[ver] = 'kstars-%s' % ver self.defaultTarget = '3.3.7' self.displayName = "KStars Desktop Planetarium" def setDependencies(self): self.runtimeDependencies["libs/qt5/qtbase"] = None self.runtimeDependencies["libs/qt5/qtdeclarative"] = None self.runtimeDependencies["libs/qt5/qtquickcontrols"] = None self.runtimeDependencies["libs/qt5/qtquickcontrols2"] = None self.runtimeDependencies["libs/qt5/qtsvg"] = None self.runtimeDependencies["libs/qt5/qtdatavis3d"] = None self.runtimeDependencies["libs/qt5/qtwebsockets"] = None self.runtimeDependencies["kde/frameworks/tier1/kconfig"] = None self.runtimeDependencies["kde/frameworks/tier2/kdoctools"] = None self.runtimeDependencies["kde/frameworks/tier1/kwidgetsaddons"] = None self.runtimeDependencies["kde/frameworks/tier3/knewstuff"] = None self.runtimeDependencies["kde/frameworks/tier1/kdbusaddons"] = None self.runtimeDependencies["kde/frameworks/tier1/ki18n"] = None self.runtimeDependencies["kde/frameworks/tier3/kinit"] = None self.runtimeDependencies["kde/frameworks/tier2/kjobwidgets"] = None self.runtimeDependencies["kde/frameworks/tier3/kio"] = None self.runtimeDependencies["kde/frameworks/tier3/kxmlgui"] = None self.runtimeDependencies["kde/frameworks/tier1/kplotting"] = None self.runtimeDependencies["kde/frameworks/tier3/knotifications"] = None self.runtimeDependencies["kde/frameworks/tier3/knotifyconfig"] = None self.runtimeDependencies["libs/eigen3"] = None self.runtimeDependencies["libs/cfitsio"] = None self.runtimeDependencies["libs/wcslib"] = None self.runtimeDependencies["libs/indiclient"] = None self.runtimeDependencies["libs/libraw"] = None self.runtimeDependencies["libs/gsl"] = None self.runtimeDependencies["qt-libs/qtkeychain"] = None # Install proper theme self.runtimeDependencies["kde/frameworks/tier1/breeze-icons"] = None if not CraftCore.compiler.isMacOS: self.runtimeDependencies["qt-libs/phonon-vlc"] = None from Package.CMakePackageBase import * class Package(CMakePackageBase): def __init__(self): CMakePackageBase.__init__(self) self.ignoredPackages.append("binary/mysql") self.ignoredPackages.append("libs/llvm-meta") self.blacklist_file = ["blacklist.txt"] def createPackage(self): self.defines["executable"] = "bin\\kstars.exe" #self.defines["setupname"] = "kstars-latest-win64.exe" self.defines["icon"] = os.path.join(self.packageDir(), "kstars.ico") # TODO: support dpi scaling # TODO: use assets from src with the next release #self.defines["icon_png"] = os.path.join(self.sourceDir(), "packaging", "windows", "assets", "Square150x150Logo.scale-100.png") #self.defines["icon_png_44"] = os.path.join(self.sourceDir(), "packaging", "windows", "assets", "Square44x44Logo.scale-100.png") #self.defines["icon_png_310x150"] = os.path.join(self.sourceDir(), "packaging", "windows", "assets", "Wide310x150Logo.scale-100.png") #self.defines["icon_png_310x310"] = os.path.join(self.sourceDir(), "packaging", "windows", "assets", "Square310x310Logo.scale-100.png") self.defines["icon_png"] = os.path.join(self.packageDir(), ".assets", "Square150x150Logo.scale-100.png") self.defines["icon_png_44"] = os.path.join(self.packageDir(), ".assets", "Square44x44Logo.scale-100.png") self.defines["icon_png_310x150"] = os.path.join(self.packageDir(), ".assets", "Wide310x150Logo.scale-100.png") self.defines["icon_png_310x310"] = os.path.join(self.packageDir(), ".assets", "Square310x310Logo.scale-100.png") if isinstance(self, AppxPackager): self.defines["display_name"] = "KStars" return TypePackager.createPackage(self)