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

MultiLevelJsonBase Class Reference

Abstract base class for managing multi-level tree objects stored in JSON format. More...

#include <MultiLevelJsonBase.hpp>

List of all members.

Public Member Functions

 MultiLevelJsonBase (MultiLevelJsonBase *parent=NULL)
 Default constructor.
void initFromUrl (const QString &url)
 Init the element from a URL.
void initFromQVariantMap (const QVariantMap &map)
 Init the element from a QVariantMap.
 ~MultiLevelJsonBase ()
 Destructor.
QString getShortName () const
 Return the short name for this image to be used in the loading bar.
bool hasErrorOccured () const
 Return true if an error occured while loading the data.
int getLevel () const
 Get the depth level in the tree.
QVariantMap toQVariantMap () const
 Convert the image informations to a map following the JSON structure.
void scheduleChildsDeletion ()
 Schedule a deletion for all the childs.

Protected Member Functions

virtual void loadFromQVariantMap (const QVariantMap &map)=0
 Load the element from a valid QVariantMap.
bool isDeletionScheduled () const
 Return true if a deletion is currently scheduled.
void updatePercent (int tot, int numToBeLoaded)
void deleteUnusedSubTiles ()
 Delete all the subtiles which were not displayed since more than lastDrawTrigger seconds.
void cancelDeletion ()
 If a deletion was scheduled, cancel it.

Static Protected Member Functions

static QVariantMap loadFromJSON (QIODevice &input, bool qZcompressed=false, bool gzCompressed=false)
 Load the element information from a JSON file.

Protected Attributes

QString shortName
 The very short name for this image set to be used in loading bar.
QString baseUrl
 Base URL to prefix to relative URL.
QString contructorUrl
 The relative URL passed to the constructor.
QList< MultiLevelJsonBase * > subTiles
 The list of all the created subtiles for this tile.
bool errorOccured
 Set to true if an error occured with this tile and it should not be displayed.
bool downloading
 true if the JSON descriptor file is currently downloading

Detailed Description

Abstract base class for managing multi-level tree objects stored in JSON format.

The JSON files can be stored on disk or remotely and are loaded into threads.


Constructor & Destructor Documentation

MultiLevelJsonBase::MultiLevelJsonBase ( MultiLevelJsonBase parent = NULL  ) 

Default constructor.

MultiLevelJsonBase::~MultiLevelJsonBase (  ) 

Destructor.


Member Function Documentation

void MultiLevelJsonBase::cancelDeletion (  )  [protected]

If a deletion was scheduled, cancel it.

void MultiLevelJsonBase::deleteUnusedSubTiles (  )  [protected]

Delete all the subtiles which were not displayed since more than lastDrawTrigger seconds.

int MultiLevelJsonBase::getLevel (  )  const [inline]

Get the depth level in the tree.

QString MultiLevelJsonBase::getShortName (  )  const [inline, virtual]

Return the short name for this image to be used in the loading bar.

Implements StelSkyLayer.

bool MultiLevelJsonBase::hasErrorOccured (  )  const [inline]

Return true if an error occured while loading the data.

void MultiLevelJsonBase::initFromQVariantMap ( const QVariantMap &  map  ) 

Init the element from a QVariantMap.

This method should be called by the constructors of the subclass.

void MultiLevelJsonBase::initFromUrl ( const QString &  url  ) 

Init the element from a URL.

This method should be called by the constructors of the subclass.

bool MultiLevelJsonBase::isDeletionScheduled (  )  const [inline, protected]

Return true if a deletion is currently scheduled.

static QVariantMap MultiLevelJsonBase::loadFromJSON ( QIODevice &  input,
bool  qZcompressed = false,
bool  gzCompressed = false 
) [static, protected]

Load the element information from a JSON file.

virtual void MultiLevelJsonBase::loadFromQVariantMap ( const QVariantMap &  map  )  [protected, pure virtual]

Load the element from a valid QVariantMap.

This method is called after the JSON files are downloaded and parsed into a QVariantMap.

Implemented in StelSkyImageTile, and StelSkyPolygon.

void MultiLevelJsonBase::scheduleChildsDeletion (  ) 

Schedule a deletion for all the childs.

It will practically occur after the delay passed as argument to deleteUnusedTiles() has expired.

QVariantMap MultiLevelJsonBase::toQVariantMap (  )  const

Convert the image informations to a map following the JSON structure.

It can be saved as JSON using the StelJsonParser methods.

Reimplemented in StelSkyImageTile, and StelSkyPolygon.


Member Data Documentation

QString MultiLevelJsonBase::baseUrl [protected]

Base URL to prefix to relative URL.

QString MultiLevelJsonBase::contructorUrl [protected]

The relative URL passed to the constructor.

true if the JSON descriptor file is currently downloading

Set to true if an error occured with this tile and it should not be displayed.

QString MultiLevelJsonBase::shortName [protected]

The very short name for this image set to be used in loading bar.

The list of all the created subtiles for this tile.

Generated on Sat Aug 25 22:13:32 2012 for Stellarium by  doxygen 1.6.3