AngleMeasure.hpp   AngleMeasure.hpp 
skipping to change at line 22 skipping to change at line 22
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef ANGLEMEASURE_HPP_ #ifndef ANGLEMEASURE_HPP_
#define ANGLEMEASURE_HPP_ #define ANGLEMEASURE_HPP_
#include "config.h"
#include <QFont> #include <QFont>
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelModule.hpp" #include "StelModule.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
class QTimer; class QTimer;
class QPixmap; class QPixmap;
class StelButton; class StelButton;
class AngleMeasureDialog;
//! This is an example of a plug-in which can be dynamically loaded into st //! Main class of the Angle Measure plug-in.
ellarium //! Provides an on-screen angle measuring tool.
class AngleMeasure : public StelModule class AngleMeasure : public StelModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool enabled
READ isEnabled
WRITE enableAngleMeasure)
Q_PROPERTY(bool dmsFormat
READ isDmsFormat
WRITE useDmsFormat)
Q_PROPERTY(bool paDisplayed
READ isPaDisplayed
WRITE showPositionAngle)
public: public:
AngleMeasure(); AngleMeasure();
virtual ~AngleMeasure(); virtual ~AngleMeasure();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
virtual void init(); virtual void init();
virtual void update(double deltaTime); virtual void update(double deltaTime);
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
virtual double getCallOrder(StelModuleActionName actionName) const; virtual double getCallOrder(StelModuleActionName actionName) const;
virtual void handleKeys(class QKeyEvent* event); virtual void handleKeys(class QKeyEvent* event);
virtual void handleMouseClicks(class QMouseEvent* event); virtual void handleMouseClicks(class QMouseEvent* event);
virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b); virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
virtual bool configureGui(bool show=true);
bool isEnabled() const {return flagShowAngleMeasure;}
bool isDmsFormat() const { return flagUseDmsFormat; }
bool isPaDisplayed() const { return flagShowPA; }
//! Restore the plug-in's settings to the default state.
//! Replace the plug-in's settings in Stellarium's configuration fil
e
//! with the default values and re-load them.
//! Uses internally loadSettings() and saveSettings().
void restoreDefaultSettings();
//! Load the plug-in's settings from the configuration file.
//! Settings are kept in the "AngleMeasure" section in Stellarium's
//! configuration file. If no such section exists, it will load defa
ult
//! values.
//! @see saveSettings(), restoreSettings()
void loadSettings();
//! Save the plug-in's settings to the configuration file.
//! @warning textColor and lineColor are not saved, probably because
//! they can't be changed by the user in-program.
//! @todo find a way to save color values without "rounding drift"
//! (this is especially important for restoring default color values
).
//! @see loadSettings(), restoreSettings()
void saveSettings();
public slots: public slots:
void enableAngleMeasure(bool b); void enableAngleMeasure(bool b);
void useDmsFormat(bool b);
void showPositionAngle(bool b);
private slots: private slots:
void updateMessageText(); void updateMessageText();
void clearMessage(); void clearMessage();
private: private:
QFont font; QFont font;
bool flagShowAngleMeasure; bool flagShowAngleMeasure;
LinearFader lineVisible; LinearFader lineVisible;
LinearFader messageFader; LinearFader messageFader;
QTimer* messageTimer; QTimer* messageTimer;
QString messageEnabled; QString messageEnabled;
QString messageLeftButton; QString messageLeftButton;
QString messageRightButton; QString messageRightButton;
QString messagePA;
bool dragging; bool dragging;
Vec3d startPoint; Vec3d startPoint;
Vec3d endPoint; Vec3d endPoint;
Vec3d perp1StartPoint; Vec3d perp1StartPoint;
Vec3d perp1EndPoint; Vec3d perp1EndPoint;
Vec3d perp2StartPoint; Vec3d perp2StartPoint;
Vec3d perp2EndPoint; Vec3d perp2EndPoint;
Vec3f textColor; Vec3f textColor;
Vec3f lineColor; Vec3f lineColor;
QString angleText; double angle;
bool flagUseDmsFormat; bool flagUseDmsFormat;
bool flagShowPA;
StelButton* toolbarButton; StelButton* toolbarButton;
void calculateEnds(); void calculateEnds();
QString calculateAngle(void) const;
QString calculatePositionAngle(const Vec3d p1, const Vec3d p2) const
;
QSettings* conf;
// GUI
AngleMeasureDialog* configDialog;
}; };
#include "fixx11h.h"
#include <QObject> #include <QObject>
#include "StelPluginInterface.hpp" #include "StelPluginInterface.hpp"
//! This class is used by Qt to manage a plug-in interface //! This class is used by Qt to manage a plug-in interface
class AngleMeasureStelPluginInterface : public QObject, public StelPluginIn terface class AngleMeasureStelPluginInterface : public QObject, public StelPluginIn terface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "stellarium.StelGuiPluginInterface/1.0")
Q_INTERFACES(StelPluginInterface) Q_INTERFACES(StelPluginInterface)
public: public:
virtual StelModule* getStelModule() const; virtual StelModule* getStelModule() const;
virtual StelPluginInfo getPluginInfo() const; virtual StelPluginInfo getPluginInfo() const;
}; };
#endif /*ANGLEMEASURE_HPP_*/ #endif /*ANGLEMEASURE_HPP_*/
 End of changes. 13 change blocks. 
5 lines changed or deleted 57 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/