Commit b57a305c authored by Jasem Mutlaq's avatar Jasem Mutlaq

+ Add FITS page options in KStars settings to better separate it from the rest...

+ Add FITS page options in KStars settings to better separate it from the rest of advanced options since it deserves its own.
+ Use Limited Resources Mode to prevent processing of WCS.

CCMAIL:kstars-devel@kde.org
parent 9302044c
......@@ -46,6 +46,7 @@ if(NOT BUILD_KSTARS_LITE)
fitsviewer/fitstab.cpp
fitsviewer/fitsdebayer.cpp
fitsviewer/bayer.c
fitsviewer/opsfits.cpp
)
set (fitsui_SRCS
fitsviewer/fitsheaderdialog.ui
......@@ -54,6 +55,7 @@ if(NOT BUILD_KSTARS_LITE)
indi/streamform.ui
indi/recordingoptions.ui
fitsviewer/fitshistogramui.ui
fitsviewer/opsfits.ui
)
include_directories(${CFITSIO_INCLUDE_DIR})
endif(CFITSIO_FOUND)
......
......@@ -2742,6 +2742,9 @@ void Align::startPAHProcess()
nothingR->setChecked(true);
currentGotoMode = GOTO_NOTHING;
if (Options::limitedResourcesMode())
appendLogText(i18n("Warning: Equatorial Grid Lines will not be drawn due to limited resources mode."));
PAHWidgets->setCurrentWidget(PAHFirstCapturePage);
}
......
......@@ -11,7 +11,9 @@
#include <QtConcurrent>
#include "Options.h"
#include "alignview.h"
#include "kstarsdata.h"
#define ZOOM_DEFAULT 100.0
#define ZOOM_MIN 10
......@@ -59,6 +61,7 @@ void AlignView::setCorrectionParams(QLineF line)
}
correctionLine = line;
celestialPolePoint = line.p1();
markerCrosshair = line.p2();
updateFrame();
......@@ -107,6 +110,24 @@ void AlignView::drawLine(QPainter *painter)
double y2 = zoomedLine.p2().y() * zoomFactor;
painter->drawLine(x1,y1,x2,y2);
// In limited memory mode, WCS data is not loaded so no Equatorial Gridlines are drawn
// so we have to at least draw the NCP/SCP locations
if (Options::limitedResourcesMode())
{
QPen pen;
pen.setWidth(2);
pen.setColor(Qt::darkRed);
painter->setPen(pen);
double x = celestialPolePoint.x() * zoomFactor;
double y = celestialPolePoint.y() * zoomFactor;
double sr= 3*zoomFactor;
if (KStarsData::Instance()->geo()->lat()->Degrees() > 0)
painter->drawText(x+sr,y+sr, i18nc("North Celestial Pole", "NCP"));
else
painter->drawText(x+sr,y+sr, i18nc("South Celestial Pole", "SCP"));
}
}
void AlignView::drawCircle(QPainter *painter)
......
......@@ -40,7 +40,7 @@ protected:
private:
// Correction Line
QLineF correctionLine;
QPointF correctionOffset;
QPointF correctionOffset, celestialPolePoint;
QVector3D RACircle;
};
......
/* INDI Options
Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
/* Ekos Options
Copyright (C) 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
*/
#include <QPushButton>
#include <QFileDialog>
......
......@@ -272,7 +272,7 @@ bool FITSData::loadFITS (const QString &inFilename, bool silent)
calculateStats();
if (Options::autoDebayerFITS() && checkDebayer())
if (Options::autoDebayer() && checkDebayer())
{
bayerBuffer = imageBuffer;
debayer();
......@@ -3886,6 +3886,10 @@ bool FITSData::createWCSFile(const QString & newWCSFile, double orientation, dou
fits_flush_file(fptr, &status);
// We do not process WCS in limited resource mode
if (Options::limitedResourcesMode())
return true;
return loadWCS();
}
......
......@@ -620,7 +620,8 @@ bool FITSView::loadFITS (const QString &inFilename , bool silent)
{
if (fitsProg.wasCanceled())
return false;
else
// Only invoke loadWCS when we are not restricted by CPU/Memory
else if (Options::limitedResourcesMode() == false)
{
QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
wcsWatcher.setFuture(future);
......@@ -880,9 +881,9 @@ template<typename T> int FITSView::rescale(FITSZoom type)
void FITSView::ZoomIn()
{
if (currentZoom >= ZOOM_DEFAULT && Options::limitedMemoryMode())
if (currentZoom >= ZOOM_DEFAULT && Options::limitedResourcesMode())
{
emit newStatus(i18n("Cannot zoom in further due to active limited memory mode."), FITS_MESSAGE);
emit newStatus(i18n("Cannot zoom in further due to active limited resources mode."), FITS_MESSAGE);
return;
}
......
/* FITS Options
Copyright (C) 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "opsfits.h"
#include "Options.h"
#include "kstars.h"
#include "kstarsdata.h"
OpsFITS::OpsFITS() : QFrame(KStars::Instance())
{
setupUi( this );
connect(kcfg_LimitedResourcesMode, &QCheckBox::toggled, this, [this](bool toggled) { if (toggled) { kcfg_Auto3DCube->setChecked(false); kcfg_AutoDebayer->setChecked(false); } });
connect(kcfg_Auto3DCube, &QCheckBox::toggled, this, [this](bool toggled) { if (toggled) kcfg_LimitedResourcesMode->setChecked(false);});
connect(kcfg_AutoDebayer, &QCheckBox::toggled, this, [this](bool toggled) { if (toggled) kcfg_LimitedResourcesMode->setChecked(false);});
}
/* FITS Options
Copyright (C) 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef OPSFITS_H_
#define OPSFITS_H_
#include "ui_opsfits.h"
#include <QStandardItemModel>
#include <kconfigdialog.h>
class KStars;
/** @class OpsFITS
*The FITS Tab of the Options window. Configure FITS options including look and feel and how FITS Viewer processes the data.
*@author Jasem Mutlaq
*@version 1.0
*/
class OpsFITS : public QFrame, public Ui::OpsFITS
{
Q_OBJECT
public:
explicit OpsFITS();
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpsFITS</class>
<widget class="QWidget" name="OpsFITS">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>128</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="FITSViewerGroup">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Look &amp;&amp; Feel</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="kcfg_singlePreviewFITS">
<property name="toolTip">
<string>Display all captured FITS images in a single tab instead of multiple tabs per image.</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Preview Mode</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_singleWindowCapturedFITS">
<property name="toolTip">
<string>Display captured FITS images from all cameras in a single FITS Viewer window instead of a dedicated window to each camera.</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Single Window Capture</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_singleWindowOpenedFITS">
<property name="toolTip">
<string>Display opened FITS images in a single FITS Viewer window instead of a dedicated window to each file.</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Single Window Open</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_independentWindowFITS">
<property name="toolTip">
<string>Make FITS Viewer window independent from KStars</string>
</property>
<property name="text">
<string>Independent Window</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Processing</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="kcfg_AutoStretch">
<property name="toolTip">
<string>Always apply auto stretch to images in FITS Viewer</string>
</property>
<property name="text">
<string>Auto Stretch</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_LimitedResourcesMode">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable limited resource mode to turn off any resource-intensive operations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Auto Debayer: Bayered images will not be debayered. Only grayscale images are shown.&lt;/li&gt;
&lt;li&gt;3D Cube: RGB images will not be processed. Only grayscale images are shown.&lt;/li&gt;
&lt;li&gt;World Coordinate System (WCS): WCS data will not be processed. WCS maps sky coordiantes to image coordinates. Equatorial grid lines, object identification, and telescope slew within an image are disabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Limited Resources Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_AutoDebayer">
<property name="toolTip">
<string>Automatically debayer captured image if it contains a bayer pattern</string>
</property>
<property name="text">
<string>Auto Debayer</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_Auto3DCube">
<property name="toolTip">
<string>Process 3D (RGB) FITS images. If unchecked, only first channel is processed.</string>
</property>
<property name="text">
<string>3D Cube</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>3</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -69,6 +69,7 @@ class OpsColors;
class OpsAdvanced;
class OpsINDI;
class OpsEkos;
class OpsFITS;
#ifdef HAVE_XPLANET
class OpsXplanet;
......@@ -721,6 +722,7 @@ private:
OpsAdvanced *opadvanced;
OpsINDI *opsindi;
OpsEkos *opsekos;
OpsFITS *opsfits;
#ifdef HAVE_XPLANET
OpsXplanet *opsxplanet;
#endif
......
......@@ -1293,16 +1293,16 @@
<label>Make FITS Viewer window independent of KStars main window</label>
<default>false</default>
</entry>
<entry name="autoDebayerFITS" type="Bool">
<entry name="AutoDebayer" type="Bool">
<label>Automatically debayer a FITS image if it is contains a bayer pattern</label>
<default>true</default>
</entry>
<entry name="auto3DCube" type="Bool">
<entry name="Auto3DCube" type="Bool">
<label>Process 3D FITS Cube (RGB). If false, only first channel is processed.</label>
<default>true</default>
</entry>
<entry name="LimitedMemoryMode" type="Bool">
<label>Conserve memory by disabling all memory-intensive features in FITS Viewer</label>
<entry name="LimitedResourcesMode" type="Bool">
<label>Conserve CPU and memory by disabling all resource-intensive features in FITS Viewer</label>
<default>false</default>
</entry>
</group>
......
......@@ -124,6 +124,7 @@
#ifdef HAVE_CFITSIO
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/opsfits.h"
#ifdef HAVE_INDI
#include "ekos/ekosmanager.h"
#include "ekos/opsekos.h"
......@@ -744,11 +745,16 @@ void KStars::slotViewOps() {
page = dialog->addPage(opcolors, i18n("Colors"), "kstars_colors");
page->setIcon(QIcon::fromTheme("kstars_colors", QIcon(":/icons/breeze/default/kstars_colors.svg")));
#ifdef HAVE_CFITSIO
opsfits = new OpsFITS();
page = dialog->addPage(opsfits, i18n("FITS"), "kstars_fitsviewer");
page->setIcon(QIcon::fromTheme("kstars_fitsviewer", QIcon(":/icons/breeze/default/kstars_fitsviewer.svg")));
#endif
#ifdef HAVE_INDI
opsindi = new OpsINDI();
page= dialog->addPage(opsindi, i18n("INDI"), "kstars_indi");
page->setIcon(QIcon::fromTheme("kstars_indi", QIcon(":/icons/breeze/default/kstars_indi.svg")));
#ifdef HAVE_CFITSIO
opsekos = new OpsEkos();
KPageWidgetItem *ekosOption = dialog->addPage(opsekos, i18n("Ekos"), "kstars_ekos");
......
......@@ -34,10 +34,6 @@ OpsAdvanced::OpsAdvanced()
{
setupUi( this );
#ifdef HAVE_CFITSIO
FITSViewerGroup->setEnabled(true);
#endif
//Initialize the timestep value
SlewTimeScale->tsbox()->changeScale( Options::slewTimeScale() );
......@@ -51,8 +47,6 @@ OpsAdvanced::OpsAdvanced()
connect(showLogsB, SIGNAL(clicked()), this, SLOT(slotShowLogFiles()));
connect(kcfg_LimitedMemoryMode, SIGNAL(toggled(bool)), this, SLOT(slotToggleLimitedMemoryMode(bool)));
connect( kcfg_ObsListDemoteHole, &QCheckBox::toggled, [this]( bool state ) {
kcfg_ObsListHoleSize->setEnabled( state );
} );
......@@ -104,9 +98,3 @@ void OpsAdvanced::slotShowLogFiles()
QDesktopServices::openUrl(path);
}
void OpsAdvanced::slotToggleLimitedMemoryMode(bool enabled)
{
kcfg_auto3DCube->setChecked(!enabled);
kcfg_autoDebayerFITS->setChecked(!enabled);
}
......@@ -48,7 +48,6 @@ private slots:
void slotToggleVerbosityOptions();
void slotToggleOutputOptions();
void slotShowLogFiles();
void slotToggleLimitedMemoryMode(bool enabled);
};
#endif //OPSADVANCED_H_
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment