kstars
kstarsdata.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KSTARSDATA_H
00019 #define KSTARSDATA_H
00020
00021 #include <qmap.h>
00022 #include <qptrlist.h>
00023 #include <qstring.h>
00024
00025 #include <kshortcut.h>
00026
00027 #include <iostream>
00028
00029 #include "fov.h"
00030 #include "geolocation.h"
00031 #include "colorscheme.h"
00032 #include "objectnamelist.h"
00033 #include "planetcatalog.h"
00034 #include "tools/lcgenerator.h"
00035 #include "kstarsdatetime.h"
00036 #include "simclock.h"
00037
00038 #define NHIPFILES 127
00039 #define NMWFILES 11
00040 #define NNGCFILES 14
00041 #define NTYPENAME 12
00042 #define NCIRCLE 360 //number of points used to define equator, ecliptic and horizon
00043
00044 #define MINZOOM 200.
00045 #define MAXZOOM 1000000.
00046 #define DEFAULTZOOM 2000.
00047 #define DZOOM 1.10
00048 #define AU_KM 1.49605e8 //km in one AU
00049
00050 #define MINDRAWSTARMAG 6.5 // min. magnitude to load all stars which are needed for constellation lines
00051
00052 class QDataPump;
00053 class QFile;
00054 class QTimer;
00055
00056 class KStandardDirs;
00057
00058 class dms;
00059 class SkyMap;
00060 class SkyPoint;
00061 class SkyObject;
00062 class DeepSkyObject;
00063 class StarObject;
00064 class KSPlanet;
00065 class KSAsteroid;
00066 class KSComet;
00067 class KSMoon;
00068 class PlanetCatalog;
00069 class JupiterMoons;
00070
00071 class TimeZoneRule;
00072 class FileSource;
00073 class StarDataSink;
00074 class KSFileReader;
00075 class INDIHostsInfo;
00076 class ADVTreeData;
00077 class CSegment;
00078 class CustomCatalog;
00079
00089 class KStarsData : public QObject
00090 {
00091 Q_OBJECT
00092 public:
00093
00094 friend class FindDialog;
00095 friend class KStars;
00096 friend class KSWizard;
00097 friend class LocationDialog;
00098 friend class FOVDialog;
00099 friend class MapCanvas;
00100 friend class SkyMap;
00101 friend class FileSource;
00102 friend class StarDataSink;
00103 friend class LCGenerator;
00104 friend class DetailDialog;
00105 friend class AltVsTime;
00106 friend class KSPopupMenu;
00107 friend class WUTDialog;
00108 friend class INDIDriver;
00109 friend class INDI_P;
00110 friend class INDIStdProperty;
00111 friend class PlanetViewer;
00112 friend class JMoonTool;
00113 friend class telescopeWizardProcess;
00114 friend class KSNewStuff;
00115 friend class ObservingList;
00116 friend class ObsListWizard;
00117
00119 KStarsData();
00120
00122 virtual ~KStarsData();
00123
00131 bool readCityData( void );
00132
00135 bool readTimeZoneRulebook( void );
00136
00157 bool processCity( QString& line );
00158
00166 bool readStarData( void );
00167
00198 void processStar( QString *line, bool reloadMode = false );
00199
00225 bool readDeepSkyData( void );
00226
00239 bool readAsteroidData( void );
00240
00252 bool readCometData( void );
00253
00270 bool readCLineData( void );
00271
00287 bool readCNameData( void );
00288
00306 bool readCBoundData( void );
00307
00316 bool readMWData( void );
00317
00324 bool readVARData(void);
00325
00326
00335 bool readADVTreeData(void);
00336
00338 bool readINDIHosts(void);
00339
00340
00341
00342
00349 bool readUserLog(void);
00350
00364 bool readURLData( QString url, int type=0, bool deepOnly=false );
00365
00371 bool openURLFile(QString urlfile, QFile& file);
00372
00375 bool readCustomCatalogs();
00376
00380 bool addCatalog( QString filename );
00381
00386 bool removeCatalog( int i );
00387
00394 CustomCatalog* createCustomCatalog( QString filename, bool showerrs = false );
00395
00407 bool parseCustomDataHeader( QStringList lines, QStringList &Columns,
00408 QString &catName, QString &catPrefix, QString &catColor, float &catEpoch, int &iStart,
00409 bool showerrs, QStringList &errs );
00410
00421 bool processCustomDataLine( int num, QStringList d, QStringList Columns,
00422 QString Prefix, QPtrList<SkyObject> &objList, bool showerrs, QStringList &errs );
00423
00430 void setMagnitude( float newMagnitude, bool forceReload=false );
00431
00436 void setNextDSTChange( const KStarsDateTime &dt ) { NextDSTChange = dt; }
00437
00441 bool isTimeRunningForward() { return TimeRunsForward; }
00442
00445 KLocale *getLocale() { return locale; }
00446
00449 KSPlanet *earth() { return PCat->earth(); }
00450
00455 SkyObject* objectNamed( const QString &name );
00456
00463 void setFullTimeUpdate();
00464
00469 void changeDateTime( const KStarsDateTime &newDate );
00470
00473 const KStarsDateTime& lt() const { return LTime; }
00474
00477 const KStarsDateTime& ut() const { return Clock.utc(); }
00478
00481 void syncLST();
00482
00486 void setHourAngle( double ha ) { HourAngle->setH( ha ); }
00487
00488
00489
00492 ColorScheme *colorScheme() { return &CScheme; }
00493
00496 SimClock *clock() { return &Clock; }
00497
00500 dms *lst() { return LST; }
00501
00503 GeoLocation *geo() { return &Geo; }
00504
00507 QPtrList<CustomCatalog>& customCatalogs() { return CustomCatalogs; }
00508
00512 void setLocation( const GeoLocation &l );
00513
00516 void setLocationFromOptions();
00517
00520 bool snapNextFocus() const { return snapToFocus; }
00521
00531 void setSnapNextFocus(bool b=true) { snapToFocus = b; }
00532
00540 bool executeScript( const QString &name, SkyMap *map );
00541
00545 void initGuides( KSNumbers *num );
00546
00547 bool useDefaultOptions, startupComplete;
00548
00552 void appendTelescopeObject(SkyObject * object);
00553
00554 signals:
00557 void progressText(QString);
00558
00561 void initFinished(bool);
00562
00566 void update();
00567
00571 void clearCache();
00572
00573 public slots:
00574
00576 void initialize();
00577
00579 void slotConsoleMessage( QString s ) { std::cout << s.utf8() << std::endl; }
00580
00589 void updateTime(GeoLocation *geo, SkyMap * skymap, const bool automaticDSTchange = true);
00590
00595 void setTimeDirection( float scale );
00596
00600 void saveTimeBoxShaded( bool b );
00601
00605 void saveGeoBoxShaded( bool b );
00606
00610 void saveFocusBoxShaded( bool b );
00611
00615 void saveTimeBoxPos( QPoint p );
00616
00620 void saveGeoBoxPos( QPoint p );
00621
00625 void saveFocusBoxPos( QPoint p );
00626
00627 private slots:
00638 void slotInitialize();
00639
00642 void checkDataPumpAction();
00643
00646 void updateSkymap();
00647
00650 void sendClearCache();
00651
00652 private:
00653
00661 void initError(QString fn, bool required);
00662
00666 void resetToNewDST(const GeoLocation *geo, const bool automaticDSTchange);
00667
00668
00669
00670
00671
00672
00673 float maxSetMagnitude;
00674
00675
00676
00677 int lastFileIndex;
00678
00679 bool reloadingData();
00680
00681
00682 bool openStarFile(int i);
00683
00684 static QPtrList<GeoLocation> geoList;
00685 QPtrList<SkyObject> objList;
00686
00687 QPtrList<StarObject> starList;
00688
00689 unsigned int StarCount;
00690
00692 QPtrList<DeepSkyObject> deepSkyList;
00694 QPtrList<DeepSkyObject> deepSkyListMessier;
00696 QPtrList<DeepSkyObject> deepSkyListNGC;
00698 QPtrList<DeepSkyObject> deepSkyListIC;
00700 QPtrList<DeepSkyObject> deepSkyListOther;
00701
00702 QPtrList<KSAsteroid> asteroidList;
00703 QPtrList<KSComet> cometList;
00704
00705 QPtrList<SkyPoint> MilkyWay[NMWFILES];
00706
00707 QPtrList<SkyPoint> clineList;
00708 QPtrList<CSegment> csegmentList;
00709 QPtrList<QChar> clineModeList;
00710 QPtrList<SkyObject> cnameList;
00711 QPtrList<SkyObject> ObjLabelList;
00712
00713 QPtrList<SkyPoint> Equator;
00714 QPtrList<SkyPoint> Ecliptic;
00715 QPtrList<SkyPoint> Horizon;
00716 QPtrList<VariableStarInfo> VariableStarsList;
00717 QPtrList<ADVTreeData> ADVtreeList;
00718 QPtrList<INDIHostsInfo> INDIHostsList;
00719 QPtrList<SkyObject> INDITelescopeList;
00720
00721 QPtrList<CustomCatalog> CustomCatalogs;
00722
00723 ObjectNameList ObjNames;
00724
00725 static QMap<QString, TimeZoneRule> Rulebook;
00726 static QStringList CustomColumns;
00727
00728 GeoLocation Geo;
00729 SimClock Clock;
00730 ColorScheme CScheme;
00731
00732 KStarsDateTime LTime;
00733
00734 bool TimeRunsForward, temporaryTrail, snapToFocus;
00735
00736 QString cnameFile;
00737 KStandardDirs *stdDirs;
00738 KLocale *locale;
00739
00740 dms *LST, *HourAngle;
00741
00742 QString TypeName[NTYPENAME];
00743 KKey resumeKey;
00744
00745 PlanetCatalog *PCat;
00746 KSMoon *Moon;
00747 JupiterMoons *jmoons;
00748
00749 KSFileReader *starFileReader;
00750
00751 FOV fovSymbol;
00752
00753 double Obliquity, dObliq, dEcLong;
00754 KStarsDateTime LastNumUpdate, LastSkyUpdate, LastPlanetUpdate, LastMoonUpdate;
00755 KStarsDateTime NextDSTChange;
00756 KStarsDateTime StoredDate;
00757
00758 QTimer *initTimer;
00759 int initCounter;
00760
00765 FileSource *source;
00766 StarDataSink *loader;
00767 QDataPump *pump;
00768
00772 static int objects;
00773 };
00774
00775
00776 #endif // KSTARSDATA_H
00777