Stellarium 0.11.3
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelSkyImageTile.hpp

00001 /*
00002  * Copyright (C) 2008 Fabien Chereau
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00017  */
00018 
00019 
00020 #ifndef _STELSKYIMAGETILE_HPP_
00021 #define _STELSKYIMAGETILE_HPP_
00022 
00023 #include "StelTextureTypes.hpp"
00024 #include "StelSphereGeometry.hpp"
00025 #include "MultiLevelJsonBase.hpp"
00026 
00027 #include <QTimeLine>
00028 
00029 //#define DEBUG_STELSKYIMAGE_TILE 1
00030 
00031 class QIODevice;
00032 class StelCore;
00033 class StelPainter;
00034 
00036 class ServerCredits
00037 {
00038 public:
00040     QString shortCredits;
00041 
00043     QString fullCredits;
00044 
00046     QString infoURL;
00047 };
00048 
00050 class DataSetCredits
00051 {
00052 public:
00054     QString shortCredits;
00055 
00057     QString fullCredits;
00058 
00060     QString infoURL;
00061 };
00062 
00064 class StelSkyImageTile : public MultiLevelJsonBase
00065 {
00066     Q_OBJECT
00067 
00068     friend class StelSkyLayerMgr;
00069 
00070 public:
00072     StelSkyImageTile();
00073 
00075     StelSkyImageTile(const QString& url, StelSkyImageTile* parent=NULL);
00077     StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent);
00078 
00080     ~StelSkyImageTile();
00081 
00083     void draw(StelCore* core, StelPainter& sPainter, float opacity=1.);
00084 
00086     DataSetCredits getDataSetCredits() const {return dataSetCredits;}
00087 
00089     ServerCredits getServerCredits() const {return serverCredits;}
00090 
00092     bool isReadyToDisplay() const;
00093 
00096     QVariantMap toQVariantMap() const;
00097 
00099     QString getAbsoluteImageURI() const {return absoluteImageURI;}
00100 
00102     virtual QString getLayerDescriptionHtml() const {return htmlDescription;}
00103 
00104 protected:
00107     virtual void loadFromQVariantMap(const QVariantMap& map);
00108 
00110     ServerCredits serverCredits;
00111 
00113     DataSetCredits dataSetCredits;
00114 
00116     QString absoluteImageURI;
00117 
00119     float luminance;
00120 
00122     bool alphaBlend;
00123 
00125     bool noTexture;
00126 
00128     QList<SphericalRegionP> skyConvexPolygons;
00129 
00131     StelTextureSP tex;
00132 
00134     float minResolution;
00135 
00136 private:
00138     void initCtor();
00139 
00142     void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result, StelCore* core, const SphericalRegionP& viewPortPoly, float limitLuminance, bool recheckIntersect=true);
00143 
00146     bool drawTile(StelCore* core, StelPainter& sPainter);
00147 
00149     double getMinResolution() const {return minResolution;}
00150 
00152     QVariantList subTilesUrls;
00153 
00154     // Used for smooth fade in
00155     QTimeLine* texFader;
00156 
00157     QString htmlDescription;
00158 };
00159 
00160 #endif // _STELSKYIMAGETILE_HPP_
Generated on Thu May 31 10:37:19 2012 for Stellarium by  doxygen 1.6.3