StelFontMgr.hpp   StelSkyLayer.hpp 
/* /*
* Copyright (C) 2006 Fabien Chereau * Copyright (C) 2009 Fabien Chereau
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _STELFONTMGR_HPP_ #ifndef STELSKYLAYER_HPP
#define _STELFONTMGR_HPP_ #define STELSKYLAYER_HPP
#include <map> #include <QObject>
#include <QString> #include <QString>
#include <QSharedPointer>
class StelFont; class StelCore;
class StelPainter;
//! @class StelFontMgr //! Abstract class defining the API to implement for all sky layer.
//! Manage fonts for Stellarium. Take into account special font for special //! A sky layer is a graphical layer containing image or polygons displayed
language. in the sky.
//! It also load fonts and store them in a cache to prevent duplication. //! The StelSkyImageMgr allows to set the display order for layers, as well
//! @author Fabien Chereau <stellarium@free.fr> as opacity.
class StelFontMgr class StelSkyLayer : public QObject
{ {
Q_OBJECT
public: public:
StelFontMgr(); StelSkyLayer(QObject* parent=NULL) : QObject(parent) {;}
~StelFontMgr();
//! Get the standard font associated to the given language ISO code. //! Draws the content of the layer.
//! @param langageName the ISO language name such as "fr" or "en" or virtual void draw(StelCore* core, StelPainter& sPainter, float opaci
"*" for default. ty=1.)=0;
//! @param size the font size in pixels.
StelFont& getStandardFont(const QString& langageName, double size=12
.);
//! Get the fixed font associated to the given language ISO code.
//! @param langageName the ISO language name such as "fr" or "en" or
"*" for default.
//! @param size the font size in pixels.
StelFont& getFixedFont(const QString& langageName, double size=12.);
private:
//! @class FontForLanguage
//! Class which describes which font to use for a given language ISO
code.
class FontForLanguage
{
public:
QString langageName;
QString fontFileName;
double fontScale;
QString fixedFontFileName;
double fixedFontScale;
bool operator == (const FontForLanguage& f) const;
};
//! @class LoadedFont
//! Class which describes a loaded font.
class LoadedFont
{
public:
LoadedFont(const QString& fileName, int size);
QString fileName;
int size; // floating point scale * 10
};
//! @class ltLoadedFonts
//! Comparator for sorting LoadedFonts.
struct ltLoadedFont
{
bool operator()(const LoadedFont l1, const LoadedFont l2) co
nst
{
return (l1.fileName<l2.fileName || (l1.fileName==l2.
fileName && l1.size<l2.size));
}
};
//! Get the structure describing the fonts and scales to use for a g
iven language.
FontForLanguage& getFontForLanguage(const QString& langageName);
//! Load the associations between languages and font file/scaling. //! Return the short name to display in the loading bar.
void loadFontForLanguage(const QString& fontMapFile); virtual QString getShortName() const =0;
//! Contains a mapping of font/langage //! Return the short server name to display in the loading bar.
std::map<QString, FontForLanguage> fontMapping; virtual QString getShortServerCredits() const {return QString();}
//! Keeps references on all loaded fonts //! Return a hint on which key to use for referencing this layer.
std::map<LoadedFont, StelFont*, ltLoadedFont> loadedFonts; //! Note that the key effectively used may be different.
virtual QString getKeyHint() const {return getShortName();}
//! Return a human readable description of the layer with e.g.
//! links and copyrights.
virtual QString getLayerDescriptionHtml() const {return "No descript
ion.";}
signals:
//! Emitted when loading of data started or stopped.
//! @param b true if data loading started, false if finished.
void loadingStateChanged(bool b);
//! Emitted when the percentage of loading tiles/tiles to be display
ed changed.
//! @param percentage the percentage of loaded data.
void percentLoadedChanged(int percentage);
}; };
#endif // _STELFONTMGR_HPP_ //! @file StelSkyLayerMgr.hpp
//! Define the classes needed for managing layers of sky elements display.
//! @typedef StelSkyLayerP
//! Shared pointer on a StelSkyLayer instance (implement reference counting
)
typedef QSharedPointer<StelSkyLayer> StelSkyLayerP;
#endif // STELSKYLAYER_HPP
 End of changes. 13 change blocks. 
72 lines changed or deleted 40 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/