Home · All Namespaces · All Classes · Functions · Coding Style · 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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
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 StelSkyImageMgr;
00069     
00070 public:
00072     StelSkyImageTile() {initCtor();}
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, const StelPainter& sPainter);
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     
00101 protected:
00103     float minResolution;
00104     
00106     ServerCredits serverCredits;
00107     
00109     DataSetCredits dataSetCredits;
00110     
00112     QString absoluteImageURI;
00113     
00115     float luminance;
00116     
00118     bool alphaBlend;
00119     
00121     bool noTexture;
00122     
00124     QList<StelGeom::ConvexPolygon> skyConvexPolygons;
00125     
00127     QList< QList<Vec2f> > textureCoords;
00128 
00130     StelTextureSP tex;
00131     
00132 protected:
00133 
00135     virtual void loadFromQVariantMap(const QVariantMap& map);
00136     
00137 private:
00139     void initCtor();
00140     
00143     void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result, StelCore* core, const StelGeom::ConvexPolygon& viewPortPoly, float limitLuminance, bool recheckIntersect=true);
00144     
00147     bool drawTile(StelCore* core, const StelPainter& sPainter);
00148     
00150     double getMinResolution() const {return minResolution;}
00151 
00152     // Used for smooth fade in
00153     QTimeLine* texFader;
00154     
00155 #ifdef DEBUG_STELSKYIMAGE_TILE
00156     static class StelFont* debugFont;
00157 #endif
00158 };
00159 
00160 #endif // _STELSKYIMAGETILE_HPP_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5