diff --git a/Tests/auxiliary/testcachingdms.h b/Tests/auxiliary/testcachingdms.h index 01f147a3d..9682a43c1 100644 --- a/Tests/auxiliary/testcachingdms.h +++ b/Tests/auxiliary/testcachingdms.h @@ -1,50 +1,50 @@ /*************************************************************************** testcachingdms.h - ------------------- begin : Sun 25 Sep 2016 03:56:35 CDT copyright : (c) 2016 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include /** * @class TestCachingDms * @short Tests for CachingDms * @author Akarsh Simha */ class TestCachingDms : public QObject { Q_OBJECT public: /** @short Constructor */ TestCachingDms(); /** @short Destructor */ - ~TestCachingDms() = default; + ~TestCachingDms() override = default; private slots: void defaultCtor(); void explicitSexigesimalCtor(); void angleCtor(); void stringCtor(); void setUsing_atan2(); void setUsing_asin(); void setUsing_acos(); void additionOperator(); void subtractionOperator(); void unaryMinusOperator(); void testFailsafeUseOfBaseClassPtr(); }; diff --git a/Tests/auxiliary/testcsvparser.h b/Tests/auxiliary/testcsvparser.h index c38cff652..69e33da5d 100644 --- a/Tests/auxiliary/testcsvparser.h +++ b/Tests/auxiliary/testcsvparser.h @@ -1,46 +1,46 @@ /*************************************************************************** TestCSVParser.h - K Desktop Planetarium ------------------- begin : 2012/23/07 copyright : (C) 2012 by Rishab Arora email : ra.rishab@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksparser.h" #include class TestCSVParser : public QObject { Q_OBJECT public: TestCSVParser(); - ~TestCSVParser() = default; + ~TestCSVParser() override = default; private slots: void initTestCase(); void cleanupTestCase(); void CSVMixedInputs(); void CSVQuotesInQuotes(); void CSVEmptyRow(); void CSVNoRow(); void CSVIgnoreHasNextRow(); void CSVReadMissingFile(); private: QStringList test_cases_; QList> sequence_; QString test_file_name_; KSParser *test_parser_ { nullptr }; }; diff --git a/Tests/auxiliary/testdms.h b/Tests/auxiliary/testdms.h index 6ee5529f9..c0537ceeb 100644 --- a/Tests/auxiliary/testdms.h +++ b/Tests/auxiliary/testdms.h @@ -1,29 +1,29 @@ /* KStars Testing - DMS Copyright (C) 2016 Jasem Mutlaq 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. */ #pragma once #include class TestDMS : public QObject { Q_OBJECT public: TestDMS(); - virtual ~TestDMS() = default; + ~TestDMS() override = default; void checkCtor_data(); private slots: void defaultCtor(); void explicitSexigesimalCtor(); void angleCtor(); void stringCtor(); void testReduceToRange(); }; diff --git a/Tests/auxiliary/testfwparser.h b/Tests/auxiliary/testfwparser.h index 6a200c739..20dfd4a59 100644 --- a/Tests/auxiliary/testfwparser.h +++ b/Tests/auxiliary/testfwparser.h @@ -1,45 +1,45 @@ /*************************************************************************** KSParser.cpp - K Desktop Planetarium ------------------- begin : 2012/15/08 copyright : (C) 2012 by Rishab Arora email : ra.rishab@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksparser.h" #include #include class TestFWParser : public QObject { Q_OBJECT public: TestFWParser(); - ~TestFWParser(); + ~TestFWParser() override; private slots: void initTestCase(); void cleanupTestCase(); void MixedInputs(); void OnlySpaceRow(); void NoRow(); void FWReadMissingFile(); private: QStringList test_cases_; QList widths_; QList> sequence_; QString test_file_name_; KSParser *test_parser_ { nullptr }; }; diff --git a/Tests/kstars_ui/kstars_ui_tests.h b/Tests/kstars_ui/kstars_ui_tests.h index 920b486af..49117fc4f 100644 --- a/Tests/kstars_ui/kstars_ui_tests.h +++ b/Tests/kstars_ui/kstars_ui_tests.h @@ -1,36 +1,36 @@ /* KStars UI tests Copyright (C) 2017 Csaba Kertesz 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. */ #pragma once #include "config-kstars.h" #include #include class KStars; class KStarsUiTests : public QObject { Q_OBJECT public: KStarsUiTests(); - virtual ~KStarsUiTests() = default; + ~KStarsUiTests() override = default; private slots: void initTestCase(); void cleanupTestCase(); #if defined(HAVE_INDI) void openEkos(); void addEkosProfile(); void verifyEkosProfile(); void removeEkosProfile(); #endif }; diff --git a/Tests/skyobjects/test_skypoint.h b/Tests/skyobjects/test_skypoint.h index 5d7d120c9..eee66fc61 100644 --- a/Tests/skyobjects/test_skypoint.h +++ b/Tests/skyobjects/test_skypoint.h @@ -1,46 +1,46 @@ /*************************************************************************** test_skypoint.h - KStars Planetarium ------------------- begin : Tue 27 Sep 2016 20:51:21 CDT copyright : (c) 2016 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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 TEST_SKYPOINT_H #define TEST_SKYPOINT_H #include #include #define UNIT_TEST #include "skyobjects/skypoint.h" /** * @class TestSkyPoint * @short Tests for some SkyPoint operations * @author Akarsh Simha */ class TestSkyPoint : public QObject { Q_OBJECT public: TestSkyPoint() : QObject(){}; - ~TestSkyPoint(){}; + ~TestSkyPoint() override{}; private slots: void testPrecession(); }; #endif diff --git a/kstars/auxiliary/QProgressIndicator.h b/kstars/auxiliary/QProgressIndicator.h index 6ae08568b..0f5a1226e 100644 --- a/kstars/auxiliary/QProgressIndicator.h +++ b/kstars/auxiliary/QProgressIndicator.h @@ -1,122 +1,122 @@ /* * * This file is part of QProgressIndicator, * an open-source recent files menu widget * * Copyright (C) 2009 - 2010 Morgan Leborgne * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with QRecentFilesMenu. If not, see . * */ #pragma once #include #include /** * @class QProgressIndicator * @brief The QProgressIndicator class lets an application display a progress indicator to show that a long task is * under way. * Progress indicators are indeterminate and do nothing more than spin to show that the application is busy. * * @sa QProgressBar */ class QProgressIndicator : public QWidget { Q_OBJECT Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay) Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped) Q_PROPERTY(QColor color READ color WRITE setColor) public: explicit QProgressIndicator(QWidget *parent = nullptr); /** * Returns the delay between animation steps. * @return The number of milliseconds between animation steps. By default, the animation delay is set to * 40 milliseconds. * * @sa setAnimationDelay */ int animationDelay() const { return m_delay; } /** * Returns a Boolean value indicating whether the component is currently animated. * @return Animation state. * @sa startAnimation stopAnimation */ bool isAnimated() const; /** * Returns a Boolean value indicating whether the receiver shows itself even when it is not animating. * @return Return true if the progress indicator shows itself even when it is not animating. By default, * it returns false. * @sa setDisplayedWhenStopped */ bool isDisplayedWhenStopped() const; /** * Returns the color of the component. * @sa setColor */ const QColor &color() const { return m_color; } - QSize sizeHint() const Q_DECL_OVERRIDE; - int heightForWidth(int w) const Q_DECL_OVERRIDE; + QSize sizeHint() const override; + int heightForWidth(int w) const override; public slots: /** * Starts the spin animation. * @sa stopAnimation isAnimated */ void startAnimation(); /** * Stops the spin animation. * @sa startAnimation isAnimated */ void stopAnimation(); /** * Sets the delay between animation steps. * Setting the \a delay to a value larger than 40 slows the animation, while setting the @a delay to a * smaller value speeds it up. * @param delay The delay, in milliseconds. * @sa animationDelay */ void setAnimationDelay(int delay); /** * Sets whether the component hides itself when it is not animating. * @param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true. * @sa isDisplayedWhenStopped */ void setDisplayedWhenStopped(bool state); /** * Sets the color of the components to the given color. * @sa color */ void setColor(const QColor &color); protected: - void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *event) override; + void paintEvent(QPaintEvent *event) override; private: int m_angle { 0 }; int m_timerId { -1 }; int m_delay { 40 }; bool m_displayedWhenStopped { false }; QColor m_color { Qt::black }; }; diff --git a/kstars/auxiliary/QRoundProgressBar.h b/kstars/auxiliary/QRoundProgressBar.h index d83857a6f..96efd4bc2 100644 --- a/kstars/auxiliary/QRoundProgressBar.h +++ b/kstars/auxiliary/QRoundProgressBar.h @@ -1,252 +1,252 @@ /* * QRoundProgressBar - a circular progress bar Qt widget. * * Sintegrial Technologies (c) 2015-now * * The software is freeware and is distributed "as is" with the complete source codes. * Anybody is free to use it in any software projects, either commercial or non-commercial. * Please do not remove this copyright message and remain the name of the author unchanged. * * It is very appreciated if you produce some feedback to us case you are going to use * the software. * * Please send your questions, suggestions, and information about found issues to the * * sintegrial@gmail.com * */ #ifndef QROUNDPROGRESSBAR_H #define QROUNDPROGRESSBAR_H #include /** * @brief The QRoundProgressBar class represents a circular progress bar and maintains its API * similar to the *QProgressBar*. * * ### Styles * QRoundProgressBar currently supports Donut, Pie and Line styles. See setBarStyle() for more details. * * ### Colors * Generally QRoundProgressBar uses its palette and font attributes to define how it will look. * * The following \a QPalette members are considered: * - *QPalette::Window* background of the whole widget (normally should be set to Qt::NoBrush) * - *QPalette::Base* background of the non-filled progress bar area (should be set to Qt::NoBrush to make it transparent) * - *QPalette::AlternateBase* background of the central circle where the text is shown (for \a Donut style) * - *QPalette::Shadow* foreground of the non-filled progress bar area (i.e. border color) * - *QPalette::Highlight* background of the filled progress bar area * - *QPalette::Text* color of the text shown in the center * * Create a \a QPalette with given attributes and apply it via `setPalette()`. * * ### Color gradient * \a Donut and \a Pie styles allow to use color gradient for currernt value area instead of plain brush fill. * See setDataColors() for more details. * * ### Value text * Value text is generally drawn inside the QRoundProgressBar using its `font()` and \a QPalette::Text role from its `palette()`. * * To define pattern of the text, use setFormat() function (see Qt's \a QProgressBar for more details). * * To define number of decimals to be shown, use setDecimals() function. * * ### Font * To use own font for value text, apply it via `setFont()`. * * By default, font size will be adjusted automatically to fit the inner circle of the widget. */ class QRoundProgressBar : public QWidget { Q_OBJECT public: explicit QRoundProgressBar(QWidget *parent = 0); static const int PositionLeft = 180; static const int PositionTop = 90; static const int PositionRight = 0; static const int PositionBottom = -90; /** * @brief Return position (in degrees) of minimum value. * \sa setNullPosition */ double nullPosition() const { return m_nullPosition; } /** * @brief Defines position of minimum value. * @param position position on the circle (in degrees) of minimum value * \sa nullPosition */ void setNullPosition(double position); /** * @brief The BarStyle enum defines general look of the progress bar. */ enum BarStyle { /// Donut style (filled torus around the text) StyleDonut, /// Pie style (filled pie segment with the text in center) StylePie, /// Line style (thin round line around the text) StyleLine }; /** * @brief Sets visual style of the widget. * \sa barStyle */ void setBarStyle(BarStyle style); /** * @brief Returns current progree bar style. * \sa setBarStyle */ BarStyle barStyle() const { return m_barStyle; } /** * @brief Sets width of the outline circle pen. * @param penWidth width of the outline circle pen (in pixels) */ void setOutlinePenWidth(double penWidth); /** * @brief Returns width of the outline circle pen. */ double outlinePenWidth() const { return m_outlinePenWidth; } /** * @brief Sets width of the data circle pen. * @param penWidth width of the data circle pen (in pixels) */ void setDataPenWidth(double penWidth); /** * @brief Returns width of the data circle pen. */ double dataPenWidth() const { return m_dataPenWidth; } /** * @brief Sets colors of the visible data and makes gradient brush from them. * Gradient colors can be set for \a Donut and \a Pie styles (see setBarStyle() function). * * *Warning*: this function will override widget's `palette()` to set dynamically created gradient brush. * * @param stopPoints List of colors (should have at least 2 values, see Qt's \a QGradientStops for more details). * Color value at point 0 corresponds to the minimum() value, while color value at point 1 * corresponds to the maximum(). Other colors will be distributed accordingly to the defined ranges (see setRange()). */ void setDataColors(const QGradientStops &stopPoints); /** * @brief Defines the string used to generate the current text. * If no format is set, no text will be shown. * @param format see \a QProgressBar's format description * \sa setDecimals */ void setFormat(const QString &format); /** * @brief Sets format string to empty string. No text will be shown therefore. * See setFormat() for more information. */ void resetFormat(); /** * @brief Returns the string used to generate the current text. */ QString format() const { return m_format; } /** * @brief Sets number of decimals to show after the comma (default is 1). * \sa setFormat */ void setDecimals(int count); /** * @brief Returns number of decimals to show after the comma (default is 1). * \sa setFormat, setDecimals */ int decimals() const { return m_decimals; } /** * @brief Returns current value shown on the widget. * \sa setValue() */ double value() const { return m_value; } /** * @brief Returns minimum of the allowed value range. * \sa setMinimum, setRange */ double minimum() const { return m_min; } /** * @brief Returns maximum of the allowed value range. * \sa setMaximum, setRange */ double maximum() const { return m_max; } public Q_SLOTS: /** * @brief Defines minimum und maximum of the allowed value range. * If the current value does not fit into the range, it will be automatically adjusted. * @param min minimum of the allowed value range * @param max maximum of the allowed value range */ void setRange(double min, double max); /** * @brief Defines minimum of the allowed value range. * If the current value does not fit into the range, it will be automatically adjusted. * @param min minimum of the allowed value range * \sa setRange */ void setMinimum(double min); /** * @brief Defines maximum of the allowed value range. * If the current value does not fit into the range, it will be automatically adjusted. * @param max maximum of the allowed value range * \sa setRange */ void setMaximum(double max); /** * @brief Sets a value which will be shown on the widget. * @param val must be between minimum() and maximum() */ void setValue(double val); /** * @brief Integer version of the previous slot. * @param val must be between minimum() and maximum() */ void setValue(int val); protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) override; virtual void drawBackground(QPainter &p, const QRectF &baseRect); virtual void drawBase(QPainter &p, const QRectF &baseRect); virtual void drawValue(QPainter &p, const QRectF &baseRect, double value, double arcLength); virtual void calculateInnerRect(const QRectF &baseRect, double outerRadius, QRectF &innerRect, double &innerRadius); virtual void drawInnerBackground(QPainter &p, const QRectF &innerRect); virtual void drawText(QPainter &p, const QRectF &innerRect, double innerRadius, double value); virtual QString valueToText(double value) const; virtual void valueFormatChanged(); - QSize minimumSizeHint() const Q_DECL_OVERRIDE { return QSize(32, 32); } + QSize minimumSizeHint() const override { return QSize(32, 32); } - bool hasHeightForWidth() const Q_DECL_OVERRIDE { return true; } - int heightForWidth(int w) const Q_DECL_OVERRIDE { return w; } + bool hasHeightForWidth() const override { return true; } + int heightForWidth(int w) const override { return w; } void rebuildDataBrushIfNeeded(); double m_min, m_max; double m_value; double m_nullPosition; BarStyle m_barStyle; double m_outlinePenWidth, m_dataPenWidth; QGradientStops m_gradientData; bool m_rebuildBrush; QString m_format; int m_decimals; static const int UF_VALUE = 1; static const int UF_PERCENT = 2; static const int UF_MAX = 4; int m_updateFlags; }; #endif // QROUNDPROGRESSBAR_H diff --git a/kstars/auxiliary/cachingdms.h b/kstars/auxiliary/cachingdms.h index 33fbdb52b..678e8d834 100644 --- a/kstars/auxiliary/cachingdms.h +++ b/kstars/auxiliary/cachingdms.h @@ -1,285 +1,285 @@ /*************************************************************************** cachingdms.h - KStars Planetarium ------------------- begin : Sat 24 Sep 2016 02:18:26 CDT copyright : (c) 2016 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "dms.h" /** * @class CachingDms * @short a dms subclass that caches its sine and cosine values every time the angle is changed. * @note This is to be used for those angles where sin/cos is repeatedly computed. * @author Akarsh Simha */ class CachingDms : public dms { public: /** * @short Default Constructor */ CachingDms() : dms(), m_sin(NaN::d), m_cos(NaN::d) { #ifdef COUNT_DMS_SINCOS_CALLS m_cacheUsed = true; ++cachingdms_constructor_calls; #endif }; /** * @short Degree angle constructor * @param x is the angle in degrees */ explicit CachingDms(const double &x); /** * @short QString constructor */ explicit CachingDms(const QString &s, bool isDeg = true); /** * @short DMS representation constructor */ explicit CachingDms(const int &d, const int &m = 0, const int &s = 0, const int &ms = 0); #ifdef COUNT_DMS_SINCOS_CALLS /** * @short Destructor must count bad cache uses */ ~CachingDms(); #endif /** * @short Sets the angle in degrees supplied as a double * @note Re-implements dms::setD() with sine/cosine caching */ - inline void setD(const double &x) Q_DECL_OVERRIDE + inline void setD(const double &x) override { dms::setD(x); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; if (!m_cacheUsed) ++cachingdms_bad_uses; m_cacheUsed = false; #endif } /** * @short Overrides dms::setD() */ - inline void setD(const int &d, const int &m, const int &s, const int &ms = 0) Q_DECL_OVERRIDE + inline void setD(const int &d, const int &m, const int &s, const int &ms = 0) override { dms::setD(d, m, s, ms); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; if (!m_cacheUsed) ++cachingdms_bad_uses; m_cacheUsed = false; #endif } /** * @short Sets the angle in hours, supplied as a double * @note Re-implements dms::setH() with sine/cosine caching * @note While this and other methods internally call setD, we want to avoid unnecessary vtable lookups. We'd rather have inline than virtual when speed matters in general. */ - inline void setH(const double &x) Q_DECL_OVERRIDE + inline void setH(const double &x) override { dms::setH(x); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; if (!m_cacheUsed) ++cachingdms_bad_uses; m_cacheUsed = false; #endif } /** * @short Sets the angle in HMS form * @note Re-implements dms::setH() with sine/cosine caching */ - inline void setH(const int &h, const int &m, const int &s, const int &ms = 0) Q_DECL_OVERRIDE + inline void setH(const int &h, const int &m, const int &s, const int &ms = 0) override { dms::setH(h, m, s, ms); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; #endif } /** * @short Sets the angle from string * @note Re-implements dms::setFromString() */ - inline bool setFromString(const QString &s, bool isDeg = true) Q_DECL_OVERRIDE + inline bool setFromString(const QString &s, bool isDeg = true) override { bool retval = dms::setFromString(s, isDeg); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; if (!m_cacheUsed) ++cachingdms_bad_uses; m_cacheUsed = false; #endif return retval; } /** * @short Sets the angle in radians */ - inline void setRadians(const double &a) Q_DECL_OVERRIDE + inline void setRadians(const double &a) override { dms::setRadians(a); dms::SinCos(m_sin, m_cos); #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta -= 2; if (!m_cacheUsed) ++cachingdms_bad_uses; m_cacheUsed = false; #endif } /** * @short Sets the angle using atan2() * @note The advantage is that we can calculate sin/cos faster because we know the tangent */ void setUsing_atan2(const double &y, const double &x); /** * @short Sets the angle using asin() * @param sine Sine of the angle * @note The advantage is that we can cache the sine value supplied * @note The limited range of asin must be borne in mind */ void setUsing_asin(const double &sine); /** * @short Sets the angle using acos() * @param cosine Cosine of the angle * @note The advantage is that we can cache the cosine value supplied * @note The limited range of acos must be borne in mind */ void setUsing_acos(const double &cosine); /** * @short Get the sine and cosine together * @note Re-implements dms::SinCos() * @note This just uses the cached values assuming that they are good */ inline void SinCos(double &s, double &c) const { s = m_sin; c = m_cos; #ifdef COUNT_DMS_SINCOS_CALLS cachingdms_delta += 2; m_cacheUsed = true; #endif } /** * @short Get the sine of this angle * @note Re-implements dms::sin() * @note This just uses the cached value assuming that it is good */ inline double sin() const { #ifdef COUNT_DMS_SINCOS_CALLS ++cachingdms_delta; m_cacheUsed = true; #endif return m_sin; } /** * @short Get the cosine of this angle * @note Re-implements dms::cos() * @note This just uses the cached value assuming that it is good */ inline double cos() const { #ifdef COUNT_DMS_SINCOS_CALLS ++cachingdms_delta; m_cacheUsed = true; #endif return m_cos; } /** * @short Construct an angle from the given string * @note Re-implements dms::fromString() */ static CachingDms fromString(const QString &s, bool deg); /** * @short operator - * @note In addition to negating the angle, we negate the sine value */ CachingDms operator-(); /** * @short Casting constructor */ CachingDms(const dms &angle); #ifdef COUNT_DMS_SINCOS_CALLS /** * Copy constructor that sets m_cacheUsed to true */ CachingDms(const CachingDms &o); CachingDms &operator=(const CachingDms &o); #endif private: double m_sin, m_cos; // Cached values /** * @short Private constructor used to create a CachingDms with known sine and cosine */ explicit CachingDms(const double °rees, const double &sine, const double &cosine) : dms(degrees), m_sin(sine), m_cos(cosine) { #ifdef COUNT_DMS_SINCOS_CALLS ++cachingdms_constructor_calls; m_cacheUsed = false; #endif } /** * @short Addition and subtraction operators * @note Uses trigonometric identities to find the new trigonometric values * @note Avoid repeated use, as the round-off errors will accumulate! */ friend CachingDms operator+(const CachingDms &, const CachingDms &); friend CachingDms operator-(const CachingDms &, const CachingDms &); friend CachingDms operator+(const dms &a, const CachingDms &b); friend CachingDms operator-(const dms &a, const CachingDms &b); friend CachingDms operator+(const CachingDms &a, const dms &b); friend CachingDms operator-(const CachingDms &a, const dms &b); #ifdef COUNT_DMS_SINCOS_CALLS private: mutable bool m_cacheUsed; public: static unsigned long cachingdms_constructor_calls; static long cachingdms_delta; // difference of ( trig function calls ) - ( trig computations ) static unsigned long cachingdms_bad_uses; #endif }; diff --git a/kstars/auxiliary/filedownloader.h b/kstars/auxiliary/filedownloader.h index b15150bdb..7d490236d 100644 --- a/kstars/auxiliary/filedownloader.h +++ b/kstars/auxiliary/filedownloader.h @@ -1,87 +1,87 @@ /* KStars File Downloader * Copyright (C) 2016 Jasem Mutlaq Adapted from https://wiki.qt.io/Download_Data_from_URL 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. */ #pragma once #include #include #include #include #include #include #include #include class QProgressDialog; class FileDownloader : public QObject { Q_OBJECT public: explicit FileDownloader(QObject *parent = nullptr); - virtual ~FileDownloader(); + ~FileDownloader() override; void get(const QUrl &fileUrl); void post(const QUrl &fileUrl, QByteArray &data); void post(const QUrl &fileUrl, QHttpMultiPart *parts); QByteArray downloadedData() const; QUrl getDownloadedFileURL() const; bool setDownloadedFileURL(const QUrl &DownloadedFile); void setProgressDialogEnabled(bool ShowProgressDialog, const QString &textTitle = QString(), const QString &textLabel = QString()); // Callbacks to verify data before being accepted void registerDataVerification(std::function verifyFunc) { m_verifyData = verifyFunc; } void registerFileVerification(std::function verifyFile){ m_verifyFile = verifyFile; } signals: void downloaded(); void canceled(); void error(const QString &errorString); void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); private slots: void dataFinished(QNetworkReply *pReply); void dataReady(); void slotError(); void setDownloadProgress(qint64 bytesReceived, qint64 bytesTotal); private: QNetworkAccessManager m_WebCtrl; QByteArray m_DownloadedData; // Downloaded file QUrl m_DownloadedFileURL; // Temporary file used until download is successful QTemporaryFile m_downloadTemporaryFile; // Network reply QNetworkReply *m_Reply { nullptr }; // Optional Progress dialog bool m_ShowProgressDialog { false }; #ifndef KSTARS_LITE QProgressDialog *progressDialog { nullptr }; #endif bool isCancelled { false }; QString label; QString title; std::function m_verifyData; std::function m_verifyFile; }; diff --git a/kstars/auxiliary/imageexporter.h b/kstars/auxiliary/imageexporter.h index d9455b93e..2fafe7806 100644 --- a/kstars/auxiliary/imageexporter.h +++ b/kstars/auxiliary/imageexporter.h @@ -1,110 +1,110 @@ /*************************************************************************** imageexporter.h - K Desktop Planetarium ------------------- begin : Sun 13 Jan 2013 00:44:47 CST copyright : (c) 2013 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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 IMAGEEXPORTER_H #define IMAGEEXPORTER_H #include "../printing/legend.h" #include class KStars; class QSize; /** * @class ImageExporter * @short Backends for exporting a sky image, either raster or vector, with a legend * @author Rafał Kułaga * @author Akarsh Simha */ class ImageExporter : public QObject { Q_OBJECT public: /** * @short Constructor */ explicit ImageExporter(QObject *parent = nullptr); /** * @short Destructor */ - ~ImageExporter(); + ~ImageExporter() override; /** * @return last error message */ inline QString getLastErrorMessage() const { return m_lastErrorMessage; } public Q_SLOTS: /** * @short Exports an image with the defined settings. * @param url URL of the exported image * @return false if the URL was a network location and uploading to the network location failed * @note This method calls an SVG backend instead if the file extension is svg. Otherwise, it draws raster. */ bool exportImage(QString url); /** * @short Set the legend properties * @param type Legend type. (See enum LEGEND_TYPE in legend.h) * @param orientation Legend orientation. (See LEGEND_ORIENTATION in legend.h) * @param position Legend position. (See LEGEND_POSITION in legend.h) * @param alpha Legend alpha (transparency). Default value is 160. * @param include Include the legend? */ void setLegendProperties(Legend::LEGEND_TYPE type, Legend::LEGEND_ORIENTATION orientation, Legend::LEGEND_POSITION position, int alpha = 160, bool include = true); /** * @short Include legend? * @param include The legend will be included if the flag is set to true */ inline void includeLegend(bool include) { m_includeLegend = include; } /** * @short Set legend transparency * @param alpha Transparency level */ void setLegendAlpha(int alpha); /** * @short Set the size of output raster images * @param size a pointer to a QSize containing the size of images. If a null pointer is supplied, the SkyMap size is used. * @note If size is larger than the skymap size, then the sky image is padded; if it is smaller, then it is cropped. No rescaling is done. */ void setRasterOutputSize(const QSize *size); /** * @return a pointer to the legend used */ inline Legend *getLegend() { return m_Legend; } private: void exportSvg(const QString &fileName); bool exportRasterGraphics(const QString &fileName); void addLegend(SkyQPainter *painter); void addLegend(QPaintDevice *pd); bool m_includeLegend; Legend *m_Legend; QSize *m_Size; QString m_lastErrorMessage; }; #endif diff --git a/kstars/auxiliary/imageviewer.h b/kstars/auxiliary/imageviewer.h index 896616b83..fd01f986c 100644 --- a/kstars/auxiliary/imageviewer.h +++ b/kstars/auxiliary/imageviewer.h @@ -1,129 +1,129 @@ /*************************************************************************** imageviewer.h - An ImageViewer for KStars ------------------- begin : Mon Aug 27 2001 copyright : (C) 2001 by Thomas Kabelmann email : tk78@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "auxiliary/filedownloader.h" #include #include #include #include #include #include class QLabel; class ImageLabel : public QFrame { Q_OBJECT public: explicit ImageLabel(QWidget *parent); - ~ImageLabel(); + ~ImageLabel() override; void setImage(const QImage &img); void invertPixels(); QImage m_Image; // ImageViewer needs access to the image in order to modify it protected: - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; - void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *) override; private: QPixmap pix; }; /** * @class ImageViewer * @short Image viewer window for KStars * @author Thomas Kabelmann * @author Jasem Mutlaq * @version 1.1 * * This image-viewer automatically resizes the picture. The output * works with kio-slaves and not directly with the QImage save-routines * because normally the image-files are in GIF-format and QT does not * save these files. For other formats, like PNG, this is not so important * because they can directly saved by QImage. * * The download-slave works asynchron so the parent-widget can be used at * this time. The save-slave works synchronously, but this is not important * because the files are at this time local saved and this works not so long. */ class ImageViewer : public QDialog { Q_OBJECT public: /** Creates empty viewer. */ explicit ImageViewer(const QString &caption, QWidget *parent = nullptr); /** Create image viewer from URL with caption */ explicit ImageViewer(const QUrl &imageURL, const QString &capText = QString(), QWidget *parent = nullptr); /** Destructor. If there is a partially downloaded image file, delete it.*/ - ~ImageViewer(); + ~ImageViewer() override; /** * @brief loadImage Load image from local file and display it * @param filename path to local image * @return True if opened and displayed, false otherwise */ bool loadImage(const QString &filename); private: /** * Display the downloaded image. Resize the window to fit the image, If the image is * larger than the screen, make the image as large as possible while preserving the * original aspect ratio */ bool showImage(); /** Download the image file pointed to by the URL string. */ void loadImageFromURL(); /** Save the downloaded image to a local file. */ void saveFile(QUrl &url); QFile file; const QUrl m_ImageUrl; bool fileIsImage { false }; QString filename; FileDownloader downloadJob; ImageLabel *m_View { nullptr }; QLabel *m_Caption { nullptr }; // Share among image viewers static QUrl lastURL; private slots: /** Initialize (common part of onstructors) */ void init(QString caption, QString capText); /** Make sure download has finished, then make sure file exists, then display the image */ //void downloadReady (KJob *); void downloadReady(); void downloadError(const QString &errorString); /** Saves file to disc. */ void saveFileToDisc(); /** Inverts colors **/ void invertColors(); }; diff --git a/kstars/auxiliary/kswizard.h b/kstars/auxiliary/kswizard.h index a19c26f47..3dfa578c3 100644 --- a/kstars/auxiliary/kswizard.h +++ b/kstars/auxiliary/kswizard.h @@ -1,192 +1,192 @@ /*************************************************************************** kswizard.h - description ------------------- begin : Wed 28 Jan 2004 copyright : (C) 2004 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include #include #include #include "ui_wizwelcome.h" #include "ui_wizlocation.h" #include "ui_wizdownload.h" #include "ui_wizdata.h" #include "ui_wizastrometry.h" #include "QProgressIndicator.h" class GeoLocation; class QStackedWidget; class WizWelcomeUI : public QFrame, public Ui::WizWelcome { Q_OBJECT public: explicit WizWelcomeUI(QWidget *parent = nullptr); }; class WizLocationUI : public QFrame, public Ui::WizLocation { Q_OBJECT public: explicit WizLocationUI(QWidget *parent = nullptr); }; class WizDataUI : public QFrame, public Ui::WizData { Q_OBJECT public: explicit WizDataUI(QWidget *parent = nullptr); }; class WizAstrometryUI : public QFrame, public Ui::WizAstrometry { Q_OBJECT public: explicit WizAstrometryUI(QWidget *parent = nullptr); }; class WizDownloadUI : public QFrame, public Ui::WizDownload { Q_OBJECT public: explicit WizDownloadUI(QWidget *parent = nullptr); }; /** * @class KSWizard * The Setup Wizard will be automatically opened when KStars runs * for the first time. It allows the user to set up some basic parameters: * @li Geographic Location * @li Download extra data files * * @author Jason Harris * @version 1.0 */ class KSWizard : public QDialog { Q_OBJECT public: /** * Constructor * @param parent Pointer to the parent widget */ explicit KSWizard(QWidget *parent = nullptr); - virtual ~KSWizard(); + ~KSWizard() override; /** @return pointer to the geographic location selected by the user */ const GeoLocation *geo() const { return Geo; } private slots: void slotNextPage(); void slotPrevPage(); /** * Set the geo pointer to the user's selected city, and display * its longitude and latitude in the window. * @note called when the highlighted city in the list box changes */ void slotChangeCity(); /** * Display only those cities which meet the user's search criteria in the city list box. * @note called when one of the name filters is modified */ void slotFilterCities(); void slotDownload(); void slotFinishWizard(); void slotUpdateText(); void slotOpenOrCreateAstrometryFolder(); void slotInstallGSC(); void slotExtractGSC(); void slotCheckDownloadProgress(); void slotGSCInstallerFinished(); void slotInstallPip(); void slotInstallPyfits(); void slotInstallNetpbm(); void slotInstallerFinished(); void slotUpdateDataButtons(); void slotOpenOrCopyKStarsDataDirectory(); private: /** * @short Initialize the geographic location page. * Populate the city list box, and highlight the current location in the list. */ void initGeoPage(); /** @short set enabled/disable state of Next/Prev buttins based on current page */ void setButtonsEnabled(); #ifdef Q_OS_OSX bool brewExists(); bool pythonExists(); bool GSCExists(); bool pipExists(); bool pyfitsExists(); bool netpbmExists(); bool dataDirExists(); bool astrometryDirExists(); void updateAstrometryButtons(); QProcess *install { nullptr }; QProgressIndicator *installMonitor { nullptr }; QProgressIndicator *gscMonitor { nullptr }; QTimer *downloadMonitor { nullptr }; QString gscZipPath; #endif QStackedWidget *wizardStack { nullptr }; WizWelcomeUI *welcome { nullptr }; WizLocationUI *location { nullptr }; WizDataUI *data { nullptr }; WizAstrometryUI *astrometry { nullptr }; QPushButton *nextB { nullptr }; QPushButton *backB { nullptr }; QDialogButtonBox *buttonBox { nullptr }; GeoLocation *Geo { nullptr }; QList filteredCityList; }; diff --git a/kstars/auxiliary/qcustomplot.h b/kstars/auxiliary/qcustomplot.h index 40bd23c9a..390461728 100644 --- a/kstars/auxiliary/qcustomplot.h +++ b/kstars/auxiliary/qcustomplot.h @@ -1,7030 +1,7030 @@ /*************************************************************************** ** ** ** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** Copyright (C) 2011-2016 Emanuel Eichhammer ** ** ** ** This program 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 3 of the License, or ** ** (at your option) any later version. ** ** ** ** This program is distributed in the hope that it will be useful, ** ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** ** GNU General Public License for more details. ** ** ** ** You should have received a copy of the GNU General Public License ** ** along with this program. If not, see http://www.gnu.org/licenses/. ** ** ** **************************************************************************** ** Author: Emanuel Eichhammer ** ** Website/Contact: http://www.qcustomplot.com/ ** ** Date: 13.09.16 ** ** Version: 2.0.0-beta ** ****************************************************************************/ #ifndef QCUSTOMPLOT_H #define QCUSTOMPLOT_H #include // some Qt version/configuration dependent macros to include or exclude certain code paths: #ifdef QCUSTOMPLOT_USE_OPENGL #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #define QCP_OPENGL_PBUFFER #else #define QCP_OPENGL_FBO #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) #define QCP_OPENGL_OFFSCREENSURFACE #endif #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) #define QCP_DEVICEPIXELRATIO_SUPPORTED #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef QCP_OPENGL_FBO #include #include #ifdef QCP_OPENGL_OFFSCREENSURFACE #include #else #include #endif #endif #ifdef QCP_OPENGL_PBUFFER #include #endif #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include #include #include #include #else #include #include #include #endif class QCPPainter; class QCustomPlot; class QCPLayerable; class QCPLayoutElement; class QCPLayout; class QCPAxis; class QCPAxisRect; class QCPAxisPainterPrivate; class QCPAbstractPlottable; class QCPGraph; class QCPAbstractItem; class QCPPlottableInterface1D; class QCPLegend; class QCPItemPosition; class QCPLayer; class QCPAbstractLegendItem; class QCPSelectionRect; class QCPColorMap; class QCPColorScale; class QCPBars; /* including file 'src/global.h', size 16131 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ // decl definitions for shared library compilation/usage: #if defined(QCUSTOMPLOT_COMPILE_LIBRARY) #define QCP_LIB_DECL Q_DECL_EXPORT #elif defined(QCUSTOMPLOT_USE_LIBRARY) #define QCP_LIB_DECL Q_DECL_IMPORT #else #define QCP_LIB_DECL #endif -// define empty macro for Q_DECL_OVERRIDE if it doesn't exist (Qt < 5) -#ifndef Q_DECL_OVERRIDE -#define Q_DECL_OVERRIDE +// define empty macro for override if it doesn't exist (Qt < 5) +#ifndef override +#define override #endif /*! The QCP Namespace contains general enums, QFlags and functions used throughout the QCustomPlot library. It provides QMetaObject-based reflection of its enums and flags via \a QCP::staticMetaObject. */ #ifndef Q_MOC_RUN namespace QCP { #else class QCP // when in moc-run, make it look like a class, so we get Q_GADGET, Q_ENUM/Q_FLAGS features in namespace { Q_GADGET Q_ENUM(ExportPen) Q_ENUM(ResolutionUnit) Q_ENUM(SignDomain) Q_ENUM(MarginSide) Q_FLAGS(MarginSides) Q_ENUM(AntialiasedElement) Q_FLAGS(AntialiasedElements) Q_ENUM(PlottingHint) Q_FLAGS(PlottingHints) Q_ENUM(Interaction) Q_FLAGS(Interactions) Q_ENUM(SelectionRectMode) Q_ENUM(SelectionType) public: #endif /*! Defines the different units in which the image resolution can be specified in the export functions. \see QCustomPlot::savePng, QCustomPlot::saveJpg, QCustomPlot::saveBmp, QCustomPlot::saveRastered */ enum ResolutionUnit { ruDotsPerMeter ///< Resolution is given in dots per meter (dpm) , ruDotsPerCentimeter ///< Resolution is given in dots per centimeter (dpcm) , ruDotsPerInch ///< Resolution is given in dots per inch (DPI/PPI) }; /*! Defines how cosmetic pens (pens with numerical width 0) are handled during export. \see QCustomPlot::savePdf */ enum ExportPen { epNoCosmetic ///< Cosmetic pens are converted to pens with pixel width 1 when exporting , epAllowCosmetic ///< Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on screen, independent of viewer zoom level) }; /*! Represents negative and positive sign domain, e.g. for passing to \ref QCPAbstractPlottable::getKeyRange and \ref QCPAbstractPlottable::getValueRange. This is primarily needed when working with logarithmic axis scales, since only one of the sign domains can be visible at a time. */ enum SignDomain { sdNegative ///< The negative sign domain, i.e. numbers smaller than zero , sdBoth ///< Both sign domains, including zero, i.e. all numbers , sdPositive ///< The positive sign domain, i.e. numbers greater than zero }; /*! Defines the sides of a rectangular entity to which margins can be applied. \see QCPLayoutElement::setAutoMargins, QCPAxisRect::setAutoMargins */ enum MarginSide { msLeft = 0x01 ///< 0x01 left margin , msRight = 0x02 ///< 0x02 right margin , msTop = 0x04 ///< 0x04 top margin , msBottom = 0x08 ///< 0x08 bottom margin , msAll = 0xFF ///< 0xFF all margins , msNone = 0x00 ///< 0x00 no margin }; Q_DECLARE_FLAGS(MarginSides, MarginSide) /*! Defines what objects of a plot can be forcibly drawn antialiased/not antialiased. If an object is neither forcibly drawn antialiased nor forcibly drawn not antialiased, it is up to the respective element how it is drawn. Typically it provides a \a setAntialiased function for this. \c AntialiasedElements is a flag of or-combined elements of this enum type. \see QCustomPlot::setAntialiasedElements, QCustomPlot::setNotAntialiasedElements */ enum AntialiasedElement { aeAxes = 0x0001 ///< 0x0001 Axis base line and tick marks , aeGrid = 0x0002 ///< 0x0002 Grid lines , aeSubGrid = 0x0004 ///< 0x0004 Sub grid lines , aeLegend = 0x0008 ///< 0x0008 Legend box , aeLegendItems = 0x0010 ///< 0x0010 Legend items , aePlottables = 0x0020 ///< 0x0020 Main lines of plottables , aeItems = 0x0040 ///< 0x0040 Main lines of items , aeScatters = 0x0080 ///< 0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) , aeFills = 0x0100 ///< 0x0100 Borders of fills (e.g. under or between graphs) , aeZeroLine = 0x0200 ///< 0x0200 Zero-lines, see \ref QCPGrid::setZeroLinePen , aeOther = 0x8000 ///< 0x8000 Other elements that don't fit into any of the existing categories , aeAll = 0xFFFF ///< 0xFFFF All elements , aeNone = 0x0000 ///< 0x0000 No elements }; Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement) /*! Defines plotting hints that control various aspects of the quality and speed of plotting. \see QCustomPlot::setPlottingHints */ enum PlottingHint { phNone = 0x000 ///< 0x000 No hints are set , phFastPolylines = 0x001 ///< 0x001 Graph/Curve lines are drawn with a faster method. This reduces the quality especially of the line segment ///< joins, thus is most effective for pen sizes larger than 1. It is only used for solid line pens. , phImmediateRefresh = 0x002 ///< 0x002 causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called with parameter \ref QCustomPlot::rpRefreshHint. ///< This is set by default to prevent the plot from freezing on fast consecutive replots (e.g. user drags ranges with mouse). , phCacheLabels = 0x004 ///< 0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance. }; Q_DECLARE_FLAGS(PlottingHints, PlottingHint) /*! Defines the mouse interactions possible with QCustomPlot. \c Interactions is a flag of or-combined elements of this enum type. \see QCustomPlot::setInteractions */ enum Interaction { iRangeDrag = 0x001 ///< 0x001 Axis ranges are draggable (see \ref QCPAxisRect::setRangeDrag, \ref QCPAxisRect::setRangeDragAxes) , iRangeZoom = 0x002 ///< 0x002 Axis ranges are zoomable with the mouse wheel (see \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeZoomAxes) , iMultiSelect = 0x004 ///< 0x004 The user can select multiple objects by holding the modifier set by \ref QCustomPlot::setMultiSelectModifier while clicking , iSelectPlottables = 0x008 ///< 0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) , iSelectAxes = 0x010 ///< 0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts) , iSelectLegend = 0x020 ///< 0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) , iSelectItems = 0x040 ///< 0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see \ref QCPAbstractItem) , iSelectOther = 0x080 ///< 0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements,...) }; Q_DECLARE_FLAGS(Interactions, Interaction) /*! Defines the behaviour of the selection rect. \see QCustomPlot::setSelectionRectMode, QCustomPlot::selectionRect, QCPSelectionRect */ enum SelectionRectMode { srmNone ///< The selection rect is disabled, and all mouse events are forwarded to the underlying objects, e.g. for axis range dragging , srmZoom ///< When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently set as range zoom axes (\ref QCPAxisRect::setRangeZoomAxes) will have their ranges zoomed accordingly. , srmSelect ///< When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that were within the selection rect are selected, if the plottable's selectability setting permits. (See \ref dataselection "data selection mechanism" for details.) , srmCustom ///< When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to connect according slots to the selection rect's signals (e.g. \ref QCPSelectionRect::accepted) in order to process the user interaction. }; /*! Defines the different ways a plottable can be selected. These images show the effect of the different selection types, when the indicated selection rect was dragged:
\image html selectiontype-none.png stNone \image html selectiontype-whole.png stWhole \image html selectiontype-singledata.png stSingleData \image html selectiontype-datarange.png stDataRange \image html selectiontype-multipledataranges.png stMultipleDataRanges
\see QCPAbstractPlottable::setSelectable, QCPDataSelection::enforceType */ enum SelectionType { stNone ///< The plottable is not selectable , stWhole ///< Selection behaves like \ref stMultipleDataRanges, but if there are any data points selected, the entire plottable is drawn as selected. , stSingleData ///< One individual data point can be selected at a time , stDataRange ///< Multiple contiguous data points (a data range) can be selected , stMultipleDataRanges ///< Any combination of data points/ranges can be selected }; /*! \internal Returns whether the specified \a value is considered an invalid data value for plottables (i.e. is \e nan or \e +/-inf). This function is used to check data validity upon replots, when the compiler flag \c QCUSTOMPLOT_CHECK_DATA is set. */ inline bool isInvalidData(double value) { return qIsNaN(value) || qIsInf(value); } /*! \internal \overload Checks two arguments instead of one. */ inline bool isInvalidData(double value1, double value2) { return isInvalidData(value1) || isInvalidData(value2); } /*! \internal Sets the specified \a side of \a margins to \a value \see getMarginValue */ inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value) { switch (side) { case QCP::msLeft: margins.setLeft(value); break; case QCP::msRight: margins.setRight(value); break; case QCP::msTop: margins.setTop(value); break; case QCP::msBottom: margins.setBottom(value); break; case QCP::msAll: margins = QMargins(value, value, value, value); break; default: break; } } /*! \internal Returns the value of the specified \a side of \a margins. If \a side is \ref QCP::msNone or \ref QCP::msAll, returns 0. \see setMarginValue */ inline int getMarginValue(const QMargins &margins, QCP::MarginSide side) { switch (side) { case QCP::msLeft: return margins.left(); case QCP::msRight: return margins.right(); case QCP::msTop: return margins.top(); case QCP::msBottom: return margins.bottom(); default: break; } return 0; } extern const QMetaObject staticMetaObject; // in moc-run we create a static meta object for QCP "fake" object. This line is the link to it via QCP::staticMetaObject in normal operation as namespace } // end of namespace QCP Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions) Q_DECLARE_METATYPE(QCP::ExportPen) Q_DECLARE_METATYPE(QCP::ResolutionUnit) Q_DECLARE_METATYPE(QCP::SignDomain) Q_DECLARE_METATYPE(QCP::MarginSide) Q_DECLARE_METATYPE(QCP::AntialiasedElement) Q_DECLARE_METATYPE(QCP::PlottingHint) Q_DECLARE_METATYPE(QCP::Interaction) Q_DECLARE_METATYPE(QCP::SelectionRectMode) Q_DECLARE_METATYPE(QCP::SelectionType) /* end of 'src/global.h' */ /* including file 'src/vector2d.h', size 4928 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPVector2D { public: QCPVector2D(); QCPVector2D(double x, double y); QCPVector2D(const QPoint &point); QCPVector2D(const QPointF &point); // getters: double x() const { return mX; } double y() const { return mY; } double &rx() { return mX; } double &ry() { return mY; } // setters: void setX(double x) { mX = x; } void setY(double y) { mY = y; } // non-virtual methods: double length() const { return qSqrt(mX * mX + mY * mY); } double lengthSquared() const { return mX * mX + mY * mY; } QPoint toPoint() const { return QPoint(mX, mY); } QPointF toPointF() const { return QPointF(mX, mY); } bool isNull() const { return qIsNull(mX) && qIsNull(mY); } void normalize(); QCPVector2D normalized() const; QCPVector2D perpendicular() const { return QCPVector2D(-mY, mX); } double dot(const QCPVector2D &vec) const { return mX * vec.mX + mY * vec.mY; } double distanceSquaredToLine(const QCPVector2D &start, const QCPVector2D &end) const; double distanceSquaredToLine(const QLineF &line) const; double distanceToStraightLine(const QCPVector2D &base, const QCPVector2D &direction) const; QCPVector2D &operator*=(double factor); QCPVector2D &operator/=(double divisor); QCPVector2D &operator+=(const QCPVector2D &vector); QCPVector2D &operator-=(const QCPVector2D &vector); private: // property members: double mX, mY; friend inline const QCPVector2D operator*(double factor, const QCPVector2D &vec); friend inline const QCPVector2D operator*(const QCPVector2D &vec, double factor); friend inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor); friend inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2); friend inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2); friend inline const QCPVector2D operator-(const QCPVector2D &vec); }; Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE); inline const QCPVector2D operator*(double factor, const QCPVector2D &vec) { return QCPVector2D(vec.mX * factor, vec.mY * factor); } inline const QCPVector2D operator*(const QCPVector2D &vec, double factor) { return QCPVector2D(vec.mX * factor, vec.mY * factor); } inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor) { return QCPVector2D(vec.mX / divisor, vec.mY / divisor); } inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX + vec2.mX, vec1.mY + vec2.mY); } inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX - vec2.mX, vec1.mY - vec2.mY); } inline const QCPVector2D operator-(const QCPVector2D &vec) { return QCPVector2D(-vec.mX, -vec.mY); } /*! \relates QCPVector2D Prints \a vec in a human readable format to the qDebug output. */ inline QDebug operator<<(QDebug d, const QCPVector2D &vec) { d.nospace() << "QCPVector2D(" << vec.x() << ", " << vec.y() << ")"; return d.space(); } /* end of 'src/vector2d.h' */ /* including file 'src/painter.h', size 4035 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPPainter : public QPainter { Q_GADGET public: /*! Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds, depending on whether they are wanted on the respective output device. */ enum PainterMode { pmDefault = 0x00 ///< 0x00 Default mode for painting on screen devices , pmVectorized = 0x01 ///< 0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fixes. , pmNoCaching = 0x02 ///< 0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels , pmNonCosmetic = 0x04 ///< 0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.) }; Q_ENUM(PainterMode) Q_FLAGS(PainterModes) Q_DECLARE_FLAGS(PainterModes, PainterMode) QCPPainter(); explicit QCPPainter(QPaintDevice *device); // getters: bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); } PainterModes modes() const { return mModes; } // setters: void setAntialiasing(bool enabled); void setMode(PainterMode mode, bool enabled = true); void setModes(PainterModes modes); // methods hiding non-virtual base class functions (QPainter bug workarounds): bool begin(QPaintDevice *device); void setPen(const QPen &pen); void setPen(const QColor &color); void setPen(Qt::PenStyle penStyle); void drawLine(const QLineF &line); void drawLine(const QPointF &p1, const QPointF &p2) { drawLine(QLineF(p1, p2)); } void save(); void restore(); // non-virtual methods: void makeNonCosmetic(); protected: // property members: PainterModes mModes; bool mIsAntialiasing; // non-property members: QStack mAntialiasingStack; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes) Q_DECLARE_METATYPE(QCPPainter::PainterMode) /* end of 'src/painter.h' */ /* including file 'src/paintbuffer.h', size 4958 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAbstractPaintBuffer { public: explicit QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio); virtual ~QCPAbstractPaintBuffer(); // getters: QSize size() const { return mSize; } bool invalidated() const { return mInvalidated; } double devicePixelRatio() const { return mDevicePixelRatio; } // setters: void setSize(const QSize &size); void setInvalidated(bool invalidated = true); void setDevicePixelRatio(double ratio); // introduced virtual methods: virtual QCPPainter *startPainting() = 0; virtual void donePainting() {} virtual void draw(QCPPainter *painter) const = 0; virtual void clear(const QColor &color) = 0; protected: // property members: QSize mSize; double mDevicePixelRatio; // non-property members: bool mInvalidated; // introduced virtual methods: virtual void reallocateBuffer() = 0; }; class QCP_LIB_DECL QCPPaintBufferPixmap : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio); - virtual ~QCPPaintBufferPixmap(); + ~QCPPaintBufferPixmap() override; // reimplemented virtual methods: - virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; - void clear(const QColor &color) Q_DECL_OVERRIDE; + QCPPainter *startPainting() override; + void draw(QCPPainter *painter) const override; + void clear(const QColor &color) override; protected: // non-property members: QPixmap mBuffer; // reimplemented virtual methods: - virtual void reallocateBuffer() Q_DECL_OVERRIDE; + void reallocateBuffer() override; }; #ifdef QCP_OPENGL_PBUFFER class QCP_LIB_DECL QCPPaintBufferGlPbuffer : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferGlPbuffer(const QSize &size, double devicePixelRatio, int multisamples); virtual ~QCPPaintBufferGlPbuffer(); // reimplemented virtual methods: - virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; - void clear(const QColor &color) Q_DECL_OVERRIDE; + virtual QCPPainter *startPainting() override; + virtual void draw(QCPPainter *painter) const override; + void clear(const QColor &color) override; protected: // non-property members: QGLPixelBuffer *mGlPBuffer; int mMultisamples; // reimplemented virtual methods: - virtual void reallocateBuffer() Q_DECL_OVERRIDE; + virtual void reallocateBuffer() override; }; #endif // QCP_OPENGL_PBUFFER #ifdef QCP_OPENGL_FBO class QCP_LIB_DECL QCPPaintBufferGlFbo : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferGlFbo(const QSize &size, double devicePixelRatio, QWeakPointer glContext, QWeakPointer glPaintDevice); virtual ~QCPPaintBufferGlFbo(); // reimplemented virtual methods: - virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; - virtual void donePainting() Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; - void clear(const QColor &color) Q_DECL_OVERRIDE; + virtual QCPPainter *startPainting() override; + virtual void donePainting() override; + virtual void draw(QCPPainter *painter) const override; + void clear(const QColor &color) override; protected: // non-property members: QWeakPointer mGlContext; QWeakPointer mGlPaintDevice; QOpenGLFramebufferObject *mGlFrameBuffer; // reimplemented virtual methods: - virtual void reallocateBuffer() Q_DECL_OVERRIDE; + virtual void reallocateBuffer() override; }; #endif // QCP_OPENGL_FBO /* end of 'src/paintbuffer.h' */ /* including file 'src/layer.h', size 6885 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPLayer : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot) Q_PROPERTY(QString name READ name) Q_PROPERTY(int index READ index) Q_PROPERTY(QList children READ children) Q_PROPERTY(bool visible READ visible WRITE setVisible) Q_PROPERTY(LayerMode mode READ mode WRITE setMode) /// \endcond public: /*! Defines the different rendering modes of a layer. Depending on the mode, certain layers can be replotted individually, without the need to replot (possibly complex) layerables on other layers. \see setMode */ enum LayerMode { lmLogical ///< Layer is used only for rendering order, and shares paint buffer with all other adjacent logical layers. , lmBuffered ///< Layer has its own paint buffer and may be replotted individually (see \ref replot). }; Q_ENUM(LayerMode) QCPLayer(QCustomPlot *parentPlot, const QString &layerName); - virtual ~QCPLayer(); + ~QCPLayer() override; // getters: QCustomPlot *parentPlot() const { return mParentPlot; } QString name() const { return mName; } int index() const { return mIndex; } QList children() const { return mChildren; } bool visible() const { return mVisible; } LayerMode mode() const { return mMode; } // setters: void setVisible(bool visible); void setMode(LayerMode mode); // non-virtual methods: void replot(); protected: // property members: QCustomPlot *mParentPlot; QString mName; int mIndex; QList mChildren; bool mVisible; LayerMode mMode; // non-property members: QWeakPointer mPaintBuffer; // non-virtual methods: void draw(QCPPainter *painter); void drawToPaintBuffer(); void addChild(QCPLayerable *layerable, bool prepend); void removeChild(QCPLayerable *layerable); private: Q_DISABLE_COPY(QCPLayer) friend class QCustomPlot; friend class QCPLayerable; }; Q_DECLARE_METATYPE(QCPLayer::LayerMode) class QCP_LIB_DECL QCPLayerable : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool visible READ visible WRITE setVisible) Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot) Q_PROPERTY(QCPLayerable *parentLayerable READ parentLayerable) Q_PROPERTY(QCPLayer *layer READ layer WRITE setLayer NOTIFY layerChanged) Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased) /// \endcond public: QCPLayerable(QCustomPlot *plot, QString targetLayer = QString(), QCPLayerable *parentLayerable = 0); - virtual ~QCPLayerable(); + ~QCPLayerable() override; // getters: bool visible() const { return mVisible; } QCustomPlot *parentPlot() const { return mParentPlot; } QCPLayerable *parentLayerable() const { return mParentLayerable.data(); } QCPLayer *layer() const { return mLayer; } bool antialiased() const { return mAntialiased; } // setters: void setVisible(bool on); Q_SLOT bool setLayer(QCPLayer *layer); bool setLayer(const QString &layerName); void setAntialiased(bool enabled); // introduced virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const; // non-property methods: bool realVisibility() const; signals: void layerChanged(QCPLayer *newLayer); protected: // property members: bool mVisible; QCustomPlot *mParentPlot; QPointer mParentLayerable; QCPLayer *mLayer; bool mAntialiased; // introduced virtual methods: virtual void parentPlotInitialized(QCustomPlot *parentPlot); virtual QCP::Interaction selectionCategory() const; virtual QRect clipRect() const; virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0; virtual void draw(QCPPainter *painter) = 0; // selection events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged); virtual void deselectEvent(bool *selectionStateChanged); // low-level mouse events: virtual void mousePressEvent(QMouseEvent *event, const QVariant &details); virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos); virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos); virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details); virtual void wheelEvent(QWheelEvent *event); // non-property methods: void initializeParentPlot(QCustomPlot *parentPlot); void setParentLayerable(QCPLayerable *parentLayerable); bool moveToLayer(QCPLayer *layer, bool prepend); void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const; private: Q_DISABLE_COPY(QCPLayerable) friend class QCustomPlot; friend class QCPLayer; friend class QCPAxisRect; }; /* end of 'src/layer.h' */ /* including file 'src/axis/range.h', size 5280 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPRange { public: double lower, upper; QCPRange(); QCPRange(double lower, double upper); bool operator==(const QCPRange &other) const { return lower == other.lower && upper == other.upper; } bool operator!=(const QCPRange &other) const { return !(*this == other); } QCPRange &operator+=(const double &value) { lower += value; upper += value; return *this; } QCPRange &operator-=(const double &value) { lower -= value; upper -= value; return *this; } QCPRange &operator*=(const double &value) { lower *= value; upper *= value; return *this; } QCPRange &operator/=(const double &value) { lower /= value; upper /= value; return *this; } friend inline const QCPRange operator+(const QCPRange &, double); friend inline const QCPRange operator+(double, const QCPRange &); friend inline const QCPRange operator-(const QCPRange &range, double value); friend inline const QCPRange operator*(const QCPRange &range, double value); friend inline const QCPRange operator*(double value, const QCPRange &range); friend inline const QCPRange operator/(const QCPRange &range, double value); double size() const { return upper - lower; } double center() const { return (upper + lower) * 0.5; } void normalize() { if (lower > upper) qSwap(lower, upper); } void expand(const QCPRange &otherRange); void expand(double includeCoord); QCPRange expanded(const QCPRange &otherRange) const; QCPRange expanded(double includeCoord) const; QCPRange bounded(double lowerBound, double upperBound) const; QCPRange sanitizedForLogScale() const; QCPRange sanitizedForLinScale() const; bool contains(double value) const { return value >= lower && value <= upper; } static bool validRange(double lower, double upper); static bool validRange(const QCPRange &range); static const double minRange; static const double maxRange; }; Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE); /*! \relates QCPRange Prints \a range in a human readable format to the qDebug output. */ inline QDebug operator<<(QDebug d, const QCPRange &range) { d.nospace() << "QCPRange(" << range.lower << ", " << range.upper << ")"; return d.space(); } /*! Adds \a value to both boundaries of the range. */ inline const QCPRange operator+(const QCPRange &range, double value) { QCPRange result(range); result += value; return result; } /*! Adds \a value to both boundaries of the range. */ inline const QCPRange operator+(double value, const QCPRange &range) { QCPRange result(range); result += value; return result; } /*! Subtracts \a value from both boundaries of the range. */ inline const QCPRange operator-(const QCPRange &range, double value) { QCPRange result(range); result -= value; return result; } /*! Multiplies both boundaries of the range by \a value. */ inline const QCPRange operator*(const QCPRange &range, double value) { QCPRange result(range); result *= value; return result; } /*! Multiplies both boundaries of the range by \a value. */ inline const QCPRange operator*(double value, const QCPRange &range) { QCPRange result(range); result *= value; return result; } /*! Divides both boundaries of the range by \a value. */ inline const QCPRange operator/(const QCPRange &range, double value) { QCPRange result(range); result /= value; return result; } /* end of 'src/axis/range.h' */ /* including file 'src/selection.h', size 8579 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPDataRange { public: QCPDataRange(); QCPDataRange(int begin, int end); bool operator==(const QCPDataRange &other) const { return mBegin == other.mBegin && mEnd == other.mEnd; } bool operator!=(const QCPDataRange &other) const { return !(*this == other); } // getters: int begin() const { return mBegin; } int end() const { return mEnd; } int size() const { return mEnd - mBegin; } int length() const { return size(); } // setters: void setBegin(int begin) { mBegin = begin; } void setEnd(int end) { mEnd = end; } // non-property methods: bool isValid() const { return (mEnd >= mBegin) && (mBegin >= 0); } bool isEmpty() const { return length() == 0; } QCPDataRange bounded(const QCPDataRange &other) const; QCPDataRange expanded(const QCPDataRange &other) const; QCPDataRange intersection(const QCPDataRange &other) const; QCPDataRange adjusted(int changeBegin, int changeEnd) const { return QCPDataRange(mBegin + changeBegin, mEnd + changeEnd); } bool intersects(const QCPDataRange &other) const; bool contains(const QCPDataRange &other) const; private: // property members: int mBegin, mEnd; }; Q_DECLARE_TYPEINFO(QCPDataRange, Q_MOVABLE_TYPE); class QCP_LIB_DECL QCPDataSelection { public: explicit QCPDataSelection(); explicit QCPDataSelection(const QCPDataRange &range); bool operator==(const QCPDataSelection &other) const; bool operator!=(const QCPDataSelection &other) const { return !(*this == other); } QCPDataSelection &operator+=(const QCPDataSelection &other); QCPDataSelection &operator+=(const QCPDataRange &other); QCPDataSelection &operator-=(const QCPDataSelection &other); QCPDataSelection &operator-=(const QCPDataRange &other); friend inline const QCPDataSelection operator+(const QCPDataSelection &a, const QCPDataSelection &b); friend inline const QCPDataSelection operator+(const QCPDataRange &a, const QCPDataSelection &b); friend inline const QCPDataSelection operator+(const QCPDataSelection &a, const QCPDataRange &b); friend inline const QCPDataSelection operator+(const QCPDataRange &a, const QCPDataRange &b); friend inline const QCPDataSelection operator-(const QCPDataSelection &a, const QCPDataSelection &b); friend inline const QCPDataSelection operator-(const QCPDataRange &a, const QCPDataSelection &b); friend inline const QCPDataSelection operator-(const QCPDataSelection &a, const QCPDataRange &b); friend inline const QCPDataSelection operator-(const QCPDataRange &a, const QCPDataRange &b); // getters: int dataRangeCount() const { return mDataRanges.size(); } int dataPointCount() const; QCPDataRange dataRange(int index = 0) const; QList dataRanges() const { return mDataRanges; } QCPDataRange span() const; // non-property methods: void addDataRange(const QCPDataRange &dataRange, bool simplify = true); void clear(); bool isEmpty() const { return mDataRanges.isEmpty(); } void simplify(); void enforceType(QCP::SelectionType type); bool contains(const QCPDataSelection &other) const; QCPDataSelection intersection(const QCPDataRange &other) const; QCPDataSelection intersection(const QCPDataSelection &other) const; QCPDataSelection inverse(const QCPDataRange &outerRange) const; private: // property members: QList mDataRanges; inline static bool lessThanDataRangeBegin(const QCPDataRange &a, const QCPDataRange &b) { return a.begin() < b.begin(); } }; Q_DECLARE_METATYPE(QCPDataSelection) /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataSelection &a, const QCPDataSelection &b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataRange &a, const QCPDataSelection &b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataSelection &a, const QCPDataRange &b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataRange &a, const QCPDataRange &b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataSelection &a, const QCPDataSelection &b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataRange &a, const QCPDataSelection &b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataSelection &a, const QCPDataRange &b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataRange &a, const QCPDataRange &b) { QCPDataSelection result(a); result -= b; return result; } /*! \relates QCPDataRange Prints \a dataRange in a human readable format to the qDebug output. */ inline QDebug operator<<(QDebug d, const QCPDataRange &dataRange) { d.nospace() << "[" << dataRange.begin() << ".." << dataRange.end() - 1 << "]"; return d.space(); } /*! \relates QCPDataSelection Prints \a selection in a human readable format to the qDebug output. */ inline QDebug operator<<(QDebug d, const QCPDataSelection &selection) { d.nospace() << "QCPDataSelection("; for (int i = 0; i < selection.dataRangeCount(); ++i) { if (i != 0) d << ", "; d << selection.dataRange(i); } d << ")"; return d.space(); } /* end of 'src/selection.h' */ /* including file 'src/selectionrect.h', size 3338 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPSelectionRect : public QCPLayerable { Q_OBJECT public: explicit QCPSelectionRect(QCustomPlot *parentPlot); - virtual ~QCPSelectionRect(); + ~QCPSelectionRect() override; // getters: QRect rect() const { return mRect; } QCPRange range(const QCPAxis *axis) const; QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } bool isActive() const { return mActive; } // setters: void setPen(const QPen &pen); void setBrush(const QBrush &brush); // non-property methods: Q_SLOT void cancel(); signals: void started(QMouseEvent *event); void changed(const QRect &rect, QMouseEvent *event); void canceled(const QRect &rect, QInputEvent *event); void accepted(const QRect &rect, QMouseEvent *event); protected: // property members: QRect mRect; QPen mPen; QBrush mBrush; // non-property members: bool mActive; // introduced virtual methods: virtual void startSelection(QMouseEvent *event); virtual void moveSelection(QMouseEvent *event); virtual void endSelection(QMouseEvent *event); virtual void keyPressEvent(QKeyEvent *event); // reimplemented virtual methods - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; friend class QCustomPlot; }; /* end of 'src/selectionrect.h' */ /* including file 'src/layout.h', size 13128 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPMarginGroup : public QObject { Q_OBJECT public: explicit QCPMarginGroup(QCustomPlot *parentPlot); - virtual ~QCPMarginGroup(); + ~QCPMarginGroup() override; // non-virtual methods: QList elements(QCP::MarginSide side) const { return mChildren.value(side); } bool isEmpty() const; void clear(); protected: // non-property members: QCustomPlot *mParentPlot; QHash> mChildren; // introduced virtual methods: virtual int commonMargin(QCP::MarginSide side) const; // non-virtual methods: void addChild(QCP::MarginSide side, QCPLayoutElement *element); void removeChild(QCP::MarginSide side, QCPLayoutElement *element); private: Q_DISABLE_COPY(QCPMarginGroup) friend class QCPLayoutElement; }; class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPLayout *layout READ layout) Q_PROPERTY(QRect rect READ rect) Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect) Q_PROPERTY(QMargins margins READ margins WRITE setMargins) Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) /// \endcond public: /*! Defines the phases of the update process, that happens just before a replot. At each phase, \ref update is called with the according UpdatePhase value. */ enum UpdatePhase { upPreparation ///< Phase used for any type of preparation that needs to be done before margin calculation and layout , upMargins ///< Phase in which the margins are calculated and set , upLayout ///< Final phase in which the layout system places the rects of the elements }; Q_ENUM(UpdatePhase) explicit QCPLayoutElement(QCustomPlot *parentPlot = 0); - virtual ~QCPLayoutElement(); + ~QCPLayoutElement() override; // getters: QCPLayout *layout() const { return mParentLayout; } QRect rect() const { return mRect; } QRect outerRect() const { return mOuterRect; } QMargins margins() const { return mMargins; } QMargins minimumMargins() const { return mMinimumMargins; } QCP::MarginSides autoMargins() const { return mAutoMargins; } QSize minimumSize() const { return mMinimumSize; } QSize maximumSize() const { return mMaximumSize; } QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup *)0); } QHash marginGroups() const { return mMarginGroups; } // setters: void setOuterRect(const QRect &rect); void setMargins(const QMargins &margins); void setMinimumMargins(const QMargins &margins); void setAutoMargins(QCP::MarginSides sides); void setMinimumSize(const QSize &size); void setMinimumSize(int width, int height); void setMaximumSize(const QSize &size); void setMaximumSize(int width, int height); void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group); // introduced virtual methods: virtual void update(UpdatePhase phase); virtual QSize minimumSizeHint() const; virtual QSize maximumSizeHint() const; virtual QList elements(bool recursive) const; // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; protected: // property members: QCPLayout *mParentLayout; QSize mMinimumSize, mMaximumSize; QRect mRect, mOuterRect; QMargins mMargins, mMinimumMargins; QCP::MarginSides mAutoMargins; QHash mMarginGroups; // introduced virtual methods: virtual int calculateAutoMargin(QCP::MarginSide side); virtual void layoutChanged(); // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) } - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) } - virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override { Q_UNUSED(painter) } + void draw(QCPPainter *painter) override { Q_UNUSED(painter) } + void parentPlotInitialized(QCustomPlot *parentPlot) override; private: Q_DISABLE_COPY(QCPLayoutElement) friend class QCustomPlot; friend class QCPLayout; friend class QCPMarginGroup; }; Q_DECLARE_METATYPE(QCPLayoutElement::UpdatePhase) class QCP_LIB_DECL QCPLayout : public QCPLayoutElement { Q_OBJECT public: explicit QCPLayout(); // reimplemented virtual methods: - virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; - virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; + void update(UpdatePhase phase) override; + QList elements(bool recursive) const override; // introduced virtual methods: virtual int elementCount() const = 0; virtual QCPLayoutElement *elementAt(int index) const = 0; virtual QCPLayoutElement *takeAt(int index) = 0; virtual bool take(QCPLayoutElement *element) = 0; virtual void simplify(); // non-virtual methods: bool removeAt(int index); bool remove(QCPLayoutElement *element); void clear(); protected: // introduced virtual methods: virtual void updateLayout(); // non-virtual methods: void sizeConstraintsChanged() const; void adoptElement(QCPLayoutElement *el); void releaseElement(QCPLayoutElement *el); QVector getSectionSizes(QVector maxSizes, QVector minSizes, QVector stretchFactors, int totalSize) const; private: Q_DISABLE_COPY(QCPLayout) friend class QCPLayoutElement; }; class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(int rowCount READ rowCount) Q_PROPERTY(int columnCount READ columnCount) Q_PROPERTY(QList columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors) Q_PROPERTY(QList rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors) Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing) Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing) Q_PROPERTY(FillOrder fillOrder READ fillOrder WRITE setFillOrder) Q_PROPERTY(int wrap READ wrap WRITE setWrap) /// \endcond public: /*! Defines in which direction the grid is filled when using \ref addElement(QCPLayoutElement*). The column/row at which wrapping into the next row/column occurs can be specified with \ref setWrap. \see setFillOrder */ enum FillOrder { foRowsFirst ///< Rows are filled first, and a new element is wrapped to the next column if the row count would exceed \ref setWrap. , foColumnsFirst ///< Columns are filled first, and a new element is wrapped to the next row if the column count would exceed \ref setWrap. }; Q_ENUM(FillOrder) explicit QCPLayoutGrid(); - virtual ~QCPLayoutGrid(); + ~QCPLayoutGrid() override; // getters: int rowCount() const { return mElements.size(); } int columnCount() const { return mElements.size() > 0 ? mElements.first().size() : 0; } QList columnStretchFactors() const { return mColumnStretchFactors; } QList rowStretchFactors() const { return mRowStretchFactors; } int columnSpacing() const { return mColumnSpacing; } int rowSpacing() const { return mRowSpacing; } int wrap() const { return mWrap; } FillOrder fillOrder() const { return mFillOrder; } // setters: void setColumnStretchFactor(int column, double factor); void setColumnStretchFactors(const QList &factors); void setRowStretchFactor(int row, double factor); void setRowStretchFactors(const QList &factors); void setColumnSpacing(int pixels); void setRowSpacing(int pixels); void setWrap(int count); void setFillOrder(FillOrder order, bool rearrange = true); // reimplemented virtual methods: - virtual void updateLayout() Q_DECL_OVERRIDE; - virtual int elementCount() const Q_DECL_OVERRIDE { return rowCount() * columnCount(); } - virtual QCPLayoutElement *elementAt(int index) const Q_DECL_OVERRIDE; - virtual QCPLayoutElement *takeAt(int index) Q_DECL_OVERRIDE; - virtual bool take(QCPLayoutElement *element) Q_DECL_OVERRIDE; - virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; - virtual void simplify() Q_DECL_OVERRIDE; - virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; - virtual QSize maximumSizeHint() const Q_DECL_OVERRIDE; + void updateLayout() override; + int elementCount() const override { return rowCount() * columnCount(); } + QCPLayoutElement *elementAt(int index) const override; + QCPLayoutElement *takeAt(int index) override; + bool take(QCPLayoutElement *element) override; + QList elements(bool recursive) const override; + void simplify() override; + QSize minimumSizeHint() const override; + QSize maximumSizeHint() const override; // non-virtual methods: QCPLayoutElement *element(int row, int column) const; bool addElement(int row, int column, QCPLayoutElement *element); bool addElement(QCPLayoutElement *element); bool hasElement(int row, int column); void expandTo(int newRowCount, int newColumnCount); void insertRow(int newIndex); void insertColumn(int newIndex); int rowColToIndex(int row, int column) const; void indexToRowCol(int index, int &row, int &column) const; protected: // property members: QList> mElements; QList mColumnStretchFactors; QList mRowStretchFactors; int mColumnSpacing, mRowSpacing; int mWrap; FillOrder mFillOrder; // non-virtual methods: void getMinimumRowColSizes(QVector *minColWidths, QVector *minRowHeights) const; void getMaximumRowColSizes(QVector *maxColWidths, QVector *maxRowHeights) const; private: Q_DISABLE_COPY(QCPLayoutGrid) }; Q_DECLARE_METATYPE(QCPLayoutGrid::FillOrder) class QCP_LIB_DECL QCPLayoutInset : public QCPLayout { Q_OBJECT public: /*! Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset. */ enum InsetPlacement { ipFree ///< The element may be positioned/sized arbitrarily, see \ref setInsetRect , ipBorderAligned ///< The element is aligned to one of the layout sides, see \ref setInsetAlignment }; Q_ENUM(InsetPlacement) explicit QCPLayoutInset(); - virtual ~QCPLayoutInset(); + ~QCPLayoutInset() override; // getters: InsetPlacement insetPlacement(int index) const; Qt::Alignment insetAlignment(int index) const; QRectF insetRect(int index) const; // setters: void setInsetPlacement(int index, InsetPlacement placement); void setInsetAlignment(int index, Qt::Alignment alignment); void setInsetRect(int index, const QRectF &rect); // reimplemented virtual methods: - virtual void updateLayout() Q_DECL_OVERRIDE; - virtual int elementCount() const Q_DECL_OVERRIDE; - virtual QCPLayoutElement *elementAt(int index) const Q_DECL_OVERRIDE; - virtual QCPLayoutElement *takeAt(int index) Q_DECL_OVERRIDE; - virtual bool take(QCPLayoutElement *element) Q_DECL_OVERRIDE; - virtual void simplify() Q_DECL_OVERRIDE {} - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + void updateLayout() override; + int elementCount() const override; + QCPLayoutElement *elementAt(int index) const override; + QCPLayoutElement *takeAt(int index) override; + bool take(QCPLayoutElement *element) override; + void simplify() override {} + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; // non-virtual methods: void addElement(QCPLayoutElement *element, Qt::Alignment alignment); void addElement(QCPLayoutElement *element, const QRectF &rect); protected: // property members: QList mElements; QList mInsetPlacement; QList mInsetAlignment; QList mInsetRect; private: Q_DISABLE_COPY(QCPLayoutInset) }; Q_DECLARE_METATYPE(QCPLayoutInset::InsetPlacement) /* end of 'src/layout.h' */ /* including file 'src/lineending.h', size 4426 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPLineEnding { Q_GADGET public: /*! Defines the type of ending decoration for line-like items, e.g. an arrow. \image html QCPLineEnding.png The width and length of these decorations can be controlled with the functions \ref setWidth and \ref setLength. Some decorations like \ref esDisc, \ref esSquare, \ref esDiamond and \ref esBar only support a width, the length property is ignored. \see QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail, QCPAxis::setLowerEnding, QCPAxis::setUpperEnding */ enum EndingStyle { esNone ///< No ending decoration , esFlatArrow ///< A filled arrow head with a straight/flat back (a triangle) , esSpikeArrow ///< A filled arrow head with an indented back , esLineArrow ///< A non-filled arrow head with open back , esDisc ///< A filled circle , esSquare ///< A filled square , esDiamond ///< A filled diamond (45 degrees rotated square) , esBar ///< A bar perpendicular to the line , esHalfBar ///< A bar perpendicular to the line, pointing out to only one side (to which side can be changed with \ref setInverted) , esSkewedBar ///< A bar that is skewed (skew controllable via \ref setLength) }; Q_ENUM(EndingStyle) QCPLineEnding(); QCPLineEnding(EndingStyle style, double width = 8, double length = 10, bool inverted = false); // getters: EndingStyle style() const { return mStyle; } double width() const { return mWidth; } double length() const { return mLength; } bool inverted() const { return mInverted; } // setters: void setStyle(EndingStyle style); void setWidth(double width); void setLength(double length); void setInverted(bool inverted); // non-property methods: double boundingDistance() const; double realLength() const; void draw(QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const; void draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const; protected: // property members: EndingStyle mStyle; double mWidth, mLength; bool mInverted; }; Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE); Q_DECLARE_METATYPE(QCPLineEnding::EndingStyle) /* end of 'src/lineending.h' */ /* including file 'src/axis/axisticker.h', size 4177 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTicker { Q_GADGET public: /*! Defines the strategies that the axis ticker may follow when choosing the size of the tick step. \see setTickStepStrategy */ enum TickStepStrategy { tssReadability ///< A nicely readable tick step is prioritized over matching the requested number of ticks (see \ref setTickCount) , tssMeetTickCount ///< Less readable tick steps are allowed which in turn facilitates getting closer to the requested tick count }; Q_ENUM(TickStepStrategy) QCPAxisTicker(); virtual ~QCPAxisTicker(); // getters: TickStepStrategy tickStepStrategy() const { return mTickStepStrategy; } int tickCount() const { return mTickCount; } double tickOrigin() const { return mTickOrigin; } // setters: void setTickStepStrategy(TickStepStrategy strategy); void setTickCount(int count); void setTickOrigin(double origin); // introduced virtual methods: virtual void generate(const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector &ticks, QVector *subTicks, QVector *tickLabels); protected: // property members: TickStepStrategy mTickStepStrategy; int mTickCount; double mTickOrigin; // introduced virtual methods: virtual double getTickStep(const QCPRange &range); virtual int getSubTickCount(double tickStep); virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision); virtual QVector createTickVector(double tickStep, const QCPRange &range); virtual QVector createSubTickVector(int subTickCount, const QVector &ticks); virtual QVector createLabelVector(const QVector &ticks, const QLocale &locale, QChar formatChar, int precision); // non-virtual methods: void trimTicks(const QCPRange &range, QVector &ticks, bool keepOneOutlier) const; double pickClosest(double target, const QVector &candidates) const; double getMantissa(double input, double *magnitude = 0) const; double cleanMantissa(double input) const; }; Q_DECLARE_METATYPE(QCPAxisTicker::TickStepStrategy) Q_DECLARE_METATYPE(QSharedPointer) /* end of 'src/axis/axisticker.h' */ /* including file 'src/axis/axistickerdatetime.h', size 3289 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerDateTime : public QCPAxisTicker { public: QCPAxisTickerDateTime(); // getters: QString dateTimeFormat() const { return mDateTimeFormat; } Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; } // setters: void setDateTimeFormat(const QString &format); void setDateTimeSpec(Qt::TimeSpec spec); void setTickOrigin( double origin); // hides base class method but calls baseclass implementation ("using" throws off IDEs and doxygen) void setTickOrigin(const QDateTime &origin); // static methods: static QDateTime keyToDateTime(double key); static double dateTimeToKey(const QDateTime dateTime); static double dateTimeToKey(const QDate date); protected: // property members: QString mDateTimeFormat; Qt::TimeSpec mDateTimeSpec; // non-property members: enum DateStrategy { dsNone, dsUniformTimeInDay, dsUniformDayInMonth } mDateStrategy; // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; - virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; - virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; - virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; + int getSubTickCount(double tickStep) override; + QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) override; + QVector createTickVector(double tickStep, const QCPRange &range) override; }; /* end of 'src/axis/axistickerdatetime.h' */ /* including file 'src/axis/axistickertime.h', size 3288 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerTime : public QCPAxisTicker { Q_GADGET public: /*! Defines the logical units in which fractions of time spans can be expressed. \see setFieldWidth, setTimeFormat */ enum TimeUnit { tuMilliseconds, tuSeconds, tuMinutes, tuHours, tuDays }; Q_ENUM(TimeUnit) QCPAxisTickerTime(); // getters: QString timeFormat() const { return mTimeFormat; } int fieldWidth(TimeUnit unit) const { return mFieldWidth.value(unit); } // setters: void setTimeFormat(const QString &format); void setFieldWidth(TimeUnit unit, int width); protected: // property members: QString mTimeFormat; QHash mFieldWidth; // non-property members: TimeUnit mSmallestUnit, mBiggestUnit; QHash mFormatPattern; // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; - virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; - virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; + int getSubTickCount(double tickStep) override; + QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) override; // non-virtual methods: void replaceUnit(QString &text, TimeUnit unit, int value) const; }; Q_DECLARE_METATYPE(QCPAxisTickerTime::TimeUnit) /* end of 'src/axis/axistickertime.h' */ /* including file 'src/axis/axistickerfixed.h', size 3308 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerFixed : public QCPAxisTicker { Q_GADGET public: /*! Defines how the axis ticker may modify the specified tick step (\ref setTickStep) in order to control the number of ticks in the axis range. \see setScaleStrategy */ enum ScaleStrategy { ssNone ///< Modifications are not allowed, the specified tick step is absolutely fixed. This might cause a high tick density and overlapping labels if the axis range is zoomed out. , ssMultiples ///< An integer multiple of the specified tick step is allowed. The used factor follows the base class properties of \ref setTickStepStrategy and \ref setTickCount. , ssPowers ///< An integer power of the specified tick step is allowed. }; Q_ENUM(ScaleStrategy) QCPAxisTickerFixed(); // getters: double tickStep() const { return mTickStep; } ScaleStrategy scaleStrategy() const { return mScaleStrategy; } // setters: void setTickStep(double step); void setScaleStrategy(ScaleStrategy strategy); protected: // property members: double mTickStep; ScaleStrategy mScaleStrategy; // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; }; Q_DECLARE_METATYPE(QCPAxisTickerFixed::ScaleStrategy) /* end of 'src/axis/axistickerfixed.h' */ /* including file 'src/axis/axistickertext.h', size 3085 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerText : public QCPAxisTicker { public: QCPAxisTickerText(); // getters: QMap &ticks() { return mTicks; } int subTickCount() const { return mSubTickCount; } // setters: void setTicks(const QMap &ticks); void setTicks(const QVector &positions, const QVector labels); void setSubTickCount(int subTicks); // non-virtual methods: void clear(); void addTick(double position, QString label); void addTicks(const QMap &ticks); void addTicks(const QVector &positions, const QVector &labels); protected: // property members: QMap mTicks; int mSubTickCount; // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; - virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; - virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; - virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; + int getSubTickCount(double tickStep) override; + QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) override; + QVector createTickVector(double tickStep, const QCPRange &range) override; }; /* end of 'src/axis/axistickertext.h' */ /* including file 'src/axis/axistickerpi.h', size 3911 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerPi : public QCPAxisTicker { Q_GADGET public: /*! Defines how fractions should be displayed in tick labels. \see setFractionStyle */ enum FractionStyle { fsFloatingPoint ///< Fractions are displayed as regular decimal floating point numbers, e.g. "0.25" or "0.125". , fsAsciiFractions ///< Fractions are written as rationals using ASCII characters only, e.g. "1/4" or "1/8" , fsUnicodeFractions ///< Fractions are written using sub- and superscript UTF-8 digits and the fraction symbol. }; Q_ENUM(FractionStyle) QCPAxisTickerPi(); // getters: QString piSymbol() const { return mPiSymbol; } double piValue() const { return mPiValue; } bool periodicity() const { return mPeriodicity; } FractionStyle fractionStyle() const { return mFractionStyle; } // setters: void setPiSymbol(QString symbol); void setPiValue(double pi); void setPeriodicity(int multiplesOfPi); void setFractionStyle(FractionStyle style); protected: // property members: QString mPiSymbol; double mPiValue; int mPeriodicity; FractionStyle mFractionStyle; // non-property members: double mPiTickStep; // size of one tick step in units of mPiValue // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; - virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; - virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; + int getSubTickCount(double tickStep) override; + QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) override; // non-virtual methods: void simplifyFraction(int &numerator, int &denominator) const; QString fractionToString(int numerator, int denominator) const; QString unicodeFraction(int numerator, int denominator) const; QString unicodeSuperscript(int number) const; QString unicodeSubscript(int number) const; }; Q_DECLARE_METATYPE(QCPAxisTickerPi::FractionStyle) /* end of 'src/axis/axistickerpi.h' */ /* including file 'src/axis/axistickerlog.h', size 2663 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerLog : public QCPAxisTicker { public: QCPAxisTickerLog(); // getters: double logBase() const { return mLogBase; } int subTickCount() const { return mSubTickCount; } // setters: void setLogBase(double base); void setSubTickCount(int subTicks); protected: // property members: double mLogBase; int mSubTickCount; // non-property members: double mLogBaseLnInv; // reimplemented virtual methods: - virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; - virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; - virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; + double getTickStep(const QCPRange &range) override; + int getSubTickCount(double tickStep) override; + QVector createTickVector(double tickStep, const QCPRange &range) override; }; /* end of 'src/axis/axistickerlog.h' */ /* including file 'src/axis/axis.h', size 20230 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPGrid : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible) Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid) Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen) Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen) /// \endcond public: explicit QCPGrid(QCPAxis *parentAxis); // getters: bool subGridVisible() const { return mSubGridVisible; } bool antialiasedSubGrid() const { return mAntialiasedSubGrid; } bool antialiasedZeroLine() const { return mAntialiasedZeroLine; } QPen pen() const { return mPen; } QPen subGridPen() const { return mSubGridPen; } QPen zeroLinePen() const { return mZeroLinePen; } // setters: void setSubGridVisible(bool visible); void setAntialiasedSubGrid(bool enabled); void setAntialiasedZeroLine(bool enabled); void setPen(const QPen &pen); void setSubGridPen(const QPen &pen); void setZeroLinePen(const QPen &pen); protected: // property members: bool mSubGridVisible; bool mAntialiasedSubGrid, mAntialiasedZeroLine; QPen mPen, mSubGridPen, mZeroLinePen; // non-property members: QCPAxis *mParentAxis; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; // non-virtual methods: void drawGridLines(QCPPainter *painter) const; void drawSubGridLines(QCPPainter *painter) const; friend class QCPAxis; }; class QCP_LIB_DECL QCPAxis : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(AxisType axisType READ axisType) Q_PROPERTY(QCPAxisRect *axisRect READ axisRect) Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged) Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged) Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed) Q_PROPERTY(QSharedPointer ticker READ ticker WRITE setTicker) Q_PROPERTY(bool ticks READ ticks WRITE setTicks) Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels) Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding) Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont) Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor) Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation) Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide) Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat) Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision) Q_PROPERTY(QVector tickVector READ tickVector) Q_PROPERTY(QVector tickVectorLabels READ tickVectorLabels) Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn) Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut) Q_PROPERTY(bool subTicks READ subTicks WRITE setSubTicks) Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn) Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut) Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen) Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen) Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen) Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont) Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor) Q_PROPERTY(QString label READ label WRITE setLabel) Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding) Q_PROPERTY(int padding READ padding WRITE setPadding) Q_PROPERTY(int offset READ offset WRITE setOffset) Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged) Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged) Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont) Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont) Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor) Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor) Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen) Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen) Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen) Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding) Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding) Q_PROPERTY(QCPGrid *grid READ grid) /// \endcond public: /*! Defines at which side of the axis rect the axis will appear. This also affects how the tick marks are drawn, on which side the labels are placed etc. */ enum AxisType { atLeft = 0x01 ///< 0x01 Axis is vertical and on the left side of the axis rect , atRight = 0x02 ///< 0x02 Axis is vertical and on the right side of the axis rect , atTop = 0x04 ///< 0x04 Axis is horizontal and on the top side of the axis rect , atBottom = 0x08 ///< 0x08 Axis is horizontal and on the bottom side of the axis rect }; Q_ENUM(AxisType) Q_FLAGS(AxisTypes) Q_DECLARE_FLAGS(AxisTypes, AxisType) /*! Defines on which side of the axis the tick labels (numbers) shall appear. \see setTickLabelSide */ enum LabelSide { lsInside ///< Tick labels will be displayed inside the axis rect and clipped to the inner axis rect , lsOutside ///< Tick labels will be displayed outside the axis rect }; Q_ENUM(LabelSide) /*! Defines the scale of an axis. \see setScaleType */ enum ScaleType { stLinear ///< Linear scaling , stLogarithmic ///< Logarithmic scaling with correspondingly transformed axis coordinates (possibly also \ref setTicker to a \ref QCPAxisTickerLog instance). }; Q_ENUM(ScaleType) /*! Defines the selectable parts of an axis. \see setSelectableParts, setSelectedParts */ enum SelectablePart { spNone = 0 ///< None of the selectable parts , spAxis = 0x001 ///< The axis backbone and tick marks , spTickLabels = 0x002 ///< Tick labels (numbers) of this axis (as a whole, not individually) , spAxisLabel = 0x004 ///< The axis label }; Q_ENUM(SelectablePart) Q_FLAGS(SelectableParts) Q_DECLARE_FLAGS(SelectableParts, SelectablePart) explicit QCPAxis(QCPAxisRect *parent, AxisType type); - virtual ~QCPAxis(); + ~QCPAxis() override; // getters: AxisType axisType() const { return mAxisType; } QCPAxisRect *axisRect() const { return mAxisRect; } ScaleType scaleType() const { return mScaleType; } const QCPRange range() const { return mRange; } bool rangeReversed() const { return mRangeReversed; } QSharedPointer ticker() const { return mTicker; } bool ticks() const { return mTicks; } bool tickLabels() const { return mTickLabels; } int tickLabelPadding() const; QFont tickLabelFont() const { return mTickLabelFont; } QColor tickLabelColor() const { return mTickLabelColor; } double tickLabelRotation() const; LabelSide tickLabelSide() const; QString numberFormat() const; int numberPrecision() const { return mNumberPrecision; } QVector tickVector() const { return mTickVector; } QVector tickVectorLabels() const { return mTickVectorLabels; } int tickLengthIn() const; int tickLengthOut() const; bool subTicks() const { return mSubTicks; } int subTickLengthIn() const; int subTickLengthOut() const; QPen basePen() const { return mBasePen; } QPen tickPen() const { return mTickPen; } QPen subTickPen() const { return mSubTickPen; } QFont labelFont() const { return mLabelFont; } QColor labelColor() const { return mLabelColor; } QString label() const { return mLabel; } int labelPadding() const; int padding() const { return mPadding; } int offset() const; SelectableParts selectedParts() const { return mSelectedParts; } SelectableParts selectableParts() const { return mSelectableParts; } QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; } QFont selectedLabelFont() const { return mSelectedLabelFont; } QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; } QColor selectedLabelColor() const { return mSelectedLabelColor; } QPen selectedBasePen() const { return mSelectedBasePen; } QPen selectedTickPen() const { return mSelectedTickPen; } QPen selectedSubTickPen() const { return mSelectedSubTickPen; } QCPLineEnding lowerEnding() const; QCPLineEnding upperEnding() const; QCPGrid *grid() const { return mGrid; } // setters: Q_SLOT void setScaleType(QCPAxis::ScaleType type); Q_SLOT void setRange(const QCPRange &range); void setRange(double lower, double upper); void setRange(double position, double size, Qt::AlignmentFlag alignment); void setRangeLower(double lower); void setRangeUpper(double upper); void setRangeReversed(bool reversed); void setTicker(QSharedPointer ticker); void setTicks(bool show); void setTickLabels(bool show); void setTickLabelPadding(int padding); void setTickLabelFont(const QFont &font); void setTickLabelColor(const QColor &color); void setTickLabelRotation(double degrees); void setTickLabelSide(LabelSide side); void setNumberFormat(const QString &formatCode); void setNumberPrecision(int precision); void setTickLength(int inside, int outside = 0); void setTickLengthIn(int inside); void setTickLengthOut(int outside); void setSubTicks(bool show); void setSubTickLength(int inside, int outside = 0); void setSubTickLengthIn(int inside); void setSubTickLengthOut(int outside); void setBasePen(const QPen &pen); void setTickPen(const QPen &pen); void setSubTickPen(const QPen &pen); void setLabelFont(const QFont &font); void setLabelColor(const QColor &color); void setLabel(const QString &str); void setLabelPadding(int padding); void setPadding(int padding); void setOffset(int offset); void setSelectedTickLabelFont(const QFont &font); void setSelectedLabelFont(const QFont &font); void setSelectedTickLabelColor(const QColor &color); void setSelectedLabelColor(const QColor &color); void setSelectedBasePen(const QPen &pen); void setSelectedTickPen(const QPen &pen); void setSelectedSubTickPen(const QPen &pen); Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts); Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts); void setLowerEnding(const QCPLineEnding &ending); void setUpperEnding(const QCPLineEnding &ending); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; // non-property methods: Qt::Orientation orientation() const { return mOrientation; } int pixelOrientation() const { return rangeReversed() != (orientation() == Qt::Vertical) ? -1 : 1; } void moveRange(double diff); void scaleRange(double factor); void scaleRange(double factor, double center); void setScaleRatio(const QCPAxis *otherAxis, double ratio = 1.0); void rescale(bool onlyVisiblePlottables = false); double pixelToCoord(double value) const; double coordToPixel(double value) const; SelectablePart getPartAt(const QPointF &pos) const; QList plottables() const; QList graphs() const; QList items() const; static AxisType marginSideToAxisType(QCP::MarginSide side); static Qt::Orientation orientation(AxisType type) { return type == atBottom || type == atTop ? Qt::Horizontal : Qt::Vertical; } static AxisType opposite(AxisType type); signals: void rangeChanged(const QCPRange &newRange); void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange); void scaleTypeChanged(QCPAxis::ScaleType scaleType); void selectionChanged(const QCPAxis::SelectableParts &parts); void selectableChanged(const QCPAxis::SelectableParts &parts); protected: // property members: // axis base: AxisType mAxisType; QCPAxisRect *mAxisRect; //int mOffset; // in QCPAxisPainter int mPadding; Qt::Orientation mOrientation; SelectableParts mSelectableParts, mSelectedParts; QPen mBasePen, mSelectedBasePen; //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter // axis label: //int mLabelPadding; // in QCPAxisPainter QString mLabel; QFont mLabelFont, mSelectedLabelFont; QColor mLabelColor, mSelectedLabelColor; // tick labels: //int mTickLabelPadding; // in QCPAxisPainter bool mTickLabels; //double mTickLabelRotation; // in QCPAxisPainter QFont mTickLabelFont, mSelectedTickLabelFont; QColor mTickLabelColor, mSelectedTickLabelColor; int mNumberPrecision; QLatin1Char mNumberFormatChar; bool mNumberBeautifulPowers; //bool mNumberMultiplyCross; // QCPAxisPainter // ticks and subticks: bool mTicks; bool mSubTicks; //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter QPen mTickPen, mSelectedTickPen; QPen mSubTickPen, mSelectedSubTickPen; // scale and range: QCPRange mRange; bool mRangeReversed; ScaleType mScaleType; // non-property members: QCPGrid *mGrid; QCPAxisPainterPrivate *mAxisPainter; QSharedPointer mTicker; QVector mTickVector; QVector mTickVectorLabels; QVector mSubTickVector; bool mCachedMarginValid; int mCachedMargin; // introduced virtual methods: virtual int calculateMargin(); // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; + QCP::Interaction selectionCategory() const override; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; // non-virtual methods: void setupTickVectors(); QPen getBasePen() const; QPen getTickPen() const; QPen getSubTickPen() const; QFont getTickLabelFont() const; QFont getLabelFont() const; QColor getTickLabelColor() const; QColor getLabelColor() const; private: Q_DISABLE_COPY(QCPAxis) friend class QCustomPlot; friend class QCPGrid; friend class QCPAxisRect; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts) Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes) Q_DECLARE_METATYPE(QCPAxis::AxisType) Q_DECLARE_METATYPE(QCPAxis::LabelSide) Q_DECLARE_METATYPE(QCPAxis::ScaleType) Q_DECLARE_METATYPE(QCPAxis::SelectablePart) class QCPAxisPainterPrivate { public: explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot); virtual ~QCPAxisPainterPrivate(); virtual void draw(QCPPainter *painter); virtual int size() const; void clearCache(); QRect axisSelectionBox() const { return mAxisSelectionBox; } QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; } QRect labelSelectionBox() const { return mLabelSelectionBox; } // public property members: QCPAxis::AxisType type; QPen basePen; QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters int labelPadding; // directly accessed by QCPAxis setters/getters QFont labelFont; QColor labelColor; QString label; int tickLabelPadding; // directly accessed by QCPAxis setters/getters double tickLabelRotation; // directly accessed by QCPAxis setters/getters QCPAxis::LabelSide tickLabelSide; // directly accessed by QCPAxis setters/getters bool substituteExponent; bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters QPen tickPen, subTickPen; QFont tickLabelFont; QColor tickLabelColor; QRect axisRect, viewportRect; double offset; // directly accessed by QCPAxis setters/getters bool abbreviateDecimalPowers; bool reversedEndings; QVector subTickPositions; QVector tickPositions; QVector tickLabels; protected: struct CachedLabel { QPointF offset; QPixmap pixmap; }; struct TickLabelData { QString basePart, expPart, suffixPart; QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds; QFont baseFont, expFont; }; QCustomPlot *mParentPlot; QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters QCache mLabelCache; QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox; virtual QByteArray generateLabelParameterHash() const; virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize); virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const; virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const; virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const; virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const; }; /* end of 'src/axis/axis.h' */ /* including file 'src/scatterstyle.h', size 7275 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPScatterStyle { Q_GADGET public: /*! Represents the various properties of a scatter style instance. For example, this enum is used to specify which properties of \ref QCPSelectionDecorator::setScatterStyle will be used when highlighting selected data points. Specific scatter properties can be transferred between \ref QCPScatterStyle instances via \ref setFromOther. */ enum ScatterProperty { spNone = 0x00 ///< 0x00 None , spPen = 0x01 ///< 0x01 The pen property, see \ref setPen , spBrush = 0x02 ///< 0x02 The brush property, see \ref setBrush , spSize = 0x04 ///< 0x04 The size property, see \ref setSize , spShape = 0x08 ///< 0x08 The shape property, see \ref setShape , spAll = 0xFF ///< 0xFF All properties }; Q_ENUM(ScatterProperty) Q_FLAGS(ScatterProperties) Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty) /*! Defines the shape used for scatter points. On plottables/items that draw scatters, the sizes of these visualizations (with exception of \ref ssDot and \ref ssPixmap) can be controlled with the \ref setSize function. Scatters are drawn with the pen and brush specified with \ref setPen and \ref setBrush. */ enum ScatterShape { ssNone ///< no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines) , ssDot ///< \enumimage{ssDot.png} a single pixel (use \ref ssDisc or \ref ssCircle if you want a round shape with a certain radius) , ssCross ///< \enumimage{ssCross.png} a cross , ssPlus ///< \enumimage{ssPlus.png} a plus , ssCircle ///< \enumimage{ssCircle.png} a circle , ssDisc ///< \enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle) , ssSquare ///< \enumimage{ssSquare.png} a square , ssDiamond ///< \enumimage{ssDiamond.png} a diamond , ssStar ///< \enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus , ssTriangle ///< \enumimage{ssTriangle.png} an equilateral triangle, standing on baseline , ssTriangleInverted ///< \enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner , ssCrossSquare ///< \enumimage{ssCrossSquare.png} a square with a cross inside , ssPlusSquare ///< \enumimage{ssPlusSquare.png} a square with a plus inside , ssCrossCircle ///< \enumimage{ssCrossCircle.png} a circle with a cross inside , ssPlusCircle ///< \enumimage{ssPlusCircle.png} a circle with a plus inside , ssPeace ///< \enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines , ssPixmap ///< a custom pixmap specified by \ref setPixmap, centered on the data point coordinates , ssCustom ///< custom painter operations are performed per scatter (As QPainterPath, see \ref setCustomPath) }; Q_ENUM(ScatterShape) QCPScatterStyle(); QCPScatterStyle(ScatterShape shape, double size = 6); QCPScatterStyle(ScatterShape shape, const QColor &color, double size); QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size); QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size); QCPScatterStyle(const QPixmap &pixmap); QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush = Qt::NoBrush, double size = 6); // getters: double size() const { return mSize; } ScatterShape shape() const { return mShape; } QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QPixmap pixmap() const { return mPixmap; } QPainterPath customPath() const { return mCustomPath; } // setters: void setFromOther(const QCPScatterStyle &other, ScatterProperties properties); void setSize(double size); void setShape(ScatterShape shape); void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setPixmap(const QPixmap &pixmap); void setCustomPath(const QPainterPath &customPath); // non-property methods: bool isNone() const { return mShape == ssNone; } bool isPenDefined() const { return mPenDefined; } void undefinePen(); void applyTo(QCPPainter *painter, const QPen &defaultPen) const; void drawShape(QCPPainter *painter, const QPointF &pos) const; void drawShape(QCPPainter *painter, double x, double y) const; protected: // property members: double mSize; ScatterShape mShape; QPen mPen; QBrush mBrush; QPixmap mPixmap; QPainterPath mCustomPath; // non-property members: bool mPenDefined; }; Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties) Q_DECLARE_METATYPE(QCPScatterStyle::ScatterProperty) Q_DECLARE_METATYPE(QCPScatterStyle::ScatterShape) /* end of 'src/scatterstyle.h' */ /* including file 'src/datacontainer.h', size 4535 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ /*! \relates QCPDataContainer Returns whether the sort key of \a a is less than the sort key of \a b. \see QCPDataContainer::sort */ template inline bool qcpLessThanSortKey(const DataType &a, const DataType &b) { return a.sortKey() < b.sortKey(); } template class QCP_LIB_DECL QCPDataContainer { public: typedef typename QVector::const_iterator const_iterator; typedef typename QVector::iterator iterator; QCPDataContainer(); // getters: int size() const { return mData.size() - mPreallocSize; } bool isEmpty() const { return size() == 0; } bool autoSqueeze() const { return mAutoSqueeze; } // setters: void setAutoSqueeze(bool enabled); // non-virtual methods: void set(const QCPDataContainer &data); void set(const QVector &data, bool alreadySorted = false); void add(const QCPDataContainer &data); void add(const QVector &data, bool alreadySorted = false); void add(const DataType &data); void removeBefore(double sortKey); void removeAfter(double sortKey); void remove(double sortKeyFrom, double sortKeyTo); void remove(double sortKey); void clear(); void sort(); void squeeze(bool preAllocation = true, bool postAllocation = true); const_iterator constBegin() const { return mData.constBegin() + mPreallocSize; } const_iterator constEnd() const { return mData.constEnd(); } iterator begin() { return mData.begin() + mPreallocSize; } iterator end() { return mData.end(); } const_iterator findBegin(double sortKey, bool expandedRange = true) const; const_iterator findEnd(double sortKey, bool expandedRange = true) const; const_iterator at(int index) const { return constBegin() + qBound(0, index, size()); } QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain = QCP::sdBoth); QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain = QCP::sdBoth, const QCPRange &inKeyRange = QCPRange()); QCPDataRange dataRange() const { return QCPDataRange(0, size()); } void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const; protected: // property members: bool mAutoSqueeze; // non-property memebers: QVector mData; int mPreallocSize; int mPreallocIteration; // non-virtual methods: void preallocateGrow(int minimumPreallocSize); void performAutoSqueeze(); }; // include implementation in header since it is a class template: /* including file 'src/datacontainer.cpp', size 31224 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPDataContainer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPDataContainer \brief The generic data container for one-dimensional plottables This class template provides a fast container for data storage of one-dimensional data. The data type is specified as template parameter (called \a DataType in the following) and must provide some methods as described in the \ref qcpdatacontainer-datatype "next section". The data is stored in a sorted fashion, which allows very quick lookups by the sorted key as well as retrieval of ranges (see \ref findBegin, \ref findEnd, \ref keyRange) using binary search. The container uses a preallocation and a postallocation scheme, such that appending and prepending data (with respect to the sort key) is very fast and minimizes reallocations. If data is added which needs to be inserted between existing keys, the merge usually can be done quickly too, using the fact that existing data is always sorted. The user can further improve performance by specifying that added data is already itself sorted by key, if he can guarantee that this is the case (see for example \ref add(const QVector &data, bool alreadySorted)). The data can be accessed with the provided const iterators (\ref constBegin, \ref constEnd). If it is necessary to alter existing data in-place, the non-const iterators can be used (\ref begin, \ref end). Changing data members that are not the sort key (for most data types called \a key) is safe from the container's perspective. Great care must be taken however if the sort key is modified through the non-const iterators. For performance reasons, the iterators don't automatically cause a re-sorting upon their manipulation. It is thus the responsibility of the user to leave the container in a sorted state when finished with the data manipulation, before calling any other methods on the container. A complete re-sort (e.g. after finishing all sort key manipulation) can be done by calling \ref sort. Failing to do so can not be detected by the container efficiently and will cause both rendering artifacts and potential data loss. Implementing one-dimensional plottables that make use of a \ref QCPDataContainer is usually done by subclassing from \ref QCPAbstractPlottable1D "QCPAbstractPlottable1D", which introduces an according \a mDataContainer member and some convenience methods. \section qcpdatacontainer-datatype Requirements for the DataType template parameter The template parameter DataType is the type of the stored data points. It must be trivially copyable and have the following public methods, preferably inline: \li double sortKey() const\n Returns the member variable of this data point that is the sort key, defining the ordering in the container. Often this variable is simply called \a key. \li static DataType fromSortKey(double sortKey)\n Returns a new instance of the data type initialized with its sort key set to \a sortKey. \li static bool sortKeyIsMainKey()\n Returns true if the sort key is equal to the main key (see method \c mainKey below). For most plottables this is the case. It is not the case for example for \ref QCPCurve, which uses \a t as sort key and \a key as main key. This is the reason why QCPCurve unlike QCPGraph can display parametric curves with loops. \li double mainKey() const\n Returns the variable of this data point considered the main key. This is commonly the variable that is used as the coordinate of this data point on the key axis of the plottable. This method is used for example when determining the automatic axis rescaling of key axes (\ref QCPAxis::rescale). \li double mainValue() const\n Returns the variable of this data point considered the main value. This is commonly the variable that is used as the coordinate of this data point on the value axis of the plottable. \li QCPRange valueRange() const\n Returns the range this data point spans in the value axis coordinate. If the data is single-valued (e.g. QCPGraphData), this is simply a range with both lower and upper set to the main data point value. However if the data points can represent multiple values at once (e.g QCPFinancialData with its \a high, \a low, \a open and \a close values at each \a key) this method should return the range those values span. This method is used for example when determining the automatic axis rescaling of value axes (\ref QCPAxis::rescale). */ /* start documentation of inline functions */ /*! \fn int QCPDataContainer::size() const Returns the number of data points in the container. */ /*! \fn bool QCPDataContainer::isEmpty() const Returns whether this container holds no data points. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::constBegin() const Returns a const iterator to the first data point in this container. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::constEnd() const Returns a const iterator to the element past the last data point in this container. */ /*! \fn QCPDataContainer::iterator QCPDataContainer::begin() const Returns a non-const iterator to the first data point in this container. You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see \ref sort, or the detailed description of this class. */ /*! \fn QCPDataContainer::iterator QCPDataContainer::end() const Returns a non-const iterator to the element past the last data point in this container. You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see \ref sort, or the detailed description of this class. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::at(int index) const Returns a const iterator to the element with the specified \a index. If \a index points beyond the available elements in this container, returns \ref constEnd, i.e. an iterator past the last valid element. You can use this method to easily obtain iterators from a \ref QCPDataRange, see the \ref dataselection-accessing "data selection page" for an example. */ /*! \fn QCPDataRange QCPDataContainer::dataRange() const Returns a \ref QCPDataRange encompassing the entire data set of this container. This means the begin index of the returned range is 0, and the end index is \ref size. */ /* end documentation of inline functions */ /*! Constructs a QCPDataContainer used for plottable classes that represent a series of key-sorted data */ template QCPDataContainer::QCPDataContainer() : mAutoSqueeze(true), mPreallocSize(0), mPreallocIteration(0) { } /*! Sets whether the container automatically decides when to release memory from its post- and preallocation pools when data points are removed. By default this is enabled and for typical applications shouldn't be changed. If auto squeeze is disabled, you can manually decide when to release pre-/postallocation with \ref squeeze. */ template void QCPDataContainer::setAutoSqueeze(bool enabled) { if (mAutoSqueeze != enabled) { mAutoSqueeze = enabled; if (mAutoSqueeze) performAutoSqueeze(); } } /*! \overload Replaces the current data in this container with the provided \a data. \see add, remove */ template void QCPDataContainer::set(const QCPDataContainer &data) { clear(); add(data); } /*! \overload Replaces the current data in this container with the provided \a data If you can guarantee that the data points in \a data have ascending order with respect to the DataType's sort key, set \a alreadySorted to true to avoid an unnecessary sorting run. \see add, remove */ template void QCPDataContainer::set(const QVector &data, bool alreadySorted) { mData = data; mPreallocSize = 0; mPreallocIteration = 0; if (!alreadySorted) sort(); } /*! \overload Adds the provided \a data to the current data in this container. \see set, remove */ template void QCPDataContainer::add(const QCPDataContainer &data) { if (data.isEmpty()) return; const int n = data.size(); const int oldSize = size(); if (oldSize > 0 && !qcpLessThanSortKey( *constBegin(), *(data.constEnd() - 1))) // prepend if new data keys are all smaller than or equal to existing ones { if (mPreallocSize < n) preallocateGrow(n); mPreallocSize -= n; std::copy(data.constBegin(), data.constEnd(), begin()); } else // don't need to prepend, so append and merge if necessary { mData.resize(mData.size() + n); std::copy(data.constBegin(), data.constEnd(), end() - n); if (oldSize > 0 && !qcpLessThanSortKey( *(constEnd() - n - 1), *(constEnd() - n))) // if appended range keys aren't all greater than existing ones, merge the two partitions std::inplace_merge(begin(), end() - n, end(), qcpLessThanSortKey); } } /*! Adds the provided data points in \a data to the current data. If you can guarantee that the data points in \a data have ascending order with respect to the DataType's sort key, set \a alreadySorted to true to avoid an unnecessary sorting run. \see set, remove */ template void QCPDataContainer::add(const QVector &data, bool alreadySorted) { if (data.isEmpty()) return; if (isEmpty()) { set(data, alreadySorted); return; } const int n = data.size(); const int oldSize = size(); if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey( *constBegin(), *(data.constEnd() - 1))) // prepend if new data is sorted and keys are all smaller than or equal to existing ones { if (mPreallocSize < n) preallocateGrow(n); mPreallocSize -= n; std::copy(data.constBegin(), data.constEnd(), begin()); } else // don't need to prepend, so append and then sort and merge if necessary { mData.resize(mData.size() + n); std::copy(data.constBegin(), data.constEnd(), end() - n); if (!alreadySorted) // sort appended subrange if it wasn't already sorted std::sort(end() - n, end(), qcpLessThanSortKey); if (oldSize > 0 && !qcpLessThanSortKey( *(constEnd() - n - 1), *(constEnd() - n))) // if appended range keys aren't all greater than existing ones, merge the two partitions std::inplace_merge(begin(), end() - n, end(), qcpLessThanSortKey); } } /*! \overload Adds the provided single data point to the current data. \see remove */ template void QCPDataContainer::add(const DataType &data) { if (isEmpty() || !qcpLessThanSortKey( data, *(constEnd() - 1))) // quickly handle appends if new data key is greater or equal to existing ones { mData.append(data); } else if (qcpLessThanSortKey(data, *constBegin())) // quickly handle prepends using preallocated space { if (mPreallocSize < 1) preallocateGrow(1); --mPreallocSize; *begin() = data; } else // handle inserts, maintaining sorted keys { QCPDataContainer::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey); mData.insert(insertionPoint, data); } } /*! Removes all data points with (sort-)keys smaller than or equal to \a sortKey. \see removeAfter, remove, clear */ template void QCPDataContainer::removeBefore(double sortKey) { QCPDataContainer::iterator it = begin(); QCPDataContainer::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); mPreallocSize += itEnd - it; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it) if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points with (sort-)keys greater than or equal to \a sortKey. \see removeBefore, remove, clear */ template void QCPDataContainer::removeAfter(double sortKey) { QCPDataContainer::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); QCPDataContainer::iterator itEnd = end(); mData.erase(it, itEnd); // typically adds it to the postallocated block if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points with (sort-)keys between \a sortKeyFrom and \a sortKeyTo. if \a sortKeyFrom is greater or equal to \a sortKeyTo, the function does nothing. To remove a single data point with known (sort-)key, use \ref remove(double sortKey). \see removeBefore, removeAfter, clear */ template void QCPDataContainer::remove(double sortKeyFrom, double sortKeyTo) { if (sortKeyFrom >= sortKeyTo || isEmpty()) return; QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey); QCPDataContainer::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey); mData.erase(it, itEnd); if (mAutoSqueeze) performAutoSqueeze(); } /*! \overload Removes a single data point at \a sortKey. If the position is not known with absolute (binary) precision, consider using \ref remove(double sortKeyFrom, double sortKeyTo) with a small fuzziness interval around the suspected position, depeding on the precision with which the (sort-)key is known. \see removeBefore, removeAfter, clear */ template void QCPDataContainer::remove(double sortKey) { QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (it != end() && it->sortKey() == sortKey) { if (it == begin()) ++mPreallocSize; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it) else mData.erase(it); } if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points. \see remove, removeAfter, removeBefore */ template void QCPDataContainer::clear() { mData.clear(); mPreallocIteration = 0; mPreallocSize = 0; } /*! Re-sorts all data points in the container by their sort key. When setting, adding or removing points using the QCPDataContainer interface (\ref set, \ref add, \ref remove, etc.), the container makes sure to always stay in a sorted state such that a full resort is never necessary. However, if you choose to directly manipulate the sort key on data points by accessing and modifying it through the non-const iterators (\ref begin, \ref end), it is your responsibility to bring the container back into a sorted state before any other methods are called on it. This can be achieved by calling this method immediately after finishing the sort key manipulation. */ template void QCPDataContainer::sort() { std::sort(begin(), end(), qcpLessThanSortKey); } /*! Frees all unused memory that is currently in the preallocation and postallocation pools. Note that QCPDataContainer automatically decides whether squeezing is necessary, if \ref setAutoSqueeze is left enabled. It should thus not be necessary to use this method for typical applications. The parameters \a preAllocation and \a postAllocation control whether pre- and/or post allocation should be freed, respectively. */ template void QCPDataContainer::squeeze(bool preAllocation, bool postAllocation) { if (preAllocation) { if (mPreallocSize > 0) { std::copy(begin(), end(), mData.begin()); mData.resize(size()); mPreallocSize = 0; } mPreallocIteration = 0; } if (postAllocation) mData.squeeze(); } /*! Returns an iterator to the data point with a (sort-)key that is equal to, just below, or just above \a sortKey. If \a expandedRange is true, the data point just below \a sortKey will be considered, otherwise the one just above. This can be used in conjunction with \ref findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range. If \a expandedRange is true but there are no data points below \a sortKey, \ref constBegin is returned. If the container is empty, returns \ref constEnd. \see findEnd, QCPPlottableInterface1D::findBegin */ template typename QCPDataContainer::const_iterator QCPDataContainer::findBegin(double sortKey, bool expandedRange) const { if (isEmpty()) return constEnd(); QCPDataContainer::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (expandedRange && it != constBegin()) // also covers it == constEnd case, and we know --constEnd is valid because mData isn't empty --it; return it; } /*! Returns an iterator to the element after the data point with a (sort-)key that is equal to, just above or just below \a sortKey. If \a expandedRange is true, the data point just above \a sortKey will be considered, otherwise the one just below. This can be used in conjunction with \ref findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range. If \a expandedRange is true but there are no data points above \a sortKey, \ref constEnd is returned. If the container is empty, \ref constEnd is returned. \see findBegin, QCPPlottableInterface1D::findEnd */ template typename QCPDataContainer::const_iterator QCPDataContainer::findEnd(double sortKey, bool expandedRange) const { if (isEmpty()) return constEnd(); QCPDataContainer::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (expandedRange && it != constEnd()) ++it; return it; } /*! Returns the range encompassed by the (main-)key coordinate of all data points. The output parameter \a foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same key). Use \a signDomain to control which sign of the key coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time. If the DataType reports that its main key is equal to the sort key (\a sortKeyIsMainKey), as is the case for most plottables, this method uses this fact and finds the range very quickly. \see valueRange */ template QCPRange QCPDataContainer::keyRange(bool &foundRange, QCP::SignDomain signDomain) { if (isEmpty()) { foundRange = false; return QCPRange(); } QCPRange range; bool haveLower = false; bool haveUpper = false; double current; QCPDataContainer::const_iterator it = constBegin(); QCPDataContainer::const_iterator itEnd = constEnd(); if (signDomain == QCP::sdBoth) // range may be anywhere { if (DataType:: sortKeyIsMainKey()) // if DataType is sorted by main key (e.g. QCPGraph, but not QCPCurve), use faster algorithm by finding just first and last key with non-NaN value { while (it != itEnd) // find first non-nan going up from left { if (!qIsNaN(it->mainValue())) { range.lower = it->mainKey(); haveLower = true; break; } ++it; } it = itEnd; while (it != constBegin()) // find first non-nan going down from right { --it; if (!qIsNaN(it->mainValue())) { range.upper = it->mainKey(); haveUpper = true; break; } } } else // DataType is not sorted by main key, go through all data points and accordingly expand range { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } ++it; } } } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if ((current < range.lower || !haveLower) && current < 0) { range.lower = current; haveLower = true; } if ((current > range.upper || !haveUpper) && current < 0) { range.upper = current; haveUpper = true; } } ++it; } } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if ((current < range.lower || !haveLower) && current > 0) { range.lower = current; haveLower = true; } if ((current > range.upper || !haveUpper) && current > 0) { range.upper = current; haveUpper = true; } } ++it; } } foundRange = haveLower && haveUpper; return range; } /*! Returns the range encompassed by the value coordinates of the data points in the specified key range (\a inKeyRange), using the full \a DataType::valueRange reported by the data points. The output parameter \a foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same value). If \a inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys. Use \a signDomain to control which sign of the value coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time. \see keyRange */ template QCPRange QCPDataContainer::valueRange(bool &foundRange, QCP::SignDomain signDomain, const QCPRange &inKeyRange) { if (isEmpty()) { foundRange = false; return QCPRange(); } QCPRange range; const bool restrictKeyRange = inKeyRange != QCPRange(); bool haveLower = false; bool haveUpper = false; QCPRange current; QCPDataContainer::const_iterator itBegin = constBegin(); QCPDataContainer::const_iterator itEnd = constEnd(); if (DataType::sortKeyIsMainKey() && restrictKeyRange) { itBegin = findBegin(inKeyRange.lower); itEnd = findEnd(inKeyRange.upper); } if (signDomain == QCP::sdBoth) // range may be anywhere { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } foundRange = haveLower && haveUpper; return range; } /*! Makes sure \a begin and \a end mark a data range that is both within the bounds of this data container's data, as well as within the specified \a dataRange. This function doesn't require for \a dataRange to be within the bounds of this data container's valid range. */ template void QCPDataContainer::limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const { QCPDataRange iteratorRange(begin - constBegin(), end - constBegin()); iteratorRange = iteratorRange.bounded(dataRange.bounded(this->dataRange())); begin = constBegin() + iteratorRange.begin(); end = constBegin() + iteratorRange.end(); } /*! \internal Increases the preallocation pool to have a size of at least \a minimumPreallocSize. Depending on the preallocation history, the container will grow by more than requested, to speed up future consecutive size increases. if \a minimumPreallocSize is smaller than or equal to the current preallocation pool size, this method does nothing. */ template void QCPDataContainer::preallocateGrow(int minimumPreallocSize) { if (minimumPreallocSize <= mPreallocSize) return; int newPreallocSize = minimumPreallocSize; newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration ++mPreallocIteration; int sizeDifference = newPreallocSize - mPreallocSize; mData.resize(mData.size() + sizeDifference); std::copy_backward(mData.begin() + mPreallocSize, mData.end() - sizeDifference, mData.end()); mPreallocSize = newPreallocSize; } /*! \internal This method decides, depending on the total allocation size and the size of the unused pre- and postallocation pools, whether it is sensible to reduce the pools in order to free up unused memory. It then possibly calls \ref squeeze to do the deallocation. If \ref setAutoSqueeze is enabled, this method is called automatically each time data points are removed from the container (e.g. \ref remove). \note when changing the decision parameters, care must be taken not to cause a back-and-forth between squeezing and reallocation due to the growth strategy of the internal QVector and \ref preallocateGrow. The hysteresis between allocation and deallocation should be made high enough (at the expense of possibly larger unused memory from time to time). */ template void QCPDataContainer::performAutoSqueeze() { const int totalAlloc = mData.capacity(); const int postAllocSize = totalAlloc - mData.size(); const int usedSize = size(); bool shrinkPostAllocation = false; bool shrinkPreAllocation = false; if (totalAlloc > 650000) // if allocation is larger, shrink earlier with respect to total used size { shrinkPostAllocation = postAllocSize > usedSize * 1.5; // QVector grow strategy is 2^n for static data. Watch out not to oscillate! shrinkPreAllocation = mPreallocSize * 10 > usedSize; } else if (totalAlloc > 1000) // below 10 MiB raw data be generous with preallocated memory, below 1k points don't even bother { shrinkPostAllocation = postAllocSize > usedSize * 5; shrinkPreAllocation = mPreallocSize > usedSize * 1.5; // preallocation can grow into postallocation, so can be smaller } if (shrinkPreAllocation || shrinkPostAllocation) squeeze(shrinkPreAllocation, shrinkPostAllocation); } /* end of 'src/datacontainer.cpp' */ /* end of 'src/datacontainer.h' */ /* including file 'src/plottable.h', size 8312 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPSelectionDecorator { Q_GADGET public: QCPSelectionDecorator(); virtual ~QCPSelectionDecorator(); // getters: QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } QCPScatterStyle::ScatterProperties usedScatterProperties() const { return mUsedScatterProperties; } // setters: void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties = QCPScatterStyle::spPen); void setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties); // non-virtual methods: void applyPen(QCPPainter *painter) const; void applyBrush(QCPPainter *painter) const; QCPScatterStyle getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const; // introduced virtual methods: virtual void copyFrom(const QCPSelectionDecorator *other); virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection); protected: // property members: QPen mPen; QBrush mBrush; QCPScatterStyle mScatterStyle; QCPScatterStyle::ScatterProperties mUsedScatterProperties; // non-property members: QCPAbstractPlottable *mPlottable; // introduced virtual methods: virtual bool registerWithPlottable(QCPAbstractPlottable *plottable); private: Q_DISABLE_COPY(QCPSelectionDecorator) friend class QCPAbstractPlottable; }; Q_DECLARE_METATYPE(QCPSelectionDecorator *) class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill) Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QCPAxis *keyAxis READ keyAxis WRITE setKeyAxis) Q_PROPERTY(QCPAxis *valueAxis READ valueAxis WRITE setValueAxis) Q_PROPERTY(QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(QCPDataSelection selection READ selection WRITE setSelection NOTIFY selectionChanged) Q_PROPERTY(QCPSelectionDecorator *selectionDecorator READ selectionDecorator WRITE setSelectionDecorator) /// \endcond public: QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPAbstractPlottable(); + ~QCPAbstractPlottable() override; // getters: QString name() const { return mName; } bool antialiasedFill() const { return mAntialiasedFill; } bool antialiasedScatters() const { return mAntialiasedScatters; } QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QCPAxis *keyAxis() const { return mKeyAxis.data(); } QCPAxis *valueAxis() const { return mValueAxis.data(); } QCP::SelectionType selectable() const { return mSelectable; } bool selected() const { return !mSelection.isEmpty(); } QCPDataSelection selection() const { return mSelection; } QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; } // setters: void setName(const QString &name); void setAntialiasedFill(bool enabled); void setAntialiasedScatters(bool enabled); void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setKeyAxis(QCPAxis *axis); void setValueAxis(QCPAxis *axis); Q_SLOT void setSelectable(QCP::SelectionType selectable); Q_SLOT void setSelection(QCPDataSelection selection); void setSelectionDecorator(QCPSelectionDecorator *decorator); // introduced virtual methods: virtual QCPPlottableInterface1D *interface1D() { return 0; } virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const = 0; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, const QCPRange &inKeyRange = QCPRange()) const = 0; // non-property methods: void coordsToPixels(double key, double value, double &x, double &y) const; const QPointF coordsToPixels(double key, double value) const; void pixelsToCoords(double x, double y, double &key, double &value) const; void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const; void rescaleAxes(bool onlyEnlarge = false) const; void rescaleKeyAxis(bool onlyEnlarge = false) const; void rescaleValueAxis(bool onlyEnlarge = false, bool inKeyRange = false) const; bool addToLegend(QCPLegend *legend); bool addToLegend(); bool removeFromLegend(QCPLegend *legend) const; bool removeFromLegend() const; signals: void selectionChanged(bool selected); void selectionChanged(const QCPDataSelection &selection); void selectableChanged(QCP::SelectionType selectable); protected: // property members: QString mName; bool mAntialiasedFill, mAntialiasedScatters; QPen mPen; QBrush mBrush; QPointer mKeyAxis, mValueAxis; QCP::SelectionType mSelectable; QCPDataSelection mSelection; QCPSelectionDecorator *mSelectionDecorator; // reimplemented virtual methods: - virtual QRect clipRect() const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; - virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; - void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; + QRect clipRect() const override; + void draw(QCPPainter *painter) override = 0; + QCP::Interaction selectionCategory() const override; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; // introduced virtual methods: virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0; // non-virtual methods: void applyFillAntialiasingHint(QCPPainter *painter) const; void applyScattersAntialiasingHint(QCPPainter *painter) const; private: Q_DISABLE_COPY(QCPAbstractPlottable) friend class QCustomPlot; friend class QCPAxis; friend class QCPPlottableLegendItem; }; /* end of 'src/plottable.h' */ /* including file 'src/item.h', size 9368 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemAnchor { Q_GADGET public: QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId = -1); virtual ~QCPItemAnchor(); // getters: QString name() const { return mName; } virtual QPointF pixelPosition() const; protected: // property members: QString mName; // non-property members: QCustomPlot *mParentPlot; QCPAbstractItem *mParentItem; int mAnchorId; QSet mChildrenX, mChildrenY; // introduced virtual methods: virtual QCPItemPosition *toQCPItemPosition() { return 0; } // non-virtual methods: void addChildX(QCPItemPosition *pos); // called from pos when this anchor is set as parent void removeChildX(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted void addChildY(QCPItemPosition *pos); // called from pos when this anchor is set as parent void removeChildY(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted private: Q_DISABLE_COPY(QCPItemAnchor) friend class QCPItemPosition; }; class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor { Q_GADGET public: /*! Defines the ways an item position can be specified. Thus it defines what the numbers passed to \ref setCoords actually mean. \see setType */ enum PositionType { ptAbsolute ///< Static positioning in pixels, starting from the top left corner of the viewport/widget. , ptViewportRatio ///< Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top ///< left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and ///< vertically at the top of the viewport/widget, etc. , ptAxisRectRatio ///< Static positioning given by a fraction of the axis rect size (see \ref setAxisRect). For example, if you call setCoords(0, 0), the position will be at the top ///< left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and ///< vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1. , ptPlotCoords ///< Dynamic positioning at a plot coordinate defined by two axes (see \ref setAxes). }; Q_ENUM(PositionType) QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name); - virtual ~QCPItemPosition(); + ~QCPItemPosition() override; // getters: PositionType type() const { return typeX(); } PositionType typeX() const { return mPositionTypeX; } PositionType typeY() const { return mPositionTypeY; } QCPItemAnchor *parentAnchor() const { return parentAnchorX(); } QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; } QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; } double key() const { return mKey; } double value() const { return mValue; } QPointF coords() const { return QPointF(mKey, mValue); } QCPAxis *keyAxis() const { return mKeyAxis.data(); } QCPAxis *valueAxis() const { return mValueAxis.data(); } QCPAxisRect *axisRect() const; - virtual QPointF pixelPosition() const Q_DECL_OVERRIDE; + QPointF pixelPosition() const override; // setters: void setType(PositionType type); void setTypeX(PositionType type); void setTypeY(PositionType type); bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition = false); bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition = false); bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition = false); void setCoords(double key, double value); void setCoords(const QPointF &coords); void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis); void setAxisRect(QCPAxisRect *axisRect); void setPixelPosition(const QPointF &pixelPosition); protected: // property members: PositionType mPositionTypeX, mPositionTypeY; QPointer mKeyAxis, mValueAxis; QPointer mAxisRect; double mKey, mValue; QCPItemAnchor *mParentAnchorX, *mParentAnchorY; // reimplemented virtual methods: - virtual QCPItemPosition *toQCPItemPosition() Q_DECL_OVERRIDE { return this; } + QCPItemPosition *toQCPItemPosition() override { return this; } private: Q_DISABLE_COPY(QCPItemPosition) }; Q_DECLARE_METATYPE(QCPItemPosition::PositionType) class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect) Q_PROPERTY(QCPAxisRect *clipAxisRect READ clipAxisRect WRITE setClipAxisRect) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: explicit QCPAbstractItem(QCustomPlot *parentPlot); - virtual ~QCPAbstractItem(); + ~QCPAbstractItem() override; // getters: bool clipToAxisRect() const { return mClipToAxisRect; } QCPAxisRect *clipAxisRect() const; bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setClipToAxisRect(bool clip); void setClipAxisRect(QCPAxisRect *rect); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE = 0; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override = 0; // non-virtual methods: QList positions() const { return mPositions; } QList anchors() const { return mAnchors; } QCPItemPosition *position(const QString &name) const; QCPItemAnchor *anchor(const QString &name) const; bool hasAnchor(const QString &name) const; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); protected: // property members: bool mClipToAxisRect; QPointer mClipAxisRect; QList mPositions; QList mAnchors; bool mSelectable, mSelected; // reimplemented virtual methods: - virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; - virtual QRect clipRect() const Q_DECL_OVERRIDE; - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; + QCP::Interaction selectionCategory() const override; + QRect clipRect() const override; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override = 0; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; // introduced virtual methods: virtual QPointF anchorPixelPosition(int anchorId) const; // non-virtual methods: double rectDistance(const QRectF &rect, const QPointF &pos, bool filledRect) const; QCPItemPosition *createPosition(const QString &name); QCPItemAnchor *createAnchor(const QString &name, int anchorId); private: Q_DISABLE_COPY(QCPAbstractItem) friend class QCustomPlot; friend class QCPItemAnchor; }; /* end of 'src/item.h' */ /* including file 'src/core.h', size 14797 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCustomPlot : public QWidget { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QRect viewport READ viewport WRITE setViewport) Q_PROPERTY(QPixmap background READ background WRITE setBackground) Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) Q_PROPERTY(QCPLayoutGrid *plotLayout READ plotLayout) Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend) Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance) Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag) Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier) Q_PROPERTY(bool openGl READ openGl WRITE setOpenGl) /// \endcond public: /*! Defines how a layer should be inserted relative to an other layer. \see addLayer, moveLayer */ enum LayerInsertMode { limBelow ///< Layer is inserted below other layer , limAbove ///< Layer is inserted above other layer }; Q_ENUM(LayerInsertMode) /*! Defines with what timing the QCustomPlot surface is refreshed after a replot. \see replot */ enum RefreshPriority { rpImmediateRefresh ///< Replots immediately and repaints the widget immediately by calling QWidget::repaint() after the replot , rpQueuedRefresh ///< Replots immediately, but queues the widget repaint, by calling QWidget::update() after the replot. This way multiple redundant widget repaints can be avoided. , rpRefreshHint ///< Whether to use immediate or queued refresh depends on whether the plotting hint \ref QCP::phImmediateRefresh is set, see \ref setPlottingHints. , rpQueuedReplot ///< Queues the entire replot for the next event loop iteration. This way multiple redundant replots can be avoided. The actual replot is then done with \ref rpRefreshHint priority. }; Q_ENUM(RefreshPriority) explicit QCustomPlot(QWidget *parent = 0); - virtual ~QCustomPlot(); + ~QCustomPlot() override; // getters: QRect viewport() const { return mViewport; } double bufferDevicePixelRatio() const { return mBufferDevicePixelRatio; } QPixmap background() const { return mBackgroundPixmap; } bool backgroundScaled() const { return mBackgroundScaled; } Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; } QCPLayoutGrid *plotLayout() const { return mPlotLayout; } QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; } QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; } bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; } const QCP::Interactions interactions() const { return mInteractions; } int selectionTolerance() const { return mSelectionTolerance; } bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; } QCP::PlottingHints plottingHints() const { return mPlottingHints; } Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; } QCP::SelectionRectMode selectionRectMode() const { return mSelectionRectMode; } QCPSelectionRect *selectionRect() const { return mSelectionRect; } bool openGl() const { return mOpenGl; } // setters: void setViewport(const QRect &rect); void setBufferDevicePixelRatio(double ratio); void setBackground(const QPixmap &pm); void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding); void setBackground(const QBrush &brush); void setBackgroundScaled(bool scaled); void setBackgroundScaledMode(Qt::AspectRatioMode mode); void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements); void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled = true); void setNotAntialiasedElements(const QCP::AntialiasedElements ¬AntialiasedElements); void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled = true); void setAutoAddPlottableToLegend(bool on); void setInteractions(const QCP::Interactions &interactions); void setInteraction(const QCP::Interaction &interaction, bool enabled = true); void setSelectionTolerance(int pixels); void setNoAntialiasingOnDrag(bool enabled); void setPlottingHints(const QCP::PlottingHints &hints); void setPlottingHint(QCP::PlottingHint hint, bool enabled = true); void setMultiSelectModifier(Qt::KeyboardModifier modifier); void setSelectionRectMode(QCP::SelectionRectMode mode); void setSelectionRect(QCPSelectionRect *selectionRect); void setOpenGl(bool enabled, int multisampling = 16); // non-property methods: // plottable interface: QCPAbstractPlottable *plottable(int index); QCPAbstractPlottable *plottable(); bool removePlottable(QCPAbstractPlottable *plottable); bool removePlottable(int index); int clearPlottables(); int plottableCount() const; QList selectedPlottables() const; QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable = false) const; bool hasPlottable(QCPAbstractPlottable *plottable) const; // specialized interface for QCPGraph: QCPGraph *graph(int index) const; QCPGraph *graph() const; QCPGraph *addGraph(QCPAxis *keyAxis = 0, QCPAxis *valueAxis = 0); bool removeGraph(QCPGraph *graph); bool removeGraph(int index); int clearGraphs(); int graphCount() const; QList selectedGraphs() const; // item interface: QCPAbstractItem *item(int index) const; QCPAbstractItem *item() const; bool removeItem(QCPAbstractItem *item); bool removeItem(int index); int clearItems(); int itemCount() const; QList selectedItems() const; QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable = false) const; bool hasItem(QCPAbstractItem *item) const; // layer interface: QCPLayer *layer(const QString &name) const; QCPLayer *layer(int index) const; QCPLayer *currentLayer() const; bool setCurrentLayer(const QString &name); bool setCurrentLayer(QCPLayer *layer); int layerCount() const; bool addLayer(const QString &name, QCPLayer *otherLayer = 0, LayerInsertMode insertMode = limAbove); bool removeLayer(QCPLayer *layer); bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode = limAbove); // axis rect/layout interface: int axisRectCount() const; QCPAxisRect *axisRect(int index = 0) const; QList axisRects() const; QCPLayoutElement *layoutElementAt(const QPointF &pos) const; QCPAxisRect *axisRectAt(const QPointF &pos) const; Q_SLOT void rescaleAxes(bool onlyVisiblePlottables = false); QList selectedAxes() const; QList selectedLegends() const; Q_SLOT void deselectAll(); bool savePdf(const QString &fileName, int width = 0, int height = 0, QCP::ExportPen exportPen = QCP::epAllowCosmetic, const QString &pdfCreator = QString(), const QString &pdfTitle = QString()); bool savePng(const QString &fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1, int resolution = 96, QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch); bool saveJpg(const QString &fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1, int resolution = 96, QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch); bool saveBmp(const QString &fileName, int width = 0, int height = 0, double scale = 1.0, int resolution = 96, QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch); bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality = -1, int resolution = 96, QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch); QPixmap toPixmap(int width = 0, int height = 0, double scale = 1.0); void toPainter(QCPPainter *painter, int width = 0, int height = 0); Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority = QCustomPlot::rpRefreshHint); QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2; QCPLegend *legend; signals: void mouseDoubleClick(QMouseEvent *event); void mousePress(QMouseEvent *event); void mouseMove(QMouseEvent *event); void mouseRelease(QMouseEvent *event); void mouseWheel(QWheelEvent *event); void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); void itemClick(QCPAbstractItem *item, QMouseEvent *event); void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event); void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event); void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event); void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); void selectionChangedByUser(); void beforeReplot(); void afterReplot(); protected: // property members: QRect mViewport; double mBufferDevicePixelRatio; QCPLayoutGrid *mPlotLayout; bool mAutoAddPlottableToLegend; QList mPlottables; QList mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph QList mItems; QList mLayers; QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements; QCP::Interactions mInteractions; int mSelectionTolerance; bool mNoAntialiasingOnDrag; QBrush mBackgroundBrush; QPixmap mBackgroundPixmap; QPixmap mScaledBackgroundPixmap; bool mBackgroundScaled; Qt::AspectRatioMode mBackgroundScaledMode; QCPLayer *mCurrentLayer; QCP::PlottingHints mPlottingHints; Qt::KeyboardModifier mMultiSelectModifier; QCP::SelectionRectMode mSelectionRectMode; QCPSelectionRect *mSelectionRect; bool mOpenGl; // non-property members: QList> mPaintBuffers; QPoint mMousePressPos; bool mMouseHasMoved; QPointer mMouseEventLayerable; QVariant mMouseEventLayerableDetails; bool mReplotting; bool mReplotQueued; int mOpenGlMultisamples; QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup; bool mOpenGlCacheLabelsBackup; #ifdef QCP_OPENGL_FBO QSharedPointer mGlContext; QSharedPointer mGlSurface; QSharedPointer mGlPaintDevice; #endif // reimplemented virtual methods: - virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; - virtual QSize sizeHint() const Q_DECL_OVERRIDE; - virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; - virtual bool event(QEvent *event) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + QSize minimumSizeHint() const override; + QSize sizeHint() const override; + void paintEvent(QPaintEvent *event) override; + void resizeEvent(QResizeEvent *event) override; + bool event(QEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void wheelEvent(QWheelEvent *event) override; // introduced virtual methods: virtual void draw(QCPPainter *painter); virtual void updateLayout(); virtual void axisRemoved(QCPAxis *axis); virtual void legendRemoved(QCPLegend *legend); Q_SLOT virtual void processRectSelection(QRect rect, QMouseEvent *event); Q_SLOT virtual void processRectZoom(QRect rect, QMouseEvent *event); Q_SLOT virtual void processPointSelection(QMouseEvent *event); // non-virtual methods: bool registerPlottable(QCPAbstractPlottable *plottable); bool registerGraph(QCPGraph *graph); bool registerItem(QCPAbstractItem *item); void updateLayerIndices() const; QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails = 0) const; QList layerableListAt(const QPointF &pos, bool onlySelectable, QList *selectionDetails = 0) const; void drawBackground(QCPPainter *painter); void setupPaintBuffers(); QCPAbstractPaintBuffer *createPaintBuffer(); bool hasInvalidatedPaintBuffers(); bool setupOpenGl(); void freeOpenGl(); friend class QCPLegend; friend class QCPAxis; friend class QCPLayer; friend class QCPAxisRect; friend class QCPAbstractPlottable; friend class QCPGraph; friend class QCPAbstractItem; }; Q_DECLARE_METATYPE(QCustomPlot::LayerInsertMode) Q_DECLARE_METATYPE(QCustomPlot::RefreshPriority) /* end of 'src/core.h' */ /* including file 'src/plottable1d.h', size 4250 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPPlottableInterface1D { public: // introduced pure virtual methods: virtual int dataCount() const = 0; virtual double dataMainKey(int index) const = 0; virtual double dataSortKey(int index) const = 0; virtual double dataMainValue(int index) const = 0; virtual QCPRange dataValueRange(int index) const = 0; virtual QPointF dataPixelPosition(int index) const = 0; virtual bool sortKeyIsMainKey() const = 0; virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const = 0; virtual int findBegin(double sortKey, bool expandedRange = true) const = 0; virtual int findEnd(double sortKey, bool expandedRange = true) const = 0; }; template class QCP_LIB_DECL QCPAbstractPlottable1D : public QCPAbstractPlottable, public QCPPlottableInterface1D { // No Q_OBJECT macro due to template class public: QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPAbstractPlottable1D(); + ~QCPAbstractPlottable1D() override; // virtual methods of 1d plottable interface: - virtual int dataCount() const; - virtual double dataMainKey(int index) const; - virtual double dataSortKey(int index) const; - virtual double dataMainValue(int index) const; - virtual QCPRange dataValueRange(int index) const; - virtual QPointF dataPixelPosition(int index) const; - virtual bool sortKeyIsMainKey() const; - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const; - virtual int findBegin(double sortKey, bool expandedRange = true) const; - virtual int findEnd(double sortKey, bool expandedRange = true) const; + int dataCount() const override; + double dataMainKey(int index) const override; + double dataSortKey(int index) const override; + double dataMainValue(int index) const override; + QCPRange dataValueRange(int index) const override; + QPointF dataPixelPosition(int index) const override; + bool sortKeyIsMainKey() const override; + QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const override; + int findBegin(double sortKey, bool expandedRange = true) const override; + int findEnd(double sortKey, bool expandedRange = true) const override; // virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const; - virtual QCPPlottableInterface1D *interface1D() { return this; } + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPPlottableInterface1D *interface1D() override { return this; } protected: // property members: QSharedPointer> mDataContainer; // helpers for subclasses: void getDataSegments(QList &selectedSegments, QList &unselectedSegments) const; void drawPolyline(QCPPainter *painter, const QVector &lineData) const; private: Q_DISABLE_COPY(QCPAbstractPlottable1D) }; // include implementation in header since it is a class template: /* including file 'src/plottable1d.cpp', size 22240 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPlottableInterface1D //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPlottableInterface1D \brief Defines an abstract interface for one-dimensional plottables This class contains only pure virtual methods which define a common interface to the data of one-dimensional plottables. For example, it is implemented by the template class \ref QCPAbstractPlottable1D (the preferred base class for one-dimensional plottables). So if you use that template class as base class of your one-dimensional plottable, you won't have to care about implementing the 1d interface yourself. If your plottable doesn't derive from \ref QCPAbstractPlottable1D but still wants to provide a 1d interface (e.g. like \ref QCPErrorBars does), you should inherit from both \ref QCPAbstractPlottable and \ref QCPPlottableInterface1D and accordingly reimplement the pure virtual methods of the 1d interface, matching your data container. Also, reimplement \ref QCPAbstractPlottable::interface1D to return the \c this pointer. If you have a \ref QCPAbstractPlottable pointer, you can check whether it implements this interface by calling \ref QCPAbstractPlottable::interface1D and testing it for a non-zero return value. If it indeed implements this interface, you may use it to access the plottable's data without needing to know the exact type of the plottable or its data point type. */ /* start documentation of pure virtual functions */ /*! \fn virtual int QCPPlottableInterface1D::dataCount() const = 0; Returns the number of data points of the plottable. */ /*! \fn virtual QCPDataSelection QCPPlottableInterface1D::selectTestRect(const QRectF &rect, bool onlySelectable) const = 0; Returns a data selection containing all the data points of this plottable which are contained (or hit by) \a rect. This is used mainly in the selection rect interaction for data selection (\ref dataselection "data selection mechanism"). If \a onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if \ref QCPAbstractPlottable::setSelectable is \ref QCP::stNone). \note \a rect must be a normalized rect (positive or zero width and height). This is especially important when using the rect of \ref QCPSelectionRect::accepted, which is not necessarily normalized. Use QRect::normalized() when passing a rect which might not be normalized. */ /*! \fn virtual double QCPPlottableInterface1D::dataMainKey(int index) const = 0 Returns the main key of the data point at the given \a index. What the main key is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual double QCPPlottableInterface1D::dataSortKey(int index) const = 0 Returns the sort key of the data point at the given \a index. What the sort key is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual double QCPPlottableInterface1D::dataMainValue(int index) const = 0 Returns the main value of the data point at the given \a index. What the main value is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual QCPRange QCPPlottableInterface1D::dataValueRange(int index) const = 0 Returns the value range of the data point at the given \a index. What the value range is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual QPointF QCPPlottableInterface1D::dataPixelPosition(int index) const = 0 Returns the pixel position on the widget surface at which the data point at the given \a index appears. Usually this corresponds to the point of \ref dataMainKey/\ref dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, \ref QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value. */ /*! \fn virtual bool QCPPlottableInterface1D::sortKeyIsMainKey() const = 0 Returns whether the sort key (\ref dataSortKey) is identical to the main key (\ref dataMainKey). What the sort and main keys are, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual int QCPPlottableInterface1D::findBegin(double sortKey, bool expandedRange) const = 0 Returns the index of the data point with a (sort-)key that is equal to, just below, or just above \a sortKey. If \a expandedRange is true, the data point just below \a sortKey will be considered, otherwise the one just above. This can be used in conjunction with \ref findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range. If \a expandedRange is true but there are no data points below \a sortKey, 0 is returned. If the container is empty, returns 0 (in that case, \ref findEnd will also return 0, so a loop using these methods will not iterate over the index 0). \see findEnd, QCPDataContainer::findBegin */ /*! \fn virtual int QCPPlottableInterface1D::findEnd(double sortKey, bool expandedRange) const = 0 Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below \a sortKey. If \a expandedRange is true, the data point just above \a sortKey will be considered, otherwise the one just below. This can be used in conjunction with \ref findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range. If \a expandedRange is true but there are no data points above \a sortKey, the index just above the highest data point is returned. If the container is empty, returns 0. \see findBegin, QCPDataContainer::findEnd */ /* end documentation of pure virtual functions */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractPlottable1D //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractPlottable1D \brief A template base class for plottables with one-dimensional data This template class derives from \ref QCPAbstractPlottable and from the abstract interface \ref QCPPlottableInterface1D. It serves as a base class for all one-dimensional data (i.e. data with one key dimension), such as \ref QCPGraph and QCPCurve. The template parameter \a DataType is the type of the data points of this plottable (e.g. \ref QCPGraphData or \ref QCPCurveData). The main purpose of this base class is to provide the member \a mDataContainer (a shared pointer to a \ref QCPDataContainer "QCPDataContainer") and implement the according virtual methods of the \ref QCPPlottableInterface1D, such that most subclassed plottables don't need to worry about this anymore. Further, it provides a convenience method for retrieving selected/unselected data segments via \ref getDataSegments. This is useful when subclasses implement their \ref draw method and need to draw selected segments with a different pen/brush than unselected segments (also see \ref QCPSelectionDecorator). This class implements basic functionality of \ref QCPAbstractPlottable::selectTest and \ref QCPPlottableInterface1D::selectTestRect, assuming point-like data points, based on the 1D data interface. In spite of that, most plottable subclasses will want to reimplement those methods again, to provide a more accurate hit test based on their specific data visualization geometry. */ /* start documentation of inline functions */ /*! \fn QCPPlottableInterface1D *QCPAbstractPlottable1D::interface1D() Returns a \ref QCPPlottableInterface1D pointer to this plottable, providing access to its 1D interface. \seebaseclassmethod */ /* end documentation of inline functions */ /*! Forwards \a keyAxis and \a valueAxis to the \ref QCPAbstractPlottable::QCPAbstractPlottable "QCPAbstractPlottable" constructor and allocates the \a mDataContainer. */ template QCPAbstractPlottable1D::QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable(keyAxis, valueAxis), mDataContainer(new QCPDataContainer) { } template QCPAbstractPlottable1D::~QCPAbstractPlottable1D() { } /*! \copydoc QCPPlottableInterface1D::dataCount */ template int QCPAbstractPlottable1D::dataCount() const { return mDataContainer->size(); } /*! \copydoc QCPPlottableInterface1D::dataMainKey */ template double QCPAbstractPlottable1D::dataMainKey(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin() + index)->mainKey(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataSortKey */ template double QCPAbstractPlottable1D::dataSortKey(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin() + index)->sortKey(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataMainValue */ template double QCPAbstractPlottable1D::dataMainValue(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin() + index)->mainValue(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataValueRange */ template QCPRange QCPAbstractPlottable1D::dataValueRange(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin() + index)->valueRange(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return QCPRange(0, 0); } } /*! \copydoc QCPPlottableInterface1D::dataPixelPosition */ template QPointF QCPAbstractPlottable1D::dataPixelPosition(int index) const { if (index >= 0 && index < mDataContainer->size()) { const typename QCPDataContainer::const_iterator it = mDataContainer->constBegin() + index; return coordsToPixels(it->mainKey(), it->mainValue()); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return QPointF(); } } /*! \copydoc QCPPlottableInterface1D::sortKeyIsMainKey */ template bool QCPAbstractPlottable1D::sortKeyIsMainKey() const { return DataType::sortKeyIsMainKey(); } /*! Implements a rect-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry. \seebaseclassmethod */ template QCPDataSelection QCPAbstractPlottable1D::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; // convert rect given in pixels to ranges given in plot coordinates: double key1, value1, key2, value2; pixelsToCoords(rect.topLeft(), key1, value1); pixelsToCoords(rect.bottomRight(), key2, value2); QCPRange keyRange(key1, key2); // QCPRange normalizes internally so we don't have to care about whether key1 < key2 QCPRange valueRange(value1, value2); typename QCPDataContainer::const_iterator begin = mDataContainer->constBegin(); typename QCPDataContainer::const_iterator end = mDataContainer->constEnd(); if (DataType:: sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval: { begin = mDataContainer->findBegin(keyRange.lower, false); end = mDataContainer->findEnd(keyRange.upper, false); } if (begin == end) return result; int currentSegmentBegin = -1; // -1 means we're currently not in a segment that's contained in rect for (typename QCPDataContainer::const_iterator it = begin; it != end; ++it) { if (currentSegmentBegin == -1) { if (valueRange.contains(it->mainValue()) && keyRange.contains(it->mainKey())) // start segment currentSegmentBegin = it - mDataContainer->constBegin(); } else if (!valueRange.contains(it->mainValue()) || !keyRange.contains(it->mainKey())) // segment just ended { result.addDataRange(QCPDataRange(currentSegmentBegin, it - mDataContainer->constBegin()), false); currentSegmentBegin = -1; } } // process potential last segment: if (currentSegmentBegin != -1) result.addDataRange(QCPDataRange(currentSegmentBegin, end - mDataContainer->constBegin()), false); result.simplify(); return result; } /*! \copydoc QCPPlottableInterface1D::findBegin */ template int QCPAbstractPlottable1D::findBegin(double sortKey, bool expandedRange) const { return mDataContainer->findBegin(sortKey, expandedRange) - mDataContainer->constBegin(); } /*! \copydoc QCPPlottableInterface1D::findEnd */ template int QCPAbstractPlottable1D::findEnd(double sortKey, bool expandedRange) const { return mDataContainer->findEnd(sortKey, expandedRange) - mDataContainer->constBegin(); } /*! Implements a point-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry. \seebaseclassmethod */ template double QCPAbstractPlottable1D::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; QCPDataSelection selectionResult; double minDistSqr = std::numeric_limits::max(); int minDistIndex = mDataContainer->size(); typename QCPDataContainer::const_iterator begin = mDataContainer->constBegin(); typename QCPDataContainer::const_iterator end = mDataContainer->constEnd(); if (DataType:: sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval: { // determine which key range comes into question, taking selection tolerance around pos into account: double posKeyMin, posKeyMax, dummy; pixelsToCoords(pos - QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy); pixelsToCoords(pos + QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy); if (posKeyMin > posKeyMax) qSwap(posKeyMin, posKeyMax); begin = mDataContainer->findBegin(posKeyMin, true); end = mDataContainer->findEnd(posKeyMax, true); } if (begin == end) return -1; QCPRange keyRange(mKeyAxis->range()); QCPRange valueRange(mValueAxis->range()); for (typename QCPDataContainer::const_iterator it = begin; it != end; ++it) { const double mainKey = it->mainKey(); const double mainValue = it->mainValue(); if (keyRange.contains(mainKey) && valueRange.contains( mainValue)) // make sure data point is inside visible range, for speedup in cases where sort key isn't main key and we iterate over all points { const double currentDistSqr = QCPVector2D(coordsToPixels(mainKey, mainValue) - pos).lengthSquared(); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; minDistIndex = it - mDataContainer->constBegin(); } } } if (minDistIndex != mDataContainer->size()) selectionResult.addDataRange(QCPDataRange(minDistIndex, minDistIndex + 1), false); selectionResult.simplify(); if (details) details->setValue(selectionResult); return qSqrt(minDistSqr); } /*! Splits all data into selected and unselected segments and outputs them via \a selectedSegments and \a unselectedSegments, respectively. This is useful when subclasses implement their \ref draw method and need to draw selected segments with a different pen/brush than unselected segments (also see \ref QCPSelectionDecorator). \see setSelection */ template void QCPAbstractPlottable1D::getDataSegments(QList &selectedSegments, QList &unselectedSegments) const { selectedSegments.clear(); unselectedSegments.clear(); if (mSelectable == QCP::stWhole) // stWhole selection type draws the entire plottable with selected style if mSelection isn't empty { if (selected()) selectedSegments << QCPDataRange(0, dataCount()); else unselectedSegments << QCPDataRange(0, dataCount()); } else { QCPDataSelection sel(selection()); sel.simplify(); selectedSegments = sel.dataRanges(); unselectedSegments = sel.inverse(QCPDataRange(0, dataCount())).dataRanges(); } } /*! A helper method which draws a line with the passed \a painter, according to the pixel data in \a lineData. NaN points create gaps in the line, as expected from QCustomPlot's plottables (this is the main difference to QPainter's regular drawPolyline, which handles NaNs by lagging or crashing). Further it uses a faster line drawing technique based on \ref QCPPainter::drawLine rather than \c QPainter::drawPolyline if the configured \ref QCustomPlot::setPlottingHints() and \a painter style allows. */ template void QCPAbstractPlottable1D::drawPolyline(QCPPainter *painter, const QVector &lineData) const { // if drawing solid line and not in PDF, use much faster line drawing instead of polyline: if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) && painter->pen().style() == Qt::SolidLine && !painter->modes().testFlag(QCPPainter::pmVectorized) && !painter->modes().testFlag(QCPPainter::pmNoCaching)) { int i = 0; bool lastIsNan = false; const int lineDataSize = lineData.size(); while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()))) // make sure first point is not NaN ++i; ++i; // because drawing works in 1 point retrospect while (i < lineDataSize) { if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line { if (!lastIsNan) painter->drawLine(lineData.at(i - 1), lineData.at(i)); else lastIsNan = false; } else lastIsNan = true; ++i; } } else { int segmentStart = 0; int i = 0; const int lineDataSize = lineData.size(); while (i < lineDataSize) { if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i) .y())) // NaNs create a gap in the line. Also filter Infs which make drawPolyline block { painter->drawPolyline(lineData.constData() + segmentStart, i - segmentStart); // i, because we don't want to include the current NaN point segmentStart = i + 1; } ++i; } // draw last segment: painter->drawPolyline(lineData.constData() + segmentStart, lineDataSize - segmentStart); } } /* end of 'src/plottable1d.cpp' */ /* end of 'src/plottable1d.h' */ /* including file 'src/colorgradient.h', size 6243 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPColorGradient { Q_GADGET public: /*! Defines the color spaces in which color interpolation between gradient stops can be performed. \see setColorInterpolation */ enum ColorInterpolation { ciRGB ///< Color channels red, green and blue are linearly interpolated , ciHSV ///< Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the shortest angle distance) }; Q_ENUM(ColorInterpolation) /*! Defines the available presets that can be loaded with \ref loadPreset. See the documentation there for an image of the presets. */ enum GradientPreset { gpGrayscale ///< Continuous lightness from black to white (suited for non-biased data representation) , gpHot ///< Continuous lightness from black over firey colors to white (suited for non-biased data representation) , gpCold ///< Continuous lightness from black over icey colors to white (suited for non-biased data representation) , gpNight ///< Continuous lightness from black over weak blueish colors to white (suited for non-biased data representation) , gpCandy ///< Blue over pink to white , gpGeography ///< Colors suitable to represent different elevations on geographical maps , gpIon ///< Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allows more precise magnitude estimates) , gpThermal ///< Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white , gpPolar ///< Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle and red for positive values , gpSpectrum ///< An approximation of the visible light spectrum (creates banding illusion but allows more precise magnitude estimates) , gpJet ///< Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates) , gpHues ///< Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see \ref setPeriodic) }; Q_ENUM(GradientPreset) QCPColorGradient(); QCPColorGradient(GradientPreset preset); bool operator==(const QCPColorGradient &other) const; bool operator!=(const QCPColorGradient &other) const { return !(*this == other); } // getters: int levelCount() const { return mLevelCount; } QMap colorStops() const { return mColorStops; } ColorInterpolation colorInterpolation() const { return mColorInterpolation; } bool periodic() const { return mPeriodic; } // setters: void setLevelCount(int n); void setColorStops(const QMap &colorStops); void setColorStopAt(double position, const QColor &color); void setColorInterpolation(ColorInterpolation interpolation); void setPeriodic(bool enabled); // non-property methods: void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor = 1, bool logarithmic = false); void colorize(const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor = 1, bool logarithmic = false); QRgb color(double position, const QCPRange &range, bool logarithmic = false); void loadPreset(GradientPreset preset); void clearColorStops(); QCPColorGradient inverted() const; protected: // property members: int mLevelCount; QMap mColorStops; ColorInterpolation mColorInterpolation; bool mPeriodic; // non-property members: QVector mColorBuffer; // have colors premultiplied with alpha (for usage with QImage::Format_ARGB32_Premultiplied) bool mColorBufferInvalidated; // non-virtual methods: bool stopsUseAlpha() const; void updateColorBuffer(); }; Q_DECLARE_METATYPE(QCPColorGradient::ColorInterpolation) Q_DECLARE_METATYPE(QCPColorGradient::GradientPreset) /* end of 'src/colorgradient.h' */ /* including file 'src/selectiondecorator-bracket.h', size 4426 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPSelectionDecoratorBracket : public QCPSelectionDecorator { Q_GADGET public: /*! Defines which shape is drawn at the boundaries of selected data ranges. Some of the bracket styles further allow specifying a height and/or width, see \ref setBracketHeight and \ref setBracketWidth. */ enum BracketStyle { bsSquareBracket ///< A square bracket is drawn. , bsHalfEllipse ///< A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. , bsEllipse ///< An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. , bsPlus ///< A plus is drawn. , bsUserStyle ///< Start custom bracket styles at this index when subclassing and reimplementing \ref drawBracket. }; Q_ENUM(BracketStyle) QCPSelectionDecoratorBracket(); - virtual ~QCPSelectionDecoratorBracket(); + ~QCPSelectionDecoratorBracket() override; // getters: QPen bracketPen() const { return mBracketPen; } QBrush bracketBrush() const { return mBracketBrush; } int bracketWidth() const { return mBracketWidth; } int bracketHeight() const { return mBracketHeight; } BracketStyle bracketStyle() const { return mBracketStyle; } bool tangentToData() const { return mTangentToData; } int tangentAverage() const { return mTangentAverage; } // setters: void setBracketPen(const QPen &pen); void setBracketBrush(const QBrush &brush); void setBracketWidth(int width); void setBracketHeight(int height); void setBracketStyle(BracketStyle style); void setTangentToData(bool enabled); void setTangentAverage(int pointCount); // introduced virtual methods: virtual void drawBracket(QCPPainter *painter, int direction) const; // virtual methods: - virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection); + void drawDecoration(QCPPainter *painter, QCPDataSelection selection) override; protected: // property members: QPen mBracketPen; QBrush mBracketBrush; int mBracketWidth; int mBracketHeight; BracketStyle mBracketStyle; bool mTangentToData; int mTangentAverage; // non-virtual methods: double getTangentAngle(const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const; QPointF getPixelCoordinates(const QCPPlottableInterface1D *interface1d, int dataIndex) const; }; Q_DECLARE_METATYPE(QCPSelectionDecoratorBracket::BracketStyle) /* end of 'src/selectiondecorator-bracket.h' */ /* including file 'src/layoutelements/layoutelement-axisrect.h', size 7528 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPixmap background READ background WRITE setBackground) Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag) Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes = true); - virtual ~QCPAxisRect(); + ~QCPAxisRect() override; // getters: QPixmap background() const { return mBackgroundPixmap; } QBrush backgroundBrush() const { return mBackgroundBrush; } bool backgroundScaled() const { return mBackgroundScaled; } Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; } Qt::Orientations rangeDrag() const { return mRangeDrag; } Qt::Orientations rangeZoom() const { return mRangeZoom; } QCPAxis *rangeDragAxis(Qt::Orientation orientation); QCPAxis *rangeZoomAxis(Qt::Orientation orientation); QList rangeDragAxes(Qt::Orientation orientation); QList rangeZoomAxes(Qt::Orientation orientation); double rangeZoomFactor(Qt::Orientation orientation); // setters: void setBackground(const QPixmap &pm); void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding); void setBackground(const QBrush &brush); void setBackgroundScaled(bool scaled); void setBackgroundScaledMode(Qt::AspectRatioMode mode); void setRangeDrag(Qt::Orientations orientations); void setRangeZoom(Qt::Orientations orientations); void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical); void setRangeDragAxes(QList axes); void setRangeDragAxes(QList horizontal, QList vertical); void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical); void setRangeZoomAxes(QList axes); void setRangeZoomAxes(QList horizontal, QList vertical); void setRangeZoomFactor(double horizontalFactor, double verticalFactor); void setRangeZoomFactor(double factor); // non-property methods: int axisCount(QCPAxis::AxisType type) const; QCPAxis *axis(QCPAxis::AxisType type, int index = 0) const; QList axes(QCPAxis::AxisTypes types) const; QList axes() const; QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis = 0); QList addAxes(QCPAxis::AxisTypes types); bool removeAxis(QCPAxis *axis); QCPLayoutInset *insetLayout() const { return mInsetLayout; } void zoom(const QRectF &pixelRect); void zoom(const QRectF &pixelRect, const QList &affectedAxes); void setupFullAxesBox(bool connectRanges = false); QList plottables() const; QList graphs() const; QList items() const; // read-only interface imitating a QRect: int left() const { return mRect.left(); } int right() const { return mRect.right(); } int top() const { return mRect.top(); } int bottom() const { return mRect.bottom(); } int width() const { return mRect.width(); } int height() const { return mRect.height(); } QSize size() const { return mRect.size(); } QPoint topLeft() const { return mRect.topLeft(); } QPoint topRight() const { return mRect.topRight(); } QPoint bottomLeft() const { return mRect.bottomLeft(); } QPoint bottomRight() const { return mRect.bottomRight(); } QPoint center() const { return mRect.center(); } // reimplemented virtual methods: - virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; - virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; + void update(UpdatePhase phase) override; + QList elements(bool recursive) const override; protected: // property members: QBrush mBackgroundBrush; QPixmap mBackgroundPixmap; QPixmap mScaledBackgroundPixmap; bool mBackgroundScaled; Qt::AspectRatioMode mBackgroundScaledMode; QCPLayoutInset *mInsetLayout; Qt::Orientations mRangeDrag, mRangeZoom; QList> mRangeDragHorzAxis, mRangeDragVertAxis; QList> mRangeZoomHorzAxis, mRangeZoomVertAxis; double mRangeZoomFactorHorz, mRangeZoomFactorVert; // non-property members: QList mDragStartHorzRange, mDragStartVertRange; QCP::AntialiasedElements mAADragBackup, mNotAADragBackup; QPoint mDragStart; bool mDragging; QHash> mAxes; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE; - virtual void layoutChanged() Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; + int calculateAutoMargin(QCP::MarginSide side) override; + void layoutChanged() override; // events: - virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; - virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; - virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event, const QVariant &details) override; + void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) override; + void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) override; + void wheelEvent(QWheelEvent *event) override; // non-property methods: void drawBackground(QCPPainter *painter); void updateAxesOffset(QCPAxis::AxisType type); private: Q_DISABLE_COPY(QCPAxisRect) friend class QCustomPlot; }; /* end of 'src/layoutelements/layoutelement-axisrect.h' */ /* including file 'src/layoutelements/layoutelement-legend.h', size 10392 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPLegend *parentLegend READ parentLegend) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged) /// \endcond public: explicit QCPAbstractLegendItem(QCPLegend *parent); // getters: QCPLegend *parentLegend() const { return mParentLegend; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setFont(const QFont &font); void setTextColor(const QColor &color); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); protected: // property members: QCPLegend *mParentLegend; QFont mFont; QColor mTextColor; QFont mSelectedFont; QColor mSelectedTextColor; bool mSelectable, mSelected; // reimplemented virtual methods: - virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual QRect clipRect() const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; + QCP::Interaction selectionCategory() const override; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + QRect clipRect() const override; + void draw(QCPPainter *painter) override = 0; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; private: Q_DISABLE_COPY(QCPAbstractLegendItem) friend class QCPLegend; }; class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem { Q_OBJECT public: QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable); // getters: QCPAbstractPlottable *plottable() { return mPlottable; } protected: // property members: QCPAbstractPlottable *mPlottable; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QSize minimumSizeHint() const override; // non-virtual methods: QPen getIconBorderPen() const; QColor getTextColor() const; QFont getFont() const; }; class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding) Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen) Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged) Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged) Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen) Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) /// \endcond public: /*! Defines the selectable parts of a legend \see setSelectedParts, setSelectableParts */ enum SelectablePart { spNone = 0x000 ///< 0x000 None , spLegendBox = 0x001 ///< 0x001 The legend box (frame) , spItems = 0x002 ///< 0x002 Legend items individually (see \ref selectedItems) }; Q_ENUM(SelectablePart) Q_FLAGS(SelectableParts) Q_DECLARE_FLAGS(SelectableParts, SelectablePart) explicit QCPLegend(); - virtual ~QCPLegend(); + ~QCPLegend() override; // getters: QPen borderPen() const { return mBorderPen; } QBrush brush() const { return mBrush; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QSize iconSize() const { return mIconSize; } int iconTextPadding() const { return mIconTextPadding; } QPen iconBorderPen() const { return mIconBorderPen; } SelectableParts selectableParts() const { return mSelectableParts; } SelectableParts selectedParts() const; QPen selectedBorderPen() const { return mSelectedBorderPen; } QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; } QBrush selectedBrush() const { return mSelectedBrush; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } // setters: void setBorderPen(const QPen &pen); void setBrush(const QBrush &brush); void setFont(const QFont &font); void setTextColor(const QColor &color); void setIconSize(const QSize &size); void setIconSize(int width, int height); void setIconTextPadding(int padding); void setIconBorderPen(const QPen &pen); Q_SLOT void setSelectableParts(const SelectableParts &selectableParts); Q_SLOT void setSelectedParts(const SelectableParts &selectedParts); void setSelectedBorderPen(const QPen &pen); void setSelectedIconBorderPen(const QPen &pen); void setSelectedBrush(const QBrush &brush); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; // non-virtual methods: QCPAbstractLegendItem *item(int index) const; QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const; int itemCount() const; bool hasItem(QCPAbstractLegendItem *item) const; bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const; bool addItem(QCPAbstractLegendItem *item); bool removeItem(int index); bool removeItem(QCPAbstractLegendItem *item); void clearItems(); QList selectedItems() const; signals: void selectionChanged(QCPLegend::SelectableParts parts); void selectableChanged(QCPLegend::SelectableParts parts); protected: // property members: QPen mBorderPen, mIconBorderPen; QBrush mBrush; QFont mFont; QColor mTextColor; QSize mIconSize; int mIconTextPadding; SelectableParts mSelectedParts, mSelectableParts; QPen mSelectedBorderPen, mSelectedIconBorderPen; QBrush mSelectedBrush; QFont mSelectedFont; QColor mSelectedTextColor; // reimplemented virtual methods: - virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE; - virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void parentPlotInitialized(QCustomPlot *parentPlot) override; + QCP::Interaction selectionCategory() const override; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; // non-virtual methods: QPen getBorderPen() const; QBrush getBrush() const; private: Q_DISABLE_COPY(QCPLegend) friend class QCustomPlot; friend class QCPAbstractLegendItem; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts) Q_DECLARE_METATYPE(QCPLegend::SelectablePart) /* end of 'src/layoutelements/layoutelement-legend.h' */ /* including file 'src/layoutelements/layoutelement-textelement.h', size 5343 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPTextElement : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: explicit QCPTextElement(QCustomPlot *parentPlot); QCPTextElement(QCustomPlot *parentPlot, const QString &text); QCPTextElement(QCustomPlot *parentPlot, const QString &text, double pointSize); QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize); QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QFont &font); // getters: QString text() const { return mText; } int textFlags() const { return mTextFlags; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setText(const QString &text); void setTextFlags(int flags); void setFont(const QFont &font); void setTextColor(const QColor &color); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + void mousePressEvent(QMouseEvent *event, const QVariant &details) override; + void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) override; + void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) override; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); void clicked(QMouseEvent *event); void doubleClicked(QMouseEvent *event); protected: // property members: QString mText; int mTextFlags; QFont mFont; QColor mTextColor; QFont mSelectedFont; QColor mSelectedTextColor; QRect mTextBoundingRect; bool mSelectable, mSelected; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; - virtual QSize maximumSizeHint() const Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; + void draw(QCPPainter *painter) override; + QSize minimumSizeHint() const override; + QSize maximumSizeHint() const override; // events: - virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, - bool *selectionStateChanged) Q_DECL_OVERRIDE; - virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; + void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, + bool *selectionStateChanged) override; + void deselectEvent(bool *selectionStateChanged) override; // non-virtual methods: QFont mainFont() const; QColor mainTextColor() const; private: Q_DISABLE_COPY(QCPTextElement) }; /* end of 'src/layoutelements/layoutelement-textelement.h' */ /* including file 'src/layoutelements/layoutelement-colorscale.h', size 5907 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCPColorScaleAxisRectPrivate : public QCPAxisRect { Q_OBJECT public: explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale); protected: QCPColorScale *mParentColorScale; QImage mGradientImage; bool mGradientImageInvalidated; // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale using QCPAxisRect::calculateAutoMargin; using QCPAxisRect::mousePressEvent; using QCPAxisRect::mouseMoveEvent; using QCPAxisRect::mouseReleaseEvent; using QCPAxisRect::wheelEvent; using QCPAxisRect::update; - virtual void draw(QCPPainter *painter); + void draw(QCPPainter *painter) override; void updateGradientImage(); Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts); Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts); friend class QCPColorScale; }; class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType) Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) Q_PROPERTY(QString label READ label WRITE setLabel) Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth) Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag) Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: explicit QCPColorScale(QCustomPlot *parentPlot); - virtual ~QCPColorScale(); + ~QCPColorScale() override; // getters: QCPAxis *axis() const { return mColorAxis.data(); } QCPAxis::AxisType type() const { return mType; } QCPRange dataRange() const { return mDataRange; } QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; } QCPColorGradient gradient() const { return mGradient; } QString label() const; int barWidth() const { return mBarWidth; } bool rangeDrag() const; bool rangeZoom() const; // setters: void setType(QCPAxis::AxisType type); Q_SLOT void setDataRange(const QCPRange &dataRange); Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); Q_SLOT void setGradient(const QCPColorGradient &gradient); void setLabel(const QString &str); void setBarWidth(int width); void setRangeDrag(bool enabled); void setRangeZoom(bool enabled); // non-property methods: QList colorMaps() const; void rescaleDataRange(bool onlyVisibleMaps); // reimplemented virtual methods: - virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; + void update(UpdatePhase phase) override; signals: void dataRangeChanged(const QCPRange &newRange); void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); void gradientChanged(const QCPColorGradient &newGradient); protected: // property members: QCPAxis::AxisType mType; QCPRange mDataRange; QCPAxis::ScaleType mDataScaleType; QCPColorGradient mGradient; int mBarWidth; // non-property members: QPointer mAxisRect; QPointer mColorAxis; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; + void applyDefaultAntialiasingHint(QCPPainter *painter) const override; // events: - virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; - virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; - virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event, const QVariant &details) override; + void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) override; + void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) override; + void wheelEvent(QWheelEvent *event) override; private: Q_DISABLE_COPY(QCPColorScale) friend class QCPColorScaleAxisRectPrivate; }; /* end of 'src/layoutelements/layoutelement-colorscale.h' */ /* including file 'src/plottables/plottable-graph.h', size 8826 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPGraphData { public: QCPGraphData(); QCPGraphData(double key, double value); inline double sortKey() const { return key; } inline static QCPGraphData fromSortKey(double sortKey) { return QCPGraphData(sortKey, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange(value, value); } double key, value; }; Q_DECLARE_TYPEINFO(QCPGraphData, Q_PRIMITIVE_TYPE); /*! \typedef QCPGraphDataContainer Container for storing \ref QCPGraphData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPGraph holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPGraphData, QCPGraph::setData */ typedef QCPDataContainer QCPGraphDataContainer; class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip) Q_PROPERTY(QCPGraph *channelFillGraph READ channelFillGraph WRITE setChannelFillGraph) Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling) /// \endcond public: /*! Defines how the graph's line is represented visually in the plot. The line is drawn with the current pen of the graph (\ref setPen). \see setLineStyle */ enum LineStyle { lsNone ///< data points are not connected with any lines (e.g. data only represented ///< with symbols according to the scatter style, see \ref setScatterStyle) , lsLine ///< data points are connected by a straight line , lsStepLeft ///< line is drawn as steps where the step height is the value of the left data point , lsStepRight ///< line is drawn as steps where the step height is the value of the right data point , lsStepCenter ///< line is drawn as steps where the step is in between two data points , lsImpulse ///< each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line }; Q_ENUM(LineStyle) explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPGraph(); + ~QCPGraph() override; // getters: QSharedPointer data() const { return mDataContainer; } LineStyle lineStyle() const { return mLineStyle; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } int scatterSkip() const { return mScatterSkip; } QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); } bool adaptiveSampling() const { return mAdaptiveSampling; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &values, bool alreadySorted = false); void setLineStyle(LineStyle ls); void setScatterStyle(const QCPScatterStyle &style); void setScatterSkip(int skip); void setChannelFillGraph(QCPGraph *targetGraph); void setAdaptiveSampling(bool enabled); // non-property methods: void addData(const QVector &keys, const QVector &values, bool alreadySorted = false); void addData(double key, double value); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; protected: // property members: LineStyle mLineStyle; QCPScatterStyle mScatterStyle; int mScatterSkip; QPointer mChannelFillGraph; bool mAdaptiveSampling; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; // introduced virtual methods: virtual void drawFill(QCPPainter *painter, QVector *lines) const; virtual void drawScatterPlot(QCPPainter *painter, const QVector &scatters, const QCPScatterStyle &style) const; virtual void drawLinePlot(QCPPainter *painter, const QVector &lines) const; virtual void drawImpulsePlot(QCPPainter *painter, const QVector &lines) const; virtual void getOptimizedLineData(QVector *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const; virtual void getOptimizedScatterData(QVector *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const; // non-virtual methods: void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const; void getLines(QVector *lines, const QCPDataRange &dataRange) const; void getScatters(QVector *scatters, const QCPDataRange &dataRange) const; QVector dataToLines(const QVector &data) const; QVector dataToStepLeftLines(const QVector &data) const; QVector dataToStepRightLines(const QVector &data) const; QVector dataToStepCenterLines(const QVector &data) const; QVector dataToImpulseLines(const QVector &data) const; void addFillBasePoints(QVector *lines) const; void removeFillBasePoints(QVector *lines) const; QPointF lowerFillBasePoint(double lowerKey) const; QPointF upperFillBasePoint(double upperKey) const; const QPolygonF getChannelFillPolygon(const QVector *lines) const; int findIndexBelowX(const QVector *data, double x) const; int findIndexAboveX(const QVector *data, double x) const; int findIndexBelowY(const QVector *data, double y) const; int findIndexAboveY(const QVector *data, double y) const; double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPGraph::LineStyle) /* end of 'src/plottables/plottable-graph.h' */ /* including file 'src/plottables/plottable-curve.h', size 7409 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPCurveData { public: QCPCurveData(); QCPCurveData(double t, double key, double value); inline double sortKey() const { return t; } inline static QCPCurveData fromSortKey(double sortKey) { return QCPCurveData(sortKey, 0, 0); } inline static bool sortKeyIsMainKey() { return false; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange(value, value); } double t, key, value; }; Q_DECLARE_TYPEINFO(QCPCurveData, Q_PRIMITIVE_TYPE); /*! \typedef QCPCurveDataContainer Container for storing \ref QCPCurveData points. The data is stored sorted by \a t, so the \a sortKey() (returning \a t) is different from \a mainKey() (returning \a key). This template instantiation is the container in which QCPCurve holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPCurveData, QCPCurve::setData */ typedef QCPDataContainer QCPCurveDataContainer; class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip) Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) /// \endcond public: /*! Defines how the curve's line is represented visually in the plot. The line is drawn with the current pen of the curve (\ref setPen). \see setLineStyle */ enum LineStyle { lsNone ///< No line is drawn between data points (e.g. only scatters) , lsLine ///< Data points are connected with a straight line }; Q_ENUM(LineStyle) explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPCurve(); + ~QCPCurve() override; // getters: QSharedPointer data() const { return mDataContainer; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } int scatterSkip() const { return mScatterSkip; } LineStyle lineStyle() const { return mLineStyle; } // setters: void setData(QSharedPointer data); void setData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted = false); void setData(const QVector &keys, const QVector &values); void setScatterStyle(const QCPScatterStyle &style); void setScatterSkip(int skip); void setLineStyle(LineStyle style); // non-property methods: void addData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted = false); void addData(const QVector &keys, const QVector &values); void addData(double t, double key, double value); void addData(double key, double value); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; protected: // property members: QCPScatterStyle mScatterStyle; int mScatterSkip; LineStyle mLineStyle; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; // introduced virtual methods: virtual void drawCurveLine(QCPPainter *painter, const QVector &lines) const; virtual void drawScatterPlot(QCPPainter *painter, const QVector &points, const QCPScatterStyle &style) const; // non-virtual methods: void getCurveLines(QVector *lines, const QCPDataRange &dataRange, double penWidth) const; void getScatters(QVector *scatters, const QCPDataRange &dataRange, double scatterWidth) const; int getRegion(double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; QVector getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; bool mayTraverse(int prevRegion, int currentRegion) const; bool getTraverse(double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const; void getTraverseCornerPoints(int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector &beforeTraverse, QVector &afterTraverse) const; double pointDistance(const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPCurve::LineStyle) /* end of 'src/plottables/plottable-curve.h' */ /* including file 'src/plottables/plottable-bars.h', size 8924 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPBarsGroup : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType) Q_PROPERTY(double spacing READ spacing WRITE setSpacing) /// \endcond public: /*! Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to \ref setSpacing actually means. \see setSpacingType, setSpacing */ enum SpacingType { stAbsolute ///< Bar spacing is in absolute pixels , stAxisRectRatio ///< Bar spacing is given by a fraction of the axis rect size , stPlotCoords ///< Bar spacing is in key coordinates and thus scales with the key axis range }; Q_ENUM(SpacingType) QCPBarsGroup(QCustomPlot *parentPlot); - virtual ~QCPBarsGroup(); + ~QCPBarsGroup() override; // getters: SpacingType spacingType() const { return mSpacingType; } double spacing() const { return mSpacing; } // setters: void setSpacingType(SpacingType spacingType); void setSpacing(double spacing); // non-virtual methods: QList bars() const { return mBars; } QCPBars *bars(int index) const; int size() const { return mBars.size(); } bool isEmpty() const { return mBars.isEmpty(); } void clear(); bool contains(QCPBars *bars) const { return mBars.contains(bars); } void append(QCPBars *bars); void insert(int i, QCPBars *bars); void remove(QCPBars *bars); protected: // non-property members: QCustomPlot *mParentPlot; SpacingType mSpacingType; double mSpacing; QList mBars; // non-virtual methods: void registerBars(QCPBars *bars); void unregisterBars(QCPBars *bars); // virtual methods: double keyPixelOffset(const QCPBars *bars, double keyCoord); double getPixelSpacing(const QCPBars *bars, double keyCoord); private: Q_DISABLE_COPY(QCPBarsGroup) friend class QCPBars; }; Q_DECLARE_METATYPE(QCPBarsGroup::SpacingType) class QCP_LIB_DECL QCPBarsData { public: QCPBarsData(); QCPBarsData(double key, double value); inline double sortKey() const { return key; } inline static QCPBarsData fromSortKey(double sortKey) { return QCPBarsData(sortKey, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange( value, value); // note that bar base value isn't held in each QCPBarsData and thus can't/shouldn't be returned here } double key, value; }; Q_DECLARE_TYPEINFO(QCPBarsData, Q_PRIMITIVE_TYPE); /*! \typedef QCPBarsDataContainer Container for storing \ref QCPBarsData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPBars holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPBarsData, QCPBars::setData */ typedef QCPDataContainer QCPBarsDataContainer; class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType) Q_PROPERTY(QCPBarsGroup *barsGroup READ barsGroup WRITE setBarsGroup) Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue) Q_PROPERTY(double stackingGap READ stackingGap WRITE setStackingGap) Q_PROPERTY(QCPBars *barBelow READ barBelow) Q_PROPERTY(QCPBars *barAbove READ barAbove) /// \endcond public: /*! Defines the ways the width of the bar can be specified. Thus it defines what the number passed to \ref setWidth actually means. \see setWidthType, setWidth */ enum WidthType { wtAbsolute ///< Bar width is in absolute pixels , wtAxisRectRatio ///< Bar width is given by a fraction of the axis rect size , wtPlotCoords ///< Bar width is in key coordinates and thus scales with the key axis range }; Q_ENUM(WidthType) explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPBars(); + ~QCPBars() override; // getters: double width() const { return mWidth; } WidthType widthType() const { return mWidthType; } QCPBarsGroup *barsGroup() const { return mBarsGroup; } double baseValue() const { return mBaseValue; } double stackingGap() const { return mStackingGap; } QCPBars *barBelow() const { return mBarBelow.data(); } QCPBars *barAbove() const { return mBarAbove.data(); } QSharedPointer data() const { return mDataContainer; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &values, bool alreadySorted = false); void setWidth(double width); void setWidthType(WidthType widthType); void setBarsGroup(QCPBarsGroup *barsGroup); void setBaseValue(double baseValue); void setStackingGap(double pixels); // non-property methods: void addData(const QVector &keys, const QVector &values, bool alreadySorted = false); void addData(double key, double value); void moveBelow(QCPBars *bars); void moveAbove(QCPBars *bars); // reimplemented virtual methods: - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; - virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE; + QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const override; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; + QPointF dataPixelPosition(int index) const override; protected: // property members: double mWidth; WidthType mWidthType; QCPBarsGroup *mBarsGroup; double mBaseValue; double mStackingGap; QPointer mBarBelow, mBarAbove; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; // non-virtual methods: void getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const; QRectF getBarRect(double key, double value) const; void getPixelWidth(double key, double &lower, double &upper) const; double getStackedBaseValue(double key, bool positive) const; static void connectBars(QCPBars *lower, QCPBars *upper); friend class QCustomPlot; friend class QCPLegend; friend class QCPBarsGroup; }; Q_DECLARE_METATYPE(QCPBars::WidthType) /* end of 'src/plottables/plottable-bars.h' */ /* including file 'src/plottables/plottable-statisticalbox.h', size 7516 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPStatisticalBoxData { public: QCPStatisticalBoxData(); QCPStatisticalBoxData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers = QVector()); inline double sortKey() const { return key; } inline static QCPStatisticalBoxData fromSortKey(double sortKey) { return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return median; } inline QCPRange valueRange() const { QCPRange result(minimum, maximum); for (QVector::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it) result.expand(*it); return result; } double key, minimum, lowerQuartile, median, upperQuartile, maximum; QVector outliers; }; Q_DECLARE_TYPEINFO(QCPStatisticalBoxData, Q_MOVABLE_TYPE); /*! \typedef QCPStatisticalBoxDataContainer Container for storing \ref QCPStatisticalBoxData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPStatisticalBox holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPStatisticalBoxData, QCPStatisticalBox::setData */ typedef QCPDataContainer QCPStatisticalBoxDataContainer; class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth) Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen) Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen) Q_PROPERTY(bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased) Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen) Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle) /// \endcond public: explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis); // getters: QSharedPointer data() const { return mDataContainer; } double width() const { return mWidth; } double whiskerWidth() const { return mWhiskerWidth; } QPen whiskerPen() const { return mWhiskerPen; } QPen whiskerBarPen() const { return mWhiskerBarPen; } bool whiskerAntialiased() const { return mWhiskerAntialiased; } QPen medianPen() const { return mMedianPen; } QCPScatterStyle outlierStyle() const { return mOutlierStyle; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted = false); void setWidth(double width); void setWhiskerWidth(double width); void setWhiskerPen(const QPen &pen); void setWhiskerBarPen(const QPen &pen); void setWhiskerAntialiased(bool enabled); void setMedianPen(const QPen &pen); void setOutlierStyle(const QCPScatterStyle &style); // non-property methods: void addData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted = false); void addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers = QVector()); // reimplemented virtual methods: - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const override; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; protected: // property members: double mWidth; double mWhiskerWidth; QPen mWhiskerPen, mWhiskerBarPen; bool mWhiskerAntialiased; QPen mMedianPen; QCPScatterStyle mOutlierStyle; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; // introduced virtual methods: virtual void drawStatisticalBox(QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const; // non-virtual methods: void getVisibleDataBounds(QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const; QRectF getQuartileBox(QCPStatisticalBoxDataContainer::const_iterator it) const; QVector getWhiskerBackboneLines(QCPStatisticalBoxDataContainer::const_iterator it) const; QVector getWhiskerBarLines(QCPStatisticalBoxDataContainer::const_iterator it) const; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-statisticalbox.h' */ /* including file 'src/plottables/plottable-colormap.h', size 7070 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPColorMapData { public: QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange); ~QCPColorMapData(); QCPColorMapData(const QCPColorMapData &other); QCPColorMapData &operator=(const QCPColorMapData &other); // getters: int keySize() const { return mKeySize; } int valueSize() const { return mValueSize; } QCPRange keyRange() const { return mKeyRange; } QCPRange valueRange() const { return mValueRange; } QCPRange dataBounds() const { return mDataBounds; } double data(double key, double value); double cell(int keyIndex, int valueIndex); unsigned char alpha(int keyIndex, int valueIndex); // setters: void setSize(int keySize, int valueSize); void setKeySize(int keySize); void setValueSize(int valueSize); void setRange(const QCPRange &keyRange, const QCPRange &valueRange); void setKeyRange(const QCPRange &keyRange); void setValueRange(const QCPRange &valueRange); void setData(double key, double value, double z); void setCell(int keyIndex, int valueIndex, double z); void setAlpha(int keyIndex, int valueIndex, unsigned char alpha); // non-property methods: void recalculateDataBounds(); void clear(); void clearAlpha(); void fill(double z); void fillAlpha(unsigned char alpha); bool isEmpty() const { return mIsEmpty; } void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const; void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const; protected: // property members: int mKeySize, mValueSize; QCPRange mKeyRange, mValueRange; bool mIsEmpty; // non-property members: double *mData; unsigned char *mAlpha; QCPRange mDataBounds; bool mDataModified; bool createAlpha(bool initializeOpaque = true); friend class QCPColorMap; }; class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate) Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary) Q_PROPERTY(QCPColorScale *colorScale READ colorScale WRITE setColorScale) /// \endcond public: explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPColorMap(); + ~QCPColorMap() override; // getters: QCPColorMapData *data() const { return mMapData; } QCPRange dataRange() const { return mDataRange; } QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; } bool interpolate() const { return mInterpolate; } bool tightBoundary() const { return mTightBoundary; } QCPColorGradient gradient() const { return mGradient; } QCPColorScale *colorScale() const { return mColorScale.data(); } // setters: void setData(QCPColorMapData *data, bool copy = false); Q_SLOT void setDataRange(const QCPRange &dataRange); Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); Q_SLOT void setGradient(const QCPColorGradient &gradient); void setInterpolate(bool enabled); void setTightBoundary(bool enabled); void setColorScale(QCPColorScale *colorScale); // non-property methods: void rescaleDataRange(bool recalculateDataBounds = false); Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode = Qt::SmoothTransformation, const QSize &thumbSize = QSize(32, 18)); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; signals: void dataRangeChanged(const QCPRange &newRange); void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); void gradientChanged(const QCPColorGradient &newGradient); protected: // property members: QCPRange mDataRange; QCPAxis::ScaleType mDataScaleType; QCPColorMapData *mMapData; QCPColorGradient mGradient; bool mInterpolate; bool mTightBoundary; QPointer mColorScale; // non-property members: QImage mMapImage, mUndersampledMapImage; QPixmap mLegendIcon; bool mMapImageInvalidated; // introduced virtual methods: virtual void updateMapImage(); // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-colormap.h' */ /* including file 'src/plottables/plottable-financial.h', size 8622 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPFinancialData { public: QCPFinancialData(); QCPFinancialData(double key, double open, double high, double low, double close); inline double sortKey() const { return key; } inline static QCPFinancialData fromSortKey(double sortKey) { return QCPFinancialData(sortKey, 0, 0, 0, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return open; } inline QCPRange valueRange() const { return QCPRange(low, high); // open and close must lie between low and high, so we don't need to check them } double key, open, high, low, close; }; Q_DECLARE_TYPEINFO(QCPFinancialData, Q_PRIMITIVE_TYPE); /*! \typedef QCPFinancialDataContainer Container for storing \ref QCPFinancialData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPFinancial holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPFinancialData, QCPFinancial::setData */ typedef QCPDataContainer QCPFinancialDataContainer; class QCP_LIB_DECL QCPFinancial : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle) Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType) Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored) Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive) Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative) Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive) Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative) /// \endcond public: /*! Defines the ways the width of the financial bar can be specified. Thus it defines what the number passed to \ref setWidth actually means. \see setWidthType, setWidth */ enum WidthType { wtAbsolute ///< width is in absolute pixels , wtAxisRectRatio ///< width is given by a fraction of the axis rect size , wtPlotCoords ///< width is in key coordinates and thus scales with the key axis range }; Q_ENUM(WidthType) /*! Defines the possible representations of OHLC data in the plot. \see setChartStyle */ enum ChartStyle { csOhlc ///< Open-High-Low-Close bar representation , csCandlestick ///< Candlestick representation }; Q_ENUM(ChartStyle) explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPFinancial(); + ~QCPFinancial() override; // getters: QSharedPointer data() const { return mDataContainer; } ChartStyle chartStyle() const { return mChartStyle; } double width() const { return mWidth; } WidthType widthType() const { return mWidthType; } bool twoColored() const { return mTwoColored; } QBrush brushPositive() const { return mBrushPositive; } QBrush brushNegative() const { return mBrushNegative; } QPen penPositive() const { return mPenPositive; } QPen penNegative() const { return mPenNegative; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted = false); void setChartStyle(ChartStyle style); void setWidth(double width); void setWidthType(WidthType widthType); void setTwoColored(bool twoColored); void setBrushPositive(const QBrush &brush); void setBrushNegative(const QBrush &brush); void setPenPositive(const QPen &pen); void setPenNegative(const QPen &pen); // non-property methods: void addData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted = false); void addData(double key, double open, double high, double low, double close); // reimplemented virtual methods: - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const override; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; // static methods: static QCPFinancialDataContainer timeSeriesToOhlc(const QVector &time, const QVector &value, double timeBinSize, double timeBinOffset = 0); protected: // property members: ChartStyle mChartStyle; double mWidth; WidthType mWidthType; bool mTwoColored; QBrush mBrushPositive, mBrushNegative; QPen mPenPositive, mPenNegative; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; // non-virtual methods: void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected); void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected); double getPixelWidth(double key, double keyPixel) const; double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const; double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const; void getVisibleDataBounds(QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const; QRectF selectionHitBox(QCPFinancialDataContainer::const_iterator it) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPFinancial::ChartStyle) /* end of 'src/plottables/plottable-financial.h' */ /* including file 'src/plottables/plottable-errorbar.h', size 7567 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPErrorBarsData { public: QCPErrorBarsData(); explicit QCPErrorBarsData(double error); QCPErrorBarsData(double errorMinus, double errorPlus); double errorMinus, errorPlus; }; Q_DECLARE_TYPEINFO(QCPErrorBarsData, Q_PRIMITIVE_TYPE); /*! \typedef QCPErrorBarsDataContainer Container for storing \ref QCPErrorBarsData points. It is a typedef for QVector<\ref QCPErrorBarsData>. This is the container in which \ref QCPErrorBars holds its data. Unlike most other data containers for plottables, it is not based on \ref QCPDataContainer. This is because the error bars plottable is special in that it doesn't store its own key and value coordinate per error bar. It adopts the key and value from the plottable to which the error bars shall be applied (\ref QCPErrorBars::setDataPlottable). So the stored \ref QCPErrorBarsData doesn't need a sortable key, but merely an index (as \c QVector provides), which maps one-to-one to the indices of the other plottable's data. \see QCPErrorBarsData, QCPErrorBars::setData */ typedef QVector QCPErrorBarsDataContainer; class QCP_LIB_DECL QCPErrorBars : public QCPAbstractPlottable, public QCPPlottableInterface1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QSharedPointer data READ data WRITE setData) Q_PROPERTY(QCPAbstractPlottable *dataPlottable READ dataPlottable WRITE setDataPlottable) Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType) Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth) Q_PROPERTY(double symbolGap READ symbolGap WRITE setSymbolGap) /// \endcond public: /*! Defines in which orientation the error bars shall appear. If your data needs both error dimensions, create two \ref QCPErrorBars with different \ref ErrorType. \see setErrorType */ enum ErrorType { etKeyError ///< The errors are for the key dimension (bars appear parallel to the key axis) , etValueError ///< The errors are for the value dimension (bars appear parallel to the value axis) }; Q_ENUM(ErrorType) explicit QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis); - virtual ~QCPErrorBars(); + ~QCPErrorBars() override; // getters: QSharedPointer data() const { return mDataContainer; } QCPAbstractPlottable *dataPlottable() const { return mDataPlottable.data(); } ErrorType errorType() const { return mErrorType; } double whiskerWidth() const { return mWhiskerWidth; } double symbolGap() const { return mSymbolGap; } // setters: void setData(QSharedPointer data); void setData(const QVector &error); void setData(const QVector &errorMinus, const QVector &errorPlus); void setDataPlottable(QCPAbstractPlottable *plottable); void setErrorType(ErrorType type); void setWhiskerWidth(double pixels); void setSymbolGap(double pixels); // non-property methods: void addData(const QVector &error); void addData(const QVector &errorMinus, const QVector &errorPlus); void addData(double error); void addData(double errorMinus, double errorPlus); // virtual methods of 1d plottable interface: - virtual int dataCount() const Q_DECL_OVERRIDE; - virtual double dataMainKey(int index) const Q_DECL_OVERRIDE; - virtual double dataSortKey(int index) const Q_DECL_OVERRIDE; - virtual double dataMainValue(int index) const Q_DECL_OVERRIDE; - virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE; - virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE; - virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE; - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; - virtual int findBegin(double sortKey, bool expandedRange = true) const Q_DECL_OVERRIDE; - virtual int findEnd(double sortKey, bool expandedRange = true) const Q_DECL_OVERRIDE; + int dataCount() const override; + double dataMainKey(int index) const override; + double dataSortKey(int index) const override; + double dataMainValue(int index) const override; + QCPRange dataValueRange(int index) const override; + QPointF dataPixelPosition(int index) const override; + bool sortKeyIsMainKey() const override; + QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const override; + int findBegin(double sortKey, bool expandedRange = true) const override; + int findEnd(double sortKey, bool expandedRange = true) const override; // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; - virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; } + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; + QCPPlottableInterface1D *interface1D() override { return this; } protected: // property members: QSharedPointer mDataContainer; QPointer mDataPlottable; ErrorType mErrorType; double mWhiskerWidth; double mSymbolGap; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; - virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE; - virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, - const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override; + QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth) const override; + QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain = QCP::sdBoth, + const QCPRange &inKeyRange = QCPRange()) const override; // non-virtual methods: void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector &backbones, QVector &whiskers) const; void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const; double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const; // helpers: void getDataSegments(QList &selectedSegments, QList &unselectedSegments) const; bool errorBarVisible(int index) const; bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-errorbar.h' */ /* including file 'src/items/item-straightline.h', size 3117 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: explicit QCPItemStraightLine(QCustomPlot *parentPlot); - virtual ~QCPItemStraightLine(); + ~QCPItemStraightLine() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const point1; QCPItemPosition *const point2; protected: // property members: QPen mPen, mSelectedPen; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; // non-virtual methods: QLineF getRectClippedStraightLine(const QCPVector2D &point1, const QCPVector2D &vec, const QRect &rect) const; QPen mainPen() const; }; /* end of 'src/items/item-straightline.h' */ /* including file 'src/items/item-line.h', size 3407 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: explicit QCPItemLine(QCustomPlot *parentPlot); - virtual ~QCPItemLine(); + ~QCPItemLine() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QCPLineEnding head() const { return mHead; } QCPLineEnding tail() const { return mTail; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setHead(const QCPLineEnding &head); void setTail(const QCPLineEnding &tail); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const start; QCPItemPosition *const end; protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; // non-virtual methods: QLineF getRectClippedLine(const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const; QPen mainPen() const; }; /* end of 'src/items/item-line.h' */ /* including file 'src/items/item-curve.h', size 3379 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: explicit QCPItemCurve(QCustomPlot *parentPlot); - virtual ~QCPItemCurve(); + ~QCPItemCurve() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QCPLineEnding head() const { return mHead; } QCPLineEnding tail() const { return mTail; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setHead(const QCPLineEnding &head); void setTail(const QCPLineEnding &tail); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const start; QCPItemPosition *const startDir; QCPItemPosition *const endDir; QCPItemPosition *const end; protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; // non-virtual methods: QPen mainPen() const; }; /* end of 'src/items/item-curve.h' */ /* including file 'src/items/item-rect.h', size 3688 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: explicit QCPItemRect(QCustomPlot *parentPlot); - virtual ~QCPItemRect(); + ~QCPItemRect() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const topLeft; QCPItemPosition *const bottomRight; QCPItemAnchor *const top; QCPItemAnchor *const topRight; QCPItemAnchor *const right; QCPItemAnchor *const bottom; QCPItemAnchor *const bottomLeft; QCPItemAnchor *const left; protected: enum AnchorIndex { aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft }; // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QPointF anchorPixelPosition(int anchorId) const override; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-rect.h' */ /* including file 'src/items/item-text.h', size 5554 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemText : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment) Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment) Q_PROPERTY(double rotation READ rotation WRITE setRotation) Q_PROPERTY(QMargins padding READ padding WRITE setPadding) /// \endcond public: explicit QCPItemText(QCustomPlot *parentPlot); - virtual ~QCPItemText(); + ~QCPItemText() override; // getters: QColor color() const { return mColor; } QColor selectedColor() const { return mSelectedColor; } QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } QFont font() const { return mFont; } QFont selectedFont() const { return mSelectedFont; } QString text() const { return mText; } Qt::Alignment positionAlignment() const { return mPositionAlignment; } Qt::Alignment textAlignment() const { return mTextAlignment; } double rotation() const { return mRotation; } QMargins padding() const { return mPadding; } // setters; void setColor(const QColor &color); void setSelectedColor(const QColor &color); void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); void setFont(const QFont &font); void setSelectedFont(const QFont &font); void setText(const QString &text); void setPositionAlignment(Qt::Alignment alignment); void setTextAlignment(Qt::Alignment alignment); void setRotation(double degrees); void setPadding(const QMargins &padding); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const position; QCPItemAnchor *const topLeft; QCPItemAnchor *const top; QCPItemAnchor *const topRight; QCPItemAnchor *const right; QCPItemAnchor *const bottomRight; QCPItemAnchor *const bottom; QCPItemAnchor *const bottomLeft; QCPItemAnchor *const left; protected: enum AnchorIndex { aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft }; // property members: QColor mColor, mSelectedColor; QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; QFont mFont, mSelectedFont; QString mText; Qt::Alignment mPositionAlignment; Qt::Alignment mTextAlignment; double mRotation; QMargins mPadding; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QPointF anchorPixelPosition(int anchorId) const override; // non-virtual methods: QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const; QFont mainFont() const; QColor mainColor() const; QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-text.h' */ /* including file 'src/items/item-ellipse.h', size 3868 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: explicit QCPItemEllipse(QCustomPlot *parentPlot); - virtual ~QCPItemEllipse(); + ~QCPItemEllipse() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const topLeft; QCPItemPosition *const bottomRight; QCPItemAnchor *const topLeftRim; QCPItemAnchor *const top; QCPItemAnchor *const topRightRim; QCPItemAnchor *const right; QCPItemAnchor *const bottomRightRim; QCPItemAnchor *const bottom; QCPItemAnchor *const bottomLeftRim; QCPItemAnchor *const left; QCPItemAnchor *const center; protected: enum AnchorIndex { aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter }; // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QPointF anchorPixelPosition(int anchorId) const override; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-ellipse.h' */ /* including file 'src/items/item-pixmap.h', size 4373 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) Q_PROPERTY(bool scaled READ scaled WRITE setScaled) Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode) Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: explicit QCPItemPixmap(QCustomPlot *parentPlot); - virtual ~QCPItemPixmap(); + ~QCPItemPixmap() override; // getters: QPixmap pixmap() const { return mPixmap; } bool scaled() const { return mScaled; } Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; } Qt::TransformationMode transformationMode() const { return mTransformationMode; } QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } // setters; void setPixmap(const QPixmap &pixmap); void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio, Qt::TransformationMode transformationMode = Qt::SmoothTransformation); void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const topLeft; QCPItemPosition *const bottomRight; QCPItemAnchor *const top; QCPItemAnchor *const topRight; QCPItemAnchor *const right; QCPItemAnchor *const bottom; QCPItemAnchor *const bottomLeft; QCPItemAnchor *const left; protected: enum AnchorIndex { aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft }; // property members: QPixmap mPixmap; QPixmap mScaledPixmap; bool mScaled; bool mScaledPixmapInvalidated; Qt::AspectRatioMode mAspectRatioMode; Qt::TransformationMode mTransformationMode; QPen mPen, mSelectedPen; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QPointF anchorPixelPosition(int anchorId) const override; // non-virtual methods: void updateScaledPixmap(QRect finalRect = QRect(), bool flipHorz = false, bool flipVert = false); QRect getFinalRect(bool *flippedHorz = 0, bool *flippedVert = 0) const; QPen mainPen() const; }; /* end of 'src/items/item-pixmap.h' */ /* including file 'src/items/item-tracer.h', size 4762 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(double size READ size WRITE setSize) Q_PROPERTY(TracerStyle style READ style WRITE setStyle) Q_PROPERTY(QCPGraph *graph READ graph WRITE setGraph) Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey) Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating) /// \endcond public: /*! The different visual appearances a tracer item can have. Some styles size may be controlled with \ref setSize. \see setStyle */ enum TracerStyle { tsNone ///< The tracer is not visible , tsPlus ///< A plus shaped crosshair with limited size , tsCrosshair ///< A plus shaped crosshair which spans the complete axis rect , tsCircle ///< A circle , tsSquare ///< A square }; Q_ENUM(TracerStyle) explicit QCPItemTracer(QCustomPlot *parentPlot); - virtual ~QCPItemTracer(); + ~QCPItemTracer() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } double size() const { return mSize; } TracerStyle style() const { return mStyle; } QCPGraph *graph() const { return mGraph; } double graphKey() const { return mGraphKey; } bool interpolating() const { return mInterpolating; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); void setSize(double size); void setStyle(TracerStyle style); void setGraph(QCPGraph *graph); void setGraphKey(double key); void setInterpolating(bool enabled); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; // non-virtual methods: void updatePosition(); QCPItemPosition *const position; protected: // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; double mSize; TracerStyle mStyle; QCPGraph *mGraph; double mGraphKey; bool mInterpolating; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; Q_DECLARE_METATYPE(QCPItemTracer::TracerStyle) /* end of 'src/items/item-tracer.h' */ /* including file 'src/items/item-bracket.h', size 3969 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(double length READ length WRITE setLength) Q_PROPERTY(BracketStyle style READ style WRITE setStyle) /// \endcond public: /*! Defines the various visual shapes of the bracket item. The appearance can be further modified by \ref setLength and \ref setPen. \see setStyle */ enum BracketStyle { bsSquare ///< A brace with angled edges , bsRound ///< A brace with round edges , bsCurly ///< A curly brace , bsCalligraphic ///< A curly brace with varying stroke width giving a calligraphic impression }; Q_ENUM(BracketStyle) explicit QCPItemBracket(QCustomPlot *parentPlot); - virtual ~QCPItemBracket(); + ~QCPItemBracket() override; // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } double length() const { return mLength; } BracketStyle style() const { return mStyle; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setLength(double length); void setStyle(BracketStyle style); // reimplemented virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE; + double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const override; QCPItemPosition *const left; QCPItemPosition *const right; QCPItemAnchor *const center; protected: // property members: enum AnchorIndex { aiCenter }; QPen mPen, mSelectedPen; double mLength; BracketStyle mStyle; // reimplemented virtual methods: - virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; - virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; + void draw(QCPPainter *painter) override; + QPointF anchorPixelPosition(int anchorId) const override; // non-virtual methods: QPen mainPen() const; }; Q_DECLARE_METATYPE(QCPItemBracket::BracketStyle) /* end of 'src/items/item-bracket.h' */ #endif // QCUSTOMPLOT_H diff --git a/kstars/auxiliary/skyobjectlistmodel.h b/kstars/auxiliary/skyobjectlistmodel.h index 5fad85101..daa4cc626 100644 --- a/kstars/auxiliary/skyobjectlistmodel.h +++ b/kstars/auxiliary/skyobjectlistmodel.h @@ -1,68 +1,68 @@ /*************************************************************************** skyobjectlistmodel.h - K Desktop Planetarium ------------------- begin : Wed Jul 29 2016 copyright : (C) 2016 by Artem Fedoskin email : afedoskin3@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 SKYOBJECTLISTMODEL_H_ #define SKYOBJECTLISTMODEL_H_ #include #include class SkyObject; /** @class SkyObjectListModel * A model used in Find Object Dialog in QML. Each entry is a QString (name of object) and pointer to * SkyObject itself * * @short Model that is used in Find Object Dialog * @author Artem Fedoskin, Jason Harris * @version 1.0 */ class SkyObjectListModel : public QAbstractListModel { Q_OBJECT public: enum DemoRoles { SkyObjectRole = Qt::UserRole + 1, }; explicit SkyObjectListModel(QObject *parent = 0); - int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE { return skyObjects.size(); } - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &) const override { return skyObjects.size(); } + QVariant data(const QModelIndex &index, int role) const override; - QHash roleNames() const Q_DECL_OVERRIDE; + QHash roleNames() const override; /** * @return index of object from skyObjects with name objectName. -1 if object with such * name was not found */ int indexOf(QString objectName) const; /** * @short filter * @param regEx * @return */ QStringList filter(QRegExp regEx); void setSkyObjectsList(QVector> sObjects); private: QVector> skyObjects; }; #endif diff --git a/kstars/auxiliary/thumbnaileditor.h b/kstars/auxiliary/thumbnaileditor.h index e669fb2fa..6721dee3b 100644 --- a/kstars/auxiliary/thumbnaileditor.h +++ b/kstars/auxiliary/thumbnaileditor.h @@ -1,54 +1,54 @@ /*************************************************************************** thumbnaileditor.h - description ------------------- begin : Thu Mar 2 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 THUMBNAILEDITOR_H_ #define THUMBNAILEDITOR_H_ #include #include #include #include "ui_thumbnaileditor.h" class ThumbnailPicker; class ThumbnailEditorUI : public QFrame, public Ui::ThumbnailEditor { Q_OBJECT public: explicit ThumbnailEditorUI(QWidget *parent); }; class ThumbnailEditor : public QDialog { Q_OBJECT public: ThumbnailEditor(ThumbnailPicker *_tp, double _w, double _h); - ~ThumbnailEditor(); + ~ThumbnailEditor() override; QPixmap thumbnail(); private slots: void slotUpdateCropLabel(); private: ThumbnailEditorUI *ui; ThumbnailPicker *tp; double w, h; }; #endif diff --git a/kstars/auxiliary/thumbnailpicker.h b/kstars/auxiliary/thumbnailpicker.h index 5d1d6c994..5729f12af 100644 --- a/kstars/auxiliary/thumbnailpicker.h +++ b/kstars/auxiliary/thumbnailpicker.h @@ -1,81 +1,81 @@ /*************************************************************************** thumbnailpicker.h - description ------------------- begin : Thu Mar 2 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_thumbnailpicker.h" #include #include #include class QRect; class KJob; class DetailDialog; class SkyObject; class ThumbnailPickerUI : public QFrame, public Ui::ThumbnailPicker { Q_OBJECT public: explicit ThumbnailPickerUI(QWidget *p); }; /** * @short Dialog for modifying an object's thumbnail image * * @author Jason Harris */ class ThumbnailPicker : public QDialog { Q_OBJECT public: ThumbnailPicker(SkyObject *o, const QPixmap ¤t, QWidget *parent = 0, double w = 200, double h = 200, QString cap = i18n("Choose Thumbnail Image")); - ~ThumbnailPicker(); + ~ThumbnailPicker() override; QPixmap *image() { return Image; } QPixmap *currentListImage() { return PixList.at(SelectedImageIndex); } bool imageFound() const { return bImageFound; } QRect *imageRect() const { return ImageRect; } private slots: void slotEditImage(); void slotUnsetImage(); void slotSetFromList(int i); void slotSetFromURL(); void slotFillList(); void slotProcessGoogleResult(KJob *); /** Make sure download has finished, then make sure file exists, then add image to list */ void slotJobResult(KJob *); private: QPixmap shrinkImage(QPixmap *original, int newSize, bool setImage = false); void parseGooglePage(const QString &URL); int SelectedImageIndex; double thumbWidth, thumbHeight; ThumbnailPickerUI *ui; QPixmap *Image; SkyObject *Object; QList JobList; QList PixList; bool bImageFound; QRect *ImageRect; }; diff --git a/kstars/dialogs/addlinkdialog.h b/kstars/dialogs/addlinkdialog.h index 0c345dd4e..85ff82b8a 100644 --- a/kstars/dialogs/addlinkdialog.h +++ b/kstars/dialogs/addlinkdialog.h @@ -1,109 +1,109 @@ /*************************************************************************** addlinQDialog - K Desktop Planetarium ------------------- begin : Sun Oct 21 2001 copyright : (C) 2001 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 ADDLINKDIALOG_H_ #define ADDLINKDIALOG_H_ #include #include #include #include #include "ui_addlinkdialog.h" class QString; class AddLinkDialogUI : public QFrame, public Ui::AddLinkDialog { Q_OBJECT public: explicit AddLinkDialogUI(QWidget *parent = 0); }; /** *@class AddLinkDialog * AddLinkDialog is a simple dialog for adding a custom URL to a popup menu. *@author Jason Harris *@version 1.0 */ class AddLinkDialog : public QDialog { Q_OBJECT public: /** *Constructor. */ explicit AddLinkDialog(QWidget *parent = 0, const QString &oname = i18n("object")); /** *Destructor (empty) */ - ~AddLinkDialog() {} + ~AddLinkDialog() override {} /** *@return QString of the entered URL */ QString url() const { return ald->URLBox->text(); } /** *@short Set the URL text *@param s the new URL text */ void setURL(const QString &s) { ald->URLBox->setText(s); } /** *@return QString of the entered menu entry text */ QString desc() const { return ald->DescBox->text(); } /** *@short Set the Description text *@param s the new description text */ void setDesc(const QString &s) { ald->DescBox->setText(s); } /** *@return true if user declared the link is an image */ bool isImageLink() const { return ald->ImageRadio->isChecked(); } /** *@short Set the link type *@param b if true, link is an image link. */ void setImageLink(bool b) { ald->ImageRadio->setChecked(b); } private slots: /** *Open the entered URL in the web browser */ void checkURL(void); /** *We provide a default menu text string; this function changes the *default string if the link type (image/webpage) is changed. Note *that if the user has changed the menu text, this function does nothing. *@param imageEnabled if true, show image string; otherwise show webpage string. */ void changeDefaultDescription(bool imageEnabled); private: QString ObjectName; AddLinkDialogUI *ald; }; #endif diff --git a/kstars/dialogs/detaildialog.h b/kstars/dialogs/detaildialog.h index 0c523df8c..09feba35d 100644 --- a/kstars/dialogs/detaildialog.h +++ b/kstars/dialogs/detaildialog.h @@ -1,256 +1,256 @@ /*************************************************************************** detaildialog.h - description ------------------- begin : Sun May 5 2002 copyright : (C) 2002 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_details_data.h" #include "ui_details_data_comet.h" #include "ui_details_database.h" #include "ui_details_links.h" #include "ui_details_log.h" #include "ui_details_position.h" #include #include #include #include class QListWidgetItem; class QPixmap; class DataCometWidget; class DataWidget; class GeoLocation; class KStars; class KStarsDateTime; class SkyObject; class PositionWidget; class LinksWidget; class DatabaseWidget; class LogWidget; struct ADVTreeData { QString Name; QString Link; int Type; }; /** * @class DetailDialog * DetailDialog is a window showing detailed information for a selected object. * The window is split into four Tabs: General, Links, Advanced and Log. * The General Tab displays some type-specific data about the object, as well as its * present coordinates and Rise/Set/Transit times for the current date. The Type-specific * data are: * @li Stars: common name, genetive name, Spectral type, magnitude, distance * @li Solar System: name, object type (planet/comet/asteroid), Distance, magnitude (TBD), * angular size (TBD) * @li Deep Sky: Common name, other names, object type, magnitude, angular size * * The Links Tab allows the user to manage the list of Image and Information links * listed in the object's popup menu. The Advanced Tab allows the user to query * a number of professional-grade online astronomical databases for data on the object. * The Log tab allows the user to attach their own text notes about the object. * * The General Tab includes a clickable image of the object. Clicking the image opens * a Thumbnail picker tool, which downloads a list of mages of the object from the * network, which the user may select as the new image for this objects Details window. * * @author Jason Harris, Jasem Mutlaq * @version 1.0 */ class DetailDialog : public KPageDialog { Q_OBJECT public: /** Constructor */ DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *geo, QWidget *parent = 0); /** Destructor */ - ~DetailDialog(); + ~DetailDialog() override; /** @return pointer to the QPixmap of the object's thumbnail image */ inline QPixmap *thumbnail() { return Thumbnail.get(); } public slots: /** @short Slot to add this object to the observing list. */ void addToObservingList(); /** @short Slot to center this object in the display. */ void centerMap(); /** @short Slot to center this object in the telescope. */ void centerTelescope(); //TODO: showThumbnail() is only called in the ctor; make it private and not a slot. /** @short Slot to display the thumbnail image for the object */ void showThumbnail(); /** * @short Slot to update thumbnail image for the object, using the Thumbnail * Picker tool. * @sa ThumbnailPicker */ void updateThumbnail(); /** @short Slot for viewing the selected image or info URL in the web browser. */ void viewLink(); /** * Popup menu function: Add a custom Image or Information URL. * Opens the AddLinkDialog window. */ void addLink(); /** * @short Set the currently-selected URL resource. * * This function is needed because there are two QListWidgets, * each with its own selection. We need to know which the user selected most recently. */ void setCurrentLink(QListWidgetItem *it); /** * @short Rebuild the Image and Info URL lists for this object. * @note used when an item is added to either list. */ void updateLists(); /** * @short Open a dialog to edit a URL in either the Images or Info lists, * and update the user's *url.dat file. */ void editLinkDialog(); /** * @short remove a URL entry from either the Images or Info lists, and * update the user's *url.dat file. */ void removeLinkDialog(); /** * Open the web browser to the selected online astronomy database, * with a query to the object of this Detail Dialog. */ void viewADVData(); /** Save the User's text in the Log Tab to the userlog.dat file. */ void saveLogData(); /** Update View/Edit/Remove buttons */ void updateButtons(); private: /** Build the General Data Tab for the current object. */ void createGeneralTab(); /** Build the Position Tab for the current object. */ void createPositionTab(const KStarsDateTime &ut, GeoLocation *geo); /** * Build the Links Tab, populating the image and info lists with the * known URLs for the current Object. */ void createLinksTab(); /** Build the Advanced Tab */ void createAdvancedTab(); /** Build the Log Tab */ void createLogTab(); /** Populate the TreeView of known astronomical databases in the Advanced Tab */ void populateADVTree(); /** * Data for the Advanced Tab TreeView is stored in the file advinterface.dat. * This function parses advinterface.dat. */ QString parseADVData(const QString &link); /** * Update the local info_url and image_url files * @param type The URL type. 0 for Info Links, 1 for Images. * @param search_line The line to be search for in the local URL files * @param replace_line The replacement line once search_line is found. * @note If replace_line is empty, the function will remove search_line from the file */ void updateLocalDatabase(int type, const QString &search_line, const QString &replace_line = QString()); SkyObject *selectedObject { nullptr }; QPalette titlePalette; QListWidgetItem *m_CurrentLink { nullptr }; std::unique_ptr Thumbnail; DataWidget *Data { nullptr }; DataCometWidget *DataComet { nullptr }; PositionWidget *Pos { nullptr }; LinksWidget *Links { nullptr }; DatabaseWidget *Adv { nullptr }; LogWidget *Log { nullptr }; }; class DataWidget : public QFrame, public Ui::DetailsData { Q_OBJECT public: explicit DataWidget(QWidget *parent = 0); }; class DataCometWidget : public QFrame, public Ui::DetailsDataComet { Q_OBJECT public: explicit DataCometWidget(QWidget *parent = 0); }; class PositionWidget : public QFrame, public Ui::DetailsPosition { Q_OBJECT public: explicit PositionWidget(QWidget *parent = 0); }; class LinksWidget : public QFrame, public Ui::DetailsLinks { Q_OBJECT public: explicit LinksWidget(QWidget *parent = 0); }; class DatabaseWidget : public QFrame, public Ui::DetailsDatabase { Q_OBJECT public: explicit DatabaseWidget(QWidget *parent = 0); }; class LogWidget : public QFrame, public Ui::DetailsLog { Q_OBJECT public: explicit LogWidget(QWidget *parent = 0); }; diff --git a/kstars/dialogs/exportimagedialog.h b/kstars/dialogs/exportimagedialog.h index 7e64976d2..1523a105c 100644 --- a/kstars/dialogs/exportimagedialog.h +++ b/kstars/dialogs/exportimagedialog.h @@ -1,79 +1,79 @@ /*************************************************************************** exportimagedialog.h - K Desktop Planetarium ------------------- begin : Mon Jun 13 2011 copyright : (C) 2011 by Rafał Kułaga email : rl.kulaga@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 EXPORTIMAGEDIALOG_H #define EXPORTIMAGEDIALOG_H #include "ui_exportimagedialog.h" #include "../printing/legend.h" #include class KStars; class QString; class QSize; class ImageExporter; // ExportImageDialog user interface. class ExportImageDialogUI : public QFrame, public Ui::ExportImageDialog { Q_OBJECT public: explicit ExportImageDialogUI(QWidget *parent = 0); }; /** @short Export sky image dialog. This dialog enables user to set up basic legend properties before image is exported. */ class ExportImageDialog : public QDialog { Q_OBJECT public: /**short Default constructor. Creates dialog operating on passed URL and output image width and height. *@param url URL for exported image. *@param size size of exported image. *@param imgExporter A pointer to an ImageExporter that we can use instead of creating our own. if 0, we will create our own. */ ExportImageDialog(const QString &url, const QSize &size, ImageExporter *imgExporter = 0); /** @short Default destructor. */ - ~ExportImageDialog() {} + ~ExportImageDialog() override {} inline void setOutputUrl(const QString &url) { m_Url = url; } inline void setOutputSize(const QSize &size) { m_Size = size; } private slots: void switchLegendEnabled(bool enabled); void previewImage(); void exportImage(); void setupWidgets(); void updateLegendSettings(); private: KStars *m_KStars; ExportImageDialogUI *m_DialogUI; QString m_Url; QSize m_Size; ImageExporter *m_ImageExporter; }; #endif // EXPORTIMAGEDIALOG_H diff --git a/kstars/dialogs/finddialog.h b/kstars/dialogs/finddialog.h index 88ddb396d..c03035269 100644 --- a/kstars/dialogs/finddialog.h +++ b/kstars/dialogs/finddialog.h @@ -1,134 +1,134 @@ /*************************************************************************** finddialog.h - K Desktop Planetarium ------------------- begin : Wed Jul 4 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 FINDDIALOG_H_ #define FINDDIALOG_H_ #include #include #include "ui_finddialog.h" class QTimer; class QStringListModel; class QSortFilterProxyModel; class SkyObjectListModel; class SkyObject; class FindDialogUI : public QFrame, public Ui::FindDialog { Q_OBJECT public: explicit FindDialogUI(QWidget *parent = 0); }; /** @class FindDialog * Dialog window for finding SkyObjects by name. The dialog contains * a QListBox showing the list of named objects, a QLineEdit for filtering * the list by name, and a QCombobox for filtering the list by object type. * * @short Find Object Dialog * @author Jason Harris * @version 1.0 */ class FindDialog : public QDialog { Q_OBJECT public: /**Constructor. Creates all widgets and packs them in QLayouts. Connects * Signals and Slots. Runs initObjectList(). */ explicit FindDialog(QWidget *parent = 0); /** Destructor */ - virtual ~FindDialog(); + ~FindDialog() override; /** * @return the target object (need not be the same as currently selected object!) * * @note Avoid using selectedObject() */ inline SkyObject *targetObject() { return m_targetObject; } public slots: /**When Text is entered in the QLineEdit, filter the List of objects * so that only objects which start with the filter text are shown. */ void filterList(); //FIXME: Still valid for QDialog? i.e., does QDialog have a slotOk() ? /** *Overloading the Standard QDialogBase slotOk() to show a "sorry" *message box if no object is selected and internet resolution was *disabled/failed when the user presses Ok. The window is not *closed in this case. */ void slotOk(); /** * @short This slot resolves the object on the internet, ignoring the selection on the list */ void slotResolve(); private slots: /** Init object list after opening dialog. */ void init(); /** Set the selected item to the first item in the list */ void initSelection(); void enqueueSearch(); void slotDetails(); protected: /**Process Keystrokes. The Up and Down arrow keys are used to select the * Previous/Next item in the listbox of named objects. The Esc key closes * the window with no selection, using reject(). * @param e The QKeyEvent pointer */ - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; /** @return the currently-selected item from the listbox of named objects */ SkyObject *selectedObject() const; private: /** @short Do some post processing on the search text to interpret what the user meant * This could include replacing text like "m93" with "m 93" */ QString processSearchText(); /** * @short Finishes the processing towards closing the dialog initiated by slotOk() or slotResolve() */ void finishProcessing(SkyObject *selObj = 0, bool resolve = true); /** @short pre-filter the list of objects according to the * selected object type. */ void filterByType(); FindDialogUI *ui; SkyObjectListModel *fModel; QSortFilterProxyModel *sortModel; QTimer *timer; bool listFiltered; QPushButton *okB; SkyObject *m_targetObject; }; #endif diff --git a/kstars/dialogs/focusdialog.h b/kstars/dialogs/focusdialog.h index 19a5d09cf..8fd64c23c 100644 --- a/kstars/dialogs/focusdialog.h +++ b/kstars/dialogs/focusdialog.h @@ -1,78 +1,78 @@ /*************************************************************************** focusdialog.h - description ------------------- begin : Sat Mar 23 2002 copyright : (C) 2002 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_focusdialog.h" #include class QPushButton; class SkyPoint; class FocusDialogUI : public QFrame, public Ui::FocusDialog { Q_OBJECT public: explicit FocusDialogUI(QWidget *parent = nullptr); }; /** * @class FocusDialog * @short A small dialog for setting the focus coordinates manually. * * @author Jason Harris * @version 1.0 */ class FocusDialog : public QDialog { Q_OBJECT public: /** Constructor. */ FocusDialog(); /** @return pointer to the SkyPoint described by the entered RA, Dec */ inline SkyPoint *point() { return Point; } /** @return suggested size of focus window. */ - QSize sizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const override; /** @return whether user set the AltAz coords */ inline bool usedAltAz() const { return UsedAltAz; } /** Show the Az/Alt page instead of the RA/Dec page. */ void activateAzAltPage() const; public slots: /** If text has been entered in both KLineEdits, enable the Ok button. */ void checkLineEdits(); /** * Attempt to interpret the text in the KLineEdits as Ra and Dec values. * If the point is validated, close the window. */ void validatePoint(); private: SkyPoint *Point { nullptr }; FocusDialogUI *fd { nullptr }; bool UsedAltAz { false }; QPushButton *okB { nullptr }; }; diff --git a/kstars/dialogs/fovdialog.h b/kstars/dialogs/fovdialog.h index 428d16b25..5e45e6986 100644 --- a/kstars/dialogs/fovdialog.h +++ b/kstars/dialogs/fovdialog.h @@ -1,128 +1,128 @@ /*************************************************************************** fovdialog.h - description ------------------- begin : Fri 05 Sept 2003 copyright : (C) 2003 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 FOVDIALOG_H_ #define FOVDIALOG_H_ #include #include #include #include "fov.h" #include "ui_fovdialog.h" #include "ui_newfov.h" class FOVDialogUI : public QFrame, public Ui::FOVDialog { Q_OBJECT public: explicit FOVDialogUI(QWidget *parent = 0); }; class NewFOVUI : public QFrame, public Ui::NewFOV { Q_OBJECT public: explicit NewFOVUI(QWidget *parent = 0); }; /** @class FOVDialog * FOVDialog is dialog to select a Field-of-View indicator (or create a new one) *@author Jason Harris *@version 1.0 */ class FOVDialog : public QDialog { Q_OBJECT public: explicit FOVDialog(QWidget *parent = 0); - virtual ~FOVDialog(); + ~FOVDialog() override; private slots: void slotNewFOV(); void slotEditFOV(); void slotRemoveFOV(); void slotSelect(int); private: /** Add new widget to list box */ QListWidgetItem *addListWidget(FOV *f); unsigned int currentItem() const; FOVDialogUI *fov; static int fovID; }; /** @class NewFOV Dialog for defining a new FOV symbol *@author Jason Harris *@version 1.0 */ class NewFOV : public QDialog { Q_OBJECT public: /** Create new dialog * @param parent parent widget * @fov widget to copy data from. If it's empty will create empty one. */ explicit NewFOV(QWidget *parent = 0, const FOV *fov = 0); - ~NewFOV() {} + ~NewFOV() override {} /** Return reference to FOV. */ const FOV &getFOV() const { return f; } public slots: void slotBinocularFOVDistanceChanged(int index); void slotUpdateFOV(); void slotComputeFOV(); void slotEyepieceAFOVChanged(int index); void slotComputeTelescopeFL(); private: FOV f; NewFOVUI *ui; QPushButton *okB; }; /** *@class TelescopeFL Dialog for calculating telescope focal length from f-number and diameter *@author Akarsh Simha *@version 1.0 */ class TelescopeFL : public QDialog { Q_OBJECT public: /** * Create a telescope focal length dialog * @param parent parent widget */ explicit TelescopeFL(QWidget *parent = 0); - ~TelescopeFL() {} + ~TelescopeFL() override {} /** * Compute and return the focal length in mm * @return focal length in mm */ double computeFL() const; private: QDoubleSpinBox *aperture, *fNumber; QComboBox *apertureUnit; }; #endif diff --git a/kstars/dialogs/timedialog.h b/kstars/dialogs/timedialog.h index f5de9cb4b..56c8bb085 100644 --- a/kstars/dialogs/timedialog.h +++ b/kstars/dialogs/timedialog.h @@ -1,95 +1,95 @@ /*************************************************************************** timedialog.h - K Desktop Planetarium ------------------- begin : Sun Feb 11 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 TIMEDIALOG_H_ #define TIMEDIALOG_H_ #include #include #include #include #include #include #include "kstarsdatetime.h" class QHBoxLayout; class QVBoxLayout; class KDatePicker; class QTimeEdit; class QPushButton; class GeoLocation; /** @class TimeDialog *A class for adjusting the Time and Date. Contains a KDatePicker widget *for selecting the date, and a QTimeEdit for selecting the time. There *is also a "Now" button for selecting the Time and Date from the system clock. *@short Dialog for adjusting the Time and Date. *@author Jason Harris *@version 1.0 */ class TimeDialog : public QDialog { Q_OBJECT public: /** *Constructor. Creates widgets and packs them into QLayouts. *Connects Signals and Slots. */ TimeDialog(const KStarsDateTime &now, GeoLocation *_geo, QWidget *parent, bool UTCFrame = false); /** *Destructor (empty) */ - ~TimeDialog() {} + ~TimeDialog() override {} /** @returns a QTime object with the selected time */ QTime selectedTime(void); /** @returns a QDate object with the selected date */ QDate selectedDate(void); /** @returns a KStarsDateTime object with the selected date and time */ KStarsDateTime selectedDateTime(void); public slots: /** *When the "Now" button is pressed, read the time and date *from the system clock. Change the selected date in the KDatePicker *to the system's date, and the displayed time *to the system time. */ void setNow(void); protected: - void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *) override; private: bool UTCNow; QHBoxLayout *hlay; QVBoxLayout *vlay; KDatePicker *dPicker; QTimeEdit *tEdit; QPushButton *NowButton; GeoLocation *geo; }; #endif diff --git a/kstars/hips/opships.h b/kstars/hips/opships.h index eed901951..b8b4703a8 100644 --- a/kstars/hips/opships.h +++ b/kstars/hips/opships.h @@ -1,70 +1,70 @@ /* HiPS Options Copyright (C) 2017 Jasem Mutlaq 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. */ #pragma once #include "ui_opships.h" #include "ui_opshipsdisplay.h" #include "ui_opshipscache.h" class KConfigDialog; class FileDownloader; class OpsHIPSDisplay : public QFrame, public Ui::OpsHIPSDisplay { Q_OBJECT public: explicit OpsHIPSDisplay(); }; class OpsHIPSCache : public QFrame, public Ui::OpsHIPSCache { Q_OBJECT public: explicit OpsHIPSCache(); }; /** * @class OpsHIPS * * HIPS Settings including download of external sources and enabling/disabling them accordingly. * * @author Jasem Mutlaq */ class OpsHIPS : public QFrame, public Ui::OpsHIPS { Q_OBJECT public: explicit OpsHIPS(); - ~OpsHIPS(); + ~OpsHIPS() override; public slots: void slotRefresh(); protected slots: void downloadReady(); void downloadError(const QString &errorString); void previewReady(); void slotItemUpdated(QListWidgetItem *item); void slotItemClicked(QListWidgetItem *item); private: void setPreview(const QString &id, const QString &url); KConfigDialog *m_ConfigDialog = nullptr; FileDownloader *downloadJob = nullptr; FileDownloader *previewJob = nullptr; QList> sources; bool dirty=false; }; diff --git a/kstars/kspopupmenu.h b/kstars/kspopupmenu.h index ac59d16fa..27a97ef1d 100644 --- a/kstars/kspopupmenu.h +++ b/kstars/kspopupmenu.h @@ -1,170 +1,170 @@ /*************************************************************************** kspopupmenu.h - K Desktop Planetarium ------------------- begin : Sat Feb 27 2003 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include class QAction; class DeepSkyObject; class KSMoon; class Satellite; class SkyObject; class SkyPoint; class StarObject; class Supernova; /** * @class KSPopupMenu * The KStars Popup Menu. The menu is sensitive to the * object type of the object which was clicked to invoke the menu. * Items in the menu include name and type data; rise/transit/set times; * actions such as Center, Details, Telescope actions, and Label; * and Image and Information URL links. * * @author Jason Harris * @version 1.0 */ class KSPopupMenu : public QMenu { Q_OBJECT public: /** Default constructor*/ KSPopupMenu(); /** Destructor (empty)*/ - ~KSPopupMenu(); + ~KSPopupMenu() override; /** * Add an item to the popup menu for each of the URL links associated with * this object. URL links appear in two categories: images and information pages. * For some objects, a link to Digitized Sky Survey images will automatically be added * in addition to the object's normal image links. Also, for some objects, an * "Add link..." item will be included, which allows the user to add their own custom * URLs for this object. * @param obj pointer to the skyobject which the menu describes * @param showDSS if true, include DSS Image links */ void addLinksToMenu(SkyObject *obj, bool showDSS = true); /** * @short Create a popup menu for a star. * * Stars get the following labels: a primary name and/or a genetive name, * a spectral type, an object type ("star"), and rise/transit/set times. * Stars get a "Center & Track" item, an Angular Distance item, and a * "Detailed Info" item. Named stars get an "Attach Label" item and an * "Add Link..." item, and may have image/info links; all stars get DSS * image links. Stars do not get an "Add Trail" item. * @param star pointer to the star which the menu describes */ void createStarMenu(StarObject *star); /** * @short Create a popup menu for a deep-sky object. * * DSOs get the following labels: * a common name and/or a catalog name, an object type, and rise/transit/set * times. DSOs get a "Center & Track" item, an Angular Distance item, an * "Attach Label" item, and a "Detailed Info" item. * They may have image/info links, and also get the DSS Image links and the * "Add Link..." item. They do not get an "Add Trail" item. * @param obj pointer to the object which the menu describes */ void createDeepSkyObjectMenu(DeepSkyObject *obj); /** * @short Create a popup menu for a solar system body. * * Solar System bodies get a name label, a type label ("solar system object"), * and rise/set/transit time labels. They also get Center&Track, * Angular Distance, Detailed Info, Attach Label, and Add Trail items. * They can have image/info links, and also get the "Add Link..." item. * @note despite the name "createPlanetMenu", this function is used for * comets and asteroids as well. * @param p the solar system object which the menu describes. */ void createPlanetMenu(SkyObject *p); void createMoonMenu(KSMoon *moon); /** * @short Create a popup menu for a satellite. * @param satellite the satellite which the menu describes. */ void createSatelliteMenu(Satellite *satellite); /** * @short Create a popup menu for a supernova * @param supernova the supernova which the menu describes. */ void createSupernovaMenu(Supernova *supernova); /** * @short Create a popup menu for empty sky. * * The popup menu when right-clicking on nothing is still useful. * Instead of a name label, it shows "Empty Sky". The rise/set/transit * times of the clicked point on the sky are also shown. You also get * the Center & Track and Angular Distance items, and the DSS image links. * @param nullObj pointer to point on the sky */ void createEmptyMenu(SkyPoint *nullObj); private slots: void slotEditFlag(); void slotDeleteFlag(); void slotEditFlag(QAction *action); void slotDeleteFlag(QAction *action); void slotViewInWI(); private: /** * Initialize the popup menus. Adds name and type labels, and possibly * Rise/Set/Transit labels, Center/Track item, and Show Details item. * @short initialize the right-click popup menu * @param obj pointer to the skyobject which the menu describes * @param name The object name * @param type a string identifying the object type * @param type short information about object * @param showDetails if true, the Show-Details item is added * @param showObsList if true, the Add to List/Remove from List item is added. */ void initPopupMenu(SkyObject *obj, const QString &name, const QString &type, QString info, bool showDetails = true, bool showObsList = true, bool showFlags = true); void initFlagActions(SkyObject *obj); /** * Add a submenu for INDI controls (Slew, Track, Sync, etc). * @return true if a valid INDI menu was added. */ void addINDI(); /** * Add fancy label to menu. * @param name is content of the label * @param deltaFontSize is change in font size from default */ void addFancyLabel(const QString &name, int deltaFontSize = 0); int m_CurrentFlagIdx { 0 }; QHash *m_EditActionMapping { nullptr }; QHash *m_DeleteActionMapping { nullptr }; }; diff --git a/kstars/kstars.h b/kstars/kstars.h index b479c2632..bbb67d08e 100644 --- a/kstars/kstars.h +++ b/kstars/kstars.h @@ -1,816 +1,816 @@ /** ************************************************************************* kstars.h - K Desktop Planetarium ------------------- begin : Mon Feb 5 01:11:45 PST 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /** ************************************************************************* * * * This program 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. * * * ***************************************************************************/ #pragma once #include "config-kstars.h" #include "oal/equipmentwriter.h" #include "oal/observeradd.h" #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) #include #else #include #endif #ifdef HAVE_CFITSIO #include #endif // forward declaration is enough. We only need pointers class QDockWidget; class QPalette; class KActionMenu; class KStarsData; class SkyPoint; class SkyMap; class GeoLocation; class FindDialog; class TimeStepBox; class ImageExporter; class AltVsTime; class WUTDialog; class WIView; class WILPSettings; class WIEquipSettings; class ObsConditions; class AstroCalc; class SkyCalendar; class ScriptBuilder; class PlanetViewer; //class JMoonTool; class MoonPhaseTool; class FlagManager; class EquipmentWriter; class ObserverAdd; class Execute; class ExportImageDialog; class PrintingWizard; class EkosManager; class HorizonManager; class EyepieceField; class AddDeepSkyObject; class OpsCatalog; class OpsGuides; class OpsSolarSystem; class OpsSatellites; class OpsSupernovae; class OpsColors; class OpsAdvanced; class OpsINDI; class OpsEkos; class OpsFITS; #ifdef HAVE_XPLANET class OpsXplanet; #endif #ifdef HAVE_CFITSIO class FITSViewer; #endif /** *@class KStars *@short This is the main window for KStars. *In addition to the GUI elements, the class contains the program clock, KStarsData, and SkyMap objects. It also contains functions for the \ref DBusInterface D-Bus interface. KStars is now a singleton class. Use KStars::createInstance() to create an instance and KStars::Instance() to get a pointer to the instance *@author Jason Harris, Jasem Mutlaq *@version 1.1 */ class KStars : public KXmlGuiWindow { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.kstars") private: /** * @short Constructor. * @param doSplash should the splash panel be displayed during * initialization. * @param startClockRunning should the clock be running on startup? * @param startDateString date (in string representation) to start running from. * * @todo Refer to documentation on date format. */ explicit KStars(bool doSplash, bool startClockRunning = true, const QString &startDateString = QString()); public: /** * @short Create an instance of this class. Destroy any previous instance * @param doSplash * @param clockrunning * @param startDateString * @note See KStars::KStars for details on parameters * @return a pointer to the instance */ static KStars *createInstance(bool doSplash, bool clockrunning = true, const QString &startDateString = QString()); /** @return a pointer to the instance of this class */ inline static KStars *Instance() { return pinstance; } /** Destructor. */ - virtual ~KStars(); + ~KStars() override; /** Syncs config file. Deletes objects. */ void releaseResources(); /** @return pointer to KStarsData object which contains application data. */ inline KStarsData *data() const { return m_KStarsData; } /** @return pointer to SkyMap object which is the sky display widget. */ inline SkyMap *map() const { return m_SkyMap; } inline FlagManager *flagManager() const { return m_FlagManager; } inline PrintingWizard *printingWizard() const { return m_PrintingWizard; } #ifdef HAVE_CFITSIO FITSViewer *genericFITSViewer(); QList &getFITSViewersList() { return m_FITSViewers; } #endif #ifdef HAVE_INDI EkosManager *ekosManager(); #endif /** Add an item to the color-scheme action manu * @param name The name to use in the menu * @param actionName The internal name for the action (derived from filename) */ void addColorMenuItem(const QString &name, const QString &actionName); /** Remove an item from the color-scheme action manu * @param actionName The internal name of the action (derived from filename) */ void removeColorMenuItem(const QString &actionName); /** @short Apply config options throughout the program. * In most cases, options are set in the "Options" object directly, * but for some things we have to manually react to config changes. * @param doApplyFocus If true, then focus posiiton will be set * from config file */ void applyConfig(bool doApplyFocus = true); void showImgExportDialog(); void syncFOVActions(); void hideAllFovExceptFirst(); void selectNextFov(); void selectPreviousFov(); void showWISettingsUI(); void showWI(ObsConditions *obs); /** Load HIPS information and repopulate menu. */ void repopulateHIPS(); WIEquipSettings *getWIEquipSettings() { return m_WIEquipmentSettings; } public Q_SLOTS: /** @defgroup DBusInterface DBus Interface KStars provides powerful scripting functionality via DBus. The most common DBus functions can be constructed and executed within the ScriptBuilder tool. Any 3rd party language or tool with support for DBus can access several interfaces provided by KStars:
  • KStars: Provides functions to manipulate the skymap including zoom, pan, and motion to selected objects. Add and remove object trails and labels. Wait for user input before running further actions.
  • SimClock: Provides functions to start and stop time, set a different date and time, and to set the clock scale.
  • Ekos: Provides functions to start and stop Ekos Manager, set Ekos connection mode, and access to Ekos modules:
    • Capture: Provides functions to capture images, load sequence queues, control filter wheel, and obtain information on job progress.
    • Focus: Provides functions to focus control in manual and automated mode. Start and stop focusing procedures and set autofocus options.
    • Guide: Provides functions to start and stop calibration and autoguiding procedures. Set calibration and autoguide options.
    • Align: Provides functions to solve images use online or offline astrometry.net solver.
*/ /*@{*/ /** DBUS interface function. * Set focus to given Ra/Dec coordinates * @param ra the Right Ascension coordinate for the focus (in Hours) * @param dec the Declination coordinate for the focus (in Degrees) */ Q_SCRIPTABLE Q_NOREPLY void setRaDec(double ra, double dec); /** DBUS interface function. * Set focus to given Alt/Az coordinates. * @param alt the Altitude coordinate for the focus (in Degrees) * @param az the Azimuth coordinate for the focus (in Degrees) */ Q_SCRIPTABLE Q_NOREPLY void setAltAz(double alt, double az); /** DBUS interface function. * Point in the direction described by the string argument. * @param direction either an object name, a compass direction (e.g., "north"), or "zenith" */ Q_SCRIPTABLE Q_NOREPLY void lookTowards(const QString &direction); /** DBUS interface function. * Add a name label to the named object * @param name the name of the object to which the label will be attached */ Q_SCRIPTABLE Q_NOREPLY void addLabel(const QString &name); /** DBUS interface function. * Remove a name label from the named object * @param name the name of the object from which the label will be removed */ Q_SCRIPTABLE Q_NOREPLY void removeLabel(const QString &name); /** DBUS interface function. * Add a trail to the named solar system body * @param name the name of the body to which the trail will be attached */ Q_SCRIPTABLE Q_NOREPLY void addTrail(const QString &name); /** DBUS interface function. * Remove a trail from the named solar system body * @param name the name of the object from which the trail will be removed */ Q_SCRIPTABLE Q_NOREPLY void removeTrail(const QString &name); /** DBUS interface function. Zoom in one step. */ Q_SCRIPTABLE Q_NOREPLY void zoomIn(); /** DBUS interface function. Zoom out one step. */ Q_SCRIPTABLE Q_NOREPLY void zoomOut(); /** DBUS interface function. reset to the default zoom level. */ Q_SCRIPTABLE Q_NOREPLY void defaultZoom(); /** DBUS interface function. Set zoom level to specified value. * @param z the zoom level. Units are pixels per radian. */ Q_SCRIPTABLE Q_NOREPLY void zoom(double z); /** DBUS interface function. Set local time and date. * @param yr year of date * @param mth month of date * @param day day of date * @param hr hour of time * @param min minute of time * @param sec second of time */ Q_SCRIPTABLE Q_NOREPLY void setLocalTime(int yr, int mth, int day, int hr, int min, int sec); /** DBUS interface function. Set local time and date to present values acc. system clock * @note Just a proxy for slotSetTimeToNow(), but it is better to * keep the DBus interface separate from the internal methods. */ Q_SCRIPTABLE Q_NOREPLY void setTimeToNow(); /** DBUS interface function. Delay further execution of DBUS commands. * @param t number of seconds to delay */ Q_SCRIPTABLE Q_NOREPLY void waitFor(double t); /** DBUS interface function. Pause further DBUS execution until a key is pressed. * @param k the key which will resume DBUS execution */ Q_SCRIPTABLE Q_NOREPLY void waitForKey(const QString &k); /** DBUS interface function. Toggle tracking. * @param track engage tracking if true; else disengage tracking */ Q_SCRIPTABLE Q_NOREPLY void setTracking(bool track); /** DBUS interface function. modify a view option. * @param option the name of the option to be modified * @param value the option's new value */ Q_SCRIPTABLE Q_NOREPLY void changeViewOption(const QString &option, const QString &value); /** DBUS interface function. * @param name the name of the option to query * @return the current value of the named option */ Q_SCRIPTABLE QString getOption(const QString &name); /** DBUS interface function. Read config file. * This function is useful for restoring the user settings from the config file, * after having modified the settings in memory. * @sa writeConfig() */ Q_SCRIPTABLE Q_NOREPLY void readConfig(); /** DBUS interface function. Write current settings to config file. * This function is useful for storing user settings before modifying them with a DBUS * script. The original settings can be restored with readConfig(). * @sa readConfig() */ Q_SCRIPTABLE Q_NOREPLY void writeConfig(); /** DBUS interface function. Show text message in a popup window. * @note Not Yet Implemented * @param x x-coordinate for message window * @param y y-coordinate for message window * @param message the text to display in the message window */ Q_SCRIPTABLE Q_NOREPLY void popupMessage(int x, int y, const QString &message); /** DBUS interface function. Draw a line on the sky map. * @note Not Yet Implemented * @param x1 starting x-coordinate of line * @param y1 starting y-coordinate of line * @param x2 ending x-coordinate of line * @param y2 ending y-coordinate of line * @param speed speed at which line should appear from start to end points (in pixels per second) */ Q_SCRIPTABLE Q_NOREPLY void drawLine(int x1, int y1, int x2, int y2, int speed); /** DBUS interface function. Set the geographic location. * @param city the city name of the location * @param province the province name of the location * @param country the country name of the location * @return True if geographic location is found and set, false otherwise. */ Q_SCRIPTABLE bool setGeoLocation(const QString &city, const QString &province, const QString &country); /** DBUS interface function. Modify a color. * @param colorName the name of the color to be modified (e.g., "SkyColor") * @param value the new color to use */ Q_SCRIPTABLE Q_NOREPLY void setColor(const QString &colorName, const QString &value); /** DBUS interface function. Load a color scheme. * @param name the name of the color scheme to load (e.g., "Moonless Night") */ Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name); /** DBUS interface function. Export the sky image to a file. * @param filename the filename for the exported image * @param width the width for the exported image. Map's width will be used if nothing or an invalid value is supplied. * @param height the height for the exported image. Map's height will be used if nothing or an invalid value is supplied. * @param includeLegend should we include a legend? */ Q_SCRIPTABLE Q_NOREPLY void exportImage(const QString &filename, int width = -1, int height = -1, bool includeLegend = false); /** DBUS interface function. Return a URL to retrieve Digitized Sky Survey image. * @param objectName name of the object. * @note If the object is note found, the string "ERROR" is returned. */ Q_SCRIPTABLE QString getDSSURL(const QString &objectName); /** DBUS interface function. Return a URL to retrieve Digitized Sky Survey image. * @param RA_J2000 J2000.0 RA * @param Dec_J2000 J2000.0 Declination * @param width width of the image, in arcminutes (default = 15) * @param height height of the image, in arcminutes (default = 15) */ Q_SCRIPTABLE QString getDSSURL(double RA_J2000, double Dec_J2000, float width = 15, float height = 15); /** DBUS interface function. Return XML containing information about a sky object * @param objectName name of the object. * @note If the object was not found, the XML is empty. */ Q_SCRIPTABLE QString getObjectDataXML(const QString &objectName); /** DBUS interface function. Return XML containing position info about a sky object * @param objectName name of the object. * @note If the object was not found, the XML is empty. */ Q_SCRIPTABLE QString getObjectPositionInfo(const QString &objectName); /** DBUS interface function. Render eyepiece view and save it in the file(s) specified * @note See EyepieceField::renderEyepieceView() for more info. This is a DBus proxy that calls that method, and then writes the resulting image(s) to file(s). * @note Important: If imagePath is empty, but overlay is true, or destPathImage is supplied, this method will make a blocking DSS download. */ Q_SCRIPTABLE Q_NOREPLY void renderEyepieceView(const QString &objectName, const QString &destPathChart, const double fovWidth = -1.0, const double fovHeight = -1.0, const double rotation = 0.0, const double scale = 1.0, const bool flip = false, const bool invert = false, QString imagePath = QString(), const QString &destPathImage = QString(), const bool overlay = false, const bool invertColors = false); /** DBUS interface function. Set the approx field-of-view * @param FOV_Degrees field of view in degrees */ Q_SCRIPTABLE Q_NOREPLY void setApproxFOV(double FOV_Degrees); /** DBUS interface function. Get the dimensions of the Sky Map. * @return a string containing widthxheight in pixels. */ Q_SCRIPTABLE QString getSkyMapDimensions(); /** DBUS interface function. Return a newline-separated list of objects in the observing wishlist. * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list. */ Q_SCRIPTABLE QString getObservingWishListObjectNames(); /** DBUS interface function. Return a newline-separated list of objects in the observing session plan. * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list. */ Q_SCRIPTABLE QString getObservingSessionPlanObjectNames(); /** DBUS interface function. Print the sky image. * @param usePrintDialog if true, the KDE print dialog will be shown; otherwise, default parameters will be used * @param useChartColors if true, the "Star Chart" color scheme will be used for the printout, which will save ink. */ Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors); /** DBUS interface function. Open FITS image. * @param imageURL URL of FITS image to load. For a local file the prefix must be file:// For example * if the file is located at /home/john/m42.fits then the full URL is file:///home/john/m42.fits * @return True if successful, false otherwise. */ Q_SCRIPTABLE bool openFITS(const QString &imageURL); // for DBus bool openFITS(const QUrl &imageUrl); // for C++ code /** @}*/ /** * Update time-dependent data and (possibly) repaint the sky map. * @param automaticDSTchange change DST status automatically? */ void updateTime(const bool automaticDSTchange = true); /** action slot: sync kstars clock to system time */ void slotSetTimeToNow(); /** Apply new settings and redraw skymap */ void slotApplyConfigChanges(); /** Apply new settings for WI */ void slotApplyWIConfigChanges(); /** Called when zoom level is changed. Enables/disables zoom * actions and updates status bar. */ void slotZoomChanged(); /** action slot: Allow user to specify a field-of-view angle for the display window in degrees, * and set the zoom level accordingly. */ void slotSetZoom(); /** action slot: Toggle whether kstars is tracking current position */ void slotTrack(); /** action slot: open dialog for selecting a new geographic location */ void slotGeoLocator(); /** * @brief slotSetTelescopeEnabled call when telescope comes online or goes offline. * @param enable True if telescope is online and connected, false otherwise. */ void slotSetTelescopeEnabled(bool enable); /** Delete FindDialog because ObjNames list has changed in KStarsData due to * reloading star data. So list in FindDialog must be new filled with current data. */ void clearCachedFindDialog(); /** Remove all trails which may have been added to solar system bodies */ void slotClearAllTrails(); /** Display position in the status bar. */ void slotShowPositionBar(SkyPoint *); /** action slot: open Flag Manager */ void slotFlagManager(); /** Show the eyepiece view tool */ void slotEyepieceView(SkyPoint *sp, const QString &imagePath = QString()); /** Show the add deep-sky object dialog */ void slotAddDeepSkyObject(); /** action slot: open KStars setup wizard */ void slotWizard(); void updateLocationFromWizard(const GeoLocation& geo); WIView *wiView() { return m_WIView; } bool isWIVisible() { if (!m_WIView) return false; if (!m_wiDock) return false; return m_wiDock->isVisible(); } //FIXME Port to QML2 //#if 0 /** action slot: open What's Interesting settings window */ void slotWISettings(); /** action slot: toggle What's Interesting window */ void slotToggleWIView(); //#endif private slots: /** action slot: open a dialog for setting the time and date */ void slotSetTime(); /** action slot: toggle whether kstars clock is running or not */ void slotToggleTimer(); /** action slot: advance one step forward in time */ void slotStepForward(); /** action slot: advance one step backward in time */ void slotStepBackward(); /** action slot: open dialog for finding a named object */ void slotFind(); /** action slot: open KNewStuff window to download extra data. */ void slotDownload(); /** action slot: open KStars calculator to compute astronomical ephemeris */ void slotCalculator(); /** action slot: open Elevation vs. Time tool */ void slotAVT(); /** action slot: open What's up tonight dialog */ void slotWUT(); /** action slot: open Sky Calendar tool */ void slotCalendar(); /** action slot: open the glossary */ void slotGlossary(); /** action slot: open ScriptBuilder dialog */ void slotScriptBuilder(); /** action slot: open Solar system viewer */ void slotSolarSystem(); /** action slot: open Jupiter Moons tool */ // void slotJMoonTool(); /** action slot: open Moon Phase Calendar tool */ void slotMoonPhaseTool(); /** action slot: open Telescope wizard */ void slotTelescopeWizard(); /** action slot: open INDI driver panel */ void slotINDIDriver(); /** action slot: open INDI control panel */ void slotINDIPanel(); /** action slot: open Ekos panel */ void slotEkos(); /** action slot: Track with the telescope (INDI) */ void slotINDITelescopeTrack(); /** * Action slot: Slew with the telescope (INDI) * * @param focused_object Slew to the focused object or the mouse pointer if false. * */ void slotINDITelescopeSlew(bool focused_object = true); void slotINDITelescopeSlewMousePointer(); /** * Action slot: Sync the telescope (INDI) * * @param focused_object Sync the position of the focused object or the mouse pointer if false. * */ void slotINDITelescopeSync(bool focused_object = true); void slotINDITelescopeSyncMousePointer(); /** action slot: Abort any telescope motion (INDI) */ void slotINDITelescopeAbort(); /** action slot: Park the telescope (INDI) */ void slotINDITelescopePark(); /** action slot: Unpark the telescope (INDI) */ void slotINDITelescopeUnpark(); /** action slot: open dialog for setting the view options */ void slotViewOps(); /** finish setting up after the kstarsData has finished */ void datainitFinished(); /** Open FITS image. */ void slotOpenFITS(); /** Action slot to save the sky image to a file.*/ void slotExportImage(); /** Action slot to select a DBUS script and run it.*/ void slotRunScript(); /** Action slot to print skymap. */ void slotPrint(); /** Action slot to start Printing Wizard. */ void slotPrintingWizard(); /** Action slot to show tip-of-the-day window. */ void slotTipOfDay(); /** Action slot to set focus coordinates manually (opens FocusDialog). */ void slotManualFocus(); /** Meta-slot to point the focus at special points (zenith, N, S, E, W). * Uses the name of the Action which sent the Signal to identify the * desired direction. */ void slotPointFocus(); /** Meta-slot to set the color scheme according to the name of the * Action which sent the activating signal. */ void slotColorScheme(); /** Select the Target symbol (a.k.a. field-of-view indicator) */ void slotTargetSymbol(bool flag); /** Select the HIPS Source catalog. */ void slotHIPSSource(); /** Invoke the Field-of-View symbol editor window */ void slotFOVEdit(); /** Toggle between Equatorial and Ecliptic coordinte systems */ void slotCoordSys(); /** Set the map projection according to the menu selection */ void slotMapProjection(); /** Toggle display of the observing list tool*/ void slotObsList(); /** Meta-slot to handle display toggles for all of the viewtoolbar buttons. * uses the name of the sender to identify the item to change. */ void slotViewToolBar(); /** Meta-slot to handle display toggles for all of the INDItoolbar buttons. * uses the name of the sender to identify the item to change. */ void slotINDIToolBar(); /** Meta-slot to handle toggling display of GUI elements (toolbars and infoboxes) * uses name of the sender action to identify the widget to hide/show. */ void slotShowGUIItem(bool); /** Toggle to and from full screen mode */ void slotFullScreen(); /** Save data to config file before exiting.*/ void slotAboutToQuit(); void slotEquipmentWriter(); void slotObserverManager(); void slotHorizonManager(); void slotExecute(); void slotPolarisHourAngle(); /** Update comets orbital elements*/ void slotUpdateComets(); /** Update asteroids orbital elements*/ void slotUpdateAsteroids(); /** Update list of recent supernovae*/ void slotUpdateSupernovae(); /** Update satellites orbital elements*/ void slotUpdateSatellites(); /** Configure Notifications */ void slotConfigureNotifications(); private: /** Load FOV information and repopulate menu. */ void repopulateFOV(); /** Initialize Menu bar, toolbars and all Actions. */ void initActions(); /** Initialize Status bar. */ void initStatusBar(); /** Initialize focus position */ void initFocus(); /** Build the KStars main window */ void buildGUI(); - virtual void closeEvent(QCloseEvent *event); + void closeEvent(QCloseEvent *event) override; public: /** Check if the KStars main window is shown */ bool isGUIReady() { return m_SkyMap != nullptr; } /// Set to true when the application is being closed static bool Closing; private: /// Pointer to an instance of KStars static KStars *pinstance; KActionMenu *colorActionMenu { nullptr }; KActionMenu *fovActionMenu { nullptr }; KActionMenu *hipsActionMenu { nullptr }; KStarsData *m_KStarsData { nullptr }; SkyMap *m_SkyMap { nullptr }; // Widgets TimeStepBox *m_TimeStepBox { nullptr }; // Dialogs & Tools // File Menu ExportImageDialog *m_ExportImageDialog { nullptr }; PrintingWizard *m_PrintingWizard { nullptr }; // Pointing Menu FindDialog *m_FindDialog { nullptr }; // Tool Menu AstroCalc *m_AstroCalc { nullptr }; AltVsTime *m_AltVsTime { nullptr }; SkyCalendar *m_SkyCalendar { nullptr }; ScriptBuilder *m_ScriptBuilder { nullptr }; PlanetViewer *m_PlanetViewer { nullptr }; WUTDialog *m_WUTDialog { nullptr }; // JMoonTool *m_JMoonTool { nullptr }; FlagManager *m_FlagManager { nullptr }; HorizonManager *m_HorizonManager { nullptr }; EyepieceField *m_EyepieceView { nullptr }; #ifdef HAVE_CFITSIO QPointer m_GenericFITSViewer; QList m_FITSViewers; #endif #ifdef HAVE_INDI QPointer m_EkosManager; #endif AddDeepSkyObject *m_addDSODialog { nullptr }; // FIXME Port to QML2 //#if 0 WIView *m_WIView { nullptr }; WILPSettings *m_WISettings { nullptr }; WIEquipSettings *m_WIEquipmentSettings { nullptr }; ObsConditions *m_ObsConditions { nullptr }; QDockWidget *m_wiDock { nullptr }; //#endif QActionGroup *projectionGroup { nullptr }; QActionGroup *cschemeGroup { nullptr }; QActionGroup *hipsGroup { nullptr }; QActionGroup *telescopeGroup { nullptr }; bool DialogIsObsolete { false }; bool StartClockRunning { false }; QString StartDateString; QLabel AltAzField, RADecField, J2000RADecField; QPalette OriginalPalette, DarkPalette; OpsCatalog *opcatalog { nullptr }; OpsGuides *opguides { nullptr }; OpsSolarSystem *opsolsys { nullptr }; OpsSatellites *opssatellites { nullptr }; OpsSupernovae *opssupernovae { nullptr }; OpsColors *opcolors { nullptr }; OpsAdvanced *opadvanced { nullptr }; OpsINDI *opsindi { nullptr }; OpsEkos *opsekos { nullptr }; OpsFITS *opsfits { nullptr }; #ifdef HAVE_XPLANET OpsXplanet *opsxplanet { nullptr }; #endif }; diff --git a/kstars/kstarsdata.h b/kstars/kstarsdata.h index 58e44cb62..b60f5092b 100644 --- a/kstars/kstarsdata.h +++ b/kstars/kstarsdata.h @@ -1,411 +1,411 @@ /*************************************************************************** kstarsdata.h - K Desktop Planetarium ------------------- begin : Sun Jul 29 2001 copyright : (C) 2001 by Heiko Evermann email : heiko@evermann.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "catalogdb.h" #include "colorscheme.h" #include "geolocation.h" #include "ksnumbers.h" #include "kstarsdatetime.h" #include "ksuserdb.h" #include "simclock.h" #ifndef KSTARS_LITE #include "oal/oal.h" #include "oal/log.h" #endif #include #include #include #include #include #define MINZOOM 250. #define MAXZOOM 5000000. #define DEFAULTZOOM 2000. #define DZOOM 1.189207115 // 2^(1/4) #define AU_KM 1.49605e8 //km in one AU class QFile; class Execute; class FOV; class ImageExporter; class SkyMap; class SkyMapComposite; class SkyObject; class ObservingList; class TimeZoneRule; #ifdef KSTARS_LITE //Will go away when details window will be implemented in KStars Lite struct ADVTreeData { QString Name; QString Link; int Type; }; #else struct ADVTreeData; #endif /** * @class KStarsData * KStarsData is the backbone of KStars. It contains all the data used by KStars, * including the SkyMapComposite that contains all items in the skymap * (stars, deep-sky objects, planets, constellations, etc). Other kinds of data * are stored here as well: the geographic locations, the timezone rules, etc. * * @author Heiko Evermann * @version 1.0 */ class KStarsData : public QObject { Q_OBJECT protected: /** Constructor. */ KStarsData(); public: // FIXME: It uses temporary trail. There must be way to // this better. And resumeKey in DBUS code friend class KStars; // FIXME: it uses temporary trail and resumeKey friend class SkyMap; // FIXME: uses geoList and changes it. friend class LocationDialog; friend class LocationDialogLite; static KStarsData *Create(); static inline KStarsData *Instance() { return pinstance; } /** * Initialize KStarsData while running splash screen. * @return true on success. */ bool initialize(); /** Destructor. Delete data objects. */ - virtual ~KStarsData(); + ~KStarsData() override; /** * Set the NextDSTChange member. * Need this accessor because I could not make KStars::privatedata a friend * class for some reason...:/ */ void setNextDSTChange(const KStarsDateTime &dt) { NextDSTChange = dt; } /** * Returns true if time is running forward else false. Used by KStars to prevent * double calculations of daylight saving change time. */ bool isTimeRunningForward() const { return TimeRunsForward; } /** @return pointer to the localization (KLocale) object */ //KLocale *getLocale() { return locale; } /** * @short Find object by name. * @param name Object name to find * @return pointer to SkyObject matching this name */ SkyObject *objectNamed(const QString &name); /** * The Sky is updated more frequently than the moon, which is updated more frequently * than the planets. The date of the last update for each category is recorded so we * know when we need to do it again (see KStars::updateTime()). * Initializing these to -1000000.0 ensures they will be updated immediately * on the first call to KStars::updateTime(). */ void setFullTimeUpdate(); /** * Change the current simulation date/time to the KStarsDateTime argument. * Specified DateTime is always universal time. * @param newDate the DateTime to set. */ void changeDateTime(const KStarsDateTime &newDate); /** @return pointer to the current simulation local time */ const KStarsDateTime <() const { return LTime; } /** @return reference to the current simulation universal time */ const KStarsDateTime &ut() const { return Clock.utc(); } /** Sync the LST with the simulation clock. */ void syncLST(); /** @return pointer to SkyComposite */ SkyMapComposite *skyComposite() { return m_SkyComposite.get(); } /** @return pointer to the ColorScheme object */ ColorScheme *colorScheme() { return &CScheme; } /** @return name of current color scheme **/ Q_INVOKABLE QString colorSchemeName() { return CScheme.fileName(); } /** @return pointer to the KSUserDB object */ KSUserDB *userdb() { return &m_ksuserdb; } /** @return pointer to the Catalog DB object */ CatalogDB *catalogdb() { return &m_catalogdb; } /** @return pointer to the simulation Clock object */ Q_INVOKABLE SimClock *clock() { return &Clock; } /** @return pointer to the local sidereal time: a dms object */ CachingDms *lst() { return &LST; } /** @return pointer to the GeoLocation object*/ GeoLocation *geo() { return &m_Geo; } /** @return list of all geographic locations */ QList &getGeoList() { return geoList; } GeoLocation *locationNamed(const QString &city, const QString &province = QString(), const QString &country = QString()); /** * Set the GeoLocation according to the argument. * @param l reference to the new GeoLocation */ void setLocation(const GeoLocation &l); /** Set the GeoLocation according to the values stored in the configuration file. */ void setLocationFromOptions(); /** Return map for daylight saving rules. */ const QMap &getRulebook() const { return Rulebook; } /** @return whether the next Focus change will omit the slewing animation. */ bool snapNextFocus() const { return snapToFocus; } /** * Disable or re-enable the slewing animation for the next Focus change. * @note If the user has turned off all animated slewing, setSnapNextFocus(false) * will *NOT* enable animation on the next slew. A false argument would only * be used if you have previously called setSnapNextFocus(true), but then decided * you didn't want that after all. In other words, it's extremely unlikely you'd * ever want to use setSnapNextFocus(false). * @param b when true (the default), the next Focus change will omit the slewing * animation. */ void setSnapNextFocus(bool b = true) { snapToFocus = b; } /** * Execute a script. This function actually duplicates the DCOP functionality * for those cases when invoking DCOP is not practical (i.e., when preparing * a sky image in command-line dump mode). * @param name the filename of the script to "execute". * @param map pointer to the SkyMap object. * @return true if the script was successfully parsed. */ bool executeScript(const QString &name, SkyMap *map); /** Synchronize list of visible FOVs and list of selected FOVs in Options */ void syncFOV(); /** * @return the list of visible FOVs */ inline const QList getVisibleFOVs() const { return visibleFOVs; } /** * @return the list of available FOVs */ inline const QList getAvailableFOVs() const { return availFOVs; } #ifndef KSTARS_LITE /** Return log object */ OAL::Log *logObject() { return m_LogObject.get(); } /** Return ADV Tree */ QList avdTree() { return ADVtreeList; } inline ObservingList *observingList() const { return m_ObservingList; } ImageExporter *imageExporter(); Execute *executeSession(); #endif /*@short Increments the updateID, forcing a recomputation of star positions as well */ unsigned int incUpdateID(); unsigned int updateID() const { return m_updateID; } unsigned int updateNumID() const { return m_updateNumID; } KSNumbers *updateNum() { return &m_updateNum; } void syncUpdateIDs(); signals: /** Signal that specifies the text that should be drawn in the KStarsSplash window. */ void progressText(const QString &text); /** Should be used to refresh skymap. */ void skyUpdate(bool); /** If data changed, emit clearCache signal. */ void clearCache(); /** Emitted when geo location changed */ void geoChanged(); public slots: /** @short send a message to the console*/ void slotConsoleMessage(QString s) { std::cout << (const char *)(s.toLocal8Bit()) << std::endl; } /** * Update the Simulation Clock. Update positions of Planets. Update * Alt/Az coordinates of objects. Update precession. * emit the skyUpdate() signal so that SkyMap / whatever draws the sky can update itself * * This is ugly. * It _will_ change! * (JH:)hey, it's much less ugly now...can we lose the comment yet? :p */ void updateTime(GeoLocation *geo, const bool automaticDSTchange = true); /** * Sets the direction of time and stores it in bool TimeRunForwards. If scale >= 0 * time is running forward else time runs backward. We need this to calculate just * one daylight saving change time (previous or next DST change). */ void setTimeDirection(float scale); private: /** * Populate list of geographic locations from "citydb.sqlite" database. Also check for custom * locations file "mycitydb.sqlite" database, but don't require it. Each line in the file * provides the information required to create one GeoLocation object. * @short Fill list of geographic locations from file(s) * @return true if at least one city read successfully. * @see KStarsData::processCity() */ bool readCityData(); /** Read the data file that contains daylight savings time rules. */ bool readTimeZoneRulebook(); //TODO JM: ADV tree should use XML instead /** * Read Advanced interface structure to be used later to construct the list view in * the advanced tab in the Detail Dialog. * @li KSLABEL designates a top-level parent label * @li KSINTERFACE designates a common URL interface for several objects * @li END designates the end of a sub tree structure * @short read online database lookup structure. * @return true if data is successfully read. */ bool readADVTreeData(); /** Read INDI hosts from an XML file */ bool readINDIHosts(); //TODO JM: Use XML instead; The logger should have more features // that allow users to enter details about their observation logs // objects observed, eye pieces, telescope, conditions, mag..etc /** * @short read user logs. * * Read user logs. The log file is formatted as following: * @li KSLABEL designates the beginning of a log * @li KSLogEnd designates the end of a log. * * @return true if data is successfully read. */ bool readUserLog(); /** * Read in URLs to be attached to a named object's right-click popup menu. At this * point, there is no way to attach URLs to unnamed objects. There are two * kinds of URLs, each with its own data file: image links and webpage links. In addition, * there may be user-specific versions with custom URLs. Each line contains 3 fields * separated by colons (":"). Note that the last field is the URL, and as such it will * generally contain a colon itself. Only the first two colons encountered are treated * as field separators. The fields are: * * @li Object name. This must be the "primary" name of the object (the name at the top of the popup menu). * @li Menu text. The string that should appear in the popup menu to activate the link. * @li URL. * @short Read in image and information URLs. * @return true if data files were successfully read. */ bool readURLData(const QString &url, int type = 0, bool deepOnly = false); /** * @short open a file containing URL links. * @param urlfile string representation of the filename to open * @param file reference to the QFile object which will be opened to this file. * @return true if file successfully opened. */ bool openUrlFile(const QString &urlfile, QFile &file); /** * Reset local time to new daylight saving time. Use this function if DST has changed. * Used by updateTime(). */ void resetToNewDST(GeoLocation *geo, const bool automaticDSTchange); QList ADVtreeList; std::unique_ptr m_SkyComposite; GeoLocation m_Geo; SimClock Clock; KStarsDateTime LTime; KSUserDB m_ksuserdb; CatalogDB m_catalogdb; ColorScheme CScheme; #ifndef KSTARS_LITE ObservingList* m_ObservingList { nullptr }; std::unique_ptr m_LogObject; std::unique_ptr m_Execute; std::unique_ptr m_ImageExporter; #endif //EquipmentWriter *m_equipmentWriter; bool TimeRunsForward { false }; bool temporaryTrail { false }; // FIXME: Used in SkyMap only. Check! bool snapToFocus { false }; //KLocale *locale; CachingDms LST; QKeySequence resumeKey; QList availFOVs; // List of all available FOVs QList visibleFOVs; // List of visible FOVs. Cached from Options::FOVNames KStarsDateTime LastNumUpdate, LastSkyUpdate, LastPlanetUpdate, LastMoonUpdate; KStarsDateTime NextDSTChange; // FIXME: Used in kstarsdcop.cpp only KStarsDateTime StoredDate; QList geoList; QMap Rulebook; quint32 m_preUpdateID, m_updateID; quint32 m_preUpdateNumID, m_updateNumID; KSNumbers m_preUpdateNum, m_updateNum; static KStarsData *pinstance; }; diff --git a/kstars/kstarssplash.h b/kstars/kstarssplash.h index 7d8152aa7..e5414f1ee 100644 --- a/kstars/kstarssplash.h +++ b/kstars/kstarssplash.h @@ -1,49 +1,49 @@ /*************************************************************************** KStarsSplash.h - description ------------------- begin : Thu Jul 26 2001 copyright : (C) 2001 by Heiko Evermann email : heiko@evermann.de ***************************************************************************/ /*************************************************************************** * * * This program 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 KSTARSSPLASH_H__ #define KSTARSSPLASH_H__ #include /** @class KStarsSplash * The KStars Splash Screen. The splash screen shows the KStars logo and * progress messages while data files are parsed and objects are initialized. * @short the KStars Splash Screen. * @author Heiko Evermann * @version 1.0 */ class KStarsSplash : public QSplashScreen { Q_OBJECT public: /** Constructor. Create widgets. Load KStars logo. Start load timer. * A non-empty customMessage will replace "Welcome to KStars [...]". */ explicit KStarsSplash(const QString &customMessage = ""); /** Destructor */ - ~KStarsSplash(); + ~KStarsSplash() override; public slots: /** Display the text argument in the Splash Screen's status label. * This is connected to KStarsData::progressText(QString)*/ void setMessage(const QString &s); }; #endif diff --git a/kstars/options/opsadvanced.h b/kstars/options/opsadvanced.h index 9ed6f0551..259e7e611 100644 --- a/kstars/options/opsadvanced.h +++ b/kstars/options/opsadvanced.h @@ -1,51 +1,51 @@ /*************************************************************************** opsadvanced.h - K Desktop Planetarium ------------------- begin : Sun 14 Mar 2004 copyright : (C) 2004 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_opsadvanced.h" /** * @class OpsAdvanced * The Advanced Tab of the Options window. In this Tab the user can configure * advanced behaviors of the program, including: * @li Whether some objects are hidden when the map is moving (and which objects) * @li Whether positions are corrected for atmospheric refraction * @li Whether a slewing animation is used to move the Focus position * @li Whether centered objects are automatically labeled * @li whether a "transient" label is attached when the mouse "hovers" at an object. * @li whether to enable verbose debug output to a file which could be useful in troubleshooting any issues in KStars. * * @author Jason Harris, Jasem Mutlaq * @version 1.1 */ class OpsAdvanced : public QFrame, public Ui::OpsAdvanced { Q_OBJECT public: OpsAdvanced(); - ~OpsAdvanced(); + ~OpsAdvanced() override; private slots: void slotChangeTimeScale(float newScale); void slotToggleHideOptions(); void slotToggleVerbosityOptions(); void slotToggleOutputOptions(); void slotShowLogFiles(); void slotApply(); }; diff --git a/kstars/options/opscatalog.h b/kstars/options/opscatalog.h index 6c5432b58..bf56e0a2f 100644 --- a/kstars/options/opscatalog.h +++ b/kstars/options/opscatalog.h @@ -1,80 +1,80 @@ /*************************************************************************** opscatalog.h - K Desktop Planetarium ------------------- begin : Sun Feb 29 2004 copyright : (C) 2004 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSCATALOG_H_ #define OPSCATALOG_H_ #include "ui_opscatalog.h" class KStars; class QListWidgetItem; class KConfigDialog; /** *@class OpsCatalog *The Catalog page for the Options window. This page allows the user *to modify display of the major object catalogs in KStars: *@li Hipparcos/Tycho Star Catalog *@li Messier Catalog *@li NGC/IC Catalogs *@li Any Custom catalogs added by the user. * *@short Catalog page of the Options window. *@author Jason Harris *@version 1.0 */ class OpsCatalog : public QFrame, public Ui::OpsCatalog { Q_OBJECT public: explicit OpsCatalog(); - ~OpsCatalog(); + ~OpsCatalog() override; private slots: void updateCustomCatalogs(); void selectCatalog(); void slotAddCatalog(); void slotLoadCatalog(); void slotRemoveCatalog(); /* void slotSetDrawStarMagnitude(double newValue); void slotSetDrawStarZoomOutMagnitude(double newValue); */ void slotStarWidgets(bool on); void slotDeepSkyWidgets(bool on); void slotApply(); void slotCancel(); private: void insertCatalog(const QString &filename); void refreshCatalogList(); void populateInbuiltCatalogs(); void populateCustomCatalogs(); QString getCatalogName(const QString &filename); QListWidgetItem *showMessier, *showMessImages, *showNGC, *showIC; KConfigDialog *m_ConfigDialog; QStringList *m_CustomCatalogFile; QStringList m_CheckedCatalogNames; QList m_ShowCustomCatalog; float m_StarDensity; bool m_ShowMessier, m_ShowMessImages, m_ShowNGC, m_ShowIC; bool isDirty = false; }; #endif //OPSCATALOG_H_ diff --git a/kstars/options/opscolors.h b/kstars/options/opscolors.h index d6370eb99..5f80d1772 100644 --- a/kstars/options/opscolors.h +++ b/kstars/options/opscolors.h @@ -1,64 +1,64 @@ /*************************************************************************** opscolors.h - K Desktop Planetarium ------------------- begin : Sun Feb 29 2004 copyright : (C) 2004 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSCOLORS_H_ #define OPSCOLORS_H_ #include #include "ui_opscolors.h" /** @class OpsColors *The Colors page allows the user to adjust all of the colors used to *display the night sky. The colors are presented as a list of *colored rectangles and a description of its assignment in the map. *Clicking on any color opens a KColorDialog for selecting a new color. * *The user can also load preset color schemes, or create new schemes *from the current set of colors. * *@short The Colors page of the Options window. *@author Jason Harris *@author Jasem Mutlaq *@version 1.1 */ class KStars; class OpsColors : public QFrame, public Ui::OpsColors { Q_OBJECT public: explicit OpsColors(); - ~OpsColors(); + ~OpsColors() override; private slots: void newColor(QListWidgetItem *item); void slotPreset(int i); void slotAddPreset(); void slotSavePreset(); void slotRemovePreset(); void slotStarColorMode(int); void slotStarColorIntensity(int); void slotDarkAppColors(bool); private: bool setColors(const QString &filename); QStringList PresetFileList; }; #endif //OPSCOLORS_H_ diff --git a/kstars/options/opsguides.h b/kstars/options/opsguides.h index def91d0b1..9068093f6 100644 --- a/kstars/options/opsguides.h +++ b/kstars/options/opsguides.h @@ -1,50 +1,50 @@ /*************************************************************************** opsguides.h - K Desktop Planetarium ------------------- begin : Sun 6 Feb 2005 copyright : (C) 2005 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSGUIDES_H_ #define OPSGUIDES_H_ #include "ui_opsguides.h" class KConfigDialog; /** * @class OpsGuides * The guide page enables to user to select to turn on and off guide overlays such as * constellation lines, boundaries, flags..etc. */ class OpsGuides : public QFrame, public Ui::OpsGuides { Q_OBJECT public: explicit OpsGuides(); - ~OpsGuides(); + ~OpsGuides() override; private slots: void slotApply(); void slotToggleConstellOptions(bool state); void slotToggleConstellationArt(bool state); void slotToggleMilkyWayOptions(bool state); void slotToggleOpaqueGround(bool state); void slotToggleAutoSelectGrid(bool state); private: KConfigDialog *m_ConfigDialog; bool isDirty = false; }; #endif // OPSGUIDES_H_ diff --git a/kstars/options/opssatellites.h b/kstars/options/opssatellites.h index a45a5e861..4a676549f 100644 --- a/kstars/options/opssatellites.h +++ b/kstars/options/opssatellites.h @@ -1,78 +1,78 @@ /*************************************************************************** opssatellites.h - K Desktop Planetarium ------------------- begin : Mon 21 Mar 2011 copyright : (C) 2011 by Jérôme SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_opssatellites.h" #include #include #include class QStandardItem; class QStandardItemModel; class KStars; class SatelliteSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: explicit SatelliteSortFilterProxyModel(QObject *parent); - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; }; /** * @class OpsSatellites * The Satellites Tab of the Options window. In this Tab the user can configure * satellites options and select satellites that should be draw * @author Jérôme SONRIER * @version 1.0 */ class OpsSatellites : public QFrame, public Ui::OpsSatellites { Q_OBJECT public: /** Constructor */ OpsSatellites(); /** Destructor */ - ~OpsSatellites(); + ~OpsSatellites() override; private: /** Refresh satellites list */ void updateListView(); /** * @brief saveSatellitesList Saves list of checked satellites in the configuration file */ void saveSatellitesList(); KConfigDialog *m_ConfigDialog; QStandardItemModel *m_Model; QSortFilterProxyModel *m_SortModel; bool isDirty = false; private slots: void slotUpdateTLEs(); void slotShowSatellites(bool on); void slotApply(); void slotCancel(); void slotFilterReg(const QString &); void slotItemChanged(QStandardItem *); }; diff --git a/kstars/options/opssolarsystem.h b/kstars/options/opssolarsystem.h index 4fe0a8deb..c13934f5d 100644 --- a/kstars/options/opssolarsystem.h +++ b/kstars/options/opssolarsystem.h @@ -1,53 +1,53 @@ /*************************************************************************** opssolarsystem.h - K Desktop Planetarium ------------------- begin : Sun 22 Aug 2004 copyright : (C) 2004 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSSOLARSYSTEM_H_ #define OPSSOLARSYSTEM_H_ #include "ui_opssolarsystem.h" class KConfigDialog; /** @class OpsSolarSystem *The Solar System page for the Options window. This page allows the user *to modify display of solar system bodies in KStars, including the *major planets, the Sun and Moon, and the comets and asteroids. *@short The Solar System page of the Options window. *@author Jason Harris *@version 1.0 */ class OpsSolarSystem : public QFrame, public Ui::OpsSolarSystem { Q_OBJECT public: explicit OpsSolarSystem(); - ~OpsSolarSystem(); + ~OpsSolarSystem() override; private slots: void slotChangeMagDownload(double mag); void slotAllWidgets(bool on); void slotAsteroidWidgets(bool on); void slotCometWidgets(bool on); void slotSelectPlanets(); void slotApply(); private: bool isDirty = false; KConfigDialog *m_ConfigDialog; }; #endif diff --git a/kstars/options/opssupernovae.h b/kstars/options/opssupernovae.h index a99d8f0da..826a7ad8a 100644 --- a/kstars/options/opssupernovae.h +++ b/kstars/options/opssupernovae.h @@ -1,50 +1,50 @@ /*************************************************************************** opssupernovae.h - K Desktop Planetarium ------------------- begin : Thu, 25 Aug 2011 copyright : (C) 2011 by Samikshan Bairagya email : samikshan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSSUPERNOVAE_H_ #define OPSSUPERNOVAE_H_ #include "ui_opssupernovae.h" #include class KStars; /** @class OpsSupernovae *The Supernovae Tab of the Options window. In this Tab the user can configure *supernovae options and select if supernovae should be drawn on the skymap. *Also the user is given the option to check for updates on startup. And whether *to be alerted on startup. *@author Samikshan Bairagya *@version 1.0 */ class OpsSupernovae : public QFrame, public Ui::OpsSupernovae { Q_OBJECT public: /** * Constructor */ explicit OpsSupernovae(); /** * Destructor */ - ~OpsSupernovae() {} + ~OpsSupernovae() override {} }; #endif //OPSSUPERNOVAE_H_ diff --git a/kstars/printing/printingwizard.h b/kstars/printing/printingwizard.h index c0bb9cc5d..913b1338e 100644 --- a/kstars/printing/printingwizard.h +++ b/kstars/printing/printingwizard.h @@ -1,287 +1,287 @@ /*************************************************************************** printingwizard.h - K Desktop Planetarium ------------------- begin : Tue Aug 2 2011 copyright : (C) 2011 by Rafał Kułaga email : rl.kulaga@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 PRINTINGWIZARD_H #define PRINTINGWIZARD_H #include "ui_pwizwelcome.h" #include "QDialog" #include "simplefovexporter.h" #include "fovsnapshot.h" #include "QSize" class KStars; class PWizObjectSelectionUI; class PWizFovBrowseUI; class PWizFovTypeSelectionUI; class PWizFovConfigUI; class PWizFovManualUI; class PWizFovShUI; class PWizChartConfigUI; class PWizChartContentsUI; class PWizPrintUI; class FinderChart; class SkyObject; class QStackedWidget; class QPrinter; /** * \class PWizWelcomeUI * \brief User interface for the first step of the Printing Wizard. * \author Rafał Kułaga */ class PWizWelcomeUI : public QFrame, public Ui::PWizWelcome { Q_OBJECT public: /** * \brief Constructor. */ explicit PWizWelcomeUI(QWidget *parent = 0); }; /** * \class PrintingWizard * \brief Class representing Printing Wizard for KStars printed documents (currently only finder charts). * \author Rafał Kułaga */ class PrintingWizard : public QDialog { Q_OBJECT public: /** * \brief Wizard steps enumeration. */ enum WIZARD_STEPS { PW_WELCOME = 0, PW_OBJECT_SELECTION = 1, PW_CHART_CONFIG = 2, PW_FOV_TYPE = 3, PW_FOV_CONFIG = 4, PW_FOV_MANUAL = 5, PW_FOV_SH = 6, PW_FOV_BROWSE = 7, PW_CHART_CONTENTS = 8, PW_CHART_PRINT = 9 }; /** * \brief FOV export method type enumeration. */ enum FOV_TYPE { FT_MANUAL, FT_STARHOPPER, FT_UNDEFINED }; /** * \brief Constructor. */ explicit PrintingWizard(QWidget *parent = 0); /** * \brief Destructor. */ - ~PrintingWizard(); + ~PrintingWizard() override; /** * \brief Get used FOV export method. * \return Selected FOV export method. */ FOV_TYPE getFovType() { return m_FovType; } /** * \brief Get printer used by Printing Wizard. * \return Used printer. */ QPrinter *getPrinter() { return m_Printer; } /** * \brief Get used FinderChart document. * \return Used FinderChart document. */ FinderChart *getFinderChart() { return m_FinderChart; } /** * \brief Get selected SkyObject, for which FinderChart is created. * \return Selected SkyObject. */ SkyObject *getSkyObject() { return m_SkyObject; } /** * \brief Get FovSnapshot list. * \return Used FovSnapshot list. */ QList *getFovSnapshotList() { return &m_FovSnapshots; } /** * \brief Get FOV snapshot image size. * \return Size of the FOV snapshot image. */ QSize getFovImageSize() { return m_FovImageSize; } /** * \brief Get pointer to the SimpleFovExporter class instance. * \return Pointer to the SimpleFovExporter instance used by Printing Wizard. */ SimpleFovExporter *getFovExporter() { return &m_SimpleFovExporter; } /** * \brief Get object at which star hopping will begin. * \return Source object for star hopper. */ SkyObject *getShBeginObject() { return m_ShBeginObject; } /** * \brief Set SkyObject for which FinderChart is created. * \return SkyObject for which finder chart is created. */ void setSkyObject(SkyObject *obj) { m_SkyObject = obj; } /** * \brief Set SkyObject at which star hopper will begin. * \return SkyObject at which star hopper will begin. */ void setShBeginObject(SkyObject *obj) { m_ShBeginObject = obj; } /** * \brief Update Next/Previous step buttons. */ void updateStepButtons(); /** * \brief Set SkyMap to pointing mode and hide Printing Wizard. */ void beginPointing(); /** * \brief Enter star hopping begin pointing mode. */ void beginShBeginPointing(); /** * \brief Quit object pointing mode and set the pointed object. * \param obj Pointer to the SkyObject that was pointed on SkyMap. */ void pointingDone(SkyObject *obj); /** * \brief Hide Printing Wizard and put SkyMap in FOV capture mode. */ void beginFovCapture(); /** * \brief Hide Printing Wizard and put SkyMap in FOV capture mode. * \param center Point at which SkyMap should be centered. * \param fov Field of view symbol, used to calculate zoom factor. */ void beginFovCapture(SkyPoint *center, FOV *fov = 0); /** * \brief Capture current contents of FOV symbol. */ void captureFov(); /** * \brief Disable FOV capture mode. */ void fovCaptureDone(); /** * \brief Capture FOV snapshots using star hopper-based method. */ void beginShFovCapture(); /** * \brief Recapture FOV snapshot of passed index. * \param idx Index of the element to be recaptured. */ void recaptureFov(int idx); private slots: /** * \brief Slot: go to the previous page of Printing Wizard. */ void slotPrevPage(); /** * \brief Slot: go to the next page of Printing Wizard. */ void slotNextPage(); private: /** * \brief Setup widget properties. */ void setupWidgets(); /** * \brief Update Previous/Next buttons. */ void updateButtons(); /** * \brief Private method, used to center SkyMap around passed SkyPoint, and enter FOV capture mode. * \param center Point at which SkyMap should be centered. * \param fov Field of view symbol, used to calculate zoom factor. */ void slewAndBeginCapture(SkyPoint *center, FOV *fov = 0); /** * \brief Create finder chart using settings from all steps. */ void createFinderChart(); KStars *m_KStars; FinderChart *m_FinderChart; SkyObject *m_SkyObject; QStackedWidget *m_WizardStack; QPrinter *m_Printer; FOV_TYPE m_FovType; QSize m_FovImageSize; SimpleFovExporter m_SimpleFovExporter; QList m_FovSnapshots; SkyObject *m_ShBeginObject; bool m_PointingShBegin; bool m_SwitchColors; QString m_PrevSchemeName; bool m_RecapturingFov; int m_RecaptureIdx; QPushButton *nextB, *backB; PWizWelcomeUI *m_WizWelcomeUI; PWizObjectSelectionUI *m_WizObjectSelectionUI; PWizFovTypeSelectionUI *m_WizFovTypeSelectionUI; PWizFovConfigUI *m_WizFovConfigUI; PWizFovManualUI *m_WizFovManualUI; PWizFovShUI *m_WizFovShUI; PWizFovBrowseUI *m_WizFovBrowseUI; PWizChartConfigUI *m_WizChartConfigUI; PWizChartContentsUI *m_WizChartContentsUI; PWizPrintUI *m_WizPrintUI; }; #endif // PRINTINGWIZARD_H diff --git a/kstars/printing/simplefovexporter.h b/kstars/printing/simplefovexporter.h index 0230b2add..fdf07cd82 100644 --- a/kstars/printing/simplefovexporter.h +++ b/kstars/printing/simplefovexporter.h @@ -1,177 +1,177 @@ /*************************************************************************** simplefovexporter.h - K Desktop Planetarium ------------------- begin : Thu Jul 7 2011 copyright : (C) 2011 by Rafał Kułaga email : rl.kulaga@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 SIMPLEFOVEXPORTER_H #define SIMPLEFOVEXPORTER_H #include "QList" class SkyPoint; class FOV; class KStarsData; class SkyMap; class QPaintDevice; /** * \class SimpleFovExporter * \brief SimpleFovExporter class is used for FOV representation exporting. * Central point is defined by passed pointer to SkyPoint instance and field-of-view parameters * are defined by FOV class instance. Fragment of sky is painted on passed QPaintDevice subclass. * SimpleFovExporter class can be used for export of FOV representations in user-interactive mode as well as * for export of multiple FOVs at once, without user interaction. * \note Please note that SimpleFovExporter class instances may pause simulation clock if they're configured * to do so (via setClockStopping() method). * \note FOV representation's shape can be overridden (i.e. FOV image will be always rectangular) using * setFovShapeOverriden() method. */ class SimpleFovExporter { public: /** * \brief Constructor */ SimpleFovExporter(); /** * \brief Paint FOV representation on passed QPaintDevice subclass. * \param point central point of the exported FOV. * \param fov represented field-of-view. * \param pd paint device on which the representation of the FOV will be painted. */ void exportFov(SkyPoint *point, FOV *fov, QPaintDevice *pd); /** * \brief Paint FOV representation on passed QPaintDevice subclass. * \param fov represented field-of-view. * \param pd paint device on which the representation of the FOV will be painted. */ void exportFov(FOV *fov, QPaintDevice *pd); /** * \brief Paint FOV representation on passed QPaintDevice subclass. * \param pd paint device on which the representation of the FOV will be painted. */ void exportFov(QPaintDevice *pd); /** * \brief Export multiple FOV representations. * \param points list of central points. * \param fovs list of fields-of-view. * \param pds list of paint devices on which the representation of the FOV will be painted. */ void exportFov(const QList &points, const QList &fovs, const QList &pds); /** * \brief Export multiple FOV representations. * \param points list of central points. * \param fovs list of fields-of-view. * \param pds list of paint devices on which the representation of the FOV will be painted. */ void exportFov(const QList &points, FOV *fov, const QList &pds); /** * \brief Check if FOV export will cause simulation clock to be stopped. * \return true if clock will be stopped for FOV export. * \note If changed, previous clock state will be restored after FOV export is done. */ inline bool isClockStopping() const { return m_StopClock; } /** * \brief Check if FOV representation will be always rectangular. * \return true if FOV shape is overridden. */ inline bool isFovShapeOverriden() const { return m_OverrideFovShape; } /** * \brief Check if FOV symbol will be drawn. * \return true if FOV symbol will be drawn. */ inline bool isFovSymbolDrawn() const { return m_DrawFovSymbol; } /** * \brief Enable or disable stopping simulation for FOV export. * \param stopping should be true if stopping is to be enabled. */ inline void setClockStopping(bool stopping) { m_StopClock = stopping; } /** * \brief Enable or disable FOV shape overriding. * \param override should be true if FOV representation is to be always rectangular. */ - inline void setFovShapeOverriden(bool override) { m_OverrideFovShape = override; } + inline void setFovShapeOverriden(bool overrideFovShape) { m_OverrideFovShape = overrideFovShape; } /** * \brief Enable or disable FOV symbol drawing. * \param draw should be true if FOV symbol is to be drawn. */ inline void setFovSymbolDrawn(bool draw) { m_DrawFovSymbol = draw; } /** * \brief Calculate zoom level at which given angular length will occupy given length in pixels. * \param pixelSize size in pixels. * \param degrees angular length. * \return zoom level. */ static inline double calculateZoomLevel(int pixelSize, float degrees) { return (pixelSize * 57.3 * 60) / degrees; } /** * \brief Calculate pixel size of given angular length at given zoom level. * \param degrees angular length. * \param zoomLevel zoom level. * \return size in pixels. */ static inline double calculatePixelSize(float degrees, double zoomLevel) { return degrees * zoomLevel / (57.3 * 60.0); } private: /** * \brief Save SkyMap state. * \param savePos should be true if current position is to be saved. */ void saveState(bool savePos); /** * \brief Restore saved SkyMap state. * \param restorePos should be true if saved position is to be restored. */ void restoreState(bool restorePos); /** * \brief Private FOV export method. * \param point central point of the exported FOV. * \param fov represented field-of-view. * \param pd paint device on which the representation of the FOV will be painted. * \note Call to this method will not change SkyMap's state. */ void pExportFov(SkyPoint *point, FOV *fov, QPaintDevice *pd); KStarsData *m_KSData; SkyMap *m_Map; bool m_StopClock; bool m_OverrideFovShape; bool m_DrawFovSymbol; bool m_PrevClockState; bool m_PrevSlewing; SkyPoint *m_PrevPoint; double m_PrevZoom; }; #endif // SIMPLEFOVEXPORTER_H diff --git a/kstars/projections/azimuthalequidistantprojector.h b/kstars/projections/azimuthalequidistantprojector.h index 01d029520..8fb12a49d 100644 --- a/kstars/projections/azimuthalequidistantprojector.h +++ b/kstars/projections/azimuthalequidistantprojector.h @@ -1,41 +1,41 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef AZIMUTHALEQUIDISTANTPROJECTOR_H #define AZIMUTHALEQUIDISTANTPROJECTOR_H #include "projector.h" /** * @class AzimuthalEquidistantProjector * * Implememntation of Azimuthal equidistant projection * */ class AzimuthalEquidistantProjector : public Projector { public: explicit AzimuthalEquidistantProjector(const ViewParams &p); - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - double projectionK(double x) const Q_DECL_OVERRIDE; - double projectionL(double x) const Q_DECL_OVERRIDE; + Projection type() const override; + double radius() const override; + double projectionK(double x) const override; + double projectionL(double x) const override; }; #endif // AZIMUTHALEQUIDISTANTPROJECTOR_H diff --git a/kstars/projections/equirectangularprojector.h b/kstars/projections/equirectangularprojector.h index d237cbf97..68dfd96ad 100644 --- a/kstars/projections/equirectangularprojector.h +++ b/kstars/projections/equirectangularprojector.h @@ -1,44 +1,44 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef EQUIRECTANGULARPROJECTOR_H #define EQUIRECTANGULARPROJECTOR_H #include "projector.h" /** * @class EquirectangularProjector * * Implememntation of Equirectangular projection * */ class EquirectangularProjector : public Projector { public: explicit EquirectangularProjector(const ViewParams &p); - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - bool unusablePoint(const QPointF &p) const Q_DECL_OVERRIDE; - Vector2f toScreenVec(const SkyPoint *o, bool oRefract = true, bool *onVisibleHemisphere = 0) const Q_DECL_OVERRIDE; - SkyPoint fromScreen(const QPointF &p, dms *LST, const dms *lat) const Q_DECL_OVERRIDE; - QVector groundPoly(SkyPoint *labelpoint = 0, bool *drawLabel = 0) const Q_DECL_OVERRIDE; - void updateClipPoly() Q_DECL_OVERRIDE; + Projection type() const override; + double radius() const override; + bool unusablePoint(const QPointF &p) const override; + Vector2f toScreenVec(const SkyPoint *o, bool oRefract = true, bool *onVisibleHemisphere = 0) const override; + SkyPoint fromScreen(const QPointF &p, dms *LST, const dms *lat) const override; + QVector groundPoly(SkyPoint *labelpoint = 0, bool *drawLabel = 0) const override; + void updateClipPoly() override; }; #endif // EQUIRECTANGULARPROJECTOR_H diff --git a/kstars/projections/gnomonicprojector.h b/kstars/projections/gnomonicprojector.h index d283692ce..341b05359 100644 --- a/kstars/projections/gnomonicprojector.h +++ b/kstars/projections/gnomonicprojector.h @@ -1,42 +1,42 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef GNOMONICPROJECTOR_H #define GNOMONICPROJECTOR_H #include "projector.h" /** * @class GnomonicProjector * * Implememntation of Gnomonic projection * */ class GnomonicProjector : public Projector { public: explicit GnomonicProjector(const ViewParams &p); - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - double projectionK(double x) const Q_DECL_OVERRIDE; - double projectionL(double x) const Q_DECL_OVERRIDE; - double cosMaxFieldAngle() const Q_DECL_OVERRIDE; + Projection type() const override; + double radius() const override; + double projectionK(double x) const override; + double projectionL(double x) const override; + double cosMaxFieldAngle() const override; }; #endif // GNOMONICPROJECTOR_H diff --git a/kstars/projections/lambertprojector.h b/kstars/projections/lambertprojector.h index 220de7ccb..ffa5296ab 100644 --- a/kstars/projections/lambertprojector.h +++ b/kstars/projections/lambertprojector.h @@ -1,42 +1,42 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef LAMBERTPROJECTOR_H #define LAMBERTPROJECTOR_H #include "projector.h" /** * @class LambertProjector * * Implememntation of Lambert azimuthal equal-area projection * */ class LambertProjector : public Projector { public: explicit LambertProjector(const ViewParams &p); - virtual ~LambertProjector() {} - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - double projectionK(double x) const Q_DECL_OVERRIDE; - double projectionL(double x) const Q_DECL_OVERRIDE; + ~LambertProjector() override {} + Projection type() const override; + double radius() const override; + double projectionK(double x) const override; + double projectionL(double x) const override; }; #endif // LAMBERTPROJECTOR_H diff --git a/kstars/projections/orthographicprojector.h b/kstars/projections/orthographicprojector.h index d72cbf2a1..5015531a1 100644 --- a/kstars/projections/orthographicprojector.h +++ b/kstars/projections/orthographicprojector.h @@ -1,41 +1,41 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef ORTHOGRAPHICPROJECTOR_H #define ORTHOGRAPHICPROJECTOR_H #include "projector.h" /** * @class OrthographicProjector * * Implememntation of Orthographic projection * */ class OrthographicProjector : public Projector { public: explicit OrthographicProjector(const ViewParams &p); - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - double projectionK(double x) const Q_DECL_OVERRIDE; - double projectionL(double x) const Q_DECL_OVERRIDE; + Projection type() const override; + double radius() const override; + double projectionK(double x) const override; + double projectionL(double x) const override; }; #endif // ORTHOGRAPHICPROJECTOR_H diff --git a/kstars/projections/stereographicprojector.h b/kstars/projections/stereographicprojector.h index 5687a897b..5cfff5a73 100644 --- a/kstars/projections/stereographicprojector.h +++ b/kstars/projections/stereographicprojector.h @@ -1,41 +1,41 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef STEREOGRAPHICPROJECTOR_H #define STEREOGRAPHICPROJECTOR_H #include "projector.h" /** * @class StereographicProjector * * Implememntation of Stereographic projection * */ class StereographicProjector : public Projector { public: explicit StereographicProjector(const ViewParams &p); - Projection type() const Q_DECL_OVERRIDE; - double radius() const Q_DECL_OVERRIDE; - double projectionK(double x) const Q_DECL_OVERRIDE; - double projectionL(double x) const Q_DECL_OVERRIDE; + Projection type() const override; + double radius() const override; + double projectionK(double x) const override; + double projectionL(double x) const override; }; #endif // STEREOGRAPHICPROJECTOR_H diff --git a/kstars/skycomponents/artificialhorizoncomponent.h b/kstars/skycomponents/artificialhorizoncomponent.h index a230a9c03..39f569f98 100644 --- a/kstars/skycomponents/artificialhorizoncomponent.h +++ b/kstars/skycomponents/artificialhorizoncomponent.h @@ -1,76 +1,76 @@ /* Artificial Horizon Component Copyright (C) 2015 Jasem Mutlaq 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. */ #pragma once #include "noprecessindex.h" #include class ArtificialHorizonEntity { public: ArtificialHorizonEntity(); ~ArtificialHorizonEntity(); QString region() const; void setRegion(const QString &Region); bool enabled() const; void setEnabled(bool Enabled); void clearList(); void setList(const std::shared_ptr &list); std::shared_ptr list(); private: QString m_Region; bool m_Enabled { false }; std::shared_ptr m_List; }; /** * @class ArtificialHorizon * Represents custom area from the horizon upwards which represent blocked views from the vantage point of the user. * Such blocked views could stem for example from tall trees or buildings. The user can define one or more polygons to * represent the blocked areas. * * @author Jasem Mutlaq * @version 0.1 */ class ArtificialHorizonComponent : public NoPrecessIndex { public: /** * @short Constructor * @p parent pointer to the parent SkyComposite object * name is the name of the subclass */ explicit ArtificialHorizonComponent(SkyComposite *parent); - virtual ~ArtificialHorizonComponent(); + ~ArtificialHorizonComponent() override; - bool selected() Q_DECL_OVERRIDE; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + bool selected() override; + void draw(SkyPainter *skyp) override; void setLivePreview(const std::shared_ptr &preview) { livePreview = preview; } void addRegion(const QString ®ionName, bool enabled, const std::shared_ptr &list); void removeRegion(const QString ®ionName, bool lineOnly = false); inline QList *horizonList() { return &m_HorizonList; } bool load(); void save(); protected: - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; private: QList m_HorizonList; std::shared_ptr livePreview; }; diff --git a/kstars/skycomponents/asteroidscomponent.h b/kstars/skycomponents/asteroidscomponent.h index aa84d7038..eef5db4b2 100644 --- a/kstars/skycomponents/asteroidscomponent.h +++ b/kstars/skycomponents/asteroidscomponent.h @@ -1,64 +1,64 @@ /*************************************************************************** asteroidscomponent.h - K Desktop Planetarium ------------------- begin : 2005/30/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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 ASTEROIDSCOMPONENT_H #define ASTEROIDSCOMPONENT_H #include #include #include "solarsystemlistcomponent.h" #include "ksparser.h" #include "typedef.h" class FileDownloader; /** @class AsteroidsComponent * Represents the asteroids on the sky map. * * @author Thomas Kabelmann * @version 0.1 */ class AsteroidsComponent : public QObject, public SolarSystemListComponent { Q_OBJECT public: /** @short Default constructor. * @p parent pointer to the parent SolarSystemComposite */ explicit AsteroidsComponent(SolarSystemComposite *parent); - virtual ~AsteroidsComponent(); - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; - bool selected() Q_DECL_OVERRIDE; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + ~AsteroidsComponent() override; + void draw(SkyPainter *skyp) override; + bool selected() override; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; void updateDataFile(); QString ans(); protected slots: void downloadReady(); void downloadError(const QString &errorString); private: void loadData(); FileDownloader *downloadJob; }; #endif diff --git a/kstars/skycomponents/catalogcomponent.h b/kstars/skycomponents/catalogcomponent.h index abedf3890..269690bd7 100644 --- a/kstars/skycomponents/catalogcomponent.h +++ b/kstars/skycomponents/catalogcomponent.h @@ -1,100 +1,100 @@ /*************************************************************************** catalogcomponent.h - K Desktop Planetarium ------------------- begin : 2005/17/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "listcomponent.h" #include "Options.h" struct stat; /** * @class CatalogComponent * Represents a custom user-defined catalog. * Code adapted from CustomCatalogComponent.cpp originally authored by Thomas Kabelmann --spacetime * * @author Thomas Kabelmann * Rishab Arora (spacetime) * @version 0.2 */ class CatalogComponent : public ListComponent { public: /** * @short Constructor * @p parent Pointer to the parent SkyComposite object */ CatalogComponent(SkyComposite *, const QString &fname, bool showerrs, int index, bool callLoadData = true); /** * @short Destructor. Delete list members */ - virtual ~CatalogComponent(); + ~CatalogComponent() override; /** * @short Draw custom catalog objects on the sky map. * @p psky Reference to the QPainter on which to paint */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; /** @return the name of the catalog */ inline QString name() const { return m_catName; } /** @return the frequency of the flux readings in the catalog, if any */ inline QString fluxFrequency() const { return m_catFluxFreq; } /** @return the unit of the flux measurements in the catalog, if any */ inline QString fluxUnit() const { return m_catFluxUnit; } /** @return color, which should be used for drawing objects in this catalog **/ inline QString catColor() { return m_catColor; } /** * @return true if visibility Option is set for this catalog * @note this is complicated for custom catalogs, because * Options::showCatalog() returns a QList, not a bool. * This function extracts the correct visibility value and * returns the appropriate bool value */ bool getVisibility(); /** @see SyncedCatalogItem */ quint32 getUpdateID() { return updateID; } /** * @brief Returns true if this catalog is to be drawn * Overridden from SkyComponent::selected * @return bool **/ - bool selected() Q_DECL_OVERRIDE; + bool selected() override; protected: /** @short Load data into custom catalog */ virtual void loadData() { _loadData(true); } /** @short Load data into custom catalog */ virtual void _loadData(bool includeCatalogDesignation); // FIXME: There seems to be no way to remove catalogs from the program. -- asimha QString m_catName, m_catColor, m_catFluxFreq, m_catFluxUnit; bool m_Showerrs { false }; int m_ccIndex { 0 }; quint32 updateID { 0 }; }; diff --git a/kstars/skycomponents/cometscomponent.h b/kstars/skycomponents/cometscomponent.h index bfb876542..931b83810 100644 --- a/kstars/skycomponents/cometscomponent.h +++ b/kstars/skycomponents/cometscomponent.h @@ -1,59 +1,59 @@ /*************************************************************************** cometscomponent.h - K Desktop Planetarium ------------------- begin : 2005/24/09 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 COMETSCOMPONENT_H #define COMETSCOMPONENT_H class SkyLabeler; #include "solarsystemlistcomponent.h" #include "ksparser.h" #include class FileDownloader; /** @class CometsComponent * This class encapsulates the Comets * * @author Jason Harris * @version 0.1 */ class CometsComponent : public QObject, public SolarSystemListComponent { Q_OBJECT public: /** @short Default constructor. * @p parent pointer to the parent SolarSystemComposite */ explicit CometsComponent(SolarSystemComposite *parent); - virtual ~CometsComponent(); - bool selected() Q_DECL_OVERRIDE; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + ~CometsComponent() override; + bool selected() override; + void draw(SkyPainter *skyp) override; void updateDataFile(); protected slots: void downloadReady(); void downloadError(const QString &errorString); private: void loadData(); FileDownloader *downloadJob; }; #endif diff --git a/kstars/skycomponents/constellationartcomponent.h b/kstars/skycomponents/constellationartcomponent.h index 616d55b95..1819a910d 100644 --- a/kstars/skycomponents/constellationartcomponent.h +++ b/kstars/skycomponents/constellationartcomponent.h @@ -1,65 +1,65 @@ /*************************************************************************** ConstellationArtComponent.h - K Desktop Planetarium ------------------- begin : 2015-05-27 copyright : (C) 2015 by M.S.Adityan email : msadityan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" class ConstellationsArt; class CultureList; /** * @class ConstellationArtComponent * Represents the ConstellationsArt objects. * For each skyculture there is a separate table in skycultures.sqlite. * @author M.S.Adityan * @version 0.1 */ class ConstellationArtComponent : public SkyComponent { public: /** Constructor */ explicit ConstellationArtComponent(SkyComposite *, CultureList *cultures); /** Destructor */ - ~ConstellationArtComponent(); + ~ConstellationArtComponent() override; /** * @short Read the skycultures.sqlite database file. * Parse all the data from the skycultures database.Construct a ConstellationsArt object * from the data, and add it to a QList. * @return true if data file is successfully read. */ void loadData(); /** * @short deletes all created ConstellationsArt objects. * Used in KStars Lite to reduce memory consumption if Constellation Art is switched off */ void deleteData(); /** @short Shows the details of the constellations selected skyculture */ void showList(); - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; QList m_ConstList; private: QString cultureName; int records { 0 }; }; diff --git a/kstars/skycomponents/constellationboundarylines.h b/kstars/skycomponents/constellationboundarylines.h index 7befb264e..881672e86 100644 --- a/kstars/skycomponents/constellationboundarylines.h +++ b/kstars/skycomponents/constellationboundarylines.h @@ -1,76 +1,76 @@ /*************************************************************************** constellationboundary.h - K Desktop Planetarium ------------------- begin : 25 Oct. 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "noprecessindex.h" #include #include class PolyList; class ConstellationBoundary; class KSFileReader; typedef QVector> PolyListList; typedef QVector> PolyIndex; /** * @class ConstellationBoundary * Collection of lines comprising the borders between constellations * * @author Jason Harris * @version 0.1 */ class ConstellationBoundaryLines : public NoPrecessIndex { public: /** * @short Constructor * Simply adds all of the coordinate grid circles (meridians and parallels) * @p parent Pointer to the parent SkyComposite object * * Reads the constellation boundary data from cbounds.dat. The boundary data is defined by * a series of RA,Dec coordinate pairs defining the "nodes" of the boundaries. The nodes are * organized into "segments", such that each segment represents a continuous series * of boundary-line intervals that divide two particular constellations. */ explicit ConstellationBoundaryLines(SkyComposite *parent); - virtual ~ConstellationBoundaryLines(); + ~ConstellationBoundaryLines() override; QString constellationName(SkyPoint *p); - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; private: void appendPoly(const std::shared_ptr &polyList, int debug = 0); /** * @short reads the indices from the KSFileReader instead of using * the SkyMesh to create them. If the file pointer is null or if * debug == -1 then we fall back to using the index. */ void appendPoly(std::shared_ptr &polyList, KSFileReader *file, int debug); PolyList *ContainingPoly(SkyPoint *p); SkyMesh *m_skyMesh { nullptr }; PolyIndex m_polyIndex; int m_polyIndexCnt { 0 }; }; diff --git a/kstars/skycomponents/constellationlines.h b/kstars/skycomponents/constellationlines.h index fb9a50ae7..62789a6be 100644 --- a/kstars/skycomponents/constellationlines.h +++ b/kstars/skycomponents/constellationlines.h @@ -1,67 +1,67 @@ /*************************************************************************** constellationlines.h - K Desktop Planetarium ------------------- begin : 25 Oct. 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksnumbers.h" #include "linelistindex.h" class CultureList; /** * @class ConstellationLines * Collection of lines making the 88 constellations * * @author Jason Harris * @version 0.1 */ class ConstellationLines : public LineListIndex { public: /** * @short Constructor * @p parent Pointer to the parent SkyComposite object * * Constellation lines data is read from clines.dat. * Each line in the file contains a command character ("M" means move to * this position without drawing a line, "D" means draw a line from * the previous position to this one), followed by the genetive name of * a star, which marks the position of the constellation node. */ ConstellationLines(SkyComposite *parent, CultureList *cultures); void reindex(KSNumbers *num); - bool selected() Q_DECL_OVERRIDE; + bool selected() override; protected: - const IndexHash &getIndexHash(LineList *lineList) Q_DECL_OVERRIDE; + const IndexHash &getIndexHash(LineList *lineList) override; /** * @short we need to override the update routine because stars are * updated differently from mere SkyPoints. */ - void JITupdate(LineList *lineList) Q_DECL_OVERRIDE; + void JITupdate(LineList *lineList) override; /** @short Set the QColor and QPen for drawing. */ - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; private: KSNumbers m_reindexNum; double m_reindexInterval { 0 }; }; diff --git a/kstars/skycomponents/constellationnamescomponent.h b/kstars/skycomponents/constellationnamescomponent.h index f4379c4e7..34acbbcf7 100644 --- a/kstars/skycomponents/constellationnamescomponent.h +++ b/kstars/skycomponents/constellationnamescomponent.h @@ -1,79 +1,79 @@ /*************************************************************************** constellationnamescomponent.h - K Desktop Planetarium ------------------- begin : 2005/10/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "listcomponent.h" class CultureList; class KSNumbers; class SkyComposite; class SkyPainter; /** * @class ConstellationNamesComponent * Represents the constellation names on the sky map. * * @author Thomas Kabelmann * @version 0.1 */ class ConstellationNamesComponent : public ListComponent { public: /** * @short Constructor * @p parent Pointer to the parent SkyComposite object * * Reads the constellation names data from cnames.dat * Each line in the file is parsed according to column position: * @li 0-1 RA hours [int] * @li 2-3 RA minutes [int] * @li 4-5 RA seconds [int] * @li 6 Dec sign [char; '+' or '-'] * @li 7-8 Dec degrees [int] * @li 9-10 Dec minutes [int] * @li 11-12 Dec seconds [int] * @li 13-15 IAU Abbreviation [string] e.g., 'Ori' == Orion * @li 17- Constellation name [string] */ ConstellationNamesComponent(SkyComposite *parent, CultureList *cultures); /** @short Destructor. Delete list members */ - virtual ~ConstellationNamesComponent(); + ~ConstellationNamesComponent() override; /** * @short Draw constellation names on the sky map. * @p psky Reference to the QPainter on which to paint */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * @short we need a custom routine (for now) so we don't * precess the locations of the names. */ - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; /** @short Return true if we are using localized constellation names */ inline bool isLocalCNames() { return localCNames; } - bool selected() Q_DECL_OVERRIDE; + bool selected() override; void loadData(CultureList *cultures); private: bool localCNames { false }; }; diff --git a/kstars/skycomponents/coordinategrid.h b/kstars/skycomponents/coordinategrid.h index dc70ae317..05b94c9ee 100644 --- a/kstars/skycomponents/coordinategrid.h +++ b/kstars/skycomponents/coordinategrid.h @@ -1,47 +1,47 @@ /*************************************************************************** coordinategrid.h - K Desktop Planetarium ------------------- begin : 15 Sept. 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "noprecessindex.h" class QString; class SkyComposite; class SkyPainter; /** * @class CoordinateGrid * Collection of all the circles in the coordinate grid * * @author Jason Harris * @version 0.1 */ class CoordinateGrid : public NoPrecessIndex { public: /** * @short Constructor * Simply adds all of the coordinate grid circles (meridians and parallels) * @p parent Pointer to the parent SkyComposite object */ CoordinateGrid(SkyComposite *parent, const QString &name); - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE = 0; + void preDraw(SkyPainter *skyp) override = 0; - bool selected() Q_DECL_OVERRIDE = 0; + bool selected() override = 0; }; diff --git a/kstars/skycomponents/deepskycomponent.h b/kstars/skycomponents/deepskycomponent.h index 9a8fcdfdd..2d51a3e68 100644 --- a/kstars/skycomponents/deepskycomponent.h +++ b/kstars/skycomponents/deepskycomponent.h @@ -1,169 +1,169 @@ /*************************************************************************** deepskycomponent.h - K Desktop Planetarium ------------------- begin : 2005/15/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" #include "skylabel.h" class QPointF; #ifdef KSTARS_LITE class DeepSkyItem; #endif class DeepSkyObject; class KSNumbers; class SkyMap; class SkyMesh; class SkyPoint; // NOTE: Although the following symbol has nothing to do with line // number in any file, we use this name to keep consistency in naming // conventions with StarComponent #define MAX_LINENUMBER_MAG 90 typedef QVector DeepSkyList; typedef QHash DeepSkyIndex; /** * @class DeepSkyComponent * Represents the deep sky objects separated by catalogs. * Custom Catalogs are a standalone component. * @note this Component is similar to ListComponent, but * the deep sky objects are stored in four separate QLists. * @author Thomas Kabelmann * @version 0.1 */ class DeepSkyComponent : public SkyComponent { #ifdef KSTARS_LITE friend class DeepSkyItem; #endif public: explicit DeepSkyComponent(SkyComposite *); - ~DeepSkyComponent(); + ~DeepSkyComponent() override; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * @short draw all the labels in the prioritized LabelLists and then * clear the LabelLists. */ void drawLabels(); /** * @short Update the sky positions of this component. FIXME -jbb does nothing now * * This function usually just updates the Horizontal (Azimuth/Altitude) coordinates of the * objects in this component. If the KSNumbers argument is not nullptr, this function also * recomputes precession and nutation for the date in KSNumbers. * @p num Pointer to the KSNumbers object * @note By default, the num parameter is nullptr, indicating that Precession/Nutation * computation should be skipped; this computation is only occasionally required. */ - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; /** * @short Search the children of this SkyComponent for a SkyObject whose name matches the argument * @p name the name to be matched * @return a pointer to the SkyObject whose name matches the argument, or a nullptr pointer * if no match was found. */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; /** * @short Searches the region(s) and appends the SkyObjects found to the list of sky objects * * Look for a SkyObject that is in one of the regions * If found, then append to the list of sky objects * @p list list of SkyObject to which matching list has to be appended to * @p region defines the regions in which the search for SkyObject should be done within * @return void */ - void objectsInArea(QList &list, const SkyRegion ®ion) Q_DECL_OVERRIDE; + void objectsInArea(QList &list, const SkyRegion ®ion) override; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; const QList &objectList() const { return m_DeepSkyList; } - bool selected() Q_DECL_OVERRIDE; + bool selected() override; private: /** * @short Read the ngcic.dat deep-sky database. * Parse all lines from the deep-sky object catalog files. Construct a DeepSkyObject * from the data in each line, and add it to the DeepSkyComponent. * * Each line in the file is parsed according to column position: * @li 0 IC indicator [char] If 'I' then IC object; if ' ' then NGC object * @li 1-4 Catalog number [int] The NGC/IC catalog ID number * @li 6-8 Constellation code (IAU abbreviation) * @li 10-11 RA hours [int] * @li 13-14 RA minutes [int] * @li 16-19 RA seconds [float] * @li 21 Dec sign [char; '+' or '-'] * @li 22-23 Dec degrees [int] * @li 25-26 Dec minutes [int] * @li 28-29 Dec seconds [int] * @li 31 Type ID [int] Indicates object type; see TypeName array in kstars.cpp * @li 33-36 Type details [string] (not yet used) * @li 38-41 Magnitude [float] can be blank * @li 43-48 Major axis length, in arcmin [float] can be blank * @li 50-54 Minor axis length, in arcmin [float] can be blank * @li 56-58 Position angle, in degrees [int] can be blank * @li 60-62 Messier catalog number [int] can be blank * @li 64-69 PGC Catalog number [int] can be blank * @li 71-75 UGC Catalog number [int] can be blank * @li 77-END Common name [string] can be blank * @return true if data file is successfully read. */ void loadData(); void clearList(QList &list); void mergeSplitFiles(); void drawDeepSkyCatalog(SkyPainter *skyp, bool drawObject, DeepSkyIndex *dsIndex, const QString &colorString, bool drawImage = false); QList m_DeepSkyList; QList m_MessierList; QList m_NGCList; QList m_ICList; QList m_OtherList; LabelList *m_labelList[MAX_LINENUMBER_MAG + 1]; bool m_hideLabels { false }; double m_zoomMagLimit { 0 }; SkyMesh *m_skyMesh { nullptr }; DeepSkyIndex m_DeepSkyIndex; DeepSkyIndex m_MessierIndex; DeepSkyIndex m_NGCIndex; DeepSkyIndex m_ICIndex; DeepSkyIndex m_OtherIndex; void appendIndex(DeepSkyObject *o, DeepSkyIndex *dsIndex, Trixel trixel); QHash nameHash; /** @short adds a label to the lists of labels to be drawn prioritized by magnitude. */ void addLabel(const QPointF &p, DeepSkyObject *obj); }; diff --git a/kstars/skycomponents/deepstarcomponent.h b/kstars/skycomponents/deepstarcomponent.h index 2effff532..02286f762 100644 --- a/kstars/skycomponents/deepstarcomponent.h +++ b/kstars/skycomponents/deepstarcomponent.h @@ -1,145 +1,145 @@ /*************************************************************************** deepstarcomponent.h - K Desktop Planetarium ------------------- begin : Fri 1st Aug 2008 copyright : (C) 2008 Akarsh Simha, Thomas Kabelmann email : akarshsimha@gmail.com, thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once /** * @class DeepStarComponent * Stores and manages unnamed stars, most of which are dynamically loaded into memory. * * @author Akarsh Simha * @note Much of the code here is copied from class StarComponent authored by Thomas Kabelmann * @version 0.1 */ #include "binfilehelper.h" #include "ksnumbers.h" #include "listcomponent.h" #include "starblockfactory.h" #include "skyobjects/deepstardata.h" #include "skyobjects/stardata.h" class SkyLabeler; class SkyMesh; class StarBlockFactory; class StarBlockList; class StarObject; class DeepStarComponent : public ListComponent { #ifdef KSTARS_LITE friend class DeepStarItem; //Needs access to staticStars and buch of other facilities #endif public: DeepStarComponent(SkyComposite *parent, QString fileName, float trigMag, bool staticstars = false); - virtual ~DeepStarComponent(); + ~DeepStarComponent() override; //This function is empty; we need that so that the JiT update //is the only one beiong used. - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; bool loadStaticStars(); bool openDataFile(); /** * @return true if this DeepStarComponent has static stars (that are not dynamically loaded) */ inline bool hasStaticStars() const { return staticStars; } /** * @return return the estimated faint magnitude limit of this DeepStarComponent */ float faintMagnitude() const { return m_FaintMagnitude; } /** * @param HDnum Henry-Draper catalog number of the desired star * @return A star matching the given Henry-Draper catalog number */ StarObject *findByHDIndex(int HDnum); /** * @return Nearest star within maxrad of SkyPoint p, or nullptr if not found */ - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; inline bool fileOpen() const { return fileOpened; } inline BinFileHelper *getStarReader() { return &starReader; } bool verifySBLIntegrity(); /** * @short Add to the given list, the stars from this component, * that lie within the specified circular aperture, and that are * brighter than the limiting magnitude specified. * @p center The center point of the aperture * @p radius The radius around the center point that defines the * aperture * @p maglim Optional parameter indicating the limiting magnitude. * If magnitude limit is numerically < -28, the limiting magnitude * is assumed to be the limiting magnitude of the catalog (i.e. no * magnitude limit) * @p list The list to operate on * @return false if the limiting magnitude is brighter than the * trigger magnitude of the DeepStarComponent */ bool starsInAperture(QList &list, const SkyPoint ¢er, float radius, float maglim = -29); // TODO: Find the right place for this method static void byteSwap(DeepStarData *stardata); static void byteSwap(StarData *stardata); static StarBlockFactory m_StarBlockFactory; private: SkyMesh *m_skyMesh { nullptr }; KSNumbers m_reindexNum; float m_zoomMagLimit { 0 }; /// Magnitude at which this catalog triggers float triggerMag { 0 }; /// Limiting magnitude of the catalog currently loaded float m_FaintMagnitude { 0 }; /// Indicates whether the file is opened or not bool fileOpened { false }; unsigned long visibleStarCount { 0 }; /// Maximum number of stars in any given trixel quint16 MSpT { 0 }; // Time keeping variables long unsigned t_dynamicLoad { 0 }; long unsigned t_drawUnnamed { 0 }; long unsigned t_updateCache { 0 }; QVector> m_starBlockList; QHash m_CatalogNumber; bool staticStars { false }; // Stuff required for reading data DeepStarData deepstardata; StarData stardata; BinFileHelper starReader; QString dataFileName; }; diff --git a/kstars/skycomponents/ecliptic.h b/kstars/skycomponents/ecliptic.h index fe46f60b0..206b5d33f 100644 --- a/kstars/skycomponents/ecliptic.h +++ b/kstars/skycomponents/ecliptic.h @@ -1,47 +1,47 @@ /*************************************************************************** ecliptic.h - K Desktop Planetarium ------------------- begin : 2007-08-09 copyright : (C) 2007 by James B. Bowlin email : bowlin@mindspring.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "linelistindex.h" #include "linelistlabel.h" /** * @class Ecliptic * Represents the ecliptic on the sky map. * * @author James B. Bowlin * @version 0.1 */ class Ecliptic : public LineListIndex { public: /** * @short Constructor * @p parent pointer to the parent SkyComposite object name is the name of the subclass */ explicit Ecliptic(SkyComposite *parent); - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; virtual void drawCompassLabels(); - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - LineListLabel *label() Q_DECL_OVERRIDE { return &m_label; } + LineListLabel *label() override { return &m_label; } private: LineListLabel m_label; }; diff --git a/kstars/skycomponents/equator.h b/kstars/skycomponents/equator.h index ecf13d945..874a6ff18 100644 --- a/kstars/skycomponents/equator.h +++ b/kstars/skycomponents/equator.h @@ -1,49 +1,49 @@ /*************************************************************************** equator.h - K Desktop Planetarium ------------------- begin : 2007-08-09 copyright : (C) 2007 by James B. Bowlin email : bowlin@mindspring.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "linelistlabel.h" #include "noprecessindex.h" /** * @class Equator * Represents the equator on the sky map. * * @author James B. Bowlin * @version 0.1 */ class Equator : public NoPrecessIndex { public: /** * @short Constructor * @p parent pointer to the parent SkyComposite object name is the name of the subclass */ explicit Equator(SkyComposite *parent); - bool selected() Q_DECL_OVERRIDE; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + bool selected() override; + void draw(SkyPainter *skyp) override; virtual void drawCompassLabels(); - LineListLabel *label() Q_DECL_OVERRIDE { return &m_label; } + LineListLabel *label() override { return &m_label; } protected: - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; private: LineListLabel m_label; }; diff --git a/kstars/skycomponents/equatorialcoordinategrid.h b/kstars/skycomponents/equatorialcoordinategrid.h index 81da1f0d0..e44ba4c15 100644 --- a/kstars/skycomponents/equatorialcoordinategrid.h +++ b/kstars/skycomponents/equatorialcoordinategrid.h @@ -1,45 +1,45 @@ /*************************************************************************** equatorialcoordinategrid.h - K Desktop Planetarium ------------------- begin : Tue 01 Mar 2012 copyright : (C) 2012 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "coordinategrid.h" class SkyComposite; class SkyPainter; /** * @class EquatorialCoordinateGrid * Collection of all the circles in the equatorial coordinate grid * * @author Jérôme SONRIER * @version 0.1 */ class EquatorialCoordinateGrid : public CoordinateGrid { public: /** * @short Constructor * Simply adds all of the equatorial coordinate grid circles (meridians and parallels) * @p parent Pointer to the parent SkyComposite object */ explicit EquatorialCoordinateGrid(SkyComposite *parent); - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; }; diff --git a/kstars/skycomponents/flagcomponent.h b/kstars/skycomponents/flagcomponent.h index f2c312524..420cf3030 100644 --- a/kstars/skycomponents/flagcomponent.h +++ b/kstars/skycomponents/flagcomponent.h @@ -1,185 +1,185 @@ /*************************************************************************** flagcomponent.h - K Desktop Planetarium ------------------- begin : Fri 16 Jan 2009 copyright : (C) 2009 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "pointlistcomponent.h" #include #include #include #include class SkyPainter; /** * @class FlagComponent * @short Represents a flag on the sky map. * Each flag is composed by a SkyPoint where coordinates are stored, an * epoch and a label. This class also stores flag images and associates * each flag with an image. * When FlagComponent is created, it seeks all file names beginning with * "_flag" in the user directory and *considere them as flag images. * * The file flags.dat stores coordinates, epoch, image name and label of each * flags and is read to init FlagComponent * * @author Jerome SONRIER * @version 1.1 */ class FlagComponent : public QObject, public PointListComponent { Q_OBJECT public: /** @short Constructor. */ explicit FlagComponent(SkyComposite *); /** @short Destructor. */ - virtual ~FlagComponent(); + ~FlagComponent() override; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; /** * @short Add a flag. * @param SkyPoint Sky point in epoch coordinates * @param epoch Moment for which celestial coordinates are specified * @param image Image name * @param label Label of the flag */ void add(const SkyPoint &flagPoint, QString epoch, QString image, QString label, QColor labelColor); /** * @short Remove a flag. * @param index Index of the flag to be remove. */ void remove(int index); /** * @short Update a flag. * @param index index of the flag to be updated. * @param epoch new flag epoch. * @param image new flag image. * @param label new flag label. * @param labelColor new flag label color. */ void updateFlag(int index, const SkyPoint &flagPoint, QString epoch, QString image, QString label, QColor labelColor); /** * @short Return image names. * @return the list of all image names */ QStringList getNames(); /** * @short Return the numbers of flags. * @return the size of m_PointList */ int size(); /** * @short Get epoch. * @return the epoch as a string * @param index Index of the flag */ QString epoch(int index); /** * @short Get label. * @return the label as a string * @param index Index of the flag */ QString label(int index); /** * @short Get label color. * @return the label color * @param index Index of the flag */ QColor labelColor(int index); /** * @short Get image. * @return the image associated with the flag * @param index Index of the flag */ QImage image(int index); /** * @short Get image name. * @return the name of the image associated with the flag * @param index Index of the flag */ QString imageName(int index); /** * @short Get images. * @return all images that can be use */ QList imageList(); /** * @short Get image. * @param index Index of the image in m_Images * @return an image from m_Images */ QImage imageList(int index); /** * @brief epochCoords return coordinates recorded in original epoch * @param index index of the flag * @return pair of RA/DEC in original epoch */ QPair epochCoords(int index); /** * @short Get list of flag indexes near specified SkyPoint with radius specified in pixels. * @param point central SkyPoint. * @param pixelRadius radius in pixels. */ QList getFlagsNearPix(SkyPoint *point, int pixelRadius); /** @short Load flags from flags.dat file. */ void loadFromFile(); /** @short Save flags to flags.dat file. */ void saveToFile(); private: // Convert from given epoch to J2000. If epoch is already J2000, do nothing void toJ2000(SkyPoint *p, QString epoch); /// List of epochs QStringList m_Epoch; /// RA/DEC stored in original epoch QList> m_EpochCoords; /// List of image index QList m_FlagImages; /// List of label QStringList m_Labels; /// List of label colors QList m_LabelColors; /// List of image names QStringList m_Names; /// List of flag images QList m_Images; }; diff --git a/kstars/skycomponents/hipscomponent.h b/kstars/skycomponents/hipscomponent.h index 950c0cd3b..4b9166272 100644 --- a/kstars/skycomponents/hipscomponent.h +++ b/kstars/skycomponents/hipscomponent.h @@ -1,36 +1,36 @@ /* HiPS : Hierarchical Progressive Surveys HiPS is the hierarchical tiling mechanism which allows one to access, visualize and browse seamlessly image, catalogue and cube data. The KStars HiPS compoenent is used to load and overlay progress surverys from various online catalogs. Copyright (C) 2017 Jasem Mutlaq 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. */ #pragma once #include "hipscomponent.h" #include "skycomponent.h" /** * @class HIPSComponent * Represents the HIPS progress survey overlay * @author Jasem Mutlaq * @version 1.0 */ class HIPSComponent : public SkyComponent { public: /** Constructor */ explicit HIPSComponent(SkyComposite *); /** Destructor */ - ~HIPSComponent(); + ~HIPSComponent() override; bool selected() override; void draw(SkyPainter *skyp) override; }; diff --git a/kstars/skycomponents/horizoncomponent.h b/kstars/skycomponents/horizoncomponent.h index d1e329c14..a21c03648 100644 --- a/kstars/skycomponents/horizoncomponent.h +++ b/kstars/skycomponents/horizoncomponent.h @@ -1,63 +1,63 @@ /*************************************************************************** horizoncomponent.h - K Desktop Planetarium ------------------- begin : 2005/07/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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 HORIZONCOMPONENT_H #define HORIZONCOMPONENT_H #include "pointlistcomponent.h" class SkyComposite; class SkyMap; class KSNumbers; /** *@class HorizonComponent *Represents the horizon on the sky map. *@author Thomas Kabelmann *@version 0.1 */ class HorizonComponent : public PointListComponent { public: /** *@short Constructor *@p parent Pointer to the parent SkyComposite object */ explicit HorizonComponent(SkyComposite *parent); /** *@short Destructor */ - virtual ~HorizonComponent(); + ~HorizonComponent() override; /** *@short Draw the Horizon on the Sky map *@p map Pointer to the SkyMap object *@p psky Reference to the QPainter on which to paint */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; - void update(KSNumbers *) Q_DECL_OVERRIDE; + void update(KSNumbers *) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; private: void drawCompassLabels(); }; #endif diff --git a/kstars/skycomponents/horizontalcoordinategrid.h b/kstars/skycomponents/horizontalcoordinategrid.h index 7d16316cd..acc59cb33 100644 --- a/kstars/skycomponents/horizontalcoordinategrid.h +++ b/kstars/skycomponents/horizontalcoordinategrid.h @@ -1,44 +1,44 @@ /*************************************************************************** horizontalcoordinategrid.h - K Desktop Planetarium ------------------- begin : Tue 01 Mar 2012 copyright : (C) 2012 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "coordinategrid.h" /** * @class HorizontalCoordinateGrid * Collection of all the circles in the horizontal coordinate grid * * @author Jérôme SONRIER * @version 0.1 */ class HorizontalCoordinateGrid : public CoordinateGrid { public: /** * @short Constructor * Simply adds all of the coordinate grid circles (meridians and parallels) * @p parent Pointer to the parent SkyComposite object */ explicit HorizontalCoordinateGrid(SkyComposite *parent); - void preDraw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void preDraw(SkyPainter *skyp) override; - void update(KSNumbers *) Q_DECL_OVERRIDE; + void update(KSNumbers *) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; }; diff --git a/kstars/skycomponents/linelistindex.h b/kstars/skycomponents/linelistindex.h index 9a36aaa13..50734f850 100644 --- a/kstars/skycomponents/linelistindex.h +++ b/kstars/skycomponents/linelistindex.h @@ -1,188 +1,188 @@ /*************************************************************************** linelistindex.h - K Desktop Planetarium ------------------- begin : 2007-07-04 copyright : (C) 2007 James B. Bowlin email : bowlin@mindspring.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" #include "skymesh.h" #include #include #include class LineList; class LineListLabel; class SkipHashList; class SkyPainter; /** * @class LineListIndex * Contains almost all the code needed for indexing and drawing and clipping * lines and polygons. * * @author James B. Bowlin @version 0.1 */ class LineListIndex : public SkyComponent { friend class LinesItem; //Needs access to reindexLines public: /** * @short Constructor * Simply set the internal skyMesh, parent, and name. * @param parent Pointer to the parent SkyComponent object * @param mesh Pointer to the universal SkyMesh instance * @param name name of the subclass used for debugging */ explicit LineListIndex(SkyComposite *parent, const QString &name = ""); /** @short Destructor */ - ~LineListIndex(); + ~LineListIndex() override; /** * @short The top level draw routine. Draws all the LineLists for any * subclass in one fell swoop which minimizes some of the loop overhead. * Overridden by MilkWay so it can decide whether to draw outlines or * filled. Therefore MilkyWay does not need to override preDraw(). The * MilkyWay draw() routine calls all of the more specific draw() * routines below. */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; #ifdef KSTARS_LITE /** * @short KStars Lite needs direct access to m_lineIndex for drawing the lines */ inline LineListHash *lineIndex() const { return m_lineIndex.get(); } inline LineListHash *polyIndex() const { return m_polyIndex.get(); } /** @short returns MeshIterator for currently visible trixels */ MeshIterator visibleTrixels(); #endif //Moved to public because KStars Lite uses it /** * @short this is called from within the draw routines when the updateID * of the lineList is stale. It is virtual because different subclasses * have different update routines. NoPrecessIndex doesn't precess in * the updates and ConstellationLines must update its points as stars, * not points. that doesn't precess the points. */ virtual void JITupdate(LineList *lineList); protected: /** * @short as the name says, recreates the lineIndex using the LineLists * in the previous index. Since we are indexing everything at J2000 * this is only used by ConstellationLines which needs to reindex * because of the proper motion of the stars. */ void reindexLines(); /** @short retrieve name of object */ QString name() const { return m_name; } /** * @short displays a message that we are loading m_name. Also prints * out the message if skyMesh debug is greater than zero. */ void intro(); /** * @short prints out some summary statistics if the skyMesh debug is * greater than 1. */ void summary(); /** @short Returns the SkyMesh object. */ SkyMesh *skyMesh() { return m_skyMesh; } /** * @short Typically called from within a subclasses constructors. * Adds the trixels covering the outline of lineList to the lineIndex. */ void appendLine(const std::shared_ptr &lineList); void removeLine(const std::shared_ptr &lineList); /** * @short Typically called from within a subclasses constructors. * Adds the trixels covering the full lineList to the polyIndex. */ void appendPoly(const std::shared_ptr &lineList); /** * @short a convenience method that adds a lineList to both the lineIndex and the polyIndex. */ void appendBoth(const std::shared_ptr &lineList); /** * @short Draws all the lines in m_listList as simple lines in float mode. */ void drawLines(SkyPainter *skyp); /** * @short Draws all the lines in m_listList as filled polygons in float * mode. */ void drawFilled(SkyPainter *skyp); /** * @short Gives the subclasses access to the top of the draw() method. * Typically used for setting the QPen, etc. in the QPainter being * passed in. Defaults to setting a thin white pen. */ virtual void preDraw(SkyPainter *skyp); /** * @short a callback overridden by NoPrecessIndex so it can use the * drawing code with the non-reverse-precessed mesh buffer. */ virtual MeshBufNum_t drawBuffer() { return DRAW_BUF; } /** * @short Returns an IndexHash from the SkyMesh that contains the set of * trixels that cover lineList. Overridden by SkipListIndex so it can * pass SkyMesh an IndexHash indicating which line segments should not * be indexed @param lineList contains the list of points to be covered. */ virtual const IndexHash &getIndexHash(LineList *lineList); /** * @short Also overridden by SkipListIndex. * Controls skipping inside of the draw() routines. The default behavior * is to simply return a null pointer. * * FIXME: I don't think that the SkipListIndex class even exists -- hdevalence */ virtual SkipHashList *skipList(LineList *lineList); virtual LineListLabel *label() { return 0; } inline LineListList listList() const { return m_listList; } private: QString m_name; SkyMesh *m_skyMesh { nullptr }; std::unique_ptr m_lineIndex; std::unique_ptr m_polyIndex; LineListList m_listList; QMutex mutex; }; diff --git a/kstars/skycomponents/listcomponent.h b/kstars/skycomponents/listcomponent.h index d8b2767b8..b1b4fc5f0 100644 --- a/kstars/skycomponents/listcomponent.h +++ b/kstars/skycomponents/listcomponent.h @@ -1,64 +1,64 @@ /*************************************************************************** listcomponent.h - K Desktop Planetarium ------------------- begin : 2005/10/01 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" #include class SkyComposite; class SkyMap; /** * @class ListComponent * An abstract parent class, to be inherited by SkyComponents that store a QList of SkyObjects. * * @author Jason Harris * @version 0.1 */ class ListComponent : public SkyComponent { public: explicit ListComponent(SkyComposite *parent); - virtual ~ListComponent(); + ~ListComponent() override; /** * @short Update the sky positions of this component. * * This function usually just updates the Horizontal (Azimuth/Altitude) * coordinates of the objects in this component. If the KSNumbers* * argument is not nullptr, this function also recomputes precession and * nutation for the date in KSNumbers. * @p num Pointer to the KSNumbers object * @note By default, the num parameter is nullptr, indicating that * Precession/Nutation computation should be skipped; this computation * is only occasionally required. */ - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; void clear(); const QList &objectList() const { return m_ObjectList; } protected: QList m_ObjectList; }; diff --git a/kstars/skycomponents/milkyway.h b/kstars/skycomponents/milkyway.h index a753f7057..50936a8b6 100644 --- a/kstars/skycomponents/milkyway.h +++ b/kstars/skycomponents/milkyway.h @@ -1,70 +1,70 @@ /*************************************************************************** milkyway.h - K Desktop Planetarium ------------------- begin : 2005/07/08 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "linelistindex.h" /** * @class MlkyWay * * Draw filled areas as Milky Way and Magellanic clouds. * * This class should store SkipLists instead of LineLists. The two methods * are used inside of LineListIndex to access the SkipLists' skip hashes. * This way the same code in LineListIndex does double duty. Only subclassed * by MilkyWay. * * @author James B. Bowlin * @version 0.1 */ class MilkyWay : public LineListIndex { friend class MilkyWayItem; public: /** * @short Constructor * @p parent pointer to the parent SkyComposite */ explicit MilkyWay(SkyComposite *parent); /** Load skiplists from file */ void loadContours(QString fname, QString greeting); - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; - bool selected() Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; + bool selected() override; protected: /** * @short Returns an IndexHash from the SkyMesh that contains the set * of trixels that cover the _SkipList_ lineList excluding skipped * lines as specified in the SkipList. SkipList is a subclass of * LineList. * FIXME: Implementation is broken!! */ - const IndexHash &getIndexHash(LineList *skipList) Q_DECL_OVERRIDE; + const IndexHash &getIndexHash(LineList *skipList) override; /** * @short Returns a boolean indicating whether to skip the i-th line * segment in the _SkipList_ skipList. Note that SkipList is a * subclass of LineList. This routine allows us to use the drawing * code in LineListIndex instead of repeating it all here. * FIXME: Implementation is broken!! */ - SkipHashList *skipList(LineList *lineList) Q_DECL_OVERRIDE; + SkipHashList *skipList(LineList *lineList) override; }; diff --git a/kstars/skycomponents/noprecessindex.h b/kstars/skycomponents/noprecessindex.h index 7f44519fb..555477020 100644 --- a/kstars/skycomponents/noprecessindex.h +++ b/kstars/skycomponents/noprecessindex.h @@ -1,47 +1,47 @@ /*************************************************************************** noprecessindex.cpp - K Desktop Planetarium ------------------- begin : 2007-08-04 copyright : (C) 2007 James B. Bowlin email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "linelistindex.h" /** * @class NoPrecessIndex * * @author James B. Bowlin * @version 0.1 */ class NoPrecessIndex : public LineListIndex { public: /** @short Constructor */ NoPrecessIndex(SkyComposite *parent, const QString &name); //Moved to public because KStars Lite uses it /** * @ short override JITupdate so we don't perform the precession * correction, only rotation. */ - void JITupdate(LineList *lineList) Q_DECL_OVERRIDE; + void JITupdate(LineList *lineList) override; protected: /** * @short we need to use the buffer that does not have the * reverse-precession correction. */ - MeshBufNum_t drawBuffer() Q_DECL_OVERRIDE { return NO_PRECESS_BUF; } + MeshBufNum_t drawBuffer() override { return NO_PRECESS_BUF; } }; diff --git a/kstars/skycomponents/planetmoonscomponent.h b/kstars/skycomponents/planetmoonscomponent.h index cca24b39d..4e93e1a64 100644 --- a/kstars/skycomponents/planetmoonscomponent.h +++ b/kstars/skycomponents/planetmoonscomponent.h @@ -1,81 +1,81 @@ /*************************************************************************** planetmoonscomponent.h - K Desktop Planetarium ------------------- begin : Sat Mar 13 2009 : by Vipul Kumar Singh, Médéric Boquien email : vipulkrsingh@gmail.com, mboquien@free.fr ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" #include "skyobjects/ksplanetbase.h" #include class KSNumbers; class PlanetMoons; class SkyComposite; class SolarSystemSingleComponent; /** * @class PlanetMoonsComponent * Represents the planetmoons on the sky map. * * @author Vipul Kumar Singh * @author Médéric boquien * @version 0.1 */ class PlanetMoonsComponent : public SkyComponent { public: /** * @short Constructor * @p parent pointer to the parent SkyComposite */ PlanetMoonsComponent(SkyComposite *parent, SolarSystemSingleComponent *pla, KSPlanetBase::Planets& planet); /** @short Destructor */ - ~PlanetMoonsComponent(); + ~PlanetMoonsComponent() override; - bool selected() Q_DECL_OVERRIDE; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + bool selected() override; + void draw(SkyPainter *skyp) override; #ifndef KSTARS_LITE - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; #endif - void updateMoons(KSNumbers *num) Q_DECL_OVERRIDE; + void updateMoons(KSNumbers *num) override; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; /** * @return a pointer to a moon if its name matches the argument * * @p name the name to be matched * @return a SkyObject pointer to the moon whose name matches * the argument, or a nullptr pointer if no match was found. */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; /** Return pointer to stored planet object. */ KSPlanetBase *getPlanet() const; /** Return pointer to stored moons object. */ inline PlanetMoons *getMoons() const { return pmoons.get(); } protected: - void drawTrails(SkyPainter *skyp) Q_DECL_OVERRIDE; + void drawTrails(SkyPainter *skyp) override; private: KSPlanetBase::Planets planet; std::unique_ptr pmoons; SolarSystemSingleComponent *m_Planet { nullptr }; }; diff --git a/kstars/skycomponents/pointlistcomponent.h b/kstars/skycomponents/pointlistcomponent.h index bd11b2487..479cce870 100644 --- a/kstars/skycomponents/pointlistcomponent.h +++ b/kstars/skycomponents/pointlistcomponent.h @@ -1,62 +1,62 @@ /*************************************************************************** pointlistcomponent.h - K Desktop Planetarium ------------------- begin : 2005/10/01 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #define NCIRCLE 360 //number of points used to define equator, ecliptic and horizon #include "skycomponent.h" #include #include class SkyPoint; /** * @class PointListComponent * An abstract parent class, to be inherited by SkyComponents that store a QList of SkyPoints. * * @author Jason Harris * @version 0.1 */ class PointListComponent : public SkyComponent { public: explicit PointListComponent(SkyComposite *parent); - virtual ~PointListComponent(); + ~PointListComponent() override; /** * @short Update the sky positions of this component. * * This function usually just updates the Horizontal (Azimuth/Altitude) * coordinates of the objects in this component. However, the precession * and nutation must also be recomputed periodically. Requests to do * so are sent through the doPrecess parameter. * @p num Pointer to the KSNumbers object * @note By default, the num parameter is nullptr, indicating that * Precession/Nutation computation should be skipped; this computation * is only occasionally required. */ - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; QList> &pointList() { return m_PointList; } private: QList> m_PointList; }; diff --git a/kstars/skycomponents/satellitescomponent.h b/kstars/skycomponents/satellitescomponent.h index 9487a48c6..091c5f971 100644 --- a/kstars/skycomponents/satellitescomponent.h +++ b/kstars/skycomponents/satellitescomponent.h @@ -1,112 +1,112 @@ /*************************************************************************** satellitescomponent.h - K Desktop Planetarium ------------------- begin : Tue 02 Mar 2011 copyright : (C) 2009 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "satellitegroup.h" #include "skycomponent.h" #include class QPointF; class Satellite; class FileDownloader; /** * @class SatellitesComponent * Represents artificial satellites on the sky map. * @author Jérôme SONRIER * @version 1.0 */ class SatellitesComponent : public SkyComponent { public: /** * @short Constructor * @param parent pointer to the parent SkyComposite */ explicit SatellitesComponent(SkyComposite *parent = nullptr); /** * @short Destructor */ - ~SatellitesComponent(); + ~SatellitesComponent() override; /** * @return true if satellites must be draw. */ - bool selected() Q_DECL_OVERRIDE; + bool selected() override; /** * Draw all satellites. * @param skyp SkyPainter to use */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * Update satellites position. * @param num */ - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; /** * Download new TLE files */ void updateTLEs(); /** * @return The list of all groups */ QList groups(); /** * Search a satellite by name. * @param name The name of the satellite * @return Satellite that was find or 0 */ Satellite *findSatellite(QString name); /** * Draw label of a satellite. * @param sat The satellite * @param pos The position of the satellite */ void drawLabel(Satellite *sat, const QPointF& pos); /** * Search the nearest satellite from point p * @param p * @param maxrad */ - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; /** * Return object given name * @param name object name * @return object if found, otherwise nullptr */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; void loadData(); protected: - void drawTrails(SkyPainter *skyp) Q_DECL_OVERRIDE; + void drawTrails(SkyPainter *skyp) override; private: QList m_groups; // List of all groups QHash nameHash; }; diff --git a/kstars/skycomponents/skycomposite.h b/kstars/skycomponents/skycomposite.h index 0366cf229..98dc9a198 100644 --- a/kstars/skycomponents/skycomposite.h +++ b/kstars/skycomponents/skycomposite.h @@ -1,112 +1,112 @@ /*************************************************************************** skycomposite.h - K Desktop Planetarium ------------------- begin : 2005/07/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include "skycomponent.h" class KSNumbers; /** * @class SkyComposite * SkyComposite is a kind of container class for SkyComponent objects. The SkyComposite is * responsible for distributing calls to functions like draw() and update() to its children, * which can be SkyComponents or other SkyComposites with their own children. This is based * on the "composite/component" design pattern. * * Performance tuning: Sometimes it will be better to override a virtual function and do * the work in the composite instead of delegating the request to all sub components. * * @author Thomas Kabelmann * @version 0.1 */ class SkyComposite : public SkyComponent { public: /** * @short Constructor * @p parent pointer to the parent SkyComponent */ explicit SkyComposite(SkyComposite *parent = nullptr); /** *@short Destructor */ - virtual ~SkyComposite(); + ~SkyComposite() override; /** * @short Delegate draw requests to all sub components * @p psky Reference to the QPainter on which to paint */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * @short Delegate update-position requests to all sub components * * This function usually just updates the Horizontal (Azimuth/Altitude) coordinates. * However, the precession and nutation must also be recomputed periodically. Requests to * do so are sent through the doPrecess parameter. * @p num Pointer to the KSNumbers object * @sa updatePlanets() * @sa updateMoons() * @note By default, the num parameter is nullptr, indicating that Precession/Nutation * computation should be skipped; this computation is only occasionally required. */ - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; /** * @short Add a new sub component to the composite * @p comp Pointer to the SkyComponent to be added * @p priority A priority ordering for various operations on the list of all sky components * (notably objectNearest()) */ void addComponent(SkyComponent *comp, int priority = 1024); /** * @short Remove a sub component from the composite * @p comp Pointer to the SkyComponent to be removed. */ void removeComponent(SkyComponent *const comp); /** * @short Search the children of this SkyComposite for a SkyObject whose name matches * the argument. * * The objects' primary, secondary and long-form names will all be checked for a match. * @p name the name to be matched * @return a pointer to the SkyObject whose name matches * the argument, or a nullptr pointer if no match was found. */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; /** * @short Identify the nearest SkyObject to the given SkyPoint, among the children of * this SkyComposite * @p p pointer to the SkyPoint around which to search. * @p maxrad reference to current search radius * @return a pointer to the nearest SkyObject */ - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; QList components() { return m_Components.values(); } QMap &componentsWithPriorities() { return m_Components; } private: QMap m_Components; }; diff --git a/kstars/skycomponents/skymapcomposite.h b/kstars/skycomponents/skymapcomposite.h index f61c8dded..9de4df102 100644 --- a/kstars/skycomponents/skymapcomposite.h +++ b/kstars/skycomponents/skymapcomposite.h @@ -1,280 +1,280 @@ /*************************************************************************** skymapcomposite.h - K Desktop Planetarium ------------------- begin : 2005/07/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomposite.h" #include "ksnumbers.h" #include "skyobject.h" #include #include class QPolygonF; class ArtificialHorizonComponent; class ConstellationArtComponent; class ConstellationBoundaryLines; class ConstellationLines; class ConstellationNamesComponent; class ConstellationsArt; class CultureList; class DeepSkyComponent; class DeepSkyObject; class DeepStarComponent; class Ecliptic; class Equator; class EquatorialCoordinateGrid; class FlagComponent; class HorizontalCoordinateGrid; class HorizonComponent; class KSPlanet; class KSPlanetBase; class MilkyWay; class SatellitesComponent; class SkyLabeler; class SkyMap; class SkyMesh; class SkyObject; class SolarSystemComposite; class StarComponent; class SupernovaeComponent; class SyncedCatalogComponent; class TargetListComponent; class HIPSComponent; /** * @class SkyMapComposite * SkyMapComposite is the root object in the object hierarchy of the sky map. * All requests to update, init, draw etc. will be done with this class. * The requests will be delegated to it's children. * The object hierarchy will created by adding new objects via addComponent(). * * @author Thomas Kabelmann * @version 0.1 */ class SkyMapComposite : public QObject, public SkyComposite { Q_OBJECT public: /** * Constructor * @p parent pointer to the parent SkyComponent */ explicit SkyMapComposite(SkyComposite *parent = nullptr); - ~SkyMapComposite(); + ~SkyMapComposite() override; - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; + void update(KSNumbers *num = 0) override; /** * @short Delegate planet position updates to the SolarSystemComposite * * Planet positions change over time, so they need to be recomputed * periodically, but not on every call to update(). This function * will recompute the positions of all solar system bodies except the * Earth's Moon, Jupiter's Moons AND Saturn Moons (because these objects' positions * change on a much more rapid timescale). * @p num Pointer to the KSNumbers object * @sa update() * @sa updateMoons() * @sa SolarSystemComposite::updatePlanets() */ - void updateSolarSystemBodies(KSNumbers *num) Q_DECL_OVERRIDE; + void updateSolarSystemBodies(KSNumbers *num) override; /** * @short Delegate moon position updates to the SolarSystemComposite * * Planet positions change over time, so they need to be recomputed * periodically, but not on every call to update(). This function * will recompute the positions of the Earth's Moon and Jupiter's four * Galilean moons. These objects are done separately from the other * solar system bodies, because their positions change more rapidly, * and so updateMoons() must be called more often than updatePlanets(). * @p num Pointer to the KSNumbers object * @sa update() * @sa updatePlanets() * @sa SolarSystemComposite::updateMoons() */ // virtual void updateMoons( KSNumbers *num ); /** * @short Delegate draw requests to all sub components * @p psky Reference to the QPainter on which to paint */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * @return the object nearest a given point in the sky. * @param p The point to find an object near * @param maxrad The maximum search radius, in Degrees * @note the angular separation to the matched object is returned * through the maxrad variable. */ - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; /** * @return the star nearest a given point in the sky. * @param p The point to find a star near * @param maxrad The maximum search radius, in Degrees * @note the angular separation to the matched star is returned * through the maxrad variable. */ SkyObject *starNearest(SkyPoint *p, double &maxrad); /** * @short Search the children of this SkyMapComposite for * a SkyObject whose name matches the argument. * * The objects' primary, secondary and long-form names will * all be checked for a match. * @note Overloaded from SkyComposite. In this version, we search * the most likely object classes first to be more efficient. * @p name the name to be matched * @return a pointer to the SkyObject whose name matches * the argument, or a nullptr pointer if no match was found. */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; /** * @return the list of objects in the region defined by skypoints * @param p1 first sky point (top-left vertex of rectangular region) * @param p2 second sky point (bottom-right vertex of rectangular region) */ QList findObjectsInArea(const SkyPoint &p1, const SkyPoint &p2); void addCustomCatalog(const QString &filename, int index); void removeCustomCatalog(const QString &name); bool addNameLabel(SkyObject *o); bool removeNameLabel(SkyObject *o); void reloadDeepSky(); void reloadAsteroids(); void reloadComets(); void reloadCLines(); void reloadCNames(); void reloadConstellationArt(); #ifndef KSTARS_LITE FlagComponent *flags(); #endif SatellitesComponent *satellites(); SupernovaeComponent *supernovaeComponent(); ArtificialHorizonComponent *artificialHorizon(); /** Getters for SkyComponents **/ inline HorizonComponent *horizon() { return m_Horizon; } inline ConstellationBoundaryLines *constellationBoundary() { return m_CBoundLines; } inline ConstellationLines *constellationLines() { return m_CLines; } inline Ecliptic *ecliptic() { return m_Ecliptic; } inline Equator *equator() { return m_Equator; } inline EquatorialCoordinateGrid *equatorialCoordGrid() { return m_EquatorialCoordinateGrid; } inline HorizontalCoordinateGrid *horizontalCoordGrid() { return m_HorizontalCoordinateGrid; } inline ConstellationArtComponent *constellationArt() { return m_ConstellationArt; } inline SolarSystemComposite *solarSystemComposite() { return m_SolarSystem; } inline ConstellationNamesComponent *constellationNamesComponent() { return m_CNames; } inline DeepSkyComponent *deepSkyComponent() { return m_DeepSky; } inline MilkyWay *milkyWay() { return m_MilkyWay; } inline SyncedCatalogComponent *internetResolvedComponent() { return m_internetResolvedComponent; } inline SyncedCatalogComponent *manualAdditionsComponent() { return m_manualAdditionsComponent; } //Accessors for StarComponent SkyObject *findStarByGenetiveName(const QString name); - void emitProgressText(const QString &message) Q_DECL_OVERRIDE; + void emitProgressText(const QString &message) override; QList &labelObjects() { return m_LabeledObjects; } const QList &deepSkyObjects() const; const QList &constellationNames() const; const QList &stars() const; const QList &asteroids() const; const QList &comets() const; const QList &supernovae() const; QList planets(); // QList moons(); const QList *getSkyObjectsList(SkyObject::TYPE t); KSPlanet *earth(); KSPlanetBase *planet(int n); QStringList getCultureNames(); QString getCultureName(int index); QString currentCulture(); void setCurrentCulture(QString culture); bool isLocalCNames(); QList customCatalogs(); inline TargetListComponent *getStarHopRouteList() { return m_StarHopRouteList; } signals: void progressText(const QString &message); private: - QHash &getObjectNames() Q_DECL_OVERRIDE; - QHash>> &getObjectLists() Q_DECL_OVERRIDE; + QHash &getObjectNames() override; + QHash>> &getObjectLists() override; std::unique_ptr m_Cultures; ConstellationBoundaryLines *m_CBoundLines { nullptr }; ConstellationNamesComponent *m_CNames { nullptr }; ConstellationLines *m_CLines { nullptr }; ConstellationArtComponent *m_ConstellationArt { nullptr }; EquatorialCoordinateGrid *m_EquatorialCoordinateGrid { nullptr }; HorizontalCoordinateGrid *m_HorizontalCoordinateGrid { nullptr }; DeepSkyComponent *m_DeepSky { nullptr }; Equator *m_Equator { nullptr }; ArtificialHorizonComponent *m_ArtificialHorizon { nullptr }; Ecliptic *m_Ecliptic { nullptr }; HorizonComponent *m_Horizon { nullptr }; MilkyWay *m_MilkyWay { nullptr }; SolarSystemComposite *m_SolarSystem { nullptr }; std::unique_ptr m_CustomCatalogs; StarComponent *m_Stars { nullptr }; #ifndef KSTARS_LITE FlagComponent *m_Flags { nullptr }; HIPSComponent *m_HiPS { nullptr }; #endif TargetListComponent *m_ObservingList { nullptr }; TargetListComponent *m_StarHopRouteList { nullptr }; SatellitesComponent *m_Satellites { nullptr }; SupernovaeComponent *m_Supernovae { nullptr }; SyncedCatalogComponent *m_internetResolvedComponent { nullptr }; SyncedCatalogComponent *m_manualAdditionsComponent { nullptr }; std::unique_ptr m_skyMesh; std::unique_ptr m_skyLabeler; KSNumbers m_reindexNum; QList m_DeepStars; QList m_LabeledObjects; QHash m_ObjectNames; QHash>> m_ObjectLists; QHash m_ConstellationNames; QString m_internetResolvedCat; // Holds the name of the internet resolved catalog QString m_manualAdditionsCat; }; diff --git a/kstars/skycomponents/solarsystemcomposite.h b/kstars/skycomponents/solarsystemcomposite.h index f56702249..e6114e770 100644 --- a/kstars/skycomponents/solarsystemcomposite.h +++ b/kstars/skycomponents/solarsystemcomposite.h @@ -1,84 +1,84 @@ /*************************************************************************** solarsystemcomposite.h - K Desktop Planetarium ------------------- begin : 2005/01/09 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "planetmoonscomponent.h" #include "skycomposite.h" class AsteroidsComponent; class CometsComponent; class KSMoon; class KSPlanet; class KSSun; //class JupiterMoonsComponent; class SkyLabeler; /** * @class SolarSystemComposite * The solar system composite manages all planets, asteroids and comets. * As every sub component of solar system needs the earth , the composite * is managing this object by itself. * * @author Thomas Kabelmann * @version 0.1 */ class SolarSystemComposite : public SkyComposite { public: explicit SolarSystemComposite(SkyComposite *parent); - ~SolarSystemComposite(); + ~SolarSystemComposite() override; KSPlanet *earth() { return m_Earth; } KSSun *sun() { return m_Sun; } const QList &asteroids() const; const QList &comets() const; const QList &planetObjects() const; const QList &moons() const; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; - void updateSolarSystemBodies(KSNumbers *num) Q_DECL_OVERRIDE; + void updateSolarSystemBodies(KSNumbers *num) override; - void updateMoons(KSNumbers *num) Q_DECL_OVERRIDE; + void updateMoons(KSNumbers *num) override; - void drawTrails(SkyPainter *skyp) Q_DECL_OVERRIDE; + void drawTrails(SkyPainter *skyp) override; CometsComponent *cometsComponent(); AsteroidsComponent *asteroidsComponent(); QList planetMoonsComponent() const; const QList &planets() const; private: KSPlanet *m_Earth { nullptr }; KSSun *m_Sun { nullptr }; KSMoon *m_Moon { nullptr }; // PlanetMoonsComponent *m_JupiterMoons; AsteroidsComponent *m_AsteroidsComponent; CometsComponent *m_CometsComponent; QList m_planets; QList m_planetObjects; QList m_moons; }; diff --git a/kstars/skycomponents/solarsystemlistcomponent.h b/kstars/skycomponents/solarsystemlistcomponent.h index f028fe284..bfff80920 100644 --- a/kstars/skycomponents/solarsystemlistcomponent.h +++ b/kstars/skycomponents/solarsystemlistcomponent.h @@ -1,56 +1,56 @@ /*************************************************************************** solarsystemlistcomponent.h - K Desktop Planetarium ------------------- begin : 2005/22/09 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 SOLARSYSTEMLISTCOMPONENT_H #define SOLARSYSTEMLISTCOMPONENT_H #include "listcomponent.h" class KSPlanet; class SolarSystemComposite; /** *@class SolarSystemListComponent * *@author Jason Harris *@version 1.0 */ class SolarSystemListComponent : public ListComponent { public: explicit SolarSystemListComponent(SolarSystemComposite *parent); - virtual ~SolarSystemListComponent(); + ~SolarSystemListComponent() override; - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; /** @short Update the coordinates of the solar system bodies in this component. * * This function updates the position of the moving solar system bodies. * @p data Pointer to the KStarsData object * @p num Pointer to the KSNumbers object */ - void updateSolarSystemBodies(KSNumbers *num) Q_DECL_OVERRIDE; + void updateSolarSystemBodies(KSNumbers *num) override; protected: - void drawTrails(SkyPainter *skyp) Q_DECL_OVERRIDE; + void drawTrails(SkyPainter *skyp) override; private: KSPlanet *m_Earth; }; #endif diff --git a/kstars/skycomponents/solarsystemsinglecomponent.h b/kstars/skycomponents/solarsystemsinglecomponent.h index 2fb94d96c..4fed3832c 100644 --- a/kstars/skycomponents/solarsystemsinglecomponent.h +++ b/kstars/skycomponents/solarsystemsinglecomponent.h @@ -1,79 +1,79 @@ /*************************************************************************** solarsystemsinglecomponent.h - K Desktop Planetarium ------------------- begin : 2005/30/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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 SOLARSYSTEMSINGLECOMPONENT_H #define SOLARSYSTEMSINGLECOMPONENT_H #include /** *@class SolarSystemSingleComponent *This class encapsulates some methods which are shared between *all single-object solar system components (Sun, Moon, Planet, Pluto) * *@author Thomas Kabelmann *@version 0.1 */ #include "skycomponent.h" class SolarSystemComposite; class KSNumbers; class KSPlanet; class KSPlanetBase; class SkyLabeler; class SolarSystemSingleComponent : public SkyComponent { public: /** Initialize visible method, minimum size and sizeScale. */ SolarSystemSingleComponent(SolarSystemComposite *, KSPlanetBase *kspb, bool (*visibleMethod)()); - virtual ~SolarSystemSingleComponent(); + ~SolarSystemSingleComponent() override; /** Return pointer to stored planet object. */ KSPlanetBase *planet() { return m_Planet; } - bool selected() Q_DECL_OVERRIDE; + bool selected() override; /** * @brief update Only convert Equatorial to Horizontal coordinates given current time. * @param num pointer to KSNumbers instance for target time */ - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; /** * @brief updateSolarSystemBodies Update Equtorial & Horizontal coordinates. * @param num pointer to KSNumbers instance for target time */ - void updateSolarSystemBodies(KSNumbers *num) Q_DECL_OVERRIDE; + void updateSolarSystemBodies(KSNumbers *num) override; - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; + void draw(SkyPainter *skyp) override; protected: - void drawTrails(SkyPainter *skyp) Q_DECL_OVERRIDE; + void drawTrails(SkyPainter *skyp) override; private: bool (*visible)(); QColor m_Color; KSPlanet *m_Earth; KSPlanetBase *m_Planet; }; #endif diff --git a/kstars/skycomponents/starcomponent.h b/kstars/skycomponents/starcomponent.h index ac69fb91b..574611ff2 100644 --- a/kstars/skycomponents/starcomponent.h +++ b/kstars/skycomponents/starcomponent.h @@ -1,214 +1,214 @@ /*************************************************************************** starcomponent.h - K Desktop Planetarium ------------------- begin : 2005/14/08 copyright : (C) 2005 by Thomas Kabelmann email : thomas.kabelmann@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksnumbers.h" #include "listcomponent.h" #include "skylabel.h" #include "stardata.h" #include "skyobjects/starobject.h" #include #ifdef KSTARS_LITE class StarItem; #endif class KStarsSplash; class BinFileHelper; class DeepStarComponent; class HighPMStarList; class MeshIterator; class SkyLabeler; class SkyMesh; class StarObject; class StarBlockFactory; #define MAX_LINENUMBER_MAG 90 /** * @class StarComponent * * @short Represents the stars on the sky map. For optimization reasons the stars are not * separate objects and are stored in a list. * * The StarComponent class manages all stars drawn in KStars. While it handles all stars * having names using its own member methods, it shunts the responsibility of unnamed stars * to the class 'DeepStarComponent', objects of which it maintains. * * @author Thomas Kabelmann * @author Akarsh Simha * @version 1.0 */ class StarComponent : public ListComponent { #ifdef KSTARS_LITE friend class StarItem; //Needs access to faintMagnitude() and reindex() #endif protected: StarComponent(SkyComposite *); public: - virtual ~StarComponent(); + ~StarComponent() override; // TODO: Desingletonize StarComponent /** @short Create an instance of StarComponent */ static StarComponent *Create(SkyComposite *); /** @return the instance of StarComponent if already created, nullptr otherwise */ static StarComponent *Instance() { return pinstance; } //This function is empty; we need that so that the JiT update //is the only one being used. - void update(KSNumbers *num) Q_DECL_OVERRIDE; + void update(KSNumbers *num) override; - bool selected() Q_DECL_OVERRIDE; + bool selected() override; - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; /** * @short draw all the labels in the prioritized LabelLists and then clear the LabelLists. */ void drawLabels(); static float zoomMagnitudeLimit(); - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; virtual SkyObject *findStarByGenetiveName(const QString name); /** * @short Find stars by name (including genetive name) * * Overrides ListComponent::findByName() to include genetive names of stars as well. * * @param name Name to search for. Could be trivial name or genetive name * @return Pointer to the star with the given name as a SkyObject, nullptr if * no match was found */ - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; + SkyObject *findByName(const QString &name) override; /** * @short Searches the region(s) and appends the SkyObjects found to the list of sky objects * * Look for a SkyObject that is in one of the regions * If found, then append to the list of sky objects * @p list list of SkyObject to which matching list has to be appended to * @p region defines the regions in which the search for SkyObject should be done within */ - void objectsInArea(QList &list, const SkyRegion ®ion) Q_DECL_OVERRIDE; + void objectsInArea(QList &list, const SkyRegion ®ion) override; /** * @short Find stars by HD catalog index * @param HDnum HD Catalog Number of the star to find * @return If the star is a static star, a pointer to the star will be returned * If it is a dynamic star, a fake copy will be created that survives till * the next findByHDIndex() call. If no match was found, returns nullptr. */ StarObject *findByHDIndex(int HDnum); /** * @short Add to the given list, the stars from this component, that lie within the * specified circular aperture, and that are brighter than the limiting magnitude specified. * @p center The center point of the aperture * @p radius The radius around the center point that defines the aperture * @p maglim Optional parameter indicating the limiting magnitude. * If magnitude limit is numerically < -28, the limiting magnitude * is assumed to be the limiting magnitude of the catalog (i.e. no magnitude limit) * @p list The list to operate on */ void starsInAperture(QList &list, const SkyPoint ¢er, float radius, float maglim = -29); // TODO: Make byteSwap a template method and put it in byteorder.h // It should ideally handle 32-bit, 16-bit fields and StarData and // DeepStarData fields static void byteSwap(StarData *stardata); private: /** * @short Read data for stars which will remain static in the memory * * This method reads data for named stars (stars having names, which are stored by * default in "namedstars.dat") into memory. These stars are always kept in memory, * as against 'deep' stars which are mostly loaded dynamically (KStars treats all * unnamed stars as 'deep' stars) into memory when required, depending on region * and magnitude limit. Once loading is successful, this method sets the starsLoaded flag to true */ bool loadStaticData(); /** @return the magnitude of the faintest star */ float faintMagnitude() const; /** true if all stars(not only high PM ones) were reindexed else false**/ bool reindex(KSNumbers *num); /** Adds a label to the lists of labels to be drawn prioritized by magnitude. */ void addLabel(const QPointF &p, StarObject *star); void reindexAll(KSNumbers *num); /** Load available deep star catalogs */ int loadDeepStarCatalogs(); bool addDeepStarCatalogIfExists(const QString &fileName, float trigMag, bool staticstars = false); SkyMesh *m_skyMesh { nullptr }; std::unique_ptr m_starIndex; KSNumbers m_reindexNum; double m_reindexInterval { 0 }; LabelList *m_labelList[MAX_LINENUMBER_MAG + 1]; bool m_hideLabels { false }; float m_zoomMagLimit { 0 }; /// Limiting magnitude of the catalog currently loaded float m_FaintMagnitude { -5 }; bool starsLoaded { false }; /// Current limiting magnitude for visible stars float magLim { 0 }; StarObject m_starObject; StarObject *focusStar { nullptr }; // This object is always drawn KStarsSplash *m_reindexSplash { nullptr }; StarBlockFactory *m_StarBlockFactory { nullptr }; QVector m_highPMStars; QHash m_genName; QHash m_HDHash; QVector m_DeepStarComponents; /** * Structure that holds star name information, to be read as-is from the * corresponding binary data file */ typedef struct starName { char bayerName[8]; char longName[32]; } starName; StarData stardata; starName starname; static StarComponent *pinstance; }; diff --git a/kstars/skycomponents/supernovaecomponent.h b/kstars/skycomponents/supernovaecomponent.h index b554486ff..e76aefdee 100644 --- a/kstars/skycomponents/supernovaecomponent.h +++ b/kstars/skycomponents/supernovaecomponent.h @@ -1,73 +1,73 @@ /* Supernova Component Copyright (C) 2016 Jasem Mutlaq Based on Samikshan Bairagya GSoC work. 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 SUPERNOVAE_COMPONENT_H #define SUPERNOVAE_COMPONENT_H #include "listcomponent.h" #include "skyobjects/supernova.h" #include "ksnumbers.h" #include /** * @class SupernovaeComponent This class encapsulates Supernovae. * * @author Jasem Mutlaq, Samikshan Bairagya * * @version 0.2 */ class Supernova; class FileDownloader; class SupernovaeComponent : public QObject, public ListComponent { Q_OBJECT public: explicit SupernovaeComponent(SkyComposite *parent); - virtual ~SupernovaeComponent(); - bool selected() Q_DECL_OVERRIDE; - void update(KSNumbers *num = 0) Q_DECL_OVERRIDE; - SkyObject *findByName(const QString &name) Q_DECL_OVERRIDE; - SkyObject *objectNearest(SkyPoint *p, double &maxrad) Q_DECL_OVERRIDE; + ~SupernovaeComponent() override; + bool selected() override; + void update(KSNumbers *num = 0) override; + SkyObject *findByName(const QString &name) override; + SkyObject *objectNearest(SkyPoint *p, double &maxrad) override; /** * @note This should actually be implemented in a better manner. * Possibly by checking if the host galaxy for the supernova is drawn. */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; //virtual void notifyNewSupernovae(); /** * @note Basically copy pasted from StarComponent::zoomMagnitudeLimit() */ static float zoomMagnitudeLimit(); public slots: /** * @short This initiates updating of the data file */ void slotTriggerDataFileUpdate(); protected slots: void downloadReady(); void downloadError(const QString &errorString); private: void loadData(); FileDownloader *downloadJob = nullptr; }; #endif diff --git a/kstars/skycomponents/syncedcatalogcomponent.h b/kstars/skycomponents/syncedcatalogcomponent.h index a479bf6ea..137ef815e 100644 --- a/kstars/skycomponents/syncedcatalogcomponent.h +++ b/kstars/skycomponents/syncedcatalogcomponent.h @@ -1,67 +1,67 @@ /*************************************************************************** syncedcatalogcomponent.h - K Desktop Planetarium ------------------- begin : Tue 16 Aug 2016 04:13:56 CDT copyright : (c) 2016 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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 SYNCEDCATALOGCOMPONENT_H #define SYNCEDCATALOGCOMPONENT_H #include "catalogcomponent.h" #include "catalogentrydata.h" class DeepSkyObject; class SkyComposite; /** * @class SyncedCatalogComponent * * @short A subclass of CatalogComponent that supports run-time * insertion of data, which it keeps synced with the database. * * @author Akarsh Simha */ class SyncedCatalogComponent : public CatalogComponent { public: /** * @short Constructor */ SyncedCatalogComponent(SkyComposite *parent, const QString &catname, bool showerrs, int index); // virtual void draw( SkyPainter *skyp ); /** * @short Create and insert a SkyObject from the given CatalogEntryData * @return 0 upon failure, a valid SkyObject pointer otherwise. */ DeepSkyObject *addObject(CatalogEntryData catalogEntry); /** * @short Edit an existing skyobject * @note Will implement when required. * @note Question: How do we match the object? Probably by internal catalog id. */ // bool editObject( SkyObject *object ); - void loadData() Q_DECL_OVERRIDE { _loadData(false); } + void loadData() override { _loadData(false); } // virtual bool selected(); private: int m_catId; int m_catCount; }; #endif diff --git a/kstars/skycomponents/targetlistcomponent.h b/kstars/skycomponents/targetlistcomponent.h index fd009c356..92d48db97 100644 --- a/kstars/skycomponents/targetlistcomponent.h +++ b/kstars/skycomponents/targetlistcomponent.h @@ -1,88 +1,88 @@ /*************************************************************************** targetlistcomponent.h - K Desktop Planetarium ------------------- begin : Oct 14 2010 9:59 PM CDT copyright : (C) 2010 Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skycomponent.h" #include /** * @class TargetListComponent * @short Highlights objects present in certain lists by drawing "target" symbols around them. * * To represent lists of specific objects on the skymap (eg: A star * hopping route, or a list of planned observation targets), one would * typically like to draw over the skymap, a bunch of symbols * highlighting the locations of these objects. This class manages * drawing of such lists. Along with the list, we also associate a pen * to use to represent objects from that list. Once this class is made * aware of a list to plot (which is stored somewhere else), it does * so when called from the SkyMapComposite. The class may be supplied * with pointers to two methods that tell it whether to draw symbols / * labels or not. Disabling symbol drawing is equivalent to disabling * the list. If the pointers are nullptr, the symbols are always drawn, * but the labels are not drawn. * * @note This does not inherit from ListComponent because it is not * necessary. ListComponent has extra methods like objectNearest(), * which we don't want. Also, ListComponent maintains its own list, * whereas this class merely holds a pointer to a list that's * manipulated from elsewhere. */ class TargetListComponent : public SkyComponent { public: /** * @short Default constructor. */ explicit TargetListComponent(SkyComposite *parent); /** * @short Constructor that sets up this target list */ TargetListComponent(SkyComposite *parent, QList *objectList, QPen _pen, bool (*optionDrawSymbols)(void) = 0, bool (*optionDrawLabels)(void) = 0); - virtual ~TargetListComponent(); + ~TargetListComponent() override; /** * @short Draw this component by iterating over the list. * * @note This method does not bother refreshing the coordinates of * the objects on the list. So this must be called only after the * objects are drawn in a given draw cycle. */ - void draw(SkyPainter *skyp) Q_DECL_OVERRIDE; + void draw(SkyPainter *skyp) override; // FIXME: Maybe we should make these member objects private / protected? std::unique_ptr list; // Pointer to list of objects to draw QPen pen; // Pen to use to draw /** * @short Pointer to static method that tells us whether to draw this list or not * @note If the pointer is nullptr, the list is drawn nevertheless */ bool (*drawSymbols)(void); /** * @short Pointer to static method that tells us whether to draw labels for this list or not * @note If the pointer is nullptr, labels are not drawn */ bool (*drawLabels)(void); }; diff --git a/kstars/skyglpainter.h b/kstars/skyglpainter.h index b01d96479..563dd2afa 100644 --- a/kstars/skyglpainter.h +++ b/kstars/skyglpainter.h @@ -1,81 +1,81 @@ /* Copyright (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef SKYGLPAINTER_H #define SKYGLPAINTER_H #include #include using namespace Eigen; #include "skypainter.h" #include "skyobjects/skyobject.h" #include "projections/projector.h" class QGLWidget; class SkyGLPainter : public SkyPainter { public: explicit SkyGLPainter(QGLWidget *widget); - bool drawPlanet(KSPlanetBase *planet) Q_DECL_OVERRIDE; - bool drawDeepSkyObject(DeepSkyObject *obj, bool drawImage = false) Q_DECL_OVERRIDE; - bool drawPointSource(SkyPoint *loc, float mag, char sp = 'A') Q_DECL_OVERRIDE; - void drawSkyPolygon(LineList *list, bool forceClip = true) Q_DECL_OVERRIDE; - void drawSkyPolyline(LineList *list, SkipHashList *skipList = 0, LineListLabel *label = 0) Q_DECL_OVERRIDE; - void drawSkyLine(SkyPoint *a, SkyPoint *b) Q_DECL_OVERRIDE; - void drawSkyBackground() Q_DECL_OVERRIDE; - void drawObservingList(const QList &obs) Q_DECL_OVERRIDE; - void drawFlags() Q_DECL_OVERRIDE; - void end() Q_DECL_OVERRIDE; - void begin() Q_DECL_OVERRIDE; - void setBrush(const QBrush &brush) Q_DECL_OVERRIDE; - void setPen(const QPen &pen) Q_DECL_OVERRIDE; - void drawHorizon(bool filled, SkyPoint *labelPoint = 0, bool *drawLabel = 0) Q_DECL_OVERRIDE; - bool drawSatellite(Satellite *sat) Q_DECL_OVERRIDE; - bool drawSupernova(Supernova *sup) Q_DECL_OVERRIDE; + bool drawPlanet(KSPlanetBase *planet) override; + bool drawDeepSkyObject(DeepSkyObject *obj, bool drawImage = false) override; + bool drawPointSource(SkyPoint *loc, float mag, char sp = 'A') override; + void drawSkyPolygon(LineList *list, bool forceClip = true) override; + void drawSkyPolyline(LineList *list, SkipHashList *skipList = 0, LineListLabel *label = 0) override; + void drawSkyLine(SkyPoint *a, SkyPoint *b) override; + void drawSkyBackground() override; + void drawObservingList(const QList &obs) override; + void drawFlags() override; + void end() override; + void begin() override; + void setBrush(const QBrush &brush) override; + void setPen(const QPen &pen) override; + void drawHorizon(bool filled, SkyPoint *labelPoint = 0, bool *drawLabel = 0) override; + bool drawSatellite(Satellite *sat) override; + bool drawSupernova(Supernova *sup) override; void drawText(int x, int y, const QString text, QFont font, QColor color); - bool drawConstellationArtImage(ConstellationsArt *obj) Q_DECL_OVERRIDE; - bool drawHips() Q_DECL_OVERRIDE; + bool drawConstellationArtImage(ConstellationsArt *obj) override; + bool drawHips() override; private: bool addItem(SkyPoint *p, int type, float width, char sp = 'a'); void drawBuffer(int type); void drawPolygon(const QVector &poly, bool convex = true, bool flush_buffers = true); /** Render textured rectangle on screeen. Parameters are texture * to be used, position, orientation and size of rectangle*/ void drawTexturedRectangle(const QImage &img, const Vector2f &pos, const float angle, const float sizeX, const float sizeY); const Projector *m_proj; Vector4f m_pen; static const int BUFSIZE = 512; ///FIXME: what kind of TYPE_UNKNOWN objects are there? static const int NUMTYPES = (int)SkyObject::TYPE_UNKNOWN + 1; static Vector2f m_vertex[NUMTYPES][6 * BUFSIZE]; static Vector2f m_texcoord[NUMTYPES][6 * BUFSIZE]; static Vector3f m_color[NUMTYPES][6 * BUFSIZE]; static int m_idx[NUMTYPES]; static bool m_init; ///< keep track of whether we have filled the texcoord array QGLWidget *m_widget; // Pointer to (GL) widget on which we are painting }; #endif // SKYGLPAINTER_H diff --git a/kstars/skymap.h b/kstars/skymap.h index 4fbed8459..2ad0826d8 100644 --- a/kstars/skymap.h +++ b/kstars/skymap.h @@ -1,683 +1,683 @@ /*************************************************************************** skymap.h - K Desktop Planetarium ------------------- begin : Sat Feb 10 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "config-kstars.h" #include "skymapdrawabstract.h" #include "printing/legend.h" #include "skyobjects/skypoint.h" #include "skyobjects/skyline.h" #include #include class QPainter; class QPaintDevice; class dms; class InfoBoxes; class InfoBoxWidget; class KSPopupMenu; class KStarsData; class Projector; class SkyObject; #ifdef HAVE_OPENGL class SkyMapGLDraw; class SkyMapQDraw; #endif /** * @class SkyMap * * This is the canvas on which the sky is painted. It's the main widget for KStars. * Contains SkyPoint members for the map's Focus (current central position), Destination * (requested central position), FocusPoint (next queued position to be focused), * MousePoint (position of mouse cursor), and ClickedPoint (position of last mouse click). * Also contains the InfoBoxes for on-screen data display. * * SkyMap handles most user interaction events (both mouse and keyboard). * * @short Canvas widget for displaying the sky bitmap; also handles user interaction events. * * @author Jason Harris * @version 1.0 */ class SkyMap : public QGraphicsView { Q_OBJECT friend class SkyMapDrawAbstract; // FIXME: SkyMapDrawAbstract requires a lot of access to SkyMap friend class SkyMapQDraw; // FIXME: SkyMapQDraw requires access to computeSkymap protected: /** *Constructor. Read stored settings from KConfig object (focus position, *zoom factor, sky color, etc.). Run initPopupMenus(). */ SkyMap(); public: static SkyMap *Create(); static SkyMap *Instance(); static bool IsSlewing() { return pinstance->isSlewing(); } /** Destructor (empty) */ - ~SkyMap(); + ~SkyMap() override; enum Projection { Lambert, AzimuthalEquidistant, Orthographic, Equirectangular, Stereographic, Gnomonic, UnknownProjection }; /** @return the angular field of view of the sky map, in degrees. *@note it must use either the height or the width of the window to calculate the *FOV angle. It chooses whichever is larger. */ float fov(); /** @short Update object name and coordinates in the Focus InfoBox */ void showFocusCoords(); /** @short Update the focus position according to current options. */ void updateFocus(); /** @short Retrieve the Focus point; the position on the sky at the *center of the skymap. *@return a pointer to the central focus point of the sky map */ SkyPoint *focus() { return &Focus; } /** @short retrieve the Destination position. * *The Destination is the point on the sky to which the focus will *be moved. * *@return a pointer to the destination point of the sky map */ SkyPoint *destination() { return &Destination; } /** @short retrieve the FocusPoint position. * *The FocusPoint stores the position on the sky that is to be *focused next. This is not exactly the same as the Destination *point, because when the Destination is set, it will begin slewing *immediately. * *@return a pointer to the sky point which is to be focused next. */ SkyPoint *focusPoint() { return &FocusPoint; } /** @short sets the central focus point of the sky map. *@param f a pointer to the SkyPoint the map should be centered on */ void setFocus(SkyPoint *f); /** @short sets the focus point of the skymap, using ra/dec coordinates * *@note This function behaves essentially like the above function. *It differs only in the data types of its arguments. * *@param ra the new right ascension *@param dec the new declination */ void setFocus(const dms &ra, const dms &dec); /** @short sets the focus point of the sky map, using its alt/az coordinates *@param alt the new altitude *@param az the new azimuth */ void setFocusAltAz(const dms &alt, const dms &az); /** @short sets the destination point of the sky map. *@note setDestination() emits the destinationChanged() SIGNAL, *which triggers the SLOT function SkyMap::slewFocus(). This *function iteratively steps the Focus point toward Destination, *repainting the sky at each step (if Options::useAnimatedSlewing()==true). *@param f a pointer to the SkyPoint the map should slew to */ void setDestination(const SkyPoint &f); /** @short sets the destination point of the skymap, using ra/dec coordinates. * *@note This function behaves essentially like the above function. *It differs only in the data types of its arguments. * *@param ra the new right ascension *@param dec the new declination */ void setDestination(const dms &ra, const dms &dec); /** @short sets the destination point of the sky map, using its alt/az coordinates. *@param alt the new altitude *@param az the new azimuth */ void setDestinationAltAz(const dms &alt, const dms &az); /** @short set the FocusPoint; the position that is to be the next Destination. *@param f a pointer to the FocusPoint SkyPoint. */ void setFocusPoint(SkyPoint *f) { if (f) FocusPoint = *f; } /** @short Retrieve the ClickedPoint position. * *When the user clicks on a point in the sky map, the sky coordinates of the mouse *cursor are stored in the private member ClickedPoint. This function retrieves *a pointer to ClickedPoint. *@return a pointer to ClickedPoint, the sky coordinates where the user clicked. */ SkyPoint *clickedPoint() { return &ClickedPoint; } /** * @short Retrieve the mouse pointer position. * * @return The sky coordinates where the mouse pointer is over. */ SkyPoint *mousePoint() { return &m_MousePoint; } /** @short Set the ClickedPoint to the skypoint given as an argument. *@param f pointer to the new ClickedPoint. */ void setClickedPoint(SkyPoint *f); /** @short Retrieve the object nearest to a mouse click event. * *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in *the private member ClickedObject. This function returns the ClickedObject pointer, *or nullptr if there is no CLickedObject. *@return a pointer to the object nearest to a user mouse click. */ SkyObject *clickedObject() const { return ClickedObject; } /** @short Set the ClickedObject pointer to the argument. *@param o pointer to the SkyObject to be assigned as the ClickedObject */ void setClickedObject(SkyObject *o); /** @short Retrieve the object which is centered in the sky map. * *If the user centers the sky map on an object (by double-clicking or using the *Find Object dialog), a pointer to the "focused" object is stored in *the private member FocusObject. This function returns a pointer to the *FocusObject, or nullptr if there is not FocusObject. *@return a pointer to the object at the center of the sky map. */ SkyObject *focusObject() const { return FocusObject; } /** @short Set the FocusObject pointer to the argument. *@param o pointer to the SkyObject to be assigned as the FocusObject */ void setFocusObject(SkyObject *o); /** @short Call to set up the projector before a draw cycle. */ void setupProjector(); /** @ Set zoom factor. *@param factor zoom factor */ void setZoomFactor(double factor); bool isSlewing() const; // NOTE: This method is draw-backend independent. /** @short update the geometry of the angle ruler. */ void updateAngleRuler(); /** @return true if the object currently has a user label attached. *@note this function only checks for a label explicitly added to the object *with the right-click popup menu; other kinds of labels are not detected by *this function. *@param o pointer to the sky object to be tested for a User label. */ bool isObjectLabeled(SkyObject *o); /*@*@short Convenience function for shutting off tracking mode. Just calls KStars::slotTrack(). */ void stopTracking(); /** Get the current projector. @return a pointer to the current projector. */ inline const Projector *projector() const { return m_proj; } // NOTE: These dynamic casts must not segfault. If they do, it's good because we know that there is a problem. /** *@short Proxy method for SkyMapDrawAbstract::exportSkyImage() */ inline void exportSkyImage(QPaintDevice *pd, bool scale = false) { dynamic_cast(m_SkyMapDraw)->exportSkyImage(pd, scale); } inline void exportSkyImage(SkyQPainter *painter, bool scale = false) { dynamic_cast(m_SkyMapDraw)->exportSkyImage(painter, scale); } SkyMapDrawAbstract *getSkyMapDrawAbstract() { return dynamic_cast(m_SkyMapDraw); } /** *@short Proxy method for SkyMapDrawAbstract::drawObjectLabels() */ inline void drawObjectLabels(QList &labelObjects) { dynamic_cast(m_SkyMapDraw)->drawObjectLabels(labelObjects); } void setPreviewLegend(bool preview) { m_previewLegend = preview; } void setLegend(const Legend &legend) { m_legend = legend; } bool isInObjectPointingMode() const { return m_objPointingMode; } void setObjectPointingMode(bool enabled) { m_objPointingMode = enabled; } void setFovCaptureMode(bool enabled) { m_fovCaptureMode = enabled; } bool isInFovCaptureMode() const { return m_fovCaptureMode; } SkyPoint getCenterPoint(); public slots: /** Recalculates the positions of objects in the sky, and then repaints the sky map. * If the positions don't need to be recalculated, use update() instead of forceUpdate(). * This saves a lot of CPU time. * @param now if true, paintEvent() is run immediately. Otherwise, it is added to the event queue */ void forceUpdate(bool now = false); /** @short Convenience function; simply calls forceUpdate(true). * @see forceUpdate() */ void forceUpdateNow() { forceUpdate(true); } /** * @short Update the focus point and call forceUpdate() * @param now is passed on to forceUpdate() */ void slotUpdateSky(bool now); /** Toggle visibility of geo infobox */ void slotToggleGeoBox(bool); /** Toggle visibility of focus infobox */ void slotToggleFocusBox(bool); /** Toggle visibility of time infobox */ void slotToggleTimeBox(bool); /** Toggle visibility of all infoboxes */ void slotToggleInfoboxes(bool); /** Step the Focus point toward the Destination point. Do this iteratively, redrawing the Sky * Map after each step, until the Focus point is within 1 step of the Destination point. * For the final step, snap directly to Destination, and redraw the map. */ void slewFocus(); /** @short Center the display at the point ClickedPoint. * * The essential part of the function is to simply set the Destination point, which will emit * the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT. Additionally, this * function performs some bookkeeping tasks, such updating whether we are tracking the new * object/position, adding a Planet Trail if required, etc. * * @see destinationChanged() * @see slewFocus() */ void slotCenter(); /** @short Popup menu function: Display 1st-Generation DSS image with the Image Viewer. * @note the URL is generated using the coordinates of ClickedPoint. */ void slotDSS(); /** @short Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer. * @note the URL is generated using the coordinates of ClickedPoint. */ void slotSDSS(); /** @short Popup menu function: Show webpage about ClickedObject * (only available for some objects). */ void slotInfo(); /** @short Popup menu function: Show image of ClickedObject * (only available for some objects). */ void slotImage(); /** @short Popup menu function: Show the Detailed Information window for ClickedObject. */ void slotDetail(); /** Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which * have User Labels attached. */ void slotAddObjectLabel(); /** Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which * have User Labels attached. */ void slotRemoveObjectLabel(); /** @short Add a Planet Trail to ClickedObject. * @note Trails are added simply by calling KSPlanetBase::addToTrail() to add the first point. * as long as the trail is not empty, new points will be automatically appended to it. * @note if ClickedObject is not a Solar System body, this function does nothing. * @see KSPlanetBase::addToTrail() */ void slotAddPlanetTrail(); /** @short Remove the PlanetTrail from ClickedObject. * @note The Trail is removed by simply calling KSPlanetBase::clearTrail(). As long as * the trail is empty, no new points will be automatically appended. * @see KSPlanetBase::clearTrail() */ void slotRemovePlanetTrail(); /** Checks whether the timestep exceeds a threshold value. If so, sets * ClockSlewing=true and sets the SimClock to ManualMode. */ void slotClockSlewing(); /** Enables the angular distance measuring mode. It saves the first * position of the ruler in a SkyPoint. It makes difference between * having clicked on the skymap and not having done so * \note This method is draw-backend independent. */ void slotBeginAngularDistance(); void slotBeginStarHop(); // TODO: Add docs /** Computes the angular distance, prints the result in the status * bar and disables the angular distance measuring mode * If the user has clicked on the map the status bar shows the * name of the clicked object plus the angular distance. If * the user did not clicked on the map, just pressed ], only * the angular distance is printed * \note This method is draw-backend independent. */ void slotEndRulerMode(); /** Disables the angular distance measuring mode. Nothing is printed * in the status bar */ void slotCancelRulerMode(); /** @short Open Flag Manager window with clickedObject() RA and Dec entered. */ void slotAddFlag(); /** @short Open Flag Manager window with selected flag focused and ready to edit. *@param flagIdx index of flag to be edited. */ void slotEditFlag(int flagIdx); /** @short Delete selected flag. *@param flagIdx index of flag to be deleted. */ void slotDeleteFlag(int flagIdx); #ifdef HAVE_OPENGL void slotToggleGL(); #endif #ifdef HAVE_XPLANET /** Run Xplanet to print a view in a Window*/ void slotXplanetToWindow(); /** Run Xplanet to print a view in a file */ void slotXplanetToFile(); #endif /** Render eyepiece view */ void slotEyepieceView(); /** Zoom in one step. */ void slotZoomIn(); /** Zoom out one step. */ void slotZoomOut(); /** Set default zoom. */ void slotZoomDefault(); /** Object pointing for Printing Wizard done */ void slotObjectSelected(); void slotCancelLegendPreviewMode(); void slotFinishFovCaptureMode(); void slotCaptureFov(); signals: /** Emitted by setDestination(), and connected to slewFocus(). Whenever the Destination * point is changed, slewFocus() will iteratively step the Focus toward Destination * until it is reached. * @see SkyMap::setDestination() * @see SkyMap::slewFocus() */ void destinationChanged(); /** Emitted when zoom level is changed. */ void zoomChanged(); /** Emitted when current object changed. */ void objectChanged(SkyObject *); /** Emitted when pointing changed. (At least should) */ void positionChanged(SkyPoint *); /** Emitted when position under mouse changed. */ void mousePointChanged(SkyPoint *); /** Emitted when a position is clicked */ void positionClicked(SkyPoint *); /** Emitted when a position is clicked */ void objectClicked(SkyObject *); protected: /** Process keystrokes: * @li arrow keys Slew the map * @li +/- keys Zoom in and out * @li Space Toggle between Horizontal and Equatorial coordinate systems * @li 0-9 Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon) * @li [ Place starting point for measuring an angular distance * @li ] End point for Angular Distance; display measurement. * @li Escape Cancel Angular measurement * @li ,/< Step backward one time step * @li ./> Step forward one time step */ - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; /** When keyRelease is triggered, just set the "slewing" flag to false, * and update the display (to draw objects that are hidden when slewing==true). */ - void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *e) override; /** Determine RA, Dec coordinates of clicked location. Find the SkyObject * which is nearest to the clicked location. * * If left-clicked: Set set mouseButtonDown==true, slewing==true; display * nearest object name in status bar. * If right-clicked: display popup menu appropriate for nearest object. */ - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *e) override; /** set mouseButtonDown==false, slewing==false */ - void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *e) override; /** Center SkyMap at double-clicked location */ - void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *e) override; /** This function does several different things depending on the state of the program: * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor, * and continue this function. * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen, * and return. * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse * cursor remains constant. * @li If just moving the mouse, simply update the curso coordinates in the status bar. */ - void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *e) override; /** Zoom in and out with the mouse wheel. */ - void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent *e) override; /** If the skymap will be resized, the sky must be new computed. So this * function calls explicitly new computing of the skymap. */ - void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *) override; private slots: /** @short display tooltip for object under cursor. It's called by m_HoverTimer. * if mouse didn't moved for last HOVER_INTERVAL milliseconds. */ void slotTransientLabel(); /** Set the shape of mouse cursor to a cross with 4 arrows. */ void setMouseMoveCursor(); private: /** @short Sets the shape of the default mouse cursor to a cross. */ void setDefaultMouseCursor(); /** @short Sets the shape of the mouse cursor to a magnifying glass. */ void setZoomMouseCursor(); /** Calculate the zoom factor for the given keyboard modifier */ double zoomFactor(const int modifier); /** calculate the magnitude factor (1, .5, .2, or .1) for the given * keyboard modifier. */ double magFactor(const int modifier); /** Decrease the magnitude limit by a step size determined by the * keyboard modifier. * @param modifier */ void decMagLimit(const int modifier); /** Increase the magnitude limit by a step size determined by the * keyboard modifier. * @param modifier */ void incMagLimit(const int modifier); /** Convenience routine to either zoom in or incraase mag limit * depending on the Alt modifier. The Shift and Control modiifers * will adjust the size of the zoom or the mag step. * @param modifier */ void zoomInOrMagStep(const int modifier); /** Convenience routine to either zoom out or decraase mag limit * depending on the Alt modifier. The Shift and Control modiifers * will adjust the size of the zoom or the mag step. * @param modifier */ void zoomOutOrMagStep(const int modifier); void beginRulerMode(bool starHopRuler); // TODO: Add docs #ifdef HAVE_XPLANET /** * @short Strart xplanet. * @param outputFile Output file path. */ void startXplanet(const QString &outputFile = ""); #endif bool mouseButtonDown { false }; bool midMouseButtonDown { false }; /// True if mouseMoveEvent; needed by setMouseMoveCursor bool mouseMoveCursor { false }; bool slewing { false }; bool clockSlewing { false }; //if false only old pixmap will repainted with bitBlt(), this // saves a lot of cpu usage bool computeSkymap { false }; // True if we are either looking for angular distance or star hopping directions bool rulerMode { false }; // True only if we are looking for star hopping directions. If // false while rulerMode is true, it means we are measuring angular // distance. FIXME: Find a better way to do this bool starHopDefineMode { false }; double y0; double m_Scale; KStarsData *data { nullptr }; KSPopupMenu *pmenu { nullptr }; /// Coordinates of point under cursor. It's update in function mouseMoveEvent SkyPoint m_MousePoint; SkyPoint Focus, ClickedPoint, FocusPoint, Destination; SkyObject *ClickedObject { nullptr }; SkyObject *FocusObject { nullptr }; Projector *m_proj { nullptr }; SkyLine AngularRuler; //The line for measuring angles in the map QRect ZoomRect; //The manual-focus circle. // Mouse should not move for that interval to display tooltip static const int HOVER_INTERVAL = 500; // Timer for tooltips QTimer m_HoverTimer; // InfoBoxes. Used in desctructor to save state InfoBoxWidget *m_timeBox { nullptr }; InfoBoxWidget *m_geoBox { nullptr }; InfoBoxWidget *m_objBox { nullptr }; InfoBoxes *m_iboxes { nullptr }; // legend bool m_previewLegend { false }; Legend m_legend; bool m_objPointingMode { false }; bool m_fovCaptureMode { false }; QWidget *m_SkyMapDraw { nullptr }; // Can be dynamic_cast<> to SkyMapDrawAbstract // NOTE: These are pointers to the individual widgets #ifdef HAVE_OPENGL SkyMapQDraw *m_SkyMapQDraw { nullptr }; SkyMapGLDraw *m_SkyMapGLDraw { nullptr }; #endif static SkyMap *pinstance; /// Good to keep the original ruler start-point for purposes of dynamic_cast const SkyPoint *m_rulerStartPoint { nullptr }; }; diff --git a/kstars/skymapqdraw.h b/kstars/skymapqdraw.h index 0872d7159..117e2dee1 100644 --- a/kstars/skymapqdraw.h +++ b/kstars/skymapqdraw.h @@ -1,55 +1,55 @@ /*************************************************************************** skymapqdraw.h - K Desktop Planetarium ------------------- begin : Tue Dec 21 2010 07:10 AM UTC-6 copyright : (C) 2010 Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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 SKYMAPQDRAW_H_ #define SKYMAPQDRAW_H_ #include "skymapdrawabstract.h" #include /** *@short This class draws the SkyMap using native QPainter. It * implements SkyMapDrawAbstract *@version 1.0 *@author Akarsh Simha */ class SkyMapQDraw : public QWidget, public SkyMapDrawAbstract { Q_OBJECT public: /** *@short Constructor */ explicit SkyMapQDraw(SkyMap *parent); /** *@short Destructor */ - ~SkyMapQDraw(); + ~SkyMapQDraw() override; protected: - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; - void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *e) override; QPixmap *m_SkyPixmap; }; #endif diff --git a/kstars/skyobjects/constellationsart.h b/kstars/skyobjects/constellationsart.h index bf9b1a521..5c742d4e6 100644 --- a/kstars/skyobjects/constellationsart.h +++ b/kstars/skyobjects/constellationsart.h @@ -1,96 +1,96 @@ /*************************************************************************** constellationsart.h - K Desktop Planetarium ------------------- begin : 2015-05-27 copyright : (C) 2015 by M.S.Adityan email : msadityan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skyobjects/skyobject.h" #include #include class dms; /** * @class ConstellationsArt * @short Information about a ConstellationsArt object. This class represents a constellation image. * * Provides all necessary information about a constellationsart object * data inherited from SkyObject includes RA/DEC coordinate pairs. * Data specific to ConstellationsArt objects includes the abbreviation * filename, constellation image, position angle, width and height. * * @author M.S.Adityan * @version 0.1 */ class ConstellationsArt : public SkyObject { public: /** * Constructor. Set ConstellationsArt data according to parameters. * @param midpointra RA of the midpoint of the constellation * @param midpointdec DEC of the midpoint of the constellation * @param pa position angle * @param w width of the constellation image * @param h height of the constellation image * @param abbreviation abbreviation of the constellation * @param filename the file name of the image of the constellation. */ explicit ConstellationsArt(dms &midpointra, dms &midpointdec, double pa, double w, double h, const QString &abbreviation, const QString &filename); /** @return an object's image */ const QImage &image() { if (imageLoaded) return constellationArtImage; else { loadImage(); return constellationArtImage; } } /** Load the object's image. This also scales the object's image to 1024x1024 pixels. */ void loadImage(); /** @return an object's abbreviation */ inline QString getAbbrev() const { return abbrev; } /** @return an object's image file name*/ inline QString getImageFileName() const { return imageFileName; } /** @return an object's position angle */ - inline double pa() const Q_DECL_OVERRIDE { return positionAngle; } + inline double pa() const override { return positionAngle; } /** Set the position angle */ inline void setPositionAngle(double pa) { positionAngle = pa; } /** @return an object's width */ inline double getWidth() { return width; } /** @return an object's height*/ inline double getHeight() { return height; } private: QString abbrev; QString imageFileName; QImage constellationArtImage; double positionAngle { 0 }; double width { 0 }; double height { 0 }; bool imageLoaded { false }; }; diff --git a/kstars/skyobjects/deepskyobject.h b/kstars/skyobjects/deepskyobject.h index bed9f1d32..c14cdbfea 100644 --- a/kstars/skyobjects/deepskyobject.h +++ b/kstars/skyobjects/deepskyobject.h @@ -1,228 +1,228 @@ /*************************************************************************** deepskyobject.h - K Desktop Planetarium ------------------- begin : Sun Feb 11 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "dms.h" #include "skyobject.h" #include #include class QImage; class QString; class KSPopupMenu; class CatalogComponent; class CatalogEntryData; /** *@class DeepSkyObject *Provides all necessary information about a deep-sky object: *data inherited from SkyObject (coordinates, type, magnitude, *2 names, and URLs) and data specific to DeepSkyObjects *(common name, angular size, position angle, Image, catalog) *@short Information about a "dep-sky" object; i.e., anything *that's not a solar system body or a star. *@author Jason Harris *@version 1.0 */ class DeepSkyObject : public SkyObject { public: /** *Constructor. Create DeepSkyObject with data according to arguments. *@param t Type of object *@param r catalog Right Ascension *@param d catalog Declination *@param m magnitude (brightness) *@param n Primary name *@param n2 Secondary name *@param lname Long name (common name) *@param cat catalog ID *@param a major axis (arcminutes) *@param b minor axis (arcminutes) *@param pa position angle (degrees) *@param pgc PGC catalog number *@param ugc UGC catalog number */ explicit DeepSkyObject(int t = SkyObject::STAR, dms r = dms(0.0), dms d = dms(0.0), float m = 0.0, const QString &n = "unnamed", const QString &n2 = QString(), const QString &lname = QString(), const QString &cat = QString(), float a = 0.0, float b = 0.0, double pa = 0.0, int pgc = 0, int ugc = 0); /** @short Copy constructor. * @param o SkyObject from which to copy data */ DeepSkyObject(const DeepSkyObject &o); explicit DeepSkyObject(const CatalogEntryData &data, CatalogComponent *cat = nullptr); - QString labelString() const Q_DECL_OVERRIDE; + QString labelString() const override; - DeepSkyObject *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + DeepSkyObject *clone() const override; + SkyObject::UID getUID() const override; /** *Destructor */ - virtual ~DeepSkyObject() {} + ~DeepSkyObject() override {} /** *@enum CATALOG *The catalog ID of the DeepSkyObject. */ enum CATALOG { CAT_MESSIER = 0, CAT_NGC = 1, CAT_IC = 2, CAT_UNKNOWN }; /** *@return a QString identifying the object's primary catalog. *Possible catalog values are: *- "M" for Messier catalog *- "NGC" for NGC catalog *- "IC" for IC catalog *- empty string is presumed to be an object in a custom catalog *@sa setCatalog() */ QString catalog(void) const; /** *Set the internal Catalog value according to the QString *argument: * "M" : CAT_MESSIER * "NGC" : CAT_NGC * "IC" : CAT_IC *@sa catalog() */ void setCatalog(const QString &s); /** *Set the reference to the custom catalog component, if any *@sa customCatalog() */ inline void setCustomCatalog(CatalogComponent *s) { customCat = s; } /** *@return a pointer to a custom catalog component */ inline CatalogComponent *customCatalog() { return customCat; } /** *Set the integrated flux value of the object */ inline void setFlux(const float &f) { Flux = f; } /** *@return the object's integrated flux, unit value is stored in the custom catalog component. */ inline float flux() const { return Flux; } /** *@return the object's major axis length, in arcminutes. */ inline float a() const { return MajorAxis; } /** *@return the object's minor axis length, in arcminutes. */ inline float b() const { return MinorAxis; } /** *@return the object's aspect ratio (MinorAxis/MajorAxis). Returns 1.0 *if the object's MinorAxis=0.0. */ float e() const; /** *@return the object's position angle in degrees, measured clockwise from North. */ - inline virtual double pa() const Q_DECL_OVERRIDE { return PositionAngle; } + inline double pa() const override { return PositionAngle; } /** *@return the object's UGC catalog number. Return 0 if the object is not in UGC. */ inline int ugc() const { return UGC; } /** *@return the object's PGC catalog number. Return 0 if the object is not in PGC. */ inline int pgc() const { return PGC; } /** @return an object's image */ const QImage &image() { if (imageLoaded) return m_image; else { loadImage(); return m_image; } } /** Try to load the object's image */ void loadImage(); /** *@return true if the object is in the Messier catalog */ inline bool isCatalogM() const { return (Catalog == CAT_MESSIER); } /** *@return true if the object is in the NGC catalog */ inline bool isCatalogNGC() const { return (Catalog == CAT_NGC); } /** *@return true if the object is in the IC catalog */ inline bool isCatalogIC() const { return (Catalog == CAT_IC); } /** *@return true if the object is not in a catalog */ inline bool isCatalogNone() const { return (Catalog == CAT_UNKNOWN); } /** *@return the pixel distance for offseting the object's name label */ - double labelOffset() const Q_DECL_OVERRIDE; + double labelOffset() const override; - void initPopupMenu(KSPopupMenu *pmenu) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *pmenu) override; public: quint64 updateID { 0 }; quint64 updateNumID { 0 }; private: double PositionAngle { 0 }; QImage m_image; /// Dreyer or other description QString Description; CatalogComponent *customCat { nullptr }; int UGC { 0 }; int PGC { 0 }; float MajorAxis { 0 }; float MinorAxis { 0 }; float Flux { 0 }; unsigned char Catalog { 0 }; bool imageLoaded { false }; }; diff --git a/kstars/skyobjects/jupitermoons.h b/kstars/skyobjects/jupitermoons.h index 3ece53bf6..303219c9c 100644 --- a/kstars/skyobjects/jupitermoons.h +++ b/kstars/skyobjects/jupitermoons.h @@ -1,76 +1,76 @@ /*************************************************************************** jupitermoons.h - description ------------------- begin : Fri Oct 18 2002 copyright : (C) 2002 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 JUPITERMOONS_H_ #define JUPITERMOONS_H_ #include #include #include "planetmoons.h" class KSNumbers; class KSPlanet; class KSSun; /** *@class JupiterMoons *Implements the four largest moons of Jupiter. *See Chapter 43 of "Astronomical Algorithms"by Jean Meeus for details * *TODO: make the moons SkyObjects, rather than just points. * *@author Jason Harris *@version 1.0 */ class JupiterMoons : public PlanetMoons { public: /** *Constructor. Assign the name of each moon, *and initialize their XYZ positions to zero. */ JupiterMoons(); /** *Destructor. Delete moon objects. */ - virtual ~JupiterMoons(); + ~JupiterMoons() override; /** *@short Find the positions of each Moon, relative to Jupiter. *We use an XYZ coordinate system, centered on Jupiter, *where the X-axis corresponds to Jupiter's Equator, *the Y-Axis is parallel to Jupiter's Poles, and the *Z-axis points along the line joining the Earth and *Jupiter. Once the XYZ positions are known, this *function also computes the RA,Dec positions of each *Moon, and sets the inFront bool variable to indicate *whether the Moon is nearer to us than Jupiter or not *(this information is used to determine whether the *Moon should be drawn on top of Jupiter, or vice versa). * *See "Astronomical Algorithms" bu Jean Meeus, Chapter 43. * *@param num pointer to the KSNumbers object describing *the date/time at which to find the positions. *@param jup pointer to the jupiter object *@param sunptr pointer to the Sun object */ - void findPosition(const KSNumbers *num, const KSPlanetBase *jup, const KSSun *sunptr) Q_DECL_OVERRIDE; + void findPosition(const KSNumbers *num, const KSPlanetBase *jup, const KSSun *sunptr) override; }; #endif diff --git a/kstars/skyobjects/ksasteroid.h b/kstars/skyobjects/ksasteroid.h index 32f18eb0b..d926095b2 100644 --- a/kstars/skyobjects/ksasteroid.h +++ b/kstars/skyobjects/ksasteroid.h @@ -1,221 +1,221 @@ /*************************************************************************** ksasteroid.h - K Desktop Planetarium ------------------- begin : Wed 19 Feb 2003 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksplanetbase.h" class dms; class KSNumbers; /** @class KSAsteroid *@short A subclass of KSPlanetBase that implements asteroids. * *The orbital elements are stored as private member variables, and it *provides methods to compute the ecliptic coordinates for any time *from the orbital elements. * *The orbital elements are: *@li JD Epoch of element values *@li a semi-major axis length (AU) *@li e eccentricity of orbit *@li i inclination angle (with respect to J2000.0 ecliptic plane) *@li w argument of perihelion (w.r.t. J2000.0 ecliptic plane) *@li N longitude of ascending node (J2000.0 ecliptic) *@li M mean anomaly at epoch JD *@li H absolute magnitude *@li G slope parameter * *@author Jason Harris *@version 1.0 */ class KSAsteroid : public KSPlanetBase { public: /** Constructor. *@p catN number of asteroid *@p s the name of the asteroid *@p image_file the filename for an image of the asteroid *@p JD the Julian Day for the orbital elements *@p a the semi-major axis of the asteroid's orbit (AU) *@p e the eccentricity of the asteroid's orbit *@p i the inclination angle of the asteroid's orbit *@p w the argument of the orbit's perihelion *@p N the longitude of the orbit's ascending node *@p M the mean anomaly for the Julian Day *@p H absolute magnitude *@p G slope parameter */ KSAsteroid(int catN, const QString &s, const QString &image_file, long double JD, double a, double e, dms i, dms w, dms N, dms M, double H, double G); - KSAsteroid *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + KSAsteroid *clone() const override; + SkyObject::UID getUID() const override; /** Destructor (empty)*/ - virtual ~KSAsteroid() {} + ~KSAsteroid() override {} /** This is inherited from KSPlanetBase. We don't use it in this class, *so it is empty. */ - bool loadData() Q_DECL_OVERRIDE; + bool loadData() override; /** This lets other classes like KSPlanetBase access H and G values *Used by KSPlanetBase::FindMagnitude */ double inline getAbsoluteMagnitude() const { return H; } double inline getSlopeParameter() const { return G; } /** *@short Sets the asteroid's perihelion distance */ void setPerihelion(double perihelion); /** *@return Perihelion distance */ inline double getPerihelion() const { return q; } /** *@short Sets the asteroid's earth minimum orbit intersection distance */ void setEarthMOID(double earth_moid); /** *@return the asteroid's earth minimum orbit intersection distance in AU */ inline double getEarthMOID() const { return EarthMOID; } /** *@short Sets the asteroid's orbit solution ID */ void setOrbitID(QString orbit_id); /** *@return the asteroid's orbit solution ID */ inline QString getOrbitID() const { return OrbitID; } /** *@short Sets the asteroid's orbit class */ void setOrbitClass(QString orbit_class); /** *@return the asteroid's orbit class */ inline QString getOrbitClass() const { return OrbitClass; } /** *@short Sets if the comet is a near earth object */ void setNEO(bool neo); /** *@return true if the asteroid is a near earth object */ inline bool isNEO() const { return NEO; } /** *@short Sets the asteroid's albedo */ void setAlbedo(float albedo); /** *@return the asteroid's albedo */ inline float getAlbedo() const { return Albedo; } /** *@short Sets the asteroid's diameter */ void setDiameter(float diam); /** *@return the asteroid's diameter */ inline float getDiameter() const { return Diameter; } /** *@short Sets the asteroid's dimensions */ void setDimensions(QString dim); /** *@return the asteroid's dimensions */ inline QString getDimensions() const { return Dimensions; } /** *@short Sets the asteroid's rotation period */ void setRotationPeriod(float rot_per); /** *@return the asteroid's rotation period */ inline float getRotationPeriod() const { return RotationPeriod; } /** *@short Sets the asteroid's period */ void setPeriod(float per); /** *@return the asteroid's period */ inline float getPeriod() const { return Period; } protected: /** Calculate the geocentric RA, Dec coordinates of the Asteroid. *@note reimplemented from KSPlanetBase *@param num time-dependent values for the desired date *@param Earth planet Earth (needed to calculate geocentric coords) *@return true if position was successfully calculated. */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override; //these set functions are needed for the new KSPluto subclass void set_a(double newa) { a = newa; } void set_e(double newe) { e = newe; } void set_P(double newP) { P = newP; } void set_i(double newi) { i.setD(newi); } void set_w(double neww) { w.setD(neww); } void set_M(double newM) { M.setD(newM); } void set_N(double newN) { N.setD(newN); } void setJD(long double jd) { JD = jd; } private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; int catN { 0 }; long double JD { 0 }; double q { 0 }; double a { 0 }; double e { 0 }; double P { 0 }; double EarthMOID { 0 }; float Albedo { 0 }; float Diameter { 0 }; float RotationPeriod { 0 }; float Period { 0 }; dms i, w, M, N; double H { 0 }; double G { 0 }; QString OrbitID, OrbitClass, Dimensions; bool NEO { false }; }; diff --git a/kstars/skyobjects/kscomet.h b/kstars/skyobjects/kscomet.h index 8771d9fbe..c13d95599 100644 --- a/kstars/skyobjects/kscomet.h +++ b/kstars/skyobjects/kscomet.h @@ -1,219 +1,219 @@ /*************************************************************************** kscomet.h - K Desktop Planetarium ------------------- begin : Wed 19 Feb 2003 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksplanetbase.h" /** * @class KSComet * @short A subclass of KSPlanetBase that implements comets. * * The orbital elements are stored as private member variables, and * it provides methods to compute the ecliptic coordinates for any * time from the orbital elements. * * The orbital elements are: * @li JD Epoch of element values * @li q perihelion distance (AU) * @li e eccentricity of orbit * @li i inclination angle (with respect to J2000.0 ecliptic plane) * @li w argument of perihelion (w.r.t. J2000.0 ecliptic plane) * @li N longitude of ascending node (J2000.0 ecliptic) * @li Tp time of perihelion passage (YYYYMMDD.DDD) * @li M1 comet total magnitude parameter * @li M2 comet nuclear magnitude parameter * @li K1 total magnitude slope parameter * @li K2 nuclear magnitude slope parameter * * @author Jason Harris * @version 1.1 */ class KSNumbers; class dms; class KSComet : public KSPlanetBase { public: /** * Constructor. * @param s the name of the comet * @param image_file the filename for an image of the comet * @param JD the Julian Day for the orbital elements * @param q the perihelion distance of the comet's orbit (AU) * @param e the eccentricity of the comet's orbit * @param i the inclination angle of the comet's orbit * @param w the argument of the orbit's perihelion * @param N the longitude of the orbit's ascending node * @param Tp The date of the most proximate perihelion passage (YYYYMMDD.DDD) * @param M1 the comet total magnitude parameter * @param M2 the comet nuclear magnitude parameter * @param K1 the comet total magnitude slope parameter * @param K2 the comet nuclear magnitude slope parameter */ KSComet(const QString &s, const QString &image_file, long double JD, double q, double e, dms i, dms w, dms N, double Tp, float M1, float M2, float K1, float K2); - KSComet *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + KSComet *clone() const override; + SkyObject::UID getUID() const override; /** Destructor (empty)*/ - virtual ~KSComet() {} + ~KSComet() override {} /** * Unused virtual function inherited from KSPlanetBase thus it's simply empty here. */ - bool loadData() Q_DECL_OVERRIDE; + bool loadData() override; /** * @short Returns the Julian Day of Perihelion passage * @return Julian Day of Perihelion Passage */ inline long double getPerihelionJD() { return JDp; } /** * @short Returns Perihelion distance * @return Perihelion distance */ inline double getPerihelion() { return q; } /** @return the comet total magnitude parameter */ inline float getTotalMagnitudeParameter() { return M1; } /** @return the comet nuclear magnitude parameter */ inline float getNuclearMagnitudeParameter() { return M2; } /** @return the total magnitude slope parameter */ inline float getTotalSlopeParameter() { return K1; } /** @return the nuclear magnitude slope parameter */ inline float getNuclearSlopeParameter() { return K2; } /** @short Sets the comet's tail length in km */ void setTailSize(double tailsize) { TailSize = tailsize; } /** @return the estimated tail length in km */ inline float getTailSize() { return TailSize; } /** @short Sets the comet's apparent tail length in degrees */ void setComaAngSize(double comaAngSize) { ComaAngSize = comaAngSize; } /** @return the estimated angular size of the tail as a dms */ inline dms getComaAngSize() { return dms(ComaAngSize); } /** @return the estimated diameter of the nucleus in km */ inline float getNuclearSize() { return NuclearSize; } /** @short Sets the comet's earth minimum orbit intersection distance */ void setEarthMOID(double earth_moid); /** @return the comet's earth minimum orbit intersection distance in km */ inline double getEarthMOID() { return EarthMOID; } /** @short Sets the comet's orbit solution ID */ void setOrbitID(QString orbit_id); /** @return the comet's orbit solution ID */ inline QString getOrbitID() { return OrbitID; } /** @short Sets the comet's orbit class */ void setOrbitClass(QString orbit_class); /** @return the comet's orbit class */ inline QString getOrbitClass() { return OrbitClass; } /** @short Sets if the comet is a near earth object */ void setNEO(bool neo); /** @return true if the comet is a near earth object */ inline bool isNEO() { return NEO; } /** @short Sets the comet's albedo */ void setAlbedo(float albedo); /** @return the comet's albedo */ inline float getAlbedo() { return Albedo; } /** @short Sets the comet's diameter */ void setDiameter(float diam); /** @return the comet's diameter */ inline float getDiameter() { return Diameter; } /** @short Sets the comet's dimensions */ void setDimensions(QString dim); /** @return the comet's dimensions */ inline QString getDimensions() { return Dimensions; } /** @short Sets the comet's rotation period */ void setRotationPeriod(float rot_per); /** @return the comet's rotation period */ inline float getRotationPeriod() { return RotationPeriod; } /** @short Sets the comet's period */ void setPeriod(float per); /** @return the comet's period */ inline float getPeriod() { return Period; } protected: /** * Calculate the geocentric RA, Dec coordinates of the Comet. * @note reimplemented from KSPlanetBase * @param num time-dependent values for the desired date * @param Earth planet Earth (needed to calculate geocentric coords) * @return true if position was successfully calculated. */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override; /** * @short Estimate physical parameters of the comet such as coma size, tail length and size of the nucleus * @note invoked from findGeocentricPosition in order */ void findPhysicalParameters(); private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; long double JD { 0 }; long double JDp { 0 }; double q { 0 }; double e { 0 }; double a { 0 }; double P { 0 }; double EarthMOID { 0 }; double TailSize { 0 }; double ComaAngSize { 0 }; double ComaSize { 0 }; double NuclearSize { 0 }; float M1 { 0 }; float M2 { 0 }; float K1 { 0 }; float K2 { 0 }; float Albedo { 0 }; float Diameter { 0 }; float RotationPeriod { 0 }; float Period { 0 }; dms i, w, N; QString OrbitID, OrbitClass, Dimensions; bool NEO { false }; /// Part of UID qint64 uidPart { 0 }; }; diff --git a/kstars/skyobjects/ksmoon.h b/kstars/skyobjects/ksmoon.h index 695297584..386cf4a22 100644 --- a/kstars/skyobjects/ksmoon.h +++ b/kstars/skyobjects/ksmoon.h @@ -1,135 +1,135 @@ /*************************************************************************** ksmoon.h - K Desktop Planetarium ------------------- begin : Sun Aug 26 2001 copyright : (C) 2001 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksplanetbase.h" #include "dms.h" class KSSun; /** * @class KSMoon * @short Provides necessary information about the Moon. * A subclass of SkyObject that provides information * needed for the Moon. Specifically, KSMoon provides a moon-specific * findPosition() function. Also, there is a method findPhase(), which returns * the lunar phase as a floating-point number between 0.0 and 1.0. * * @author Jason Harris * @version 1.0 */ class KSMoon : public KSPlanetBase { public: using KSPlanetBase::findPhase; /** Default constructor. Set name="Moon". */ KSMoon(); /** Copy constructor */ KSMoon(const KSMoon &o); - ~KSMoon(); + ~KSMoon() override; - KSMoon *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + KSMoon *clone() const override; + SkyObject::UID getUID() const override; /** * Determine the phase angle of the moon, and assign the appropriate moon image * @param Sun a KSSun pointer with coordinates updated to the time of computation. * If not supplied, the findByName() method will be used to find the sun. * @note Overrides KSPlanetBase::findPhase() */ virtual void findPhase(const KSSun *Sun = nullptr); /** @return the illuminated fraction of the Moon as seen from Earth */ double illum() const { return 0.5 * (1.0 - cos(Phase * dms::PI / 180.0)); } /** @return a short string describing the moon's phase */ QString phaseName() const; /** reimplemented from KSPlanetBase */ - bool loadData() Q_DECL_OVERRIDE; + bool loadData() override; /** @return iPhase, which is used as a key to find the right image file */ inline short int getIPhase() const { return iPhase; } /** * Reimplemented from KSPlanetBase, this function employs unique algorithms for * estimating the lunar coordinates. Finding the position of the moon is * much more difficult than the other planets. For one thing, the Moon is * a lot closer, so we can detect smaller deviations in its orbit. Also, * the Earth has a significant effect on the Moon's orbit, and their * interaction is complex and nonlinear. As a result, the positions as * calculated by findPosition() are only accurate to about 10 arcseconds * (10 times less precise than the planets' positions!) * @short moon-specific coordinate finder * @param num KSNumbers pointer for the target date/time * @note we don't use the Earth pointer here */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *) override; /** * @brief updateMag calls findMagnitude() to calculate current magnitude of moon * according to current phase. This function is required to perform findMagnitude() * from any where in Kstars */ void updateMag() { findMagnitude(nullptr); } - void initPopupMenu(KSPopupMenu *pmenu) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *pmenu) override; private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; static bool data_loaded; static int instance_count; /** * @class MoonLRData * @short Moon Longitude and radius data object * Encapsulates the Longitude and radius terms of the sums * used to compute the moon's position. */ struct MoonLRData { int nd { 0 }; int nm { 0 }; int nm1 { 0 }; int nf { 0 }; double Li { 0 }; double Ri { 0 }; }; static QList LRData; /** * @class MoonBData * Encapsulates the Latitude terms of the sums used to compute the moon's position. * @short Moon Latitude data object */ struct MoonBData { int nd { 0 }; int nm { 0 }; int nm1 { 0 }; int nf { 0 }; double Bi { 0 }; }; static QList BData; unsigned int iPhase { 0 }; }; diff --git a/kstars/skyobjects/ksplanet.h b/kstars/skyobjects/ksplanet.h index 10afddda0..d6e26ce0f 100644 --- a/kstars/skyobjects/ksplanet.h +++ b/kstars/skyobjects/ksplanet.h @@ -1,186 +1,186 @@ /*************************************************************************** ksplanet.h - K Desktop Planetarium ------------------- begin : Sun Jul 22 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ksplanetbase.h" #include #include #include class KSNumbers; /** * @class KSPlanet * A subclass of KSPlanetBase for seven of the major planets in the solar system * (Earth and Pluto have their own specialized classes derived from KSPlanetBase). * @note The Sun is subclassed from KSPlanet. * * KSPlanet contains internal classes to manage the computations of a planet's position. * The position is computed as a series of sinusoidal sums, similar to a Fourier * transform. See "Astronomical Algorithms" by Jean Meeus or the file README.planetmath * for details. * @short Provides necessary information about objects in the solar system. * * @author Jason Harris * @version 1.0 */ class KSPlanet : public KSPlanetBase { public: /** * Constructor. * @param s Name of planet * @param image_file filename of the planet's image * @param c the color for the planet * @param pSize physical diameter of the planet, in km */ explicit KSPlanet(const QString &s = "unnamed", const QString &image_file = QString(), const QColor &c = Qt::white, double pSize = 0); /** * Simplified constructor * @param n identifier of the planet to be created * @see PLANET enum */ explicit KSPlanet(int n); - KSPlanet *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + KSPlanet *clone() const override; + SkyObject::UID getUID() const override; - virtual ~KSPlanet() {} + ~KSPlanet() override {} /** * @short return the untranslated name * This is a dirty way to solve a lot of localization-related trouble for the KDE 4.2 release * TODO: Change the whole architecture for names later */ QString untranslatedName() const; /** @short Preload the data used by findPosition. */ - bool loadData() Q_DECL_OVERRIDE; + bool loadData() override; /** * Calculate the ecliptic longitude and latitude of the planet for * the given date (expressed in Julian Millenia since J2000). A reference * to the ecliptic coordinates is returned as the second object. * @param jm Julian Millenia (=jd/1000) * @param ret The ecliptic coordinates are returned by reference through this argument. */ virtual void calcEcliptic(double jm, EclipticPosition &ret) const; protected: /** * Calculate the geocentric RA, Dec coordinates of the Planet. * @note reimplemented from KSPlanetBase * @param num pointer to object with time-dependent values for the desired date * @param Earth pointer to the planet Earth (needed to calculate geocentric coords) * @return true if position was successfully calculated. */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override; /** * @class OrbitData * This class contains doubles A,B,C which represent a single term in a planet's * positional expansion sums (each sum-term is A*COS(B+C*T)). * * @author Mark Hollomon * @version 1.0 */ class OrbitData { public: /** Default constructor */ OrbitData() : A(0.), B(0.), C(0.) {} /** * Constructor * @param a the A value * @param b the B value * @param c the C value */ OrbitData(double a, double b, double c) : A(a), B(b), C(c) {} double A, B, C; }; typedef QVector OBArray[6]; /** * OrbitDataColl contains three groups of six QVectors. Each QVector is a * list of OrbitData objects, representing a single sum used in computing * the planet's position. A set of six of these vectors comprises the large * "meta-sum" which yields the planet's Longitude, Latitude, or Distance value. * * @author Mark Hollomon * @version 1.0 */ class OrbitDataColl { public: /** Constructor */ OrbitDataColl(); OBArray Lon; OBArray Lat; OBArray Dst; }; /** * OrbitDataManager places the OrbitDataColl objects for all planets in a QDict * indexed by the planets' names. It also loads the positional data of each planet from disk. * * @author Mark Hollomon * @version 1.0 */ class OrbitDataManager { public: /** Constructor */ OrbitDataManager(); /** * Load orbital data for a planet from disk. * The data is stored on disk in a series of files named * "name.[LBR][0...5].vsop", where "L"=Longitude data, "B"=Latitude data, * and R=Radius data. * @param n the name of the planet whose data is to be loaded from disk. * @param odc reference to the OrbitDataColl containing the planet's orbital data. * @return true if data successfully loaded */ bool loadData(OrbitDataColl &odc, const QString &n); private: /** * Read a single orbital data file from disk into an OrbitData vector. * The data files are named "name.[LBR][0...5].vsop", where * "L"=Longitude data, "B"=Latitude data, and R=Radius data. * @param fname the filename to be read. * @param vector pointer to the OrbitData vector to be filled with these data. */ bool readOrbitData(const QString &fname, QVector *vector); QHash hash; }; private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; protected: bool data_loaded { false }; static OrbitDataManager odm; }; diff --git a/kstars/skyobjects/ksplanetbase.h b/kstars/skyobjects/ksplanetbase.h index 2adc68845..6c2badbf1 100644 --- a/kstars/skyobjects/ksplanetbase.h +++ b/kstars/skyobjects/ksplanetbase.h @@ -1,284 +1,284 @@ /*************************************************************************** ksplanetbase.h - K Desktop Planetarium ------------------- begin : Sun Jan 29 2002 copyright : (C) 2002 by Mark Hollomon email : mhh@mindspring.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "trailobject.h" #include #include #include #include class KSNumbers; /** * @class EclipticPosition * @short The ecliptic position of a planet (Longitude, Latitude, and distance from Sun). * @author Mark Hollomon * @version 1.0 */ class EclipticPosition { public: dms longitude; dms latitude; double radius; /**Constructor. */ explicit EclipticPosition(dms plong = dms(), dms plat = dms(), double prad = 0.0) : longitude(plong), latitude(plat), radius(prad) { } }; /** * @class KSPlanetBase * A subclass of TrailObject that provides additional information needed for most solar system * objects. This is a base class for KSSun, KSMoon, KSPlanet, KSAsteroid and KSComet. * Those classes cover all solar system objects except planetary moons, which are * derived directly from TrailObject * @short Provides necessary information about objects in the solar system. * @author Mark Hollomon * @version 1.0 */ class KSPlanetBase : public TrailObject { public: /** * Constructor. Calls SkyObject constructor with type=2 (planet), * coordinates=0.0, mag=0.0, primary name s, and all other QStrings empty. * @param s Name of planet * @param image_file filename of the planet's image * @param c color of the symbol to use for this planet * @param pSize the planet's physical size, in km */ explicit KSPlanetBase(const QString &s = i18n("unnamed"), const QString &image_file = QString(), const QColor &c = Qt::white, double pSize = 0); /** Destructor (empty) */ - virtual ~KSPlanetBase() {} + ~KSPlanetBase() override {} void init(const QString &s, const QString &image_file, const QColor &c, double pSize); //enum Planets { MERCURY=0, VENUS=1, MARS=2, JUPITER=3, SATURN=4, URANUS=5, NEPTUNE=6, PLUTO=7, SUN=8, MOON=9, UNKNOWN_PLANET }; enum Planets { MERCURY = 0, VENUS = 1, MARS = 2, JUPITER = 3, SATURN = 4, URANUS = 5, NEPTUNE = 6, SUN = 7, MOON = 8, UNKNOWN_PLANET }; static KSPlanetBase *createPlanet(int n); static QVector planetColor; virtual bool loadData() = 0; /** @return pointer to Ecliptic Longitude coordinate */ const dms &ecLong() const { return ep.longitude; } /** @return pointer to Ecliptic Latitude coordinate */ const dms &ecLat() const { return ep.latitude; } /** * @short Set Ecliptic Geocentric Longitude according to argument. * @param elong Ecliptic Longitude */ void setEcLong(dms elong) { ep.longitude = elong; } /** * @short Set Ecliptic Geocentric Latitude according to argument. * @param elat Ecliptic Latitude */ void setEcLat(dms elat) { ep.latitude = elat; } /** @return pointer to Ecliptic Heliocentric Longitude coordinate */ const dms &helEcLong() const { return helEcPos.longitude; } /** @return pointer to Ecliptic Heliocentric Latitude coordinate */ const dms &helEcLat() const { return helEcPos.latitude; } /** * @short Convert Ecliptic logitude/latitude to Right Ascension/Declination. * @param Obliquity current Obliquity of the Ecliptic (angle from Equator) */ void EclipticToEquatorial(const CachingDms *Obliquity); /** * @short Convert Right Ascension/Declination to Ecliptic logitude/latitude. * @param Obliquity current Obliquity of the Ecliptic (angle from Equator) */ void EquatorialToEcliptic(const CachingDms *Obliquity); /** @return pointer to this planet's texture */ const QImage &image() const { return m_image; } /** @return distance from Sun, in Astronomical Units (1 AU is Earth-Sun distance) */ double rsun() const { return ep.radius; } /** * @short Set the solar distance in AU. * @param r the new solar distance in AU */ void setRsun(double r) { ep.radius = r; } /** @return distance from Earth, in Astronomical Units (1 AU is Earth-Sun distance) */ double rearth() const { return Rearth; } /** * @short Set the distance from Earth, in AU. * @param r the new earth-distance in AU */ void setRearth(double r) { Rearth = r; } /** * @short compute and set the distance from Earth, in AU. * @param Earth pointer to the Earth from which to calculate the distance. */ void setRearth(const KSPlanetBase *Earth); /** * Update position of the planet (reimplemented from SkyPoint) * @param num current KSNumbers object * @param includePlanets this function does nothing if includePlanets=false * @param lat pointer to the geographic latitude; if nullptr, we skip localizeCoords() * @param LST pointer to the local sidereal time; if nullptr, we skip localizeCoords() */ void updateCoords(const KSNumbers *num, bool includePlanets = true, const CachingDms *lat = 0, - const CachingDms *LST = 0, bool forceRecompute = false) Q_DECL_OVERRIDE; + const CachingDms *LST = 0, bool forceRecompute = false) override; /** * @short Find position, including correction for Figure-of-the-Earth. * @param num KSNumbers pointer for the target date/time * @param lat pointer to the geographic latitude; if nullptr, we skip localizeCoords() * @param LST pointer to the local sidereal time; if nullptr, we skip localizeCoords() * @param Earth pointer to the Earth (not used for the Moon) */ void findPosition(const KSNumbers *num, const CachingDms *lat = 0, const CachingDms *LST = 0, const KSPlanetBase *Earth = 0); /** @return the Planet's position angle. */ - double pa() const Q_DECL_OVERRIDE { return PositionAngle; } + double pa() const override { return PositionAngle; } /** * @short Set the Planet's position angle. * @param p the new position angle */ void setPA(double p) { PositionAngle = p; } /** @return the Planet's angular size, in arcminutes */ double angSize() const { return AngularSize; } /** @short set the planet's angular size, in km. * @param size the planet's size, in km */ void setAngularSize(double size) { AngularSize = size; } /** @return the Planet's physical size, in km */ double physicalSize() const { return PhysicalSize; } /** @short set the planet's physical size, in km. * @param size the planet's size, in km */ void setPhysicalSize(double size) { PhysicalSize = size; } /** @return the phase angle of this planet */ inline dms phase() { return dms(Phase); } /** @return the color for the planet symbol */ QColor &color() { return m_Color; } /** @short Set the color for the planet symbol */ void setColor(const QColor &c) { m_Color = c; } /** @return true if the KSPlanet is one of the eight major planets */ bool isMajorPlanet() const; /** @return the pixel distance for offseting the object's name label */ - double labelOffset() const Q_DECL_OVERRIDE; + double labelOffset() const override; protected: /** Big object. Planet, Moon, Sun. */ static const UID UID_SOL_BIGOBJ; /** Asteroids */ static const UID UID_SOL_ASTEROID; /** Comets */ static const UID UID_SOL_COMET; /** Compute high 32-bits of UID. */ inline UID solarsysUID(UID type) const { return (SkyObject::UID_SOLARSYS << 60) | (type << 56); } /** * @short find the object's current geocentric equatorial coordinates (RA and Dec) * This function is pure virtual; it must be overloaded by subclasses. * This function is private; it is called by the public function findPosition() * which also includes the figure-of-the-earth correction, localizeCoords(). * @param num pointer to current KSNumbers object * @param Earth pointer to planet Earth (needed to calculate geocentric coords) * @return true if position was successfully calculated. */ virtual bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) = 0; /** * @short Computes the visual magnitude for the major planets. * @param num pointer to a ksnumbers object. Needed for the saturn rings contribution to * saturn's magnitude. */ virtual void findMagnitude(const KSNumbers *num) = 0; /** * Determine the position angle of the planet for a given date * (used internally by findPosition() ) */ void findPA(const KSNumbers *num); /** Determine the phase of the planet. */ virtual void findPhase(); // Geocentric ecliptic position, but distance to the Sun EclipticPosition ep; // Heliocentric ecliptic position referred to the equinox of the epoch // as obtained from VSOP. EclipticPosition helEcPos; double Rearth; double Phase; QImage m_image; private: /** * @short correct the position for the fact that the location is not at the center of the Earth, * but a position on its surface. This causes a small parallactic shift in a solar system * body's apparent position. The effect is most significant for the Moon. * This function is private, and should only be called from the public findPosition() function. * @param num pointer to a ksnumbers object for the target date/time * @param lat pointer to the geographic latitude of the location. * @param LST pointer to the local sidereal time. */ void localizeCoords(const KSNumbers *num, const CachingDms *lat, const CachingDms *LST); double PositionAngle, AngularSize, PhysicalSize; QColor m_Color; }; diff --git a/kstars/skyobjects/kspluto.h b/kstars/skyobjects/kspluto.h index 8b600aeff..dd16e28d6 100644 --- a/kstars/skyobjects/kspluto.h +++ b/kstars/skyobjects/kspluto.h @@ -1,80 +1,80 @@ /*************************************************************************** kspluto.h - K Desktop Planetarium ------------------- begin : Mon Sep 24 2001 copyright : (C) 2001 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 KSPLUTO_H_ #define KSPLUTO_H_ #include "ksasteroid.h" /** @class KSPluto *A subclass of KSAsteroid that represents the planet Pluto. Now, we *are certainly NOT claiming that Pluto is an asteroid. However, the *findPosition() routines of KSPlanet do not work properly for Pluto. *We had been using a unique polynomial expansion for Pluto, but even *this fails spectacularly for dates much more remote than a few *hundred years. We consider it better to instead treat Pluto's *orbit much more simply, using elliptical orbital elements as we do *for asteroids. In order to improve the long-term accuracy of Pluto's *position, we are also including linear approximations of the evolution *of each orbital element with time. * *The orbital element data (including the time-derivatives) come from *the NASA/JPL website: http://ssd.jpl.nasa.gov/elem_planets.html * *@short Provides necessary information about Pluto. *@author Jason Harris *@version 1.0 */ class KSPluto : public KSAsteroid { public: /** Constructor. Calls KSAsteroid constructor with name="Pluto", and fills *in orbital element data (which is hard-coded for now). *@param kd pointer to the KStarsData object *@param fn filename of Pluto's image *@param pSize physical diameter of Pluto, in km */ explicit KSPluto(const QString &fn = QString(), double pSize = 0); - KSPluto *clone() const Q_DECL_OVERRIDE; + KSPluto *clone() const override; /**Destructor (empty) */ - virtual ~KSPluto(); + ~KSPluto() override; protected: /** A custom findPosition() function for Pluto. Computes the values of the *orbital elements on the requested date, and calls KSAsteroid::findGeocentricPosition() *using those elements. *@param num time-dependent values for the desired date *@param Earth planet Earth (needed to calculate geocentric coords) *@return true if position was successfully calculated. */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override; private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; //The base orbital elements for J2000 (these don't change with time) double a0, e0; dms i0, w0, M0, N0; //Rates-of-change for each orbital element double a1, e1, i1, w1, M1, N1; }; #endif diff --git a/kstars/skyobjects/kssun.h b/kstars/skyobjects/kssun.h index 25aac117e..23f3c69ac 100644 --- a/kstars/skyobjects/kssun.h +++ b/kstars/skyobjects/kssun.h @@ -1,67 +1,67 @@ /*************************************************************************** kssun.h - K Desktop Planetarium ------------------- begin : Sun Jan 29 2002 copyright : (C) 2002 by Mark Hollomon email : mhh@mindspring.com ***************************************************************************/ /*************************************************************************** * * * This program 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 KSSUN_H_ #define KSSUN_H_ #include #include "ksplanet.h" /** @class KSSun *Child class of KSPlanetBase; encapsulates information about the Sun. *@short Provides necessary information about the Sun. *@author Mark Hollomon *@version 1.0 */ class KSSun : public KSPlanet { public: /** Constructor. Defines constants needed by findPosition(). *Sets Ecliptic coordinates appropriate for J2000. *@param kd pointer to KStarsData object */ KSSun(); - KSSun *clone() const Q_DECL_OVERRIDE; - SkyObject::UID getUID() const Q_DECL_OVERRIDE; + KSSun *clone() const override; + SkyObject::UID getUID() const override; /** Destructor (empty) */ - virtual ~KSSun() {} + ~KSSun() override {} /** Read orbital data from disk *@note reimplemented from KSPlanet *@note we actually read Earth's orbital data. The Sun's geocentric *ecliptic coordinates are by definition exactly the opposite of the *Earth's heliocentric ecliptic coordinates. */ - bool loadData() Q_DECL_OVERRIDE; + bool loadData() override; protected: /** Determine geocentric RA, Dec coordinates for the Epoch given in the argument. *@p Epoch current Julian Date *@p Earth pointer to earth object */ - bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) Q_DECL_OVERRIDE; + bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override; private: - void findMagnitude(const KSNumbers *) Q_DECL_OVERRIDE; + void findMagnitude(const KSNumbers *) override; }; long double equinox(int year, int d, int m, int angle); #endif diff --git a/kstars/skyobjects/satellite.h b/kstars/skyobjects/satellite.h index 17c2e601b..4a06d67c1 100644 --- a/kstars/skyobjects/satellite.h +++ b/kstars/skyobjects/satellite.h @@ -1,175 +1,175 @@ /*************************************************************************** satellite.h - K Desktop Planetarium ------------------- begin : Tue 02 Mar 2011 copyright : (C) 2009 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "skyobject.h" #include class KSPopupMenu; /** * @class Satellite * Represents an artificial satellites. * * @author Jérôme SONRIER * @version 0.1 */ class Satellite : public SkyObject { public: /** @short Constructor */ Satellite(const QString &name, const QString &line1, const QString &line2); /** * @return a clone of this object * @note See SkyObject::clone() */ - Satellite *clone() const Q_DECL_OVERRIDE; + Satellite *clone() const override; /** @short Destructor */ - ~Satellite(); + ~Satellite() override; /** @short Update satellite position */ int updatePos(); /** * @return True if the satellite is visible (above horizon, in the sunlight and sun at least 12° under horizon) */ bool isVisible(); /** @return True if the satellite is selected */ bool selected(); /** @short Select or not the satellite */ void setSelected(bool selected); /** @return Satellite velocity in km/s */ double velocity(); /** @return Satellite altitude in km */ double altitude(); /** @return Satellite range from observer in km */ double range(); /** @return Satellite international designator */ QString id(); /** * @brief sgp4ErrorString Get error string associated with sgp4 calculation failure * @param code error code as returned from sgp4() function * @return error string */ QString sgp4ErrorString(int code); - void initPopupMenu(KSPopupMenu *pmenu) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *pmenu) override; private: /** @short Compute non time dependant parameters */ void init(); /** @short Compute satellite position */ int sgp4(double tsince); /** @return Arcsine of the argument */ double arcSin(double arg); /** * Provides the difference between UT (approximately the same as UTC) * and ET (now referred to as TDT). * This function is based on a least squares fit of data from 1950 * to 1991 and will need to be updated periodically. */ double deltaET(double year); /** @return arg1 mod arg2 */ double Modulus(double arg1, double arg2); // TLE /// Satellite Number int m_number { 0 }; /// Security Classification QChar m_class; /// International Designator QString m_id; /// Epoch Year double m_epoch_year { 0 }; /// Epoch (Day of the year and fractional portion of the day) double m_epoch { 0 }; /// First Time Derivative of the Mean Motion double m_first_deriv { 0 }; /// Second Time Derivative of Mean Motion double m_second_deriv { 0 }; /// BSTAR drag term (decimal point assumed) double m_bstar { 0 }; /// Ephemeris type int m_ephem_type { 0 }; /// Element number int m_elem_number { 0 }; /// Inclination [Radians] double m_inclination { 0 }; /// Right Ascension of the Ascending Node [Radians] double m_ra { 0 }; /// Eccentricity double m_eccentricity { 0 }; /// Argument of Perigee [Radians] double m_arg_perigee { 0 }; /// Mean Anomaly [Radians] double m_mean_anomaly { 0 }; /// Mean Motion [Radians per minutes] double m_mean_motion { 0 }; /// Revolution number at epoch [Revs] int m_nb_revolution { 0 }; /// TLE epoch converted to julian date double m_tle_jd { 0 }; // Satellite /// True if the satellite is visible bool m_is_visible { false }; /// True if the satellite is in the shadow of the earth bool m_is_eclipsed { false }; /// True if the satellite is selected bool m_is_selected { false }; /// Satellite velocity in km/s double m_velocity { 0 }; /// Satellite altitude in km double m_altitude { 0 }; /// Satellite range from observer in km double m_range { 0 }; // Near Earth bool isimp { false }; double aycof { 0 }, con41 { 0 }, cc1 { 0 }, cc4 { 0 }, cc5 { 0 }, d2 { 0 }, d3 { 0 }, d4 { 0 }; double delmo { 0 }, eta { 0 }, argpdot { 0 }, omgcof { 0 }, sinmao { 0 }, t { 0 }, t2cof { 0 }; double t3cof { 0 }, t4cof { 0 }, t5cof { 0 }, x1mth2 { 0 }, x7thm1 { 0 }, mdot { 0 }; double nodedot { 0 }, xlcof { 0 }, xmcof { 0 }, nodecf { 0 }; // Deep Space int irez { 0 }; double d2201 { 0 }, d2211 { 0 }, d3210 { 0 }, d3222 { 0 }, d4410 { 0 }, d4422 { 0 }, d5220 { 0 }; double d5232 { 0 }, d5421 { 0 }, d5433 { 0 }, dedt { 0 }, del1 { 0 }, del2 { 0 }, del3 { 0 }; double didt { 0 }, dmdt { 0 }, dnodt { 0 }, domdt { 0 }, e3 { 0 }, ee2 { 0 }, peo { 0 }; double pgho { 0 }, pho { 0 }, pinco { 0 }, plo { 0 }, se2 { 0 }, se3 { 0 }, sgh2 { 0 }; double sgh3 { 0 }, sgh4 { 0 }, sh2 { 0 }, sh3 { 0 }, si2 { 0 }, si3 { 0 }, sl2 { 0 }, sl3 { 0 }; double sl4 { 0 }, gsto { 0 }, xfact { 0 }, xgh2 { 0 }, xgh3 { 0 }, xgh4 { 0 }, xh2 { 0 }; double xh3 { 0 }, xi2 { 0 }, xi3 { 0 }, xl2 { 0 }, xl3 { 0 }, xl4 { 0 }, xlamo { 0 }, zmol { 0 }; double zmos { 0 }, atime { 0 }, xli { 0 }, xni { 0 }; char method; }; diff --git a/kstars/skyobjects/skyobject.h b/kstars/skyobjects/skyobject.h index 49be1a032..c4c3a8ea5 100644 --- a/kstars/skyobjects/skyobject.h +++ b/kstars/skyobjects/skyobject.h @@ -1,477 +1,477 @@ /*************************************************************************** skyobject.h - K Desktop Planetarium ------------------- begin : Sun Feb 11 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "auxinfo.h" #include "dms.h" #include "skypoint.h" #include #include #include #include class QPoint; class GeoLocation; class KStarsDateTime; class KSPopupMenu; /** * @class SkyObject * Provides all necessary information about an object in the sky: * its coordinates, name(s), type, magnitude, and QStringLists of * URLs for images and webpages regarding the object. * @short Information about an object in the sky. * @author Jason Harris * @version 1.0 */ class SkyObject : public SkyPoint { public: /** * @short Type for Unique object IDenticator. * * Each object has unique ID (UID). For different objects UIDs must be different. */ typedef qint64 UID; /** @short Kind of UID */ static const UID UID_STAR; static const UID UID_GALAXY; static const UID UID_DEEPSKY; static const UID UID_SOLARSYS; /** Invalid UID. Real sky object could not have such UID */ static const UID invalidUID; /** * Constructor. Set SkyObject data according to arguments. * @param t Type of object * @param r catalog Right Ascension * @param d catalog Declination * @param m magnitude (brightness) * @param n Primary name * @param n2 Secondary name * @param lname Long name (common name) */ explicit SkyObject(int t = TYPE_UNKNOWN, dms r = dms(0.0), dms d = dms(0.0), float m = 0.0, const QString &n = QString(), const QString &n2 = QString(), const QString &lname = QString()); /** * Constructor. Set SkyObject data according to arguments. Differs from * above function only in data type of RA and Dec. * @param t Type of object * @param r catalog Right Ascension * @param d catalog Declination * @param m magnitude (brightness) * @param n Primary name * @param n2 Secondary name * @param lname Long name (common name) */ SkyObject(int t, double r, double d, float m = 0.0, const QString &n = QString(), const QString &n2 = QString(), const QString &lname = QString()); /** Destructor (empty) */ - virtual ~SkyObject(); + ~SkyObject() override; /** * @short Create copy of object. * This method is virtual copy constructor. It allows for safe * copying of objects. In other words, KSPlanet object stored in * SkyObject pointer will be copied as KSPlanet. * * Each subclass of SkyObject MUST implement clone method. There * is no checking to ensure this, though. * * @return pointer to newly allocated object. Caller takes full responsibility * for deallocating it. */ virtual SkyObject *clone() const; /** * @enum TYPE * The type classification of the SkyObject. * @note Keep TYPE_UNKNOWN at 255. To find out how many known * types exist, keep the NUMBER_OF_KNOWN_TYPES at the highest * non-Unknown value. This is a fake type that can be used in * comparisons and for loops. */ enum TYPE { STAR = 0, CATALOG_STAR = 1, PLANET = 2, OPEN_CLUSTER = 3, GLOBULAR_CLUSTER = 4, GASEOUS_NEBULA = 5, PLANETARY_NEBULA = 6, SUPERNOVA_REMNANT = 7, GALAXY = 8, COMET = 9, ASTEROID = 10, CONSTELLATION = 11, MOON = 12, ASTERISM = 13, GALAXY_CLUSTER = 14, DARK_NEBULA = 15, QUASAR = 16, MULT_STAR = 17, RADIO_SOURCE = 18, SATELLITE = 19, SUPERNOVA = 20, NUMBER_OF_KNOWN_TYPES = 21, TYPE_UNKNOWN = 255 }; /** * @return A translated string indicating the type name for a given type number * @param t The type number * @note Note the existence of a SkyObject::typeName( void ) method that is not static and returns the type of this object. */ static QString typeName(const int t); /** @return object's primary name. */ inline virtual QString name(void) const { return hasName() ? Name : unnamedString; } /** @return object's primary name, translated to local language. */ inline QString translatedName() const { return i18n( name() .toUtf8()); // FIXME: Hmm... that's funny. How does the string extraction work, if we are UTF8-ing the name first? Does the string extraction change to UTF8? } /** @return object's secondary name */ inline QString name2(void) const { return (hasName2() ? Name2 : emptyString); } /** @return object's secondary name, translated to local language. */ inline QString translatedName2() const { return (hasName2() ? i18n(Name2.toUtf8()) : emptyString); } /** * @return object's common (long) name */ virtual QString longname(void) const { return hasLongName() ? LongName : unnamedObjectString; } /** * @return object's common (long) name, translated to local language. */ QString translatedLongName() const { return i18n(longname().toUtf8()); } /** * Set the object's long name. * @param longname the object's long name. */ void setLongName(const QString &longname = QString()); /** * @return the string used to label the object on the map * In the default implementation, this just returns translatedName() * Overridden by StarObject. */ virtual QString labelString() const; /** * @return object's type identifier (int) * @see enum TYPE */ inline int type(void) const { return (int)Type; } /** * Set the object's type identifier to the argument. * @param t the object's type identifier (e.g., "SkyObject::PLANETARY_NEBULA") * @see enum TYPE */ inline void setType(int t) { Type = (unsigned char)t; } /** * @return the type name for this object * @note This just calls the static method by the same name, with the appropriate type number. See SkyObject::typeName( const int ) */ QString typeName() const; /** * @return object's magnitude */ inline float mag() const { return sortMagnitude; } /** * @return the object's position angle. This is overridden in KSPlanetBase * and DeepSkyObject; for all other SkyObjects, this returns 0.0. */ inline virtual double pa() const { return 0.0; } /** * @return true if the object is a solar system body. */ inline bool isSolarSystem() const { return (type() == 2 || type() == 9 || type() == 10 || type() == 12); } /** * Initialize the popup menut. This function should call correct * initialization function in KSPopupMenu. By overloading the * function, we don't have to check the object type when we need * the menu. */ virtual void initPopupMenu(KSPopupMenu *pmenu); /** Show Type-specific popup menu. Oveloading is done in the function initPopupMenu */ void showPopupMenu(KSPopupMenu *pmenu, const QPoint &pos); /** * Determine the time at which the point will rise or set. Because solar system * objects move across the sky, it is necessary to iterate on the solution. * We compute the rise/set time for the object's current position, then * compute the object's position at that time. Finally, we recompute then * rise/set time for the new coordinates. Further iteration is not necessary, * even for the most swiftly-moving object (the Moon). * @return the local time that the object will rise * @param dt current UT date/time * @param geo current geographic location * @param rst If true, compute rise time. If false, compute set time. * @param exact If true, use a second iteration for more accurate time */ QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact = true) const; /** * @return the UT time when the object will rise or set * @param dt target date/time * @param geo pointer to Geographic location * @param rst Boolean. If true will compute rise time. If false * will compute set time. * @param exact If true, use a second iteration for more accurate time */ QTime riseSetTimeUT(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact = true) const; /** * @return the Azimuth time when the object will rise or set. This function * recomputes set or rise UT times. * @param dt target date/time * @param geo GeoLocation object * @param rst Boolen. If true will compute rise time. If false * will compute set time. */ dms riseSetTimeAz(const KStarsDateTime &dt, const GeoLocation *geo, bool rst) const; /** * The same iteration technique described in riseSetTime() is used here. * @return the local time that the object will transit the meridian. * @param dt target date/time * @param geo pointer to the geographic location */ QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const; /** * @return the universal time that the object will transit the meridian. * @param dt target date/time * @param geo pointer to the geographic location */ QTime transitTimeUT(const KStarsDateTime &dt, const GeoLocation *geo) const; /** * @return the altitude of the object at the moment it transits the meridian. * @param dt target date/time * @param geo pointer to the geographic location */ dms transitAltitude(const KStarsDateTime &dt, const GeoLocation *geo) const; /** * The equatorial coordinates for the object on date dt are computed and returned, * but the object's internal coordinates are not modified. * @return the coordinates of the selected object for the time given by jd * @param dt date/time for which the coords will be computed. * @param geo pointer to geographic location (used for solar system only) * @note Does not update the horizontal coordinates. Call EquatorialToHorizontal for that. */ SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo = 0) const; /** * @short Like recomputeCoords, but also calls EquatorialToHorizontal before returning */ SkyPoint recomputeHorizontalCoords(const KStarsDateTime &dt, const GeoLocation *geo) const; inline bool hasName() const { return !Name.isEmpty(); } inline bool hasName2() const { return !Name2.isEmpty(); } inline bool hasLongName() const { return !LongName.isEmpty(); } /** * @short Given the Image title from a URL file, try to convert it to an image credit string. */ QString messageFromTitle(const QString &imageTitle) const; /** * @short Save new user log text */ void saveUserLog(const QString &newLog); /** * @return the pixel distance for offseting the object's name label * @note overridden in StarObject, DeepSkyObject, KSPlanetBase */ virtual double labelOffset() const; /** * @short Query whether this SkyObject has a valid AuxInfo structure associated with it. * @return true if this SkyObject has a valid AuxInfo structure associated with it, false if not. */ inline bool hasAuxInfo() const { return !(!info); } /** * @return A reference to a QStringList storing a list of Image URLs associated with this SkyObject. */ inline QStringList &ImageList() { return getAuxInfo()->ImageList; } /** * @return A reference to a QStringList storing a list of Image Titles associated with this SkyObject. */ inline QStringList &ImageTitle() { return getAuxInfo()->ImageTitle; } /** * @return A reference to a QStringList storing a list of Information Links associated with * this SkyObject. */ inline QStringList &InfoList() { return getAuxInfo()->InfoList; } /** * @return A reference to a QStringList storing a list of Information Link Titles associated with * this SkyObject. */ inline QStringList &InfoTitle() { return getAuxInfo()->InfoTitle; } /** * @return a reference to a QString storing the users' log for this SkyObject */ inline QString &userLog() { return getAuxInfo()->userLog; } inline QString ¬es() { return getAuxInfo()->notes; } void setNotes(QString _notes) { getAuxInfo()->notes = _notes; } /** * @short Return UID for object. * This method should be reimplemented in all concrete * subclasses. Implementation for SkyObject just returns * invalidUID. It's required SkyObject is not an abstract class. */ virtual UID getUID() const; private: /** * Compute the UT time when the object will rise or set. It is an auxiliary * procedure because it does not use the RA and DEC of the object but values * given as parameters. You may want to use riseSetTimeUT() which is * public. riseSetTimeUT() calls this function iteratively. * @param dt target date/time * @param geo pointer to Geographic location * @param righta pointer to Right ascention of the object * @param decl pointer to Declination of the object * @param rst Boolean. If true will compute rise time. If false * will compute set time. * @return the time at which the given position will rise or set. */ QTime auxRiseSetTimeUT(const KStarsDateTime &dt, const GeoLocation *geo, const dms *righta, const dms *decl, bool riseT) const; /** * Compute the LST time when the object will rise or set. It is an auxiliary * procedure because it does not use the RA and DEC of the object but values * given as parameters. You may want to use riseSetTimeLST() which is * public. riseSetTimeLST() calls this function iteratively. * @param gLt Geographic latitude * @param rga Right ascention of the object * @param decl Declination of the object * @param rst Boolean. If true will compute rise time. If false * will compute set time. */ dms auxRiseSetTimeLST(const dms *gLt, const dms *rga, const dms *decl, bool rst) const; /** * Compute the approximate hour angle that an object with declination d will have * when its altitude is h (as seen from geographic latitude gLat). * This function is only used by auxRiseSetTimeLST(). * @param h pointer to the altitude of the object * @param gLat pointer to the geographic latitude * @param d pointer to the declination of the object. * @return the Hour Angle, in degrees. */ double approxHourAngle(const dms *h, const dms *gLat, const dms *d) const; /** * Correct for the geometric altitude of the center of the body at the * time of rising or setting. This is due to refraction at the horizon * and to the size of the body. The moon correction has also to take into * account parallax. The value we use here is a rough approximation * suggested by J. Meeus. * * Weather status (temperature and pressure basically) is not taken * into account although change of conditions between summer and * winter could shift the times of sunrise and sunset by 20 seconds. * * This function is only used by auxRiseSetTimeLST(). * @return dms object with the correction. */ dms elevationCorrection(void) const; /** * @short Return a pointer to the AuxInfo object associated with this SkyObject. * @note This method creates the AuxInfo object if it is non-existent * @return Pointer to an AuxInfo structure */ AuxInfo *getAuxInfo(); // FIXME: Can this be made conceptually const or the like? unsigned char Type; float sortMagnitude; // This magnitude is used for sorting / making decisions about the visibility of an object. Should not be NaN. protected: /** * Set the object's sorting magnitude. * @param m the object's magnitude. */ inline void setMag(float m) { sortMagnitude = m < 36.0 ? m : NaN:: f; // Updating faintest sane magnitude to 36.0 (faintest visual magnitude visible with E-ELT, acc. to Wikipedia on Apparent Magnitude.) } // FIXME: We claim sortMagnitude should not be NaN, but we are setting it to NaN above!! ^ /** * Set the object's primary name. * @param name the object's primary name */ inline void setName(const QString &name) { Name = name; } /** * Set the object's secondary name. * @param name2 the object's secondary name. */ inline void setName2(const QString &name2 = QString()) { Name2 = name2; } QString Name, Name2, LongName; // Pointer to an auxiliary info structure that stores Image URLs, Info URLs etc. QSharedDataPointer info; // store often used name strings in static variables static QString emptyString; static QString unnamedString; static QString unnamedObjectString; static QString starString; }; diff --git a/kstars/skyobjects/starobject.h b/kstars/skyobjects/starobject.h index f1a713955..9e22139fb 100644 --- a/kstars/skyobjects/starobject.h +++ b/kstars/skyobjects/starobject.h @@ -1,307 +1,307 @@ /*************************************************************************** starobject.h - K Desktop Planetarium ------------------- begin : Tue Sep 18 2001 copyright : (C) 2001 by Thomas Kabelmann email : tk78@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once //#define PROFILE_UPDATECOORDS #include "skyobject.h" #include struct DeepStarData; class KSNumbers; class KSPopupMenu; struct StarData; /** @class StarObject *This is a subclass of SkyObject. It adds the Spectral type, and flags *for variability and multiplicity. *For stars, the primary name (n) is the latin name (e.g., "Betelgeuse"). The *secondary name (n2) is the genetive name (e.g., "alpha Orionis"). *@short subclass of SkyObject specialized for stars. *@author Thomas Kabelmann *@version 1.0 */ class StarObject : public SkyObject { public: /** @short returns the reindex interval (in centuries!) for the given * magnitude of proper motion (in milliarcsec/year). ASSUMING a * 25 arc-minute margin for proper motion. */ static double reindexInterval(double pm); /** *Constructor. Sets sky coordinates, magnitude, latin name, genetive name, and *spectral type. *@param r Right Ascension *@param d Declination *@param m magnitude *@param n common name *@param n2 genetive name *@param sptype Spectral Type *@param pmra Proper motion in RA direction [mas/yr] *@param pmdec Proper motion in Dec direction [mas/yr] *@param par Parallax angle [mas] *@param mult Multiplicity flag (false=dingle star; true=multiple star) *@param var Variability flag (true if star is a known periodic variable) *@param hd Henry Draper Number */ explicit StarObject(dms r = dms(0.0), dms d = dms(0.0), float m = 0.0, const QString &n = QString(), const QString &n2 = QString(), const QString &sptype = "--", double pmra = 0.0, double pmdec = 0.0, double par = 0.0, bool mult = false, bool var = false, int hd = 0); /** *Constructor. Sets sky coordinates, magnitude, latin name, genetive name, and *spectral type. Differs from above function only in data type of RA and Dec. *@param r Right Ascension *@param d Declination *@param m magnitude *@param n common name *@param n2 genetive name *@param sptype Spectral Type *@param pmra Proper motion in RA direction [mas/yr] *@param pmdec Proper motion in Dec direction [mas/yr] *@param par Parallax angle [mas] *@param mult Multiplicity flag (false=dingle star; true=multiple star) *@param var Variability flag (true if star is a known periodic variable) *@param hd Henry Draper Number */ StarObject(double r, double d, float m = 0.0, const QString &n = QString(), const QString &n2 = QString(), const QString &sptype = "--", double pmra = 0.0, double pmdec = 0.0, double par = 0.0, bool mult = false, bool var = false, int hd = 0); - StarObject *clone() const Q_DECL_OVERRIDE; - UID getUID() const Q_DECL_OVERRIDE; + StarObject *clone() const override; + UID getUID() const override; /** Copy constructor */ StarObject(const StarObject &o); /** Destructor. (Empty) */ - ~StarObject() {} + ~StarObject() override {} /** *@short Initializes a StarObject to given data * * This is almost like the StarObject constructor itself, but it avoids * setting up name, gname etc for unnamed stars. If called instead of the * constructor, this method will be much faster for unnamed stars * *@param stardata Pointer to starData object containing required data (except name and gname) *@return Nothing */ void init(const StarData *stardata); /** *@short Initializes a StarObject to given data * *@param stardata Pointer to deepStarData object containing the available data *@return Nothing */ void init(const DeepStarData *stardata); /** *@short Sets the name, genetive name, and long name * *@param name Common name *@param name2 Genetive name */ void setNames(const QString &name, const QString &name2); /** @return true if the star has a name ("star" doesn't count) */ inline bool hasName() const { return (!Name.isEmpty() && Name != starString); } /** @return true if the star has a latin name ("star" or HD... doesn't count) */ inline bool hasLatinName() const { return (!Name.isEmpty() && Name != starString && Name != gname(false) && Name != gname(true) && !Name.startsWith("HD ")); } /** If star is unnamed return "star" otherwise return the name */ - inline virtual QString name(void) const Q_DECL_OVERRIDE { return hasName() ? Name : starString; } + inline QString name(void) const override { return hasName() ? Name : starString; } /** If star is unnamed return "star" otherwise return the longname */ - inline virtual QString longname(void) const Q_DECL_OVERRIDE { return hasLongName() ? LongName : starString; } + inline QString longname(void) const override { return hasLongName() ? LongName : starString; } /** Returns entire spectral type string * @return Spectral Type string */ QString sptype(void) const; /** Returns just the first character of the spectral type string. */ char spchar() const; /** Returns the genetive name of the star. * @return genetive name of the star */ QString gname(bool useGreekChars = true) const; /** Returns the greek letter portion of the star's genetive name. * Returns empty string if star has no genetive name defined. * @return greek letter portion of genetive name */ QString greekLetter(bool useGreekChars = true) const; /** @return the genitive form of the star's constellation. */ QString constell(void) const; /** Determine the current coordinates (RA, Dec) from the catalog * coordinates (RA0, Dec0), accounting for both precession and nutation. * @param num pointer to KSNumbers object containing current values of * time-dependent variables. * @param includePlanets does nothing in this implementation (see KSPlanetBase::updateCoords()). * @param lat does nothing in this implementation (see KSPlanetBase::updateCoords()). * @param LST does nothing in this implementation (see KSPlanetBase::updateCoords()). */ void updateCoords(const KSNumbers *num, bool includePlanets = true, const CachingDms *lat = 0, - const CachingDms *LST = 0, bool forceRecompute = false) Q_DECL_OVERRIDE; + const CachingDms *LST = 0, bool forceRecompute = false) override; /** @short fills ra and dec with the coordinates of the star with the proper * motion correction but without precesion and its friends. It is used * in StarComponent to re-index all the stars. * * @return true if we changed the coordinates, false otherwise * NOTE: ra and dec both in degrees. */ bool getIndexCoords(const KSNumbers *num, CachingDms &ra, CachingDms &dec); bool getIndexCoords(const KSNumbers *num, double *ra, double *dec); /** @short added for JIT updates from both StarComponent and ConstellationLines */ void JITupdate(); /** @short returns the magnitude of the proper motion correction in milliarcsec/year */ inline double pmMagnitude() const { double cosDec = dec0().cos(); return sqrt(cosDec * cosDec * pmRA() * pmRA() + pmDec() * pmDec()); } /** *@short returns the square of the magnitude of the proper motion correction in (milliarcsec/year)^2 *@note This method is faster when the square root need not be taken */ inline double pmMagnitudeSquared() const { double metric_weighted_pmRA = dec0().cos() * pmRA(); return (metric_weighted_pmRA * metric_weighted_pmRA + pmDec() * pmDec()); } /** @short Set the Ra and Dec components of the star's proper motion, in milliarcsec/year. * Note that the RA component is multiplied by cos(dec). * @param pmra the new RA propoer motion * @param pmdec the new Dec proper motion */ inline void setProperMotion(double pmra, double pmdec) { PM_RA = pmra; PM_Dec = pmdec; } /** @return the RA component of the star's proper motion, in mas/yr (multiplied by cos(dec)) */ inline double pmRA() const { return PM_RA; } /** @return the Dec component of the star's proper motion, in mas/yr */ inline double pmDec() const { return PM_Dec; } /** @short set the star's parallax angle, in milliarcsec */ inline void setParallax(double plx) { Parallax = plx; } /** @return the star's parallax angle, in milliarcsec */ inline double parallax() const { return Parallax; } /** @return the star's distance from the Sun in parsecs, as computed from the parallax. */ inline double distance() const { return 1000. / parallax(); } /** @short set the star's multiplicity flag (i.e., is it a binary or multiple star?) * @param m true if binary/multiple star system */ inline void setMultiple(bool m) { Multiplicity = m; } /** @return whether the star is a binary or multiple starobject */ inline bool isMultiple() const { return Multiplicity; } /** @return the star's HD index */ inline int getHDIndex() const { return HD; } /** @short set the star's variability flag *@param v true if star is variable */ inline void setVariable(bool v) { Variability = v; } /** @return whether the star is a binary or multiple starobject */ inline bool isVariable() const { return Variability; } /** @short returns the name, the magnitude or both. */ QString nameLabel(bool drawName, bool drawMag) const; - QString labelString() const Q_DECL_OVERRIDE; + QString labelString() const override; /** *@return the pixel distance for offseting the star's name label *This takes the zoom level and the star's brightness into account. */ - double labelOffset() const Q_DECL_OVERRIDE; + double labelOffset() const override; /** *@return the Visual magnitude of the star */ inline float getVMag() const { return V; } /** *@return the blue magnitude of the star */ inline float getBMag() const { return B; } /** *@return the B - V color index of the star, or a nonsense number *larger than 30 if it's not well defined */ inline float getBVIndex() const { return ((B < 30.0 && V < 30.0) ? B - V : 99.9); } - void initPopupMenu(KSPopupMenu *pmenu) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *pmenu) override; quint64 updateID; quint64 updateNumID; #ifdef PROFILE_UPDATECOORDS static double updateCoordsCpuTime; static unsigned int starsUpdated; #endif protected: // DEBUG EDIT. For testing proper motion, uncomment this, and related blocks // See starobject.cpp for further info. // static QVector Trail; // bool testStar; // END DEBUG private: double PM_RA { 0 }; double PM_Dec { 0 }; double Parallax { 0 }; bool Multiplicity { false }; bool Variability { false }; char SpType[2]; int HD { 0 }; // B and V magnitudes, separately. NOTE 1) This is kept separate from mag for a reason. // See init( const DeepStarData *); 2) This applies only to deep stars at the moment float B { 0 }; float V { 0 }; }; diff --git a/kstars/skyobjects/supernova.h b/kstars/skyobjects/supernova.h index 04eb2a6c8..e89ff21e8 100644 --- a/kstars/skyobjects/supernova.h +++ b/kstars/skyobjects/supernova.h @@ -1,79 +1,79 @@ /* Supernova Object Copyright (C) 2016 Jasem Mutlaq Based on Samikshan Bairagya GSoC work. 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 SUPERNOVA_H #define SUPERNOVA_H #include "skyobject.h" /** * @class Supernova * Represents the supernova object. It is a subclass of the SkyObject class. * This class has the information for different supernovae. * * N.B. This was modified to use the Open Supernova Project * @author Samikshan Bairagya * @author Jasem Mutlaq */ /** * @note The Data File Contains the following parameters * @li sName Designation * @li RA Right Ascension * @li Dec Declination * @li type Supernova Type * @li hostGalaxy Host Galaxy for the supernova * @li date Discovery date yyyy/mm/dd * @li sRedShift Redshift * @li sMag Maximum Apparent magnitude */ class Supernova : public SkyObject { public: explicit Supernova(const QString &sName, dms ra, dms dec, const QString &type = QString(), const QString &hostGalaxy = QString(), const QString &date = QString(), float sRedShift = 0.0, float sMag = 99.9); /** * @return a clone of this object * @note See SkyObject::clone() */ - Supernova *clone() const Q_DECL_OVERRIDE; + Supernova *clone() const override; /** Destructor(Empty) */ - virtual ~Supernova() {} + ~Supernova() override {} /** * @return the type of the supernova */ inline QString getType() const { return type; } /** * @return the host galaxy of the supernova */ inline QString getHostGalaxy() const { return hostGalaxy; } /** * @return the date the supernova was observed */ inline QString getDate() const { return date; } /** * @return the date the supernova was observed */ inline float getRedShift() const { return redShift; } - void initPopupMenu(KSPopupMenu *) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *) override; private: QString type, hostGalaxy, date; float redShift; }; #endif diff --git a/kstars/skyobjects/trailobject.h b/kstars/skyobjects/trailobject.h index 3061aad1a..b2e49c06f 100644 --- a/kstars/skyobjects/trailobject.h +++ b/kstars/skyobjects/trailobject.h @@ -1,85 +1,85 @@ /*************************************************************************** trailobject.h - K Desktop Planetarium ------------------- begin : Sat Oct 27 2007 copyright : (C) 2007 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 TRAILOBJECT_H_ #define TRAILOBJECT_H_ #include #include "skyobject.h" class SkyPainter; /** *@class TrailObject *@short provides a SkyObject with an attachable Trail *@author Jason Harris *@version 1.0 */ class TrailObject : public SkyObject { public: /** Constructor */ explicit TrailObject(int t = TYPE_UNKNOWN, dms r = dms(0.0), dms d = dms(0.0), float m = 0.0, const QString &n = QString()); /** Constructor */ TrailObject(int t, double r, double d, float m = 0.0, const QString &n = QString()); - virtual ~TrailObject(); + ~TrailObject() override; - TrailObject *clone() const Q_DECL_OVERRIDE; + TrailObject *clone() const override; /** @return whether the planet has a trail */ inline bool hasTrail() const { return (Trail.count() > 0); } /** @return a reference to the planet's trail */ inline const QList &trail() const { return Trail; } /** @short adds a point to the planet's trail */ void addToTrail(const QString &label = QString()); /** @short removes the oldest point from the trail */ void clipTrail(); /** @short clear the Trail */ void clearTrail(); /** @short update Horizontal coords of the trail */ void updateTrail(dms *LST, const dms *lat); /**Remove trail for all objects but one which is passed as * parameter. It has SkyObject type for generality. */ static void clearTrailsExcept(SkyObject *o); void drawTrail(SkyPainter *skyp) const; /** Maximum trail size */ static const int MaxTrail = 400; - void initPopupMenu(KSPopupMenu *pmenu) Q_DECL_OVERRIDE; + void initPopupMenu(KSPopupMenu *pmenu) override; protected: QList Trail; QList m_TrailLabels; /// Store list of objects with trails. static QSet trailObjects; private: }; #endif diff --git a/kstars/skyqpainter.h b/kstars/skyqpainter.h index 00a1d5db4..addad4bfb 100644 --- a/kstars/skyqpainter.h +++ b/kstars/skyqpainter.h @@ -1,114 +1,114 @@ /* (C) 2010 Henry de Valence This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include "skypainter.h" #include #include class Projector; class QWidget; class QSize; class QMessageBox; class HIPSRenderer; /** * @short The QPainter-based painting backend. * This class implements the SkyPainter interface using a QPainter. * For documentation, @see SkyPainter. */ class SkyQPainter : public SkyPainter, public QPainter { public: /** Release the image cache */ static void releaseImageCache(); /** * @short Creates a SkyQPainter with the given QPaintDevice and uses the dimensions of the paint device as canvas dimensions * @param pd the painting device. Cannot be 0 * @param canvasSize the size of the canvas */ SkyQPainter(QPaintDevice *pd, const QSize &canvasSize); /** * @short Creates a SkyQPainter with the given QPaintDevice and given canvas size * @param pd the painting device. Cannot be 0 */ explicit SkyQPainter(QPaintDevice *pd); /** * @short Creates a SkyQPainter given a QWidget and an optional QPaintDevice. * @param widget the QWidget that provides the canvas size, and also the paint device unless @p pd is specified * @param pd the painting device. If 0, then @p widget will be used. */ explicit SkyQPainter(QWidget *widget, QPaintDevice *pd = nullptr); - virtual ~SkyQPainter(); + ~SkyQPainter() override; - void setPen(const QPen &pen) Q_DECL_OVERRIDE; - void setBrush(const QBrush &brush) Q_DECL_OVERRIDE; + void setPen(const QPen &pen) override; + void setBrush(const QBrush &brush) override; /** * @param vectorStars Draw stars as vector graphics whenever possible. * @note Drawing stars as vectors is slower, but is better when saving .svg files. Set to true only when you are drawing on a canvas where speed doesn't matter. Definitely not when drawing on the SkyMap. */ inline void setVectorStars(bool vectorStars) { m_vectorStars = vectorStars; } inline bool getVectorStars() const { return m_vectorStars; } - void begin() Q_DECL_OVERRIDE; - void end() Q_DECL_OVERRIDE; + void begin() override; + void end() override; /** Recalculates the star pixmaps. */ static void initStarImages(); // Sky drawing functions - void drawSkyBackground() Q_DECL_OVERRIDE; - void drawSkyLine(SkyPoint *a, SkyPoint *b) Q_DECL_OVERRIDE; + void drawSkyBackground() override; + void drawSkyLine(SkyPoint *a, SkyPoint *b) override; void drawSkyPolyline(LineList *list, SkipHashList *skipList = nullptr, - LineListLabel *label = nullptr) Q_DECL_OVERRIDE; - void drawSkyPolygon(LineList *list, bool forceClip = true) Q_DECL_OVERRIDE; - bool drawPointSource(SkyPoint *loc, float mag, char sp = 'A') Q_DECL_OVERRIDE; - bool drawDeepSkyObject(DeepSkyObject *obj, bool drawImage = false) Q_DECL_OVERRIDE; - bool drawPlanet(KSPlanetBase *planet) Q_DECL_OVERRIDE; - void drawObservingList(const QList &obs) Q_DECL_OVERRIDE; - void drawFlags() Q_DECL_OVERRIDE; - void drawHorizon(bool filled, SkyPoint *labelPoint = nullptr, bool *drawLabel = nullptr) Q_DECL_OVERRIDE; - bool drawSatellite(Satellite *sat) Q_DECL_OVERRIDE; + LineListLabel *label = nullptr) override; + void drawSkyPolygon(LineList *list, bool forceClip = true) override; + bool drawPointSource(SkyPoint *loc, float mag, char sp = 'A') override; + bool drawDeepSkyObject(DeepSkyObject *obj, bool drawImage = false) override; + bool drawPlanet(KSPlanetBase *planet) override; + void drawObservingList(const QList &obs) override; + void drawFlags() override; + void drawHorizon(bool filled, SkyPoint *labelPoint = nullptr, bool *drawLabel = nullptr) override; + bool drawSatellite(Satellite *sat) override; virtual void drawDeepSkySymbol(const QPointF &pos, int type, float size, float e, float positionAngle); - bool drawSupernova(Supernova *sup) Q_DECL_OVERRIDE; - bool drawComet(KSComet *com) Q_DECL_OVERRIDE; + bool drawSupernova(Supernova *sup) override; + bool drawComet(KSComet *com) override; /// This function exists so that we can draw other objects (e.g., planets) as point sources. virtual void drawPointSource(const QPointF &pos, float size, char sp = 'A'); - bool drawConstellationArtImage(ConstellationsArt *obj) Q_DECL_OVERRIDE; - bool drawHips() Q_DECL_OVERRIDE; + bool drawConstellationArtImage(ConstellationsArt *obj) override; + bool drawHips() override; private: virtual bool drawDeepSkyImage(const QPointF &pos, DeepSkyObject *obj, float positionAngle); QPaintDevice *m_pd { nullptr }; const Projector *m_proj { nullptr }; bool m_vectorStars { false }; HIPSRenderer *m_hipsRender { nullptr }; QSize m_size; static int starColorMode; static QColor m_starColor; static QMap ColorMap; }; diff --git a/kstars/tools/adddeepskyobject.h b/kstars/tools/adddeepskyobject.h index 50ce41426..a3d37aacc 100644 --- a/kstars/tools/adddeepskyobject.h +++ b/kstars/tools/adddeepskyobject.h @@ -1,60 +1,60 @@ /*************************************************************************** adddeepskyobject.h - K Desktop Planetarium ------------------- begin : Wed 17 Aug 2016 20:23:05 CDT copyright : (c) 2016 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_adddeepskyobject.h" class QString; class SyncedCatalogComponent; /** * @class AddDeepSkyObject * @short Allows the user to add an object to a @sa SyncedCatalogComponent * * @author Akarsh Simha */ class AddDeepSkyObject : public QDialog, public Ui::AddDeepSkyObject { Q_OBJECT; public: /** @short Constructor */ AddDeepSkyObject(QWidget *parent, SyncedCatalogComponent *catalog); /** @short Destructor */ - ~AddDeepSkyObject(); + ~AddDeepSkyObject() override; /** @short Fills the dialog from a text by trying to guess fields */ void fillFromText(const QString &text); public slots: /** @short Accept the dialog and add the entry to the catalog */ bool slotOk(); /** @short Resets the entries in the dialog */ void resetView(); /** @short Gathers the text and calls fillFromText() to parse the text */ void slotFillFromText(); private: SyncedCatalogComponent *m_catalog { nullptr }; Ui::AddDeepSkyObject *ui { nullptr }; }; diff --git a/kstars/tools/altvstime.h b/kstars/tools/altvstime.h index 3f8364e35..4c84d5f4b 100644 --- a/kstars/tools/altvstime.h +++ b/kstars/tools/altvstime.h @@ -1,209 +1,209 @@ /*************************************************************************** altvstime.h - description ------------------- begin : Mon Dec 23 2002 copyright : (C) 2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include "ui_altvstime.h" class QCPAbstractPlottable; class QCPItemPixmap; class QCPRange; class QMouseEvent; class QPixmap; class GeoLocation; class KStarsDateTime; class SkyObject; class SkyPoint; class AltVsTimeUI : public QFrame, public Ui::AltVsTime { Q_OBJECT public: explicit AltVsTimeUI(QWidget *p = 0); }; /** * @class AltVsTime * @short the Altitude vs. Time Tool. * Plot the altitude as a function of time for any list of * objects, as seen from any location, on any date. * * @author Jason Harris */ class AltVsTime : public QDialog { Q_OBJECT public: /** Constructor */ explicit AltVsTime(QWidget *parent = nullptr); /** Destructor */ - ~AltVsTime(); + ~AltVsTime() override; /** * Determine the limits for the sideral time axis, using * the sidereal time at midnight for the current date * and location settings. */ void setLSTLimits(); /** * Set the AltVsTime Date according to the current Date * in the KStars main window. Currently, this is only * used in the ctor to initialize the Date. */ void showCurrentDate(); /** * @return a KStarsDateTime object constructed from the * current setting in the Date widget. */ KStarsDateTime getDate(); /** * Determine the time of sunset and sunrise for the current * date and location settings. Convert the times to doubles, * expressing the times as fractions of a full day. * Calls AVTPlotWidget::setSunRiseSetTimes() to send the * numbers to the plot widget. */ void computeSunRiseSetTimes(); /** * Parse a string as an epoch number. If the string can't * be parsed, return 2000.0. * @param eName the epoch string to be parsed * @return the epoch number */ double getEpoch(const QString &eName); /** * @short Add a SkyObject to the display. * Constructs a PLotObject representing the Alt-vs-time curve for the object. * @param o pointer to the SkyObject to be added * @param forceAdd if true, then the object will be added, even if there * is already a curve for the same coordinates. */ void processObject(SkyObject *o, bool forceAdd = false); /** * @short Determine the altitude coordinate of a SkyPoint, * given an hour of the day. * * This is called for every 30-minute interval in the displayed Day, * in order to construct the altitude curve for a given object. * @param p the skypoint whose altitude is to be found * @param hour the time in the displayed day, expressed in hours * @return the Altitude, expresse in degrees */ double findAltitude(SkyPoint *p, double hour); /** * @short get object name. If star has no name, generate a name based on catalog number. * @param translated set to true if the translated name is required. */ QString getObjectName(const SkyObject *o, bool translated = true); void drawGradient(); public slots: /** @short Update the plot to reflec new Date and Location settings. */ void slotUpdateDateLoc(); /** @short Clear the list of displayed objects. */ void slotClear(); /** @short Show information from the curve as a tooltip. */ void plotMousePress(QCPAbstractPlottable *abstractPlottable, int dataIndex, QMouseEvent *event); /** @short Update the X axis on Zoom and Drag. */ void onXRangeChanged(const QCPRange &range); /** @short Update the Y axis on Zoom and Drag. */ void onYRangeChanged(const QCPRange &range); /** @short Compute the altitude for a certain time. */ void slotComputeAltitudeByTime(); /** @short Mark the rise time on the curve. */ void slotMarkRiseTime(); /** @short Mark the set time on the curve. */ void slotMarkSetTime(); /** @short Mark the transit time on the curve. */ void slotMarkTransitTime(); /** @short Draw the white vertical line on click. */ void mouseOverLine(QMouseEvent *event); /** @short Clear the edit boxes for specifying a new object. */ void slotClearBoxes(); /** * @short Add an object to the list of displayed objects, according * to the data entered in the edit boxes. */ void slotAddSource(); /** * @short Launch the Find Object window to select a new object for * the list of displayed objects. */ void slotBrowseObject(); /** @short Launch the Location dialog to choose a new location. */ void slotChooseCity(); /** * @short Move input keyboard focus to the next logical widget. * We need a separate slot for this because we are intercepting * Enter key events, which close the window by default, to * advance input focus instead (when the Enter events occur in * certain Edit boxes). */ void slotAdvanceFocus(); /** * Update the plot to highlight the altitude curve of the objects * which is highlighted in the listbox. */ void slotHighlight(int); /** @short Print plot widget */ void slotPrint(); private: /** @short find start of dawn, end of dusk, maximum and minimum elevation of the sun */ void setDawnDusk(); AltVsTimeUI *avtUI { nullptr }; GeoLocation *geo { nullptr }; QList pList; QList deleteList; int DayOffset { 0 }; int minAlt { 0 }; int maxAlt { 0 }; QCPItemPixmap *background { nullptr }; QPixmap *gradient { nullptr }; }; diff --git a/kstars/tools/astrocalc.h b/kstars/tools/astrocalc.h index 5fe58944f..1050b62f2 100644 --- a/kstars/tools/astrocalc.h +++ b/kstars/tools/astrocalc.h @@ -1,111 +1,111 @@ /*************************************************************************** astrocalc.h - description ------------------- begin : wed dec 19 16:20:11 CET 2002 copyright : (C) 2001-2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include class QStackedWidget; class QTextEdit; class QTreeWidget; class QTreeWidgetItem; /** * @class AstroCalc is the base class for the KStars astronomical calculator * * @author: Pablo de Vicente * @version 0.9 */ class AstroCalc : public QDialog { Q_OBJECT public: explicit AstroCalc(QWidget *parent = nullptr); /** @return suggested size of calculator window. */ - QSize sizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const override; public slots: // Q: Why is this public when we don't have access to navigationPanel anyway? // Also doesn't seem to be used from outside -- asimha /** Display calculator module or help text based on item selected. */ void slotItemSelection(QTreeWidgetItem *it); private: /** Pointer to function which return QWidget */ typedef QWidget *(AstroCalc::*WidgetConstructor)(); /** * Data structure used for lazy widget construction. This class * construct widget when it requested. */ class WidgetThunk { public: /** * Create thunk * @param acalc pointer to class. * @param f function which construct widget. */ WidgetThunk(AstroCalc *acalc, const WidgetConstructor& f) : widget(0), calc(acalc), func(f) { } /** * Request widget. * @return newly created widget or cached value. */ QWidget *eval(); private: /// Cached value QWidget *widget { nullptr }; /// Pointer to calculator AstroCalc *calc { nullptr }; /// Function call to construct the widget. WidgetConstructor func; }; /** * Create widget of type T and put it to widget stack. Widget must * have construtor of type T(QWidget*). Returns constructed widget. */ template inline QWidget *addToStack(); /** * Add top level item to navigation panel. At the same time adds item to htmlTable * @param title name of item * @param html string to be displayed in splash screen */ QTreeWidgetItem *addTreeTopItem(QTreeWidget *parent, const QString &title, const QString &html); /** * Add item to navigation panel. At the same time adds item to dispatchTable Template * parameter is type of widget to be constructed and added to widget stack. It must * have T() constructor. * @param title name of item */ template QTreeWidgetItem *addTreeItem(QTreeWidgetItem *parent, const QString &title); /** Lookup table for help texts. Maps navpanel item to help text. */ QMap htmlTable; /** Lookup table for widgets. Maps navpanel item to widget to be displayed. */ QMap dispatchTable; QTreeWidget *navigationPanel { nullptr }; QStackedWidget *acStack { nullptr }; QTextEdit *splashScreen { nullptr }; }; diff --git a/kstars/tools/avtplotwidget.h b/kstars/tools/avtplotwidget.h index da19b04fa..1c7d43c94 100644 --- a/kstars/tools/avtplotwidget.h +++ b/kstars/tools/avtplotwidget.h @@ -1,109 +1,109 @@ /*************************************************************************** avtplotwidget.h - description ------------------- begin : Sat Nov 10 2007 copyright : (C) 2007 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include class GeoLocation; /** * @class AVTPlotWidget * @short An extension of the KPlotWidget for the AltVsTime tool. * The biggest difference is that in addition to the plot objects, it draws the "ground" below * Alt=0 and draws the sky light blue for day times, and black for night times. The transition * between day and night is drawn with a gradient, and the position follows the actual * sunrise/sunset times of the given date/location. Also, this plot widget provides two * time axes (local time along the bottom, and local sideral time along the top). Finally, it * provides user interaction: on mouse click, it draws crosshairs at the mouse position with * labels for the time and altitude. * * @version 1.0 * @author Jason Harris */ class AVTPlotWidget : public KPlotWidget { Q_OBJECT public: explicit AVTPlotWidget(QWidget *parent = nullptr); /** * Set the fractional positions of the Sunrise and Sunset positions, in units where last * midnight was 0.0, and next midnight is 1.0. i.e., if Sunrise is at 06:00, then we set * it as 0.25 in this function. Likewise, if Sunset is at 18:00, then we set it as * 0.75 in this function. * @param sr the fractional position of Sunrise * @param ss the fractional position of Sunset */ void setSunRiseSetTimes(double sr, double ss); void setDawnDuskTimes(double da, double du); void setMinMaxSunAlt(double min, double max); /** * Set the fractional positions of moonrise and moon set in units * where last midnight was 0.0 and next midnight is 1.0 */ void setMoonRiseSetTimes(double mr, double ms); /** * @short Set the moon illumination * @param mi Moon illuminated fraction (0.0 to 1.0) * @note Used to determine the brightness of the gradient representing lunar skyglow */ void setMoonIllum(double mi); /** * @short Set the GeoLocation * @param Used to convert and format the current time correctly * @fixme Might be better to skip the entire shebang and include the KSAlmanac calls within AVTPlotWidget */ inline void setGeoLocation(const GeoLocation *geo_) { geo = geo_; } protected: /** * Handle mouse move events. If the mouse button is down, draw crosshair lines * centered at the cursor position. This allows the user to pinpoint specific * position sin the plot. */ - void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *e) override; /** Simply calls mouseMoveEvent(). */ - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *e) override; /** Reset the MousePoint to a null value, to erase the crosshairs */ - void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *e) override; /** Redraw the plot. */ - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; private: double SunRise { 0.25 }; double SunSet { 0.75 }; double Dawn { 0 }; double Dusk { 0 }; double SunMinAlt { 0 }; double SunMaxAlt { 0 }; double MoonRise { 0 }; double MoonSet { 0 }; double MoonIllum { 0 }; QPoint MousePoint; const GeoLocation *geo { nullptr }; }; diff --git a/kstars/tools/calendarwidget.h b/kstars/tools/calendarwidget.h index c7bf606d2..aadb021f1 100644 --- a/kstars/tools/calendarwidget.h +++ b/kstars/tools/calendarwidget.h @@ -1,54 +1,54 @@ /*************************************************************************** calendarwidget.h - description ------------------- begin : Wed Jul 16 2008 copyright : (C) 2008 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 CALENDARWIDGET_H_ #define CALENDARWIDGET_H_ #include #include /** @class CalendarWidget *@short An extension of the KPlotWidget for the SkyCalendar tool. */ class CalendarWidget : public KPlotWidget { Q_OBJECT public: explicit CalendarWidget(QWidget *parent = 0); void setHorizon(); inline float getRiseTime(int i) { return riseTimeList.at(i); } inline float getSetTime(int i) { return setTimeList.at(i); } protected: - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; private: void drawHorizon(QPainter *p); - void drawAxes(QPainter *p) Q_DECL_OVERRIDE; + void drawAxes(QPainter *p) override; QList dateList; QList riseTimeList; QList setTimeList; float minSTime; float maxRTime; QPolygonF polySunRise; QPolygonF polySunSet; }; #endif diff --git a/kstars/tools/conjunctions.h b/kstars/tools/conjunctions.h index ba7995ba5..070601dfc 100644 --- a/kstars/tools/conjunctions.h +++ b/kstars/tools/conjunctions.h @@ -1,80 +1,80 @@ /*************************************************************************** conjunctions.h - Conjunctions Tool ------------------- begin : Sun 20th Apr 2008 copyright : (C) 2008 Akarsh Simha email : akarshsimha@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ /*************************************************************************** * * * Much of the code here is taken from Pablo de Vicente's * * modcalcplanets.h * * * ***************************************************************************/ #pragma once #include "dms.h" #include "ui_conjunctions.h" #include #include #include #include class QSortFilterProxyModel; class QStandardItemModel; class GeoLocation; class KSPlanetBase; class SkyObject; /** * @short Predicts conjunctions using KSConjunct in the background */ class ConjunctionsTool : public QFrame, public Ui::ConjunctionsDlg { Q_OBJECT public: explicit ConjunctionsTool(QWidget *p); - ~ConjunctionsTool(); + ~ConjunctionsTool() override; public slots: void slotLocation(); void slotCompute(); void showProgress(int); void slotFindObject(); void slotGoto(); void slotFilterType(int); void slotClear(); void slotExport(); void slotFilterReg(const QString &); private: void showConjunctions(const QMap &conjunctionlist, const QString &object1, const QString &object2); std::unique_ptr Object1; std::unique_ptr Object2; // Second object is always a planet. /// To store the names of Planets vs. values expected by KSPlanetBase::createPlanet() QHash pNames; /// To store Julian Days corresponding to the row index in the output list widget QMap outputJDList; GeoLocation *geoPlace { nullptr }; QStandardItemModel *m_Model { nullptr }; QSortFilterProxyModel *m_SortModel { nullptr }; int m_index { 0 }; }; diff --git a/kstars/tools/eqplotwidget.h b/kstars/tools/eqplotwidget.h index 37a29b845..35b8b5d8c 100644 --- a/kstars/tools/eqplotwidget.h +++ b/kstars/tools/eqplotwidget.h @@ -1,30 +1,30 @@ /*************************************************************************** eqplotwidget.h - description ------------------- begin : Thu 16 Mar 2007 copyright : (C) 2007 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kplotwidget.h" class eqPlotWidget : public KPlotWidget { Q_OBJECT public: explicit eqPlotWidget(QWidget *parent = nullptr); protected: - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *) override; }; diff --git a/kstars/tools/flagmanager.h b/kstars/tools/flagmanager.h index 549f6eb41..c6f74ed6a 100644 --- a/kstars/tools/flagmanager.h +++ b/kstars/tools/flagmanager.h @@ -1,87 +1,87 @@ /*************************************************************************** flagmanager.h - Flag manager ------------------- begin : Mon Feb 01 2009 copyright : (C) 2009 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_flagmanager.h" #include #include class QSortFilterProxyModel; class QStandardItemModel; class KStars; class FlagManagerUI : public QFrame, public Ui::FlagManager { Q_OBJECT public: /** @short Constructor */ explicit FlagManagerUI(QWidget *parent); }; /** * @class FlagManager * @short Flag manager * Dialog box to add and remove flags * * @version 1.1 * @author Jerome SONRIER */ class FlagManager : public QDialog { Q_OBJECT public: /** @short Constructor */ explicit FlagManager(QWidget *ks); /** @short Destructor */ - ~FlagManager(); + ~FlagManager() override; void setRaDec(const dms &ra, const dms &dec); void clearFields(); void showFlag(const int flagIdx); bool validatePoint(); void deleteFlagItem(int flagIdx); public slots: /** @short Verify coordinates and add a flag */ void slotAddFlag(); /** @short Delete a flag */ void slotDeleteFlag(); /** @short Center the selected flag in the display */ void slotCenterFlag(); /** @brief Center the selected flag in the telescope. */ void slotCenterTelescope(); private slots: void slotSaveChanges(); void slotSetShownFlag(QModelIndex idx); private: void insertFlag(bool isNew, int row = 0); KStars *m_Ks { nullptr }; FlagManagerUI *ui { nullptr }; QStandardItemModel *m_Model { nullptr }; QSortFilterProxyModel *m_SortModel { nullptr }; }; diff --git a/kstars/tools/horizonmanager.h b/kstars/tools/horizonmanager.h index 1b5eb226b..cd78265b8 100644 --- a/kstars/tools/horizonmanager.h +++ b/kstars/tools/horizonmanager.h @@ -1,94 +1,94 @@ /* Artificial Horizon Manager Copyright (C) 2015 Jasem Mutlaq 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. */ #pragma once #include "ui_horizonmanager.h" #include #include class QStandardItem; class QStandardItemModel; class ArtificialHorizonComponent; class ArtificialHorizonEntity; class LineList; class SkyPoint; class HorizonManagerUI : public QFrame, public Ui::HorizonManager { Q_OBJECT public: /** @short Constructor */ explicit HorizonManagerUI(QWidget *parent); }; /** * @class HorizonManager * @short Manages adding/removing and editing regions and points associated with * user-customized artificial horizons. * * @version 1.0 * @author Jasem Mutlaq */ class HorizonManager : public QDialog { Q_OBJECT public: /** @short Constructor */ explicit HorizonManager(QWidget *ks); /** @short Destructor */ - ~HorizonManager(); + ~HorizonManager() override; void showRegion(const int regionID); bool validatePolygon(int regionID); void deleteRegion(int regionID); public slots: /** @short Add region */ void slotAddRegion(); /** @short Delete region */ void slotRemoveRegion(); void addSkyPoint(SkyPoint *skypoint); void slotAddPoint(); void slotRemovePoint(); void clearPoints(); void setSelectPoints(bool); private slots: void processSkyPoint(QStandardItem *item, int row); void verifyItemValue(QStandardItem *item); void checkRegionState(QStandardItem *item); void slotSaveChanges(); void slotSetShownRegion(QModelIndex idx); private: void terminateLivePreview(); void setPointSelection(bool enable); HorizonManagerUI *ui { nullptr }; QStandardItemModel *m_RegionsModel { nullptr }; ArtificialHorizonComponent *horizonComponent { nullptr }; QList *m_HorizonList { nullptr }; std::shared_ptr livePreview; bool selectPoints { false }; }; diff --git a/kstars/tools/modcalcaltaz.h b/kstars/tools/modcalcaltaz.h index 3f451bc21..d9d48b3a4 100644 --- a/kstars/tools/modcalcaltaz.h +++ b/kstars/tools/modcalcaltaz.h @@ -1,48 +1,48 @@ /*************************************************************************** modcalcaltaz.h - description ------------------- begin : sáb oct 26 2002 copyright : (C) 2002 by Pablo de Vicente email : pvicentea@wanadoo.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "dms.h" #include "ui_modcalcaltaz.h" class QDateTime; class GeoLocation; /** *@author Pablo de Vicente */ class modCalcAltAz : public QFrame, public Ui::modCalcAltAz { Q_OBJECT public: explicit modCalcAltAz(QWidget *p); - ~modCalcAltAz(); + ~modCalcAltAz() override; public slots: void slotCompute(); void slotNow(); void slotLocation(); void slotObject(); void slotDateTimeChanged(const QDateTime &); private: GeoLocation *geoPlace; dms LST; }; diff --git a/kstars/tools/modcalcangdist.h b/kstars/tools/modcalcangdist.h index 4847ee2f6..8191dc29f 100644 --- a/kstars/tools/modcalcangdist.h +++ b/kstars/tools/modcalcangdist.h @@ -1,56 +1,56 @@ /*************************************************************************** modcalcapcoord.h - description ------------------- begin : Sun May 30 2004 copyright : (C) 2004 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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 MODCALCANGDIST_H_ #define MODCALCANGDIST_H_ #include "ui_modcalcangdist.h" class dms; class dmsBox; class SkyPoint; class QTextStream; /** Module to compute the angular distance between two points in the sky and position angle. *@author Pablo de Vicente *@author Jasem Mutlaq *@version 1.0 */ class modCalcAngDist : public QFrame, public Ui::modCalcAngDistDlg { Q_OBJECT public: /**Constructor. */ explicit modCalcAngDist(QWidget *p); /**Destructor. */ - ~modCalcAngDist(); + ~modCalcAngDist() override; public slots: void slotValidatePositions(); void slotObjectButton(); void slotResetTitle(); void slotRunBatch(); private: /** Process Lines **/ void processLines(QTextStream &istream); /** @returns a SkyPoint constructed from the coordinates in the RA and Dec dmsBoxes. */ SkyPoint getCoords(dmsBox *rBox, dmsBox *dBox, bool *ok); }; #endif diff --git a/kstars/tools/modcalcdaylength.h b/kstars/tools/modcalcdaylength.h index 4d305fa58..60973695e 100644 --- a/kstars/tools/modcalcdaylength.h +++ b/kstars/tools/modcalcdaylength.h @@ -1,69 +1,69 @@ /*************************************************************************** modcalcdaylength.h - description ------------------- begin : wed jun 12 2002 copyright : (C) 2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_modcalcdaylength.h" #include class QDate; class QTextStream; class QTime; class GeoLocation; /** * Module to compute the equatorial coordinates for a given date and time * from a given epoch or equinox * * @author Pablo de Vicente */ class modCalcDayLength : public QFrame, public Ui::modCalcDayLengthDlg { Q_OBJECT public: /** Constructor */ explicit modCalcDayLength(QWidget *p); /** Destructor */ - ~modCalcDayLength(); + ~modCalcDayLength() override; public slots: void slotLocation(); void slotLocationBatch(); void slotComputeAlmanac(); void slotRunBatch(); void slotViewBatch(); void slotCheckFiles(); private: void updateAlmanac(const QDate &d, GeoLocation *geo); QTime lengthOfDay(const QTime &setQTime, const QTime &riseQTime); void showCurrentDate(); void initGeo(); void processLines(QTextStream &istream); GeoLocation *geoPlace { nullptr }; GeoLocation *geoBatch { nullptr }; QString srTimeString, stTimeString, ssTimeString; QString mrTimeString, mtTimeString, msTimeString; QString srAzString, stAltString, ssAzString; QString mrAzString, mtAltString, msAzString; QString daylengthString, lunarphaseString; }; diff --git a/kstars/tools/modcalceclipticcoords.h b/kstars/tools/modcalceclipticcoords.h index 11dd82b68..fed128d33 100644 --- a/kstars/tools/modcalceclipticcoords.h +++ b/kstars/tools/modcalceclipticcoords.h @@ -1,47 +1,47 @@ /*************************************************************************** modcalceclipticcoords.h - description ------------------- begin : Fri May 14 2004 copyright : (C) 2004 by Pablo de Vicente email : p.devicente@wanadoo.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kstarsdatetime.h" #include "ui_modcalceclipticcoords.h" /** * Class which implements the KStars calculator module to compute * geocentric ecliptic coordinates to/from geocentric equatorial coordinates. * * Inherits QWidget * * @author Pablo de Vicente */ class modCalcEclCoords : public QFrame, public Ui::modCalcEclCoordsDlg { Q_OBJECT public: explicit modCalcEclCoords(QWidget *p); - ~modCalcEclCoords(); + ~modCalcEclCoords() override; public slots: void slotNow(void); void slotObject(void); void slotDateTimeChanged(const QDateTime &edt); void slotCompute(void); private: KStarsDateTime kdt; }; diff --git a/kstars/tools/modcalcgalcoord.h b/kstars/tools/modcalcgalcoord.h index 8f7dd5a95..eb4f68d9d 100644 --- a/kstars/tools/modcalcgalcoord.h +++ b/kstars/tools/modcalcgalcoord.h @@ -1,58 +1,58 @@ /*************************************************************************** modcalcgal.h - description ------------------- begin : Thu Jan 17 2002 copyright : (C) 2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "dms.h" #include "ui_modcalcgalcoord.h" /** * Class which implements the KStars calculator module to compute * Galactic coordinates to/from Equatorial coordinates. * * @author Pablo de Vicente * @version 0.9 */ class modCalcGalCoord : public QFrame, public Ui::modCalcGalCoordDlg { Q_OBJECT public: explicit modCalcGalCoord(QWidget *p); - ~modCalcGalCoord(); + ~modCalcGalCoord() override; public slots: void slotComputeCoords(); void slotObject(); void slotGalLatCheckedBatch(); void slotGalLongCheckedBatch(); void slotRaCheckedBatch(); void slotDecCheckedBatch(); void slotEpochCheckedBatch(); void slotRunBatch(); private: void equCheck(); void galCheck(); void processLines(QTextStream &is); dms galLong, galLat, raCoord, decCoord; QString epoch; bool galInputCoords { false }; }; diff --git a/kstars/tools/modcalcjd.h b/kstars/tools/modcalcjd.h index 5ab1f0c1c..c1932e31a 100644 --- a/kstars/tools/modcalcjd.h +++ b/kstars/tools/modcalcjd.h @@ -1,59 +1,59 @@ /*************************************************************************** modcalcjd.h - description ------------------- begin : Tue Jan 15 2002 copyright : (C) 2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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 MODCALCJD_H_ #define MODCALCJD_H_ #include "ui_modcalcjd.h" class QWidget; class VBox; class QTextStream; /** * Class for KStars module which computes JD, MJD and Date/Time from the * any of the other entries. * * Inherits QVBox *@author Pablo de Vicente *@version 0.9 */ class modCalcJD : public QFrame, public Ui::modCalcJdDlg { Q_OBJECT public: explicit modCalcJD(QWidget *p); - ~modCalcJD(); + ~modCalcJD() override; public slots: void slotUpdateCalendar(); void slotUpdateModJD(); void slotUpdateJD(); void showCurrentTime(void); void slotRunBatch(); void slotViewBatch(); void slotCheckFiles(); private: void processLines(QTextStream &istream, int inputData); /** Shows Julian Day in the Box */ void showJd(long double jd); /** Shows the modified Julian Day in the Box */ void showMjd(long double mjd); }; #endif diff --git a/kstars/tools/modcalcplanets.h b/kstars/tools/modcalcplanets.h index d0cf39899..9cbc65217 100644 --- a/kstars/tools/modcalcplanets.h +++ b/kstars/tools/modcalcplanets.h @@ -1,64 +1,64 @@ /*************************************************************************** modcalcazel.h - description ------------------- begin : mier abr 20 2004 copyright : (C) 2004-2005 by Pablo de Vicente email : pvicentea@wanadoo.es ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_modcalcplanets.h" class QTextStream; class GeoLocation; class KSPlanetBase; /** *@author Pablo de Vicente */ class modCalcPlanets : public QFrame, public Ui::modCalcPlanetsDlg { Q_OBJECT public: explicit modCalcPlanets(QWidget *p); - ~modCalcPlanets(); + ~modCalcPlanets() override; public slots: void slotLocation(); void slotComputePosition(); void slotUtCheckedBatch(); void slotDateCheckedBatch(); void slotLongCheckedBatch(); void slotLatCheckedBatch(); void slotPlanetsCheckedBatch(); void slotRunBatch(); void processLines(QTextStream &istream); //void slotInputFile(); //void slotOutputFile(); //void slotRunBatch(); private: void showCoordinates(const KSPlanetBase &ksp); void showHeliocentricEclipticCoords(const dms &hLong, const dms &hLat, double dist); void showGeocentricEclipticCoords(const dms &eLong, const dms &eLat, double r); void showEquatorialCoords(const dms &ra, const dms &dec); void showTopocentricCoords(const dms &az, const dms &el); unsigned int requiredBatchFields(); // void processLines( QTextStream &istream ); GeoLocation *geoPlace; }; diff --git a/kstars/tools/modcalcvizequinox.h b/kstars/tools/modcalcvizequinox.h index 96dda2dfa..ca598b4bb 100644 --- a/kstars/tools/modcalcvizequinox.h +++ b/kstars/tools/modcalcvizequinox.h @@ -1,58 +1,58 @@ /*************************************************************************** modcalcvizequinox.h - description ------------------- begin : Thu 22 Feb 2007 copyright : (C) 2007 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kstarsdatetime.h" #include "ui_modcalcvizequinox.h" class QTextStream; class KPlotObject; /** * @class modCalcEquinox * * @author Jason Harris */ class modCalcEquinox : public QFrame, public Ui::modCalcEquinox { Q_OBJECT public: explicit modCalcEquinox(QWidget *p); - ~modCalcEquinox(); + ~modCalcEquinox() override; double dmonth(int imonth); private slots: void slotCompute(); void slotCheckFiles(); void slotRunBatch(); void slotViewBatch(); private: void processLines(QTextStream &istream); void addDateAxes(); KStarsDateTime findEquinox(int year, bool Spring, KPlotObject *po); KStarsDateTime findSolstice(int year, bool Summer); public: KStarsDateTime dSpring, dSummer, dAutumn, dWinter; private: double DMonth[12]; }; diff --git a/kstars/tools/modcalcvlsr.h b/kstars/tools/modcalcvlsr.h index 6e6ed52b4..05a23a4f1 100644 --- a/kstars/tools/modcalcvlsr.h +++ b/kstars/tools/modcalcvlsr.h @@ -1,81 +1,81 @@ /*************************************************************************** modcalcLSRVel.h - description ------------------- begin : dom mar 13 2005 copyright : (C) 2005 by Pablo de Vicente email : pvicentea@wanadoo.es ***************************************************************************/ /*************************************************************************** * * * This program 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 MODCALCVLSR_H_ #define MODCALCVLSR_H_ #include #include "ui_modcalcvlsr.h" class QWidget; class SkyPoint; class GeoLocation; class dms; /** *@author Pablo de Vicente *Module to compute the heliocentric radial velocity, geocentric radial velocity and *topocentric radial velocity for a source, given its coordinates, its Vlsr and the date and *location on the Earth. */ class modCalcVlsr : public QFrame, public Ui::modCalcVlsrDlg { Q_OBJECT public: explicit modCalcVlsr(QWidget *p); - ~modCalcVlsr(); + ~modCalcVlsr() override; private slots: void slotNow(); void slotLocation(); void slotFindObject(); void slotCompute(); void slotUtChecked(); void slotDateChecked(); void slotRaChecked(); void slotDecChecked(); void slotEpochChecked(); void slotLongChecked(); void slotLatChecked(); void slotHeightChecked(); void slotVlsrChecked(); void slotInputFile(); void slotOutputFile(); void slotRunBatch(); private: /** @returns a SkyPoint constructed from the coordinates in the * RA and Dec dmsBoxes. */ SkyPoint skypoint(); /* Constructs the a GeoLocation object (geoPlace) from the calling classes. * This is for using as Geolocation the location setup in KStars * */ void initGeo(void); /* Method to process the lines from a file */ void processLines(QTextStream &istream); GeoLocation *geoPlace; int velocityFlag; }; #endif diff --git a/kstars/tools/observinglist.h b/kstars/tools/observinglist.h index b6341e40e..4e634b2ae 100644 --- a/kstars/tools/observinglist.h +++ b/kstars/tools/observinglist.h @@ -1,428 +1,428 @@ /*************************************************************************** observinglist.h - K Desktop Planetarium ------------------- begin : 29 Nov 2004 copyright : (C) 2004 by Jeff Woods, Jason Harris email : jcwoods@bellsouth.net, jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kstarsdatetime.h" #include "ui_observinglist.h" #include #include #include #include #include #include #include #include class QSortFilterProxyModel; class QStandardItem; class QStandardItemModel; class QTimer; class GeoLocation; class KSAlmanac; class KSDssDownloader; class KStars; class KStarsDateTime; class ObsListPopupMenu; class SkyObject; class SkyPoint; class ObservingListUI : public QFrame, public Ui::ObservingList { Q_OBJECT public: /** @short Cunstructor */ explicit ObservingListUI(QWidget *parent); }; /** @class ObservingList *Tool window for managing a custom list of objects. The window *displays the Name, RA, Dec, mag, and type of each object in the list. * *By selecting an object in the list, you can perform a number of functions *on that object: *+ Center it in the display *+ Examine its Details Window *+ Point the telescope at it *+ Attach a custom icon or name label (TBD) *+ Attach a trail (solar system only) (TBD) *+ Open the AltVsTime tool * *The user can also save/load their observing lists, and can export *list data (TBD: as HTML table? CSV format? plain text?) * *The observing notes associated with the selected object are displayed *below the list. * *TODO: *+ Implement a "shaded" state, in which the UI is compressed to * make it easier to float on the KStars window. Displays only * object names, and single-letter action buttons, and no user log. *+ Implement an InfoBox version (the ultimate shaded state) * *@short Tool for managing a custom list of objects *@author Jeff Woods, Jason Harris *@version 1.0 */ class ObservingList : public QDialog { Q_OBJECT public: /** @short Constructor */ ObservingList(); /** @short Destuctor (empty) */ - ~ObservingList(); + ~ObservingList() override; /** @return reference to the current observing list */ QList> &obsList() { return m_WishList; } /** @return reference to the current observing list */ QList> &sessionList() { return m_SessionList; } /** @return pointer to the currently-selected object in the observing list *@note if more than one object is selected, this function returns 0. */ inline SkyObject *currentObject() const { return m_CurrentObject; } /** @short If the current list has unsaved changes, ask the user about saving it. *@note also clears the list in preparation of opening a new one */ void saveCurrentList(); /** @short Plot the SkyObject's Altitude vs Time in the AVTPlotWidget. *@p o pointer to the object to be plotted */ void plot(SkyObject *o); /** @short Return the altitude of the given SkyObject for the given hour. *@p p pointer to the SkyObject *@p hour time at which altitude has to be found */ double findAltitude(SkyPoint *p, double hour = 0); /** @short Sets the image parameters for the current object *@p o The passed object for setting the parameters */ void setCurrentImage(const SkyObject *o); /** * @short Returns a path to the current image, or a writable image. */ QString getCurrentImagePath(); /** @short Save the user log text to a file. *@note the log is attached to the current object in obsList. */ void saveCurrentUserLog(); /** @short decides on whether to enable the SaveImages button or not */ void setSaveImagesButton(); /** @short This is the declaration of the event filter function * which is installed on the KImageFilePreview and the TabeView */ - bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; + bool eventFilter(QObject *obj, QEvent *event) override; /** @short saves a thumbnail image for the details dialog * from the downloaded image */ void saveThumbImage(); QString getTime(const SkyObject *o) const; QTime scheduledTime(SkyObject *o) const; void setTime(const SkyObject *o, QTime t); inline GeoLocation *geoLocation() { return geo; } inline KStarsDateTime dateTime() const { return dt; } /** @short return the object with the name as the passed * QString from the Session List, return null otherwise */ SkyObject *findObjectByName(QString name); /** @short make a selection in the session view */ void selectObject(const SkyObject *o); /** @short set the default image in the image preview. */ void setDefaultImage(); /** @short get object name. If star has no name, generate a name based on catalog number. * @param translated set to true if the translated name is required. */ QString getObjectName(const SkyObject *o, bool translated = true); /** * @return true if the selected list contains the given object */ inline bool contains(const SkyObject *o, bool session = false) { return bool(findObject(o, session)); } QSharedPointer findObject(const SkyObject *o, bool session = false); public slots: /** @short add a new object to list *@p o pointer to the object to add to the list *@p session flag toggle adding the object to the session list *@p update flag to toggle the call of slotSaveList */ void slotAddObject(const SkyObject *o = nullptr, bool session = false, bool update = false); /** @short Remove skyobjects which are highlighted in the *observing list tool from the observing list. */ void slotRemoveSelectedObjects(); /** @short Remove skyobject from the observing list. *@p o pointer to the SkyObject to be removed. *@p session flag to tell it whether to remove the object *from the sessionlist or from the wishlist *@p update flag to toggle the call of slotSaveList *Use SkyMap::clickedObject() if o is nullptr (default) */ void slotRemoveObject(const SkyObject *o = nullptr, bool session = false, bool update = false); /** @short center the selected object in the display */ void slotCenterObject(); /** @short slew the telescope to the selected object */ void slotSlewToObject(); /** * @brief slotAddToEkosScheduler Add object to Ekos scheduler */ void slotAddToEkosScheduler(); /** @short Show the details window for the selected object */ void slotDetails(); /** @short Show the Altitude vs Time for selecteld objects */ void slotAVT(); /** @short Open the WUT dialog */ void slotWUT(); /** @short Add the object to the Session List */ void slotAddToSession(); /** @short Open the Find Dialog */ void slotFind(); /** @short Tasks needed when changing the selected object *Save the user log of the previous selected object, *find the new selected object in the obsList, and *show the notes associated with the new selected object */ void slotNewSelection(); /** @short load an observing list from disk. */ void slotOpenList(); /** @short save the current observing list to disk. */ void slotSaveList(); /** @short Load the Wish list from disk. */ void slotLoadWishList(); /** @short save the current observing session plan to disk, specify filename. */ void slotSaveSessionAs(bool nativeSave = true); /** @short save the current session */ void slotSaveSession(bool nativeSave = true); /** @short construct a new observing list using the wizard. */ void slotWizard(); /** @short toggle the setEnabled flags according to current view *set the m_currentItem to nullptr and clear selections *@p index captures the integer value sent by the signal *which is the currentIndex of the table */ void slotChangeTab(int index); /** @short Opens the Location dialog to set the GeoLocation *for the sessionlist. */ void slotLocation(); /** @short Updates the tableviews for the new geolocation and date */ void slotUpdate(); /** @short Takes the time from the QTimeEdit box and sets it as the *time parameter in the tableview of the SessionList. */ void slotSetTime(); /** @short Downloads the corresponding DSS or SDSS image from the web and *displays it */ void slotGetImage(bool _dss = false, const SkyObject *o = 0); void slotSearchImage(); /** @short Downloads the images of all the objects in the session list *Note: This downloads the SDSS image, checks if the size is > default image *and gets the DSS image if thats the case */ void slotSaveAllImages(); /** @short saves the image syncronously from a given URL into a given file *@p url the url from which the image has to be downloaded *@p filename the file onto which the url has to be copied to *NOTE: This is not a generic image saver, it is specific to the current object */ void saveImage(QUrl url, QString filename, const SkyObject *o = 0); /** @short Shows the image in a ImageViewer window. */ void slotImageViewer(); /** @short Remove the current image */ void slotDeleteCurrentImage(); /** @short Removes all the save DSS/SDSS images from the disk. */ void slotDeleteAllImages(); /** @short download the DSS image and show it */ void slotDSS() { slotGetImage(true); } /** *@short Present the user with options to get the right DSS image for the job */ void slotCustomDSS(); /** @short Export a target list to the oal compliant format */ void slotOALExport(); void slotAddVisibleObj(); /** * @short Show the eyepiece field view */ void slotEyepieceView(); /** * @short Recalculate and update the values of the altitude in the wishlist for the current time */ void slotUpdateAltitudes(); /** * @brief slotClearList Remove all objects from current list */ void slotClearList(); protected slots: void slotClose(); void downloadReady(bool success); protected: - void showEvent(QShowEvent *) Q_DECL_OVERRIDE; + void showEvent(QShowEvent *) override; private: /** * @short Return the active list * @return The session list or the wish list depending on which tab is currently being viewed. */ inline QList> &getActiveList() { return ((sessionView) ? m_SessionList : m_WishList); } /** * @short Return the active itemmodel * @return the session model or the wishlist model depending on which tab is currently being viewed. */ inline QStandardItemModel *getActiveModel() const { return (sessionView ? m_SessionModel.get() : m_WishListModel.get()); } /** * @short Return the active sort model * @return the session sort model or the wishlist sort model depending on which tab is currently being viewed. */ inline QSortFilterProxyModel *getActiveSortModel() const { return (sessionView ? m_SessionSortModel.get() : m_WishListSortModel.get()); } /** * @short Return the active view * @return the active view in the UI -- session view or wishlist view depending on which one is active. */ inline QTableView *getActiveView() const { return ((sessionView) ? (ui->SessionView) : (ui->WishListView)); } /** * @short Get the currently selected item indexes * @return a QModelIndexList containing the selected rows in the active QTableView */ inline QModelIndexList getSelectedItems() const { return getActiveView()->selectionModel()->selectedRows(); } std::unique_ptr ksal; ObservingListUI *ui { nullptr }; QList> m_WishList, m_SessionList; SkyObject *LogObject { nullptr }; SkyObject *m_CurrentObject { nullptr }; bool isModified { false }; bool sessionView { false }; bool dss { false }; bool singleSelection { false }; bool showScope { false }; bool noSelection { false }; QString m_listFileName, m_currentImageFileName, m_currentThumbImageFileName; KStarsDateTime dt; GeoLocation *geo { nullptr }; std::unique_ptr m_WishListModel; std::unique_ptr m_SessionModel; std::unique_ptr m_WishListSortModel; std::unique_ptr m_SessionSortModel; QHash TimeHash; std::unique_ptr pmenu; KSDssDownloader *m_dl { nullptr }; QHash ImagePreviewHash; QPixmap m_NoImagePixmap; QTimer *m_altitudeUpdater { nullptr }; std::function m_altCostHelper; bool m_initialWishlistLoad { false }; }; diff --git a/kstars/tools/obslistpopupmenu.h b/kstars/tools/obslistpopupmenu.h index c9fb0bd2d..5f506cf67 100644 --- a/kstars/tools/obslistpopupmenu.h +++ b/kstars/tools/obslistpopupmenu.h @@ -1,48 +1,48 @@ /*************************************************************************** obslistpopupmenu.h - K Desktop Planetarium ------------------- begin : Sun July 5 2009 copyright : (C) 2008 by Prakash Mohan email : prakash.mohan@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include /** * @class ObsListPopupMenu * The Popup Menu for the observing list in KStars. The menu is sensitive to the * type of selection in the observing list. * @author Prakash Mohan * @version 1.0 */ class ObsListPopupMenu : public QMenu { Q_OBJECT public: /** Default constructor*/ ObsListPopupMenu(); /** Destructor (empty)*/ - virtual ~ObsListPopupMenu(); + ~ObsListPopupMenu() override; /** * Initialize the popup menus. * @short initializes the popup menu based on the kind of selection in the observation planner * @param sessionView true if we are viewing the session, false if we are viewing the wish list * @param multiSelection true if multiple objects were selected, false if a single object was selected * @param showScope true if we should show INDI/telescope-related options, false otherwise. * @note Showing this popup-menu without a selection may lead to crashes. */ void initPopupMenu(bool sessionView, bool multiSelection, bool showScope); }; diff --git a/kstars/tools/obslistwizard.h b/kstars/tools/obslistwizard.h index 59b21f05d..2bf17fa93 100644 --- a/kstars/tools/obslistwizard.h +++ b/kstars/tools/obslistwizard.h @@ -1,122 +1,122 @@ /*************************************************************************** obslistwizard.h - Display overhead view of the solar system ------------------- begin : Thu 23 Jun 2005 copyright : (C) 2005 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_obslistwizard.h" #include "skyobjects/skypoint.h" #include class QListWidget; class QPushButton; class SkyObject; class GeoLocation; class ObsListWizardUI : public QFrame, public Ui::ObsListWizard { Q_OBJECT public: explicit ObsListWizardUI(QWidget *p); }; /** * @class ObsListWizard * @short Wizard for constructing observing lists * * @author Jason Harris */ class ObsListWizard : public QDialog { Q_OBJECT public: /** @short Constructor */ explicit ObsListWizard(QWidget *parent); /** @short Destructor */ - ~ObsListWizard(); + ~ObsListWizard() override; /** @return reference to QPtrList of objects selected by the wizard */ QList &obsList() { return ObsList; } private slots: void slotNextPage(); void slotPrevPage(); void slotAllButton(); void slotNoneButton(); void slotDeepSkyButton(); void slotSolarSystemButton(); void slotChangeLocation(); void slotToggleDateWidgets(); void slotToggleMagWidgets(); void slotParseRegion(); /** @short Construct the observing list by applying the selected filters */ void slotObjectCountDirty(); void slotUpdateObjectCount(); void slotApplyFilters() { applyFilters(true); } private: void initialize(); void applyFilters(bool doBuildList); /** @return true if the object passes the filter region constraints, false otherwise.*/ bool applyRegionFilter(SkyObject *o, bool doBuildList, bool doAdjustCount = true); bool applyObservableFilter(SkyObject *o, bool doBuildList, bool doAdjustCount = true); /** * Convenience function for safely getting the selected state of a QListWidget item by name. * QListWidget has no method for easily selecting a single item based on its text. * @return true if the named QListWidget item is selected. * @param name the QListWidget item to be queried is the one whose text matches this string * @param listWidget pointer to the QListWidget whose item is to be queried * @param ok pointer to a bool, which if present will return true if a matching list item was found */ bool isItemSelected(const QString &name, QListWidget *listWidget, bool *ok = nullptr); /** * Convenience function for safely setting the selected state of a QListWidget item by name. * QListWidget has no method for easily selecting a single item based on its text. * @param name the QListWidget item to be (de)selected is the one whose text matches this string * @param listWidget pointer to the QListWidget whose item is to be (de)selected * @param value set the item's selected state to this bool value * @param ok pointer to a bool, which if present will return true if a matching list item was found */ void setItemSelected(const QString &name, QListWidget *listWidget, bool value, bool *ok = nullptr); QList ObsList; ObsListWizardUI *olw { nullptr }; uint ObjectCount { 0 }; uint StarCount { 0 }; uint PlanetCount { 0 }; uint CometCount { 0 }; uint AsteroidCount { 0 }; uint GalaxyCount { 0 }; uint OpenClusterCount { 0 }; uint GlobClusterCount { 0 }; uint GasNebCount { 0 }; uint PlanNebCount { 0 }; double xRect1 { 0 }; double xRect2 { 0 }; double yRect1 { 0 }; double yRect2 { 0 }; double rCirc { 0 }; SkyPoint pCirc; GeoLocation *geo { nullptr }; QPushButton *nextB { nullptr }; QPushButton *backB { nullptr }; }; diff --git a/kstars/tools/planetviewer.h b/kstars/tools/planetviewer.h index f408877d0..ae0b855b9 100644 --- a/kstars/tools/planetviewer.h +++ b/kstars/tools/planetviewer.h @@ -1,86 +1,86 @@ /*************************************************************************** planetviewer.h - Display overhead view of the solar system ------------------- begin : Sun May 25 2003 copyright : (C) 2003 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kstarsdatetime.h" #include "ui_planetviewer.h" #include #include class QKeyEvent; class QPaintEvent; #define AUMAX 48 class KSPlanetBase; class PlanetViewerUI : public QFrame, public Ui::PlanetViewer { Q_OBJECT public: explicit PlanetViewerUI(QWidget *parent = nullptr); }; /** * @class PlanetViewer * @short Display an overhead view of the solar system * * @version 1.0 * @author Jason Harris */ class PlanetViewer : public QDialog { Q_OBJECT public: explicit PlanetViewer(QWidget *parent = nullptr); inline QString centerPlanet() const { return CenterPlanet; } inline void setCenterPlanet(const QString &cp) { CenterPlanet = cp; } inline KPlotObject *planetObject(uint i) const { return planet[i]; } QString planetName(uint i) const; protected: - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; + void paintEvent(QPaintEvent *) override; private slots: void initPlotObjects(); void tick(); void setTimeScale(float); void slotChangeDate(); void slotRunClock(); void slotToday(); void slotCloseWindow(); private: void updatePlanets(); PlanetViewerUI *pw { nullptr }; KStarsDateTime ut; double scale { 0 }; bool isClockRunning { false }; QTimer tmr; int UpdateInterval[9], LastUpdate[9]; QString CenterPlanet; QList PlanetList; KPlotObject *ksun { nullptr }; KPlotObject *planet[9] { nullptr }; }; diff --git a/kstars/tools/polarishourangle.h b/kstars/tools/polarishourangle.h index 4044122e6..26d4110cc 100644 --- a/kstars/tools/polarishourangle.h +++ b/kstars/tools/polarishourangle.h @@ -1,48 +1,48 @@ /* Copyright (C) 2015-2017, Pavel Mraz Copyright (C) 2017, Jasem Mutlaq This program 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include #include "ui_polarishourangle.h" class SkyObject; class PolarisHourAngle : public QDialog, public Ui::PolarisHourAngle { Q_OBJECT public: explicit PolarisHourAngle(QWidget *parent); protected: - void paintEvent(QPaintEvent *); + void paintEvent(QPaintEvent *) override; private slots: void onTimeUpdated(QDateTime newDateTime); private: double m_polarisHourAngle; SkyObject *m_polaris = { nullptr }; std::unique_ptr m_reticle; }; diff --git a/kstars/tools/pvplotwidget.h b/kstars/tools/pvplotwidget.h index f6b136bb6..44b18bb9d 100644 --- a/kstars/tools/pvplotwidget.h +++ b/kstars/tools/pvplotwidget.h @@ -1,52 +1,52 @@ /*************************************************************************** pvplotwidget.h ------------------- begin : Sat 17 Dec 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kplotwidget.h" class PlanetViewer; class PVPlotWidget : public KPlotWidget { Q_OBJECT public: explicit PVPlotWidget(QWidget *parent = nullptr); public slots: void slotZoomIn(); void slotZoomOut(); signals: void doubleClicked(double, double); protected: - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; - void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE; - void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseMoveEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *) override; + void mouseDoubleClickEvent(QMouseEvent *e) override; + void wheelEvent(QWheelEvent *e) override; private: void updateFactor(const int modifier); bool mouseButtonDown { false }; int oldx { 0 }; int oldy { 0 }; double factor { 2 }; PlanetViewer *pv { nullptr }; }; diff --git a/kstars/tools/scriptbuilder.h b/kstars/tools/scriptbuilder.h index 039a0a5d6..11881fa37 100644 --- a/kstars/tools/scriptbuilder.h +++ b/kstars/tools/scriptbuilder.h @@ -1,253 +1,253 @@ /*************************************************************************** scriptbuilder.h - description ------------------- begin : Thu Apr 17 2003 copyright : (C) 2003 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "scriptargwidgets.h" #include "ui_scriptbuilder.h" #include "ui_scriptnamedialog.h" #include "ui_optionstreeview.h" #include #include #include class QTreeWidget; class QTreeWidgetItem; class QTextStream; class KStars; class ScriptFunction; class OptionsTreeViewWidget : public QFrame, public Ui::OptionsTreeView { Q_OBJECT public: explicit OptionsTreeViewWidget(QWidget *p); }; class OptionsTreeView : public QDialog { Q_OBJECT public: explicit OptionsTreeView(QWidget *p); - ~OptionsTreeView(); + ~OptionsTreeView() override; QTreeWidget *optionsList() { return otvw->OptionsList; } void resizeColumns(); private: std::unique_ptr otvw; }; class ScriptNameWidget : public QFrame, public Ui::ScriptNameDialog { Q_OBJECT public: explicit ScriptNameWidget(QWidget *p); }; class ScriptNameDialog : public QDialog { Q_OBJECT public: explicit ScriptNameDialog(QWidget *p); - ~ScriptNameDialog(); + ~ScriptNameDialog() override; QString scriptName() const { return snw->ScriptName->text(); } QString authorName() const { return snw->AuthorName->text(); } private slots: void slotEnableOkButton(); private: ScriptNameWidget *snw { nullptr }; QPushButton *okB { nullptr }; }; class ScriptBuilderUI : public QFrame, public Ui::ScriptBuilder { Q_OBJECT public: explicit ScriptBuilderUI(QWidget *p); }; /** * @class ScriptBuilder * A GUI tool for building behavioral DBus scripts for KStars. * * @author Jason Harris * @version 1.0 */ class ScriptBuilder : public QDialog { Q_OBJECT public: explicit ScriptBuilder(QWidget *parent); - ~ScriptBuilder(); + ~ScriptBuilder() override; bool unsavedChanges() const { return UnsavedChanges; } void setUnsavedChanges(bool b = true); void saveWarning(); void readScript(QTextStream &istream); void writeScript(QTextStream &ostream); bool parseFunction(QString fn_name, QStringList &fn); public slots: void slotAddFunction(); void slotMoveFunctionUp(); void slotMoveFunctionDown(); void slotArgWidget(); void slotShowDoc(); void slotNew(); void slotOpen(); void slotSave(); void slotSaveAs(); void slotRunScript(); void slotClose(); void slotCopyFunction(); void slotRemoveFunction(); void slotFindCity(); void slotFindObject(); void slotShowOptions(); void slotLookToward(); void slotArgFindObject(); void slotRa(); void slotDec(); void slotAz(); void slotAlt(); void slotChangeDate(); void slotChangeTime(); void slotWaitFor(); void slotWaitForKey(); void slotTracking(); void slotViewOption(); void slotChangeCity(); void slotChangeProvince(); void slotChangeCountry(); void slotTimeScale(); void slotZoom(); void slotExportImage(); void slotPrintImage(); void slotChangeColor(); void slotChangeColorName(); void slotLoadColorScheme(); #if 0 void slotINDIWaitCheck(bool toggleState); void slotINDIFindObject(); void slotINDIStartDeviceName(); void slotINDIStartDeviceMode(); void slotINDISetDevice(); void slotINDIShutdown(); void slotINDISwitchDeviceConnection(); void slotINDISetPortDevicePort(); void slotINDISetTargetCoordDeviceRA(); void slotINDISetTargetCoordDeviceDEC(); void slotINDISetTargetNameTargetName(); void slotINDISetActionName(); void slotINDIWaitForActionName(); void slotINDISetFocusSpeed(); void slotINDIStartFocusDirection(); void slotINDISetFocusTimeout(); void slotINDISetGeoLocationDeviceLong(); void slotINDISetGeoLocationDeviceLat(); void slotINDIStartExposureTimeout(); void slotINDISetUTC(); void slotINDISetScopeAction(); void slotINDISetFrameType(); void slotINDISetCCDTemp(); void slotINDISetFilterNum(); #endif private: void initViewOptions(); void warningMismatch(const QString &expected) const; ScriptBuilderUI *sb { nullptr }; KStars *ks { nullptr }; //parent needed for sub-dialogs QList KStarsFunctionList; QList SimClockFunctionList; #if 0 QList INDIFunctionList; #endif QList ScriptList; QWidget *argBlank { nullptr }; ArgLookToward *argLookToward { nullptr }; ArgFindObject *argFindObject { nullptr }; ArgSetRaDec *argSetRaDec { nullptr }; ArgSetAltAz *argSetAltAz { nullptr }; ArgSetLocalTime *argSetLocalTime { nullptr }; ArgWaitFor *argWaitFor { nullptr }; ArgWaitForKey *argWaitForKey { nullptr }; ArgSetTrack *argSetTracking { nullptr }; ArgChangeViewOption *argChangeViewOption { nullptr }; ArgSetGeoLocation *argSetGeoLocation { nullptr }; ArgTimeScale *argTimeScale { nullptr }; ArgZoom *argZoom { nullptr }; ArgExportImage *argExportImage { nullptr }; ArgPrintImage *argPrintImage { nullptr }; ArgSetColor *argSetColor { nullptr }; ArgLoadColorScheme *argLoadColorScheme { nullptr }; #if 0 ArgStartINDI * argStartINDI; ArgSetDeviceINDI * argSetDeviceINDI; ArgShutdownINDI * argShutdownINDI; ArgSwitchINDI * argSwitchINDI; ArgSetPortINDI * argSetPortINDI; ArgSetTargetCoordINDI * argSetTargetCoordINDI; ArgSetTargetNameINDI * argSetTargetNameINDI; ArgSetActionINDI * argSetActionINDI; ArgSetActionINDI * argWaitForActionINDI; ArgSetFocusSpeedINDI * argSetFocusSpeedINDI; ArgStartFocusINDI * argStartFocusINDI; ArgSetFocusTimeoutINDI * argSetFocusTimeoutINDI; ArgSetGeoLocationINDI * argSetGeoLocationINDI; ArgStartExposureINDI * argStartExposureINDI; ArgSetUTCINDI * argSetUTCINDI; ArgSetScopeActionINDI * argSetScopeActionINDI; ArgSetFrameTypeINDI * argSetFrameTypeINDI; ArgSetCCDTempINDI * argSetCCDTempINDI; ArgSetFilterNumINDI * argSetFilterNumINDI; #endif ScriptNameDialog *snd { nullptr }; OptionsTreeView *otv { nullptr }; QTreeWidgetItem *opsGUI { nullptr }; QTreeWidgetItem *opsToolbar { nullptr }; QTreeWidgetItem *opsShowObj { nullptr }; QTreeWidgetItem *opsShowOther { nullptr }; QTreeWidgetItem *opsCName { nullptr }; QTreeWidgetItem *opsHide { nullptr }; QTreeWidgetItem *opsSkymap { nullptr }; QTreeWidgetItem *opsLimit { nullptr }; bool UnsavedChanges { false }; bool checkForChanges { false }; QUrl currentFileURL; QString currentDir; QString currentScriptName, currentAuthor; }; diff --git a/kstars/tools/sessionsortfilterproxymodel.h b/kstars/tools/sessionsortfilterproxymodel.h index 0b234a9e1..47c6f8234 100644 --- a/kstars/tools/sessionsortfilterproxymodel.h +++ b/kstars/tools/sessionsortfilterproxymodel.h @@ -1,47 +1,47 @@ /************************************************************************** sessionsortfilterproxymodel.h - K Desktop Planetarium ------------------- begin : Sat Apr 14 2012 copyright : (C) 2012 by Akarsh Simha email : akarsh.simha@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include class QModelIndex; /** * @class SessionSortFilterProxyModel * @short Sort best observation times by reimplementing lessThan() to work on the transit times of objects * * Any observing session starts at about sunset (~ 6 PM local time) * and goes on till sunrise (~ 6 AM local time). Thus, the correct * order to view objects in is to view those with meridian transit * times just after 12 noon local time first, working towards those * that transit in the evening, and finishing the ones that have * meridian transits just before 12 noon at the end of the * session. So, the observing session list should be sorted in a * special manner when sorting by time. This class reimplements * lessThan() in QSortFilterProxyModel to obtain the required sorting. */ class SessionSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT; public: explicit SessionSortFilterProxyModel(QObject *parent = nullptr); protected: - bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; + bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; }; diff --git a/kstars/tools/skycalendar.h b/kstars/tools/skycalendar.h index af7c8fa4c..7e2f1b738 100644 --- a/kstars/tools/skycalendar.h +++ b/kstars/tools/skycalendar.h @@ -1,68 +1,68 @@ /*************************************************************************** skycalendar.h - description ------------------- begin : Wed Jul 16 2008 copyright : (C) 2008 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include "ui_skycalendar.h" class GeoLocation; class SkyCalendarUI : public QFrame, public Ui::SkyCalendar { Q_OBJECT public: explicit SkyCalendarUI(QWidget *p = nullptr); }; /** * @class SkyCalendar * * Draws Rise/Set/Transit curves for major solar system planets for any calendar year. */ class SkyCalendar : public QDialog { Q_OBJECT friend class CalendarWidget; public: explicit SkyCalendar(QWidget *parent = nullptr); - ~SkyCalendar(); + ~SkyCalendar() override; int year(); GeoLocation *get_geo(); public slots: void slotFillCalendar(); void slotPrint(); void slotLocation(); void slotCalculating(); private: void addPlanetEvents(int nPlanet); void drawEventLabel(float x1, float y1, float x2, float y2, QString LabelText); SkyCalendarUI *scUI { nullptr }; GeoLocation *geo { nullptr }; QMutex calculationMutex; QString plotButtonText; bool calculating { false }; }; diff --git a/kstars/tools/starhopperdialog.h b/kstars/tools/starhopperdialog.h index 1fff15e65..2c2d71179 100644 --- a/kstars/tools/starhopperdialog.h +++ b/kstars/tools/starhopperdialog.h @@ -1,70 +1,70 @@ /*************************************************************************** starhopperdialog.cpp - UI of Star Hopping Guide for KStars ------------------- begin : Sat 15th Nov 2014 copyright : (C) 2014 Utkarsh Simha email : utkarshsimha@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "ui_starhopperdialog.h" #include "starobject.h" #include #include class SkyObject; class SkyPoint; class StarHopper; class StarObject; class TargetListComponent; Q_DECLARE_METATYPE(StarObject *) class StarHopperDialog : public QDialog, public Ui::StarHopperDialog { Q_OBJECT; public: explicit StarHopperDialog(QWidget *parent = nullptr); - virtual ~StarHopperDialog(); + ~StarHopperDialog() override; /** * @short Forms a Star Hop route from source to destination and displays on skymap * @param startHop SkyPoint to the start of Star Hop * @param stopHop SkyPoint to destination of StarHop * @param fov Field of view under consideration * @param maglim Magnitude limit of star to search for * @note In turn calls StarHopper to perform computations */ void starHop(const SkyPoint &startHop, const SkyPoint &stopHop, float fov, float maglim); private slots: void slotNext(); void slotGoto(); void slotDetails(); void slotRefreshMetadata(); private: SkyObject *getStarData(QListWidgetItem *); void setData(StarObject *); TargetListComponent *getTargetListComponent(); QList *m_skyObjList { nullptr }; std::unique_ptr m_sh; Ui::StarHopperDialog *ui { nullptr }; QListWidget *m_lw { nullptr }; QStringList *m_Metadata { nullptr }; }; diff --git a/kstars/tools/whatsinteresting/modelmanager.h b/kstars/tools/whatsinteresting/modelmanager.h index 93318f3fa..7cd8f226f 100644 --- a/kstars/tools/whatsinteresting/modelmanager.h +++ b/kstars/tools/whatsinteresting/modelmanager.h @@ -1,123 +1,123 @@ /*************************************************************************** modelmanager.h - K Desktop Planetarium ------------------- begin : 2012/26/05 copyright : (C) 2012 by Samikshan Bairagya email : samikshan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include class ObsConditions; class SkyObjItem; class SkyObjListModel; /** * @class ModelManager * @brief Manages models for QML listviews of different types of sky-objects. * * @author Samikshan Bairagya */ class ModelManager : public QObject { Q_OBJECT public: /** * @enum ModelType * @brief Model type for different types of sky-objects. */ enum ObjectList { Planets, Stars, Constellations, Galaxies, Clusters, Nebulas, Satellites, Asteroids, Comets, Supernovas, Messier, NGC, IC, Sharpless, NumberOfLists }; /** * @brief Constructor - Creates models for different sky-object types. * @param obs Pointer to an ObsConditions object. */ explicit ModelManager(ObsConditions *obs); - virtual ~ModelManager(); + ~ModelManager() override; /** Updates sky-object list models. */ void updateAllModels(ObsConditions *obs); void updateModel(ObsConditions *obs, QString modelName); /** Clears all sky-objects list models. */ void resetAllModels(); void setShowOnlyVisibleObjects(bool show) { showOnlyVisible = show; } bool showOnlyVisibleObjects() { return showOnlyVisible; } void setShowOnlyFavoriteObjects(bool show) { showOnlyFavorites = show; } bool showOnlyFavoriteObjects() { return showOnlyFavorites; } /** * @brief Returns model of given type. * @return Pointer to SkyObjListModel of given type. * @param type Type of sky-object model to be returned. */ SkyObjListModel *returnModel(QString modelName); int getModelNumber(QString modelName); SkyObjListModel *getTempModel() { return tempModel; } void loadNGCCatalog(); void loadICCatalog(); void loadSharplessCatalog(); bool isNGCLoaded() { return ngcLoaded; } bool isICLoaded() { return icLoaded; } bool isSharplessLoaded() { return sharplessLoaded; } signals: void loadProgressUpdated(double progress); void modelUpdated(); private: void loadLists(); void loadObjectList(QList &skyObjectList, int type); void loadNamedStarList(); void loadObjectsIntoModel(SkyObjListModel &model, QList &skyObjectList); ObsConditions *m_ObsConditions { nullptr }; QList> m_ObjectList; QList m_ModelList; bool showOnlyVisible { true }; bool showOnlyFavorites { true }; QList favoriteGalaxies; QList favoriteNebulas; QList favoriteClusters; SkyObjListModel *tempModel { nullptr }; bool ngcLoaded { false }; bool icLoaded { false }; bool sharplessLoaded { false }; }; diff --git a/kstars/tools/whatsinteresting/skyobjdescription.h b/kstars/tools/whatsinteresting/skyobjdescription.h index 5ffe0dcf5..f6b3047b7 100644 --- a/kstars/tools/whatsinteresting/skyobjdescription.h +++ b/kstars/tools/whatsinteresting/skyobjdescription.h @@ -1,76 +1,76 @@ /*************************************************************************** skyobjdescription.h - K Desktop Planetarium ------------------- begin : 2013/10/13 copyright : (C) 2013 by Vijay Dhameliya email : vijay.atwork13@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 SKYOBJDESCRIPTION_H #define SKYOBJDESCRIPTION_H #include #include #include #include #include #include /** * \class SkyObjDescription * Fatches short description for various sky object from wikipedia. * \author Vijay Dhameliya */ class SkyObjDescription : public QObject { Q_OBJECT public: /** * @brief Constructor sends request to network for data from wikipedia API and starts * downloading data from QUrl * @param soName SkyObject name * @param soType SkyObject type */ explicit SkyObjDescription(const QString soName, const QString soType); /** * \brief Destructor */ - virtual ~SkyObjDescription(); + ~SkyObjDescription() override; /** * @return returns description if it was available on wikipedia else returns empty string */ QString downloadedData() const { return m_description; } /** * @return returns wikipedia link for skyobject */ QString url() const { return m_url; } signals: void downloaded(); private slots: /** * @brief parse downloaded data to extract description of SkyObject when downloading is finished * @param reply */ void fileDownloaded(QNetworkReply *reply); private: QString soName, soType, m_description, m_url; QNetworkAccessManager *manager; QByteArray m_DownloadedData; }; #endif // SKYOBJDESCRIPTION_H diff --git a/kstars/tools/whatsinteresting/skyobjlistmodel.h b/kstars/tools/whatsinteresting/skyobjlistmodel.h index dfe3fd6cc..cd3d18d78 100644 --- a/kstars/tools/whatsinteresting/skyobjlistmodel.h +++ b/kstars/tools/whatsinteresting/skyobjlistmodel.h @@ -1,81 +1,81 @@ /*************************************************************************** skyobjlistmodel.h - K Desktop Planetarium ------------------- begin : 2012/26/05 copyright : (C) 2012 by Samikshan Bairagya email : samikshan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "qabstractitemmodel.h" class SkyObjItem; /** * @class SkyObjListModel * Represents a model for the list of interesting sky-objects to be displayed in the QML interface. * * @author Samikshan Bairagya */ class SkyObjListModel : public QAbstractListModel { Q_OBJECT public: /** Constructor */ explicit SkyObjListModel(SkyObjItem *soitem = nullptr, QObject *parent = nullptr); /** * @brief Add a sky-object to the model. * @param sobj * Pointer to sky-object to be added. */ void addSkyObject(SkyObjItem *sobj); /** * @brief Create and return a QHash of rolenames for the SkyObjItem. * @return QHash of rolenames for the SkyObjItem. */ - QHash roleNames() const Q_DECL_OVERRIDE; + QHash roleNames() const override; /** * @brief Overridden method from QAbstractItemModel. * @return The number of items in the sky-object list model. */ - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; /** * @brief Overridden method from QAbstractItemModel. * @return Data stored under the given role for the sky-object item referred to by the index. */ - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; /** * @brief Get the list of sky-object items in the model. * @return A QList of pointers to SkyObjItems which are there in the model. */ QList getSkyObjItems(); /** * @brief Get sky-object item referred to by index. * @return Pointer to SkyObjItem referred to by index. */ SkyObjItem *getSkyObjItem(int index); /** Erase all data in model. */ void resetModel(); int getSkyObjIndex(SkyObjItem *item); private: QList m_SoItemList; ///List of sky-object items in model. }; diff --git a/kstars/tools/whatsinteresting/wiview.h b/kstars/tools/whatsinteresting/wiview.h index 918845075..7f724a3d7 100644 --- a/kstars/tools/whatsinteresting/wiview.h +++ b/kstars/tools/whatsinteresting/wiview.h @@ -1,171 +1,171 @@ /*************************************************************************** wiview.h - K Desktop Planetarium ------------------- begin : 2012/26/05 copyright : (C) 2012 by Samikshan Bairagya email : samikshan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include #include class QNetworkAccessManager; class QQmlContext; class QQuickItem; class QQuickView; class ModelManager; class ObsConditions; class SkyObject; class SkyObjItem; /** * @class WIView * @brief Manages the QML user interface for What's Interesting. WIView is used to display the * QML UI using a QQuickView. It acts on all signals emitted by the UI and manages the data * sent to the UI for display. * * @author Samikshan Bairagya */ class WIView : public QWidget { Q_OBJECT public: /** * @brief Constructor - Store QML components as QObject pointers. * Connect signals from various QML components into public slots. * Displays the user interface for What's Interesting */ explicit WIView(QWidget *parent = nullptr); - ~WIView(); + ~WIView() override; /** Load details-view for selected sky-object */ void loadDetailsView(SkyObjItem *soitem, int index); /** Updates sky-object list models */ void updateModel(ObsConditions& obs); inline QQuickView *getWIBaseView() const { return m_BaseView; } public slots: /** * @brief public slot - Act upon signal emitted when category of sky-object is selected * from category selection view of the QML UI. * @param type Category selected */ void onCategorySelected(QString model); /** * @brief public slot - Act upon signal emitted when an item is selected from list of sky-objects. * Display details-view for the skyobject selected. * @param type Category selected. * @param typename Name of category selected. * @param index Index of item in the list of skyobjects. */ void onSoListItemClicked(int index); /** public slot - Show details-view for next sky-object from list of current sky-objects's category. */ void onNextObjClicked(); /** * @brief public slot - Show details-view for previous sky-object from list of current sky-objects's * category. */ void onPrevObjClicked(); /** public slot - Slew map to current sky-object in the details view. */ void onCenterButtonClicked(); /** public slot - Slew map to current sky-object in the details view. */ void onSlewTelescopeButtonClicked(); /** public slot - Open Details Dialog to show more details for current sky-object. */ void onDetailsButtonClicked(); /** public slot - Open WI settings dialog. */ void onSettingsIconClicked(); void onInspectIconClicked(bool checked) { inspectOnClick = checked; } /** public slot - Reload list of visible sky-objects. */ void onReloadIconClicked(); void onVisibleIconClicked(bool checked); void onFavoriteIconClicked(bool checked); void onUpdateIconClicked(); void updateWikipediaDescription(SkyObjItem *soitem); void loadObjectDescription(SkyObjItem *soitem); void tryToUpdateWikipediaInfo(SkyObjItem *soitem, QString name); void loadObjectInfoBox(SkyObjItem *soitem); void saveImageURL(SkyObjItem *soitem, QString imageURL); void saveInfoURL(SkyObjItem *soitem, QString infoURL); void saveObjectInfoBoxText(SkyObjItem *soitem, QString type, QString infoText); void downloadWikipediaImage(SkyObjItem *soitem, QString imageURL); void inspectSkyObject(const QString& name); void inspectSkyObjectOnClick(SkyObject *obj); void inspectSkyObject(SkyObject *obj); bool inspectOnClickIsActive() { return inspectOnClick; } void updateObservingConditions(); void tryToUpdateWikipediaInfoInModel(bool onlyMissing); void refreshListView(); void updateProgress(double value); void setProgressBarVisible(bool visible); void setNightVisionOn(bool on); private: QString getWikipediaName(SkyObjItem *soitem); QQuickItem *m_BaseObj { nullptr }; QQuickItem *m_ViewsRowObj { nullptr }; QQuickItem *m_CategoryTitle { nullptr }; QQuickItem *m_SoListObj { nullptr }; QQuickItem *m_DetailsViewObj { nullptr }; QQuickItem *m_ProgressBar { nullptr }; QQuickItem *m_loadingMessage { nullptr }; QQuickItem *m_NextObj { nullptr }; QQuickItem *m_PrevObj { nullptr }; QQuickItem *m_CenterButtonObj { nullptr }; QQuickItem *m_SlewTelescopeButtonObj { nullptr }; QQuickItem *m_DetailsButtonObj { nullptr }; QQuickItem *inspectIconObj { nullptr }; QQuickItem *visibleIconObj { nullptr }; QQuickItem *favoriteIconObj { nullptr }; QQmlContext *m_Ctxt { nullptr }; QObject *infoBoxText { nullptr }; QObject *descTextObj { nullptr }; QObject *nightVision { nullptr }; QObject *autoTrackCheckbox { nullptr }; QObject *autoCenterCheckbox { nullptr }; QQuickView *m_BaseView { nullptr }; ObsConditions *m_Obs { nullptr }; std::unique_ptr m_ModManager; /// Current sky object item. SkyObjItem *m_CurSoItem { nullptr }; /// Created sky object item on-demand std::unique_ptr trackedItem; /// Index of current sky-object item in Details view. int m_CurIndex { 0 }; /// Currently selected category from WI QML view QString m_CurrentObjectListName; std::unique_ptr manager; bool inspectOnClick { false }; }; diff --git a/kstars/tools/wutdialog.h b/kstars/tools/wutdialog.h index 09282f33b..6877ede72 100644 --- a/kstars/tools/wutdialog.h +++ b/kstars/tools/wutdialog.h @@ -1,133 +1,133 @@ /*************************************************************************** wutdialog.h - K Desktop Planetarium ------------------- begin : Die Feb 25 2003 copyright : (C) 2003 by Thomas Kabelmann email : tk78@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include "kstarsdata.h" #include "kstarsdatetime.h" #include "ui_wutdialog.h" #include #include class GeoLocation; class SkyObject; class WUTDialogUI : public QFrame, public Ui::WUTDialog { Q_OBJECT public: explicit WUTDialogUI(QWidget *p = nullptr); }; /** * @class WUTDialog * * What's up tonight dialog is a window which lists all sky objects * that will be visible during the next night. * * @author Thomas Kabelmann * @version 1.0 */ class WUTDialog : public QDialog { Q_OBJECT public: /** Constructor */ explicit WUTDialog(QWidget *ks, bool session = false, GeoLocation *geo = KStarsData::Instance()->geo(), KStarsDateTime lt = KStarsData::Instance()->lt()); - ~WUTDialog(); + ~WUTDialog() override; /** * @short Check visibility of object * @p o the object to check * @return true if visible */ bool checkVisibility(const SkyObject *o); public slots: /** * @short Determine which objects are visible, and store them in * an array of lists, classified by object type */ void init(); private slots: /** * @short Load the list of visible objects for selected object type. * @p category the string describing the type of object */ void slotLoadList(const QString &category); /** Display the rise/transit/set times for selected object */ void slotDisplayObject(const QString &name); /** * @short Apply user's choice of what part of the night should be examined: * @li 0: Evening only (sunset to midnight) * @li 1: Morning only (midnight to sunrise) * @li 2: All night (sunset to sunrise) */ void slotEveningMorning(int flag); /** * @short Adjust the date for the WUT tool * @note this does NOT affect the date of the sky map */ void slotChangeDate(); /** * @short Adjust the geographic location for the WUT tool * @note this does NOT affect the geographic location for the sky map */ void slotChangeLocation(); /** Open the detail dialog for the current object */ void slotDetails(); /** Center the display on the current object */ void slotCenter(); /** Add the object to the observing list */ void slotObslist(); /** Filters the objects displayed by Magnitude */ void slotChangeMagnitude(); void updateMag(); private: QList &visibleObjects(const QString &category); bool isCategoryInitialized(const QString &category); /** @short Initialize all SIGNAL/SLOT connections, used in constructor */ void makeConnections(); /** @short Initialize catgory list, used in constructor */ void initCategories(); WUTDialogUI *WUT { nullptr }; bool session { false }; QTime sunRiseTomorrow, sunSetToday, sunRiseToday, moonRise, moonSet; KStarsDateTime T0, UT0, Tomorrow, TomorrowUT, Evening, EveningUT; GeoLocation *geo { nullptr }; int EveningFlag { 0 }; double m_Mag { 0 }; QTimer *timer { nullptr }; QStringList m_Categories; QHash> m_VisibleList; QHash m_CategoryInitialized; }; diff --git a/kstars/widgets/clicklabel.h b/kstars/widgets/clicklabel.h index e8f81943f..b7a4b93e2 100644 --- a/kstars/widgets/clicklabel.h +++ b/kstars/widgets/clicklabel.h @@ -1,46 +1,46 @@ /*************************************************************************** clicklabel.h - description ------------------- begin : Sat 03 Dec 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 CLICKLABEL_H #define CLICKLABEL_H #include #include /** @class ClickLabel is a QLabel with a clicked() signal. *@author Jason Harris *@version 1.0 */ class ClickLabel : public QLabel { Q_OBJECT public: explicit ClickLabel(QWidget *parent = 0, const char *name = 0); - ~ClickLabel() {} + ~ClickLabel() override {} signals: void clicked(); protected: - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE + void mousePressEvent(QMouseEvent *e) override { if (e->button() == Qt::LeftButton) emit clicked(); } }; #endif diff --git a/kstars/widgets/dmsbox.h b/kstars/widgets/dmsbox.h index a55c18959..e724b1dcc 100644 --- a/kstars/widgets/dmsbox.h +++ b/kstars/widgets/dmsbox.h @@ -1,148 +1,148 @@ /*************************************************************************** dmsbox.h - description ------------------- begin : Wed Dec 19 2002 copyright : (C) 2001-2002 by Pablo de Vicente email : vicente@oan.es ***************************************************************************/ /*************************************************************************** * * * This program 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 DMSBOX_H #define DMSBOX_H #include #include //#include #include "dms.h" /** @class dmsBox *A QLineEdit which is capable of displaying and parsing angle values *flexibly and robustly. Angle values can be displayed and parsed as *Degrees or Hours. When displaying a value, it uses a space-delimited *triplet of integers representing the degrees, arcminutes, and arcseconds *of the angle (or hours, minutes, seconds). For example, "-34 45 57". *When parsing a value input by the user, it can also understand *a number of other formats: *@li colon-delimited fields ("-34:45:57") *@li one or two fields ("-35"; "-34 46") *@li fields with unit-labels ("-34d 45m 57s") *@li floating-point numbers ("-34.76583") * *@note Inherits QLineEdit. *@author Pablo de Vicente *@version 1.0 */ class dmsBox : public QLineEdit { Q_OBJECT Q_PROPERTY(bool degType READ degType WRITE setDegType) public: /**Constructor for the dmsBox object. *@param parent pointer to the parent QWidget *@param deg if true use deg/arcmin/arcsec; otherwise * use hours/min/sec. */ explicit dmsBox(QWidget *parent, bool deg = true); /**Destructor (empty)*/ - ~dmsBox(); + ~dmsBox() override; /**Display an angle using Hours/Min/Sec. *@p t the dms object which is to be displayed */ void showInHours(dms t); /**Display an angle using Hours/Min/Sec. This behaves just *like the above function. It differs only in the data type of *the argument. *@p t pointer to the dms object which is to be displayed */ void showInHours(const dms *t); /**Display an angle using Deg/Arcmin/Arcsec. *@p t the dms object which is to be displayed */ void showInDegrees(dms t); /**Display an angle using Deg/Arcmin/Arcsec. This behaves just *like the above function. It differs only in the data type of *the argument. *@p t pointer to the dms object which is to be displayed */ void showInDegrees(const dms *t); /**Display an angle. Simply calls showInDegrees(t) or *showInHours(t) depending on the value of deg. *@param t the dms object which is to be displayed. *@param deg if true, display Deg/Arcmin/Arcsec; otherwise *display Hours/Min/Sec. */ void show(dms t, bool deg = true); /**Display an angle. Simply calls showInDegrees(t) or *showInHours(t) depending on the value of deg. *This behaves essentially like the above function. It *differs only in the data type of its argument. *@param t the dms object which is to be displayed. *@param deg if true, display Deg/Arcmin/Arcsec; otherwise *display Hours/Min/Sec. */ void show(const dms *t, bool deg = true); /**Simply display a string. *@note JH: Why don't we just use QLineEdit::setText() instead? *@param s the string to display (it need not be a valid angle value). */ void setDMS(const QString &s) { setText(s); } /**Parse the text in the dmsBox as an angle. The text may be an integer *or double value, or it may be a triplet of integer values (separated by spaces *or colons) representing deg/hrs, min, sec. It is also possible to have two *fields. In this case, if the second field is a double, it is converted *to decimal min and double sec. *@param deg if true use deg/arcmin/arcsec; otherwise * use hours/min/sec. *@param ok set to true if a dms object was succedssfully created. *@return a dms object constructed from the fields of the dmsbox */ dms createDms(bool deg = true, bool *ok = 0); /** @return a boolean indicating if object contains degrees or hours */ bool degType(void) const { return deg; } /** @short set the dmsBox to Degrees or Hours *@param t if true, the box expects angle values in degrees; otherwise *it expects values in hours */ void setDegType(bool t); /**Clears the QLineEdit */ void clearFields(void) { setDMS(QString()); } inline bool isEmpty() { return EmptyFlag; } protected: - void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE; - void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; + void focusInEvent(QFocusEvent *e) override; + void focusOutEvent(QFocusEvent *e) override; private slots: void slotTextChanged(const QString &t); private: void setEmptyText(); bool deg, EmptyFlag; dms degValue; }; #endif diff --git a/kstars/widgets/draglistbox.h b/kstars/widgets/draglistbox.h index 03d990f90..e6a8cf2dc 100644 --- a/kstars/widgets/draglistbox.h +++ b/kstars/widgets/draglistbox.h @@ -1,52 +1,52 @@ /*************************************************************************** draglistbox.h - description ------------------- begin : Sun May 29 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include class QDragEnterEvent; class QDropEvent; class QMouseEvent; /** * @class DragListBox * @short Extension of KListWidget that allows Drag-and-Drop with other DragListBoxes * * @author Jason Harris * @version 1.0 */ class DragListBox : public QListWidget { Q_OBJECT public: explicit DragListBox(QWidget *parent = nullptr, const char *name = nullptr); int ignoreIndex() const { return IgnoreIndex; } bool contains(const QString &s) const; - void dragEnterEvent(QDragEnterEvent *evt) Q_DECL_OVERRIDE; - void dragMoveEvent(QDragMoveEvent *evt) Q_DECL_OVERRIDE; - void dropEvent(QDropEvent *evt) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *evt) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent *evt) override; + void dragMoveEvent(QDragMoveEvent *evt) override; + void dropEvent(QDropEvent *evt) override; + void mousePressEvent(QMouseEvent *evt) override; + void mouseMoveEvent(QMouseEvent *) override; + void mouseReleaseEvent(QMouseEvent *) override; private: bool leftButtonDown { false }; int IgnoreIndex { 0 }; }; diff --git a/kstars/widgets/fovwidget.h b/kstars/widgets/fovwidget.h index 275c1945c..8ac65550e 100644 --- a/kstars/widgets/fovwidget.h +++ b/kstars/widgets/fovwidget.h @@ -1,41 +1,41 @@ /*************************************************************************** fovwidget.h - description ------------------- begin : Sat 22 Sept 2007 copyright : (C) 2007 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 FOVWIDGET_H_ #define FOVWIDGET_H_ #include class FOV; class FOVWidget : public QFrame { Q_OBJECT public: explicit FOVWidget(QWidget *parent = 0); - ~FOVWidget(); + ~FOVWidget() override; void setFOV(FOV *f); protected: - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; private: FOV *m_FOV; }; #endif diff --git a/kstars/widgets/infoboxwidget.h b/kstars/widgets/infoboxwidget.h index 0517f1c04..e8efc09ba 100644 --- a/kstars/widgets/infoboxwidget.h +++ b/kstars/widgets/infoboxwidget.h @@ -1,118 +1,118 @@ /*************************************************************************** infoboxwidet.h - description ------------------- begin : 20 Aug 2009 copyright : (C) 2009 by Khudyakov Alexey email : alexey.skladnoy@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 INFOBOXWIDGET_H_ #define INFOBOXWIDGET_H_ #include #include #include #include #include class SkyPoint; class SkyObject; class InfoBoxWidget; /** * @brief The InfoBoxes class is a collection of InfoBoxWidget objects that display a transparent box for display of text messages */ class InfoBoxes : public QWidget { Q_OBJECT public: explicit InfoBoxes(QWidget *parent = 0); - virtual ~InfoBoxes(); + ~InfoBoxes() override; void addInfoBox(InfoBoxWidget *ibox); QList getInfoBoxes() const { return m_boxes; } protected: - void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *event) override; private: QList m_boxes; }; /** * @brief The InfoBoxWidget class is a widget that displays a transparent box for display of text messages. */ class InfoBoxWidget : public QWidget { Q_OBJECT public: /** Alignment of widget. */ enum { NoAnchor = 0, AnchorRight = 1, AnchorBottom = 2, AnchorBoth = 3 }; /** Create one infobox. */ InfoBoxWidget(bool shade, const QPoint &pos, int anchor = 0, const QStringList &str = QStringList(), QWidget *parent = 0); /** Destructor */ - virtual ~InfoBoxWidget(); + ~InfoBoxWidget() override; /** Check whether box is shaded. In this case only one line is shown. */ bool shaded() const { return m_shaded; } /** Get stickyness status of */ int sticky() const { return m_anchor; } /** Adjust widget's postion */ void adjust(); public slots: /** Set information about time. Data is taken from KStarsData. */ void slotTimeChanged(); /** Set information about location. Data is taken from KStarsData. */ void slotGeoChanged(); /** Set information about object. */ void slotObjectChanged(SkyObject *obj); /** Set information about pointing. */ void slotPointChanged(SkyPoint *p); signals: /** Emitted when widget is clicked */ void clicked(); protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void showEvent(QShowEvent *event) override; private: /** Uset to set information about object. */ void setPoint(QString name, SkyPoint *p); /** Recalculate size of widet */ void updateSize(); QStringList m_strings; // list of string to show bool m_adjusted; // True if widget coordinates were adjusted bool m_grabbed; // True if widget is dragged around bool m_shaded; // True if widget if shaded int m_anchor; // Vertical alignment of widget static const int padX; static const int padY; }; #endif /* INFOBOXWIDGET_H_ */ diff --git a/kstars/widgets/logedit.h b/kstars/widgets/logedit.h index 3b048a55f..aab73f818 100644 --- a/kstars/widgets/logedit.h +++ b/kstars/widgets/logedit.h @@ -1,43 +1,43 @@ /*************************************************************************** logedit.h - description ------------------- begin : Sat 03 Dec 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 LOGEDIT_H #define LOGEDIT_H #include #include /** @class LogEdit is a simple derivative of QTextEdit, that just adds a *focusOut() signal, emitted when the edit loses focus. *@author Jason Harris *@version 1.0 */ class LogEdit : public QTextEdit { Q_OBJECT public: explicit LogEdit(QWidget *parent = 0); - ~LogEdit() {} + ~LogEdit() override {} signals: void focusOut(); protected: - void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; + void focusOutEvent(QFocusEvent *e) override; }; #endif diff --git a/kstars/widgets/mapcanvas.h b/kstars/widgets/mapcanvas.h index d0a497e38..09806f602 100644 --- a/kstars/widgets/mapcanvas.h +++ b/kstars/widgets/mapcanvas.h @@ -1,99 +1,99 @@ /*************************************************************************** mapcanvas.h - K Desktop Planetarium ------------------- begin : Tue Apr 10 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 MAPCANVAS_H #define MAPCANVAS_H #include #include #include #include /** @class MapCanvas *Used in LocationDialog for displaying a map of the Earth. *In addition, cities in the database are drawn as grey or white dots. *Also, the widget processes mouse clicks, to trim the list of *cities to those near the mouse click. *@short Widget used in the LocationDialog for displaying the world map. *@author Jason Harris *@version 1.0 */ class LocationDialog; class QPixmap; class MapCanvas : public QFrame { Q_OBJECT public: /**Default constructor. Initialize the widget: create pixmaps, load the * world map image * @param parent pointer to the parent LocationDialog */ explicit MapCanvas(QWidget *parent); /**Destructor (empty) */ - ~MapCanvas(); + ~MapCanvas() override; /** Set location dialog */ // FIXME: This is temporary plug void setLocationDialog(LocationDialog *loc) { ld = loc; } public slots: /**Set the geometry of the map widget (overloaded from QWidget). * Resizes the size of the map pixmap to match the widget, and resets * the Origin QPoint so it remains at the center of the widget. * @note this is called automatically by resize events. * @p x the x-position of the widget * @p y the y-position of the widget * @p w the width of the widget * @p h the height of the widget */ virtual void setGeometry(int x, int y, int w, int h); /**Set the geometry of the map widget (overloaded from QWidget). * Resizes the size of the map pixmap to match the widget, and resets * the Origin QPoint so it remains at the center of the widget. * This function behaves just like the above function. It differs * only in the data type of its argument. * @note this is called automatically by resize events. * @p r QRect describing geometry */ virtual void setGeometry(const QRect &r); protected: /**Draw the map. Draw grey dots on the locations of all cities, * and highlight the cities which match the current filters as * white dits. Also draw a red crosshairs on the * currently-selected city. * @see LocationDialog */ - void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) override; /**Trim the list of cities so that only those within 2 degrees * of the mouse click are shown in the list. * @see LocationDialog */ - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *e) override; private: LocationDialog *ld; QPixmap *bgImage; QString BGColor; QPoint origin; }; #endif diff --git a/kstars/widgets/thumbimage.h b/kstars/widgets/thumbimage.h index 8225f59dd..6982c9513 100644 --- a/kstars/widgets/thumbimage.h +++ b/kstars/widgets/thumbimage.h @@ -1,62 +1,62 @@ /*************************************************************************** thumbimage.h - description ------------------- begin : Fri 09 Dec 2005 copyright : (C) 2005 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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 THUMBIMAGE_H #define THUMBIMAGE_H #include #include class ThumbImage : public QLabel { Q_OBJECT public: explicit ThumbImage(QWidget *parent, const char *name = 0); - ~ThumbImage(); + ~ThumbImage() override; void setImage(QPixmap *pm) { Image = pm; setFixedSize(Image->width(), Image->height()); } QPixmap *image() { return Image; } QPixmap croppedImage(); void setCropRect(int x, int y, int w, int h) { CropRect->setRect(x, y, w, h); } QRect *cropRect() const { return CropRect; } signals: void cropRegionModified(); protected: // void resizeEvent( QResizeEvent *e); - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; + void mouseMoveEvent(QMouseEvent *e) override; private: QRect *CropRect; QPoint *Anchor; QPixmap *Image; bool bMouseButtonDown; bool bTopLeftGrab, bBottomLeftGrab, bTopRightGrab, bBottomRightGrab; int HandleSize; }; #endif diff --git a/kstars/widgets/timespinbox.h b/kstars/widgets/timespinbox.h index bdad3bb53..8a2b9d092 100644 --- a/kstars/widgets/timespinbox.h +++ b/kstars/widgets/timespinbox.h @@ -1,76 +1,76 @@ /*************************************************************************** timespinbox.h - description ------------------- begin : Sun Mar 31 2002 copyright : (C) 2002 by Jason Harris email : kstars@30doradus.org ***************************************************************************/ /*************************************************************************** * * * This program 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. * * * ***************************************************************************/ #pragma once #include #include /** * @class TimeSpinBox * Custom spinbox to handle selection of timestep values with variable units. * @note this should only be used internally, embedded in a TimeStepBox widget. * * @author Jason Harris * @version 1.0 */ class TimeSpinBox : public QSpinBox { Q_OBJECT public: /** Constructor */ explicit TimeSpinBox(QWidget *parent, bool daysOnly = false); /** Destructor (empty) */ - ~TimeSpinBox() {} + ~TimeSpinBox() override {} /** * Convert the internal value to a display string. * @note reimplemented from QSpinBox * @p value the internal value to convert to a display string * @return the display string */ - QString textFromValue(int value) const Q_DECL_OVERRIDE; + QString textFromValue(int value) const override; /** * Convert the displayed string to an internal value. * @note reimplemented from QSpinBox * @p ok bool pointer set to true if conversion was successful * @return internal value converted from displayed text */ - int valueFromText(const QString &text) const Q_DECL_OVERRIDE; + int valueFromText(const QString &text) const override; /** @return the current TimeStep setting */ float timeScale() const; void setDaysOnly(bool daysonly); bool daysOnly() const { return DaysOnly; } signals: void scaleChanged(float s); public slots: void changeScale(float s); protected slots: void reportChange(); private: bool DaysOnly; float TimeScale[43]; QStringList TimeString; }; diff --git a/kstars/widgets/unitspinboxwidget.h b/kstars/widgets/unitspinboxwidget.h index f85792c96..956c0db5a 100644 --- a/kstars/widgets/unitspinboxwidget.h +++ b/kstars/widgets/unitspinboxwidget.h @@ -1,56 +1,56 @@ /*************************************************************************** unitspinboxwidget.h - A widget for providing multiple units ------------------- begin : Sun 18th Jan 2015 copyright : (C) 2015 Utkarsh Simha email : utkarshsimha@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program 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 UNITSPINBOXWIDGET_H #define UNITSPINBOXWIDGET_H #include "ui_unitspinboxwidget.h" /** * @brief The UnitSpinBoxWidget class * It is a widget that provides a DoubleSpinBox * and a ComboBox for conversions from different * units. * @author Utkarsh Simha */ class UnitSpinBoxWidget : public QWidget { Q_OBJECT public: explicit UnitSpinBoxWidget(QWidget *parent = 0); - ~UnitSpinBoxWidget(); + ~UnitSpinBoxWidget() override; /** * @brief addUnit Adds a item to the combo box * @param unitName The name of the unit to be displayed * @param conversionFactor The factor the value of a unit must be multiplied by */ void addUnit(const QString &unitName, double conversionFactor); /** * @brief value Returns value upon conversion */ double value() const; private: Ui::UnitSpinBoxWidget *ui; QComboBox *comboBox; QDoubleSpinBox *doubleSpinBox; }; #endif // UNITSPINBOXWIDGET_H diff --git a/kstars/xplanet/opsxplanet.h b/kstars/xplanet/opsxplanet.h index 07a9eaa22..093c68b80 100644 --- a/kstars/xplanet/opsxplanet.h +++ b/kstars/xplanet/opsxplanet.h @@ -1,48 +1,48 @@ /*************************************************************************** opsxplanet.h - K Desktop Planetarium ------------------- begin : Wed 26 Nov 2008 copyright : (C) 2008 by Jerome SONRIER email : jsid@emor3j.fr.eu.org ***************************************************************************/ /*************************************************************************** * * * This program 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 OPSXPLANET_H_ #define OPSXPLANET_H_ #include "ui_opsxplanet.h" class KStars; class OpsXplanet : public QFrame, public Ui::OpsXplanet { Q_OBJECT public: explicit OpsXplanet(KStars *_ks); - ~OpsXplanet(); + ~OpsXplanet() override; private: KStars *ksw; private slots: void slotUpdateWidgets(bool on); void slotConfigFileWidgets(bool on); void slotStarmapFileWidgets(bool on); void slotArcFileWidgets(bool on); void slotLabelWidgets(bool on); void slotMarkerFileWidgets(bool on); void slotMarkerBoundsWidgets(bool on); void slotProjectionWidgets(int index); void slotBackgroundWidgets(bool on); void toggleXPlanetInternal(); }; #endif // OPSGUIDES_H_