123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- #ifndef SKYVIEW_H
- #define SKYVIEW_H
- #include <QDeclarativeItem>
- class SkyViewPrivate;
- class SkyView : public QDeclarativeItem
- {
- Q_OBJECT
- Q_PROPERTY(qreal azimuth READ azimuth WRITE setAzimuth NOTIFY azimuthChanged)
- Q_PROPERTY(qreal altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
- Q_PROPERTY(qreal fov READ fov WRITE setFov NOTIFY fovChanged)
- Q_PROPERTY(qreal viewportWidthHours READ viewportWidthHours NOTIFY viewportWidthHoursChanged)
- Q_PROPERTY(qreal viewportHeightDegrees READ viewportHeightDegrees NOTIFY viewportHeightDegreesChanged)
- public:
- explicit SkyView(QDeclarativeItem *parent = 0);
- virtual ~SkyView();
- /** @overload QDeclarativeItem::paint()
- */
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- /** Get current view azimuth.
- * @return azimuth in hours.
- */
- qreal azimuth() const;
- /** Get current view altitude.
- * @return altitude in degrees.
- */
- qreal altitude() const;
- /** Get current field of view setting.
- * @return field of view in radians.
- */
- qreal fov() const;
- /** Get current viewport width in decimal hours.
- * @return viewport width in decimal hours.
- */
- qreal viewportWidthHours() const;
- /** Get current vieport height in decimal degrees.
- * @return viewport height in decimal degrees.
- */
- qreal viewportHeightDegrees() const;
- signals:
- /** Emitted when view azimuth changes.
- */
- void azimuthChanged();
- /** Emitted when view altitude changes.
- */
- void altitudeChanged();
- /** Emitted when field of view changes.
- */
- void fovChanged();
- /** Emitted when field of view changes.
- */
- void viewportWidthHoursChanged();
- /** Emitted when field of view changes.
- */
- void viewportHeightDegreesChanged();
- public slots:
- /** Set new view azimuth.
- * @param azimuth new azimuth in hours.
- */
- void setAzimuth(qreal azimuth);
- /** Set new view altitude.
- * @param altitude new altitude in degrees.
- */
- void setAltitude(qreal altitude);
- /** Set new field of view.
- * @param fov new field of view in radians.
- */
- void setFov(qreal fov);
- private:
- friend class SkyViewPrivate;
- SkyViewPrivate* const d;
- /** Paint sky view background
- * @param painter painter as passed to paint().
- */
- void paintGrid(QPainter* painter) const;
- /** Paint sky objects
- * @param painter painter as passed to paint().
- */
- void paintObjects(QPainter* painter) const;
- /** Map given RA and DEC to screen coordinates.
- * @param ra the right ascension in radians.
- * @param dec the declination in radians.
- * @return a point in screen coordinates.
- */
- QPoint mapToScreenPoint(qreal ra, qreal dec) const;
- /** Get azimuth of left edge of viewport in hours.
- * @return azimuth of left edge of viewport in hours.
- */
- qreal leftEdgeAzimuth() const;
- };
- #endif // SKYVIEW_H
|