skyobjitem.h 5.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/***************************************************************************
                          skyobjitem.h  -  K Desktop Planetarium
                             -------------------
    begin                : 2012/21/06
    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.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef SKYOBJITEM_H
#define SKYOBJITEM_H

#include "skyobject.h"
Vijay Dhameliya's avatar
Vijay Dhameliya committed
23
#include "skyobjdescription.h"
24

25 26 27 28 29
/**
 * \class SkyObjItem
 * Represents an item in the list of interesting sky-objects.
 * \author Samikshan Bairagya
 */
30
class SkyObjItem
31
{
32 33 34 35 36
    public:
        /**
         * \enum SkyObjectRoles
         * User-defined role for the SkyObjItem
         */
37
        enum SkyObjectRoles { DispNameRole = Qt::UserRole + 1, DispImageRole, DispSummaryRole, CategoryRole, CategoryNameRole };
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

        /**
         * \enum Type
         * The type classification for the SkyObjItem
         */
        enum Type { Planet, Star, Constellation, Galaxy, Cluster, Nebula };

        /**
         * \brief Constructor
         * \param so Pointer to the SkyObject which the SkyObjItem represents.
         */
        SkyObjItem(SkyObject * so = 0);

        /**
         * \brief Destructor
         */
        ~SkyObjItem();

        /**
         * \brief Get data associated with a particular role for the SkyObjItem
         * \param role User-defined role for which data is required
         * \return QVariant data associated with role
         */
        QVariant data(int role);

        /**
         * \brief Get name of sky-object associated with the SkyObjItem.
         * \return Name of sky-object associated with the SkyObjItem as a QString
         */
        inline QString getName() const
        {
            return m_Name;
        }

        /**
         * \brief Get longname of sky-object associated with the SkyObjItem.
         * \return Longname of sky-object associated with the SkyObjItem as a QString
         */
        inline QString getLongName() const
        {
            return m_LongName;
        }

        /**
         * \brief Get category of sky-object associated with the SkyObjItem as a QString.
         * \return Category of sky-object associated with the SkyObjItem as a QString.
         */
        inline QString getTypeName() const
        {
            return m_TypeName;
        }

        /**
         * \brief Get category of sky-object associated with the SkyObjItem as an integer.
         * \return Category of sky-object associated with the SkyObjItem as a QString as an integer.
         */
        inline int getType() const
        {
            return m_Type;
        }

        /**
         * \brief Get current position of sky-object associated with the SkyObjItem.
         * \return Current position of sky-object associated with the SkyObjItem.
         */
        inline QString getPosition() const
        {
            return m_Position;
        }

        /**
         * \brief Get sky-object associated with the SkyObjItem.
         * \return Pointer to SkyObject associated with the SkyObjItem.
         */
        inline SkyObject * getSkyObject()
        {
            return m_So;
        }

117 118 119
        QString getImageURL() const;


120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
        /**
         * \brief Get description for the SkyObjItem.
         * \return Description for the SkyObjItem as a QString.
         */
        QString getDesc() const;

        /**
         * \brief Get source of description for the SkyObjItem.
         * \return Source of description for the SkyObjItem as a QString.
         */
        QString getDescSource();

        /**
         * \brief Get magnitude of sky-object associated with the SkyObjItem.
         * \return Magnitude of sky-object associated with the SkyObjItem.
         */
        inline float getMagnitude() const
        {
            return m_So->mag();
        }

        /**
         * \brief Get surface-brightness of sky-object associated with the SkyObjItem as a QString
         * to be displayed on the details-view.
         * \return Surface-brightness of sky-object associated with the SkyObjItem as a QString.
         */
        QString getSurfaceBrightness() const;

        /**
         * \brief Get size of sky-object associated with the SkyObjItem as a QString
         * to be displayed on the details-view.
         * \return Size of sky-object associated with the SkyObjItem as a QString.
         */
        QString getSize() const;

        /**
         * \brief Set current position of the sky-object in the sky.
         * \param so Pointer to SkyObject for which position information is required.
         */
        void setPosition(SkyObject * so);

    private:
        QString m_Name;      ///Name of sky-object
        QString m_LongName;  ///Longname of sky-object(if available)
        QString m_TypeName;  ///Category of sky-object
        QString m_Position;  ///Position of sky-object in the sky.
        Type m_Type;         ///Category of sky-object of type SkyObjItem::Type
        SkyObject * m_So;    ///Pointer to SkyObject represented by SkyObjItem
        SkyObjDescription * skd; /// pointer to SkyObjDescription
169 170
};

171
#endif