kstars
KStarsData Class Reference
KStarsData manages all the data objects used by KStars: Lists of stars, deep-sky objects, planets, geographic locations, and constellations. More...
#include <kstarsdata.h>

Public Slots | |
void | initialize () |
void | saveFocusBoxPos (QPoint p) |
void | saveFocusBoxShaded (bool b) |
void | saveGeoBoxPos (QPoint p) |
void | saveGeoBoxShaded (bool b) |
void | saveTimeBoxPos (QPoint p) |
void | saveTimeBoxShaded (bool b) |
void | setTimeDirection (float scale) |
void | slotConsoleMessage (QString s) |
void | updateTime (GeoLocation *geo, SkyMap *skymap, const bool automaticDSTchange=true) |
Signals | |
void | clearCache () |
void | initFinished (bool) |
void | progressText (QString) |
void | update () |
Public Member Functions | |
bool | addCatalog (QString filename) |
void | appendTelescopeObject (SkyObject *object) |
void | changeDateTime (const KStarsDateTime &newDate) |
SimClock * | clock () |
ColorScheme * | colorScheme () |
CustomCatalog * | createCustomCatalog (QString filename, bool showerrs=false) |
QPtrList< CustomCatalog > & | customCatalogs () |
KSPlanet * | earth () |
bool | executeScript (const QString &name, SkyMap *map) |
GeoLocation * | geo () |
KLocale * | getLocale () |
void | initGuides (KSNumbers *num) |
bool | isTimeRunningForward () |
KStarsData () | |
dms * | lst () |
const KStarsDateTime & | lt () const |
SkyObject * | objectNamed (const QString &name) |
bool | openURLFile (QString urlfile, QFile &file) |
bool | parseCustomDataHeader (QStringList lines, QStringList &Columns, QString &catName, QString &catPrefix, QString &catColor, float &catEpoch, int &iStart, bool showerrs, QStringList &errs) |
bool | processCity (QString &line) |
bool | processCustomDataLine (int num, QStringList d, QStringList Columns, QString Prefix, QPtrList< SkyObject > &objList, bool showerrs, QStringList &errs) |
void | processStar (QString *line, bool reloadMode=false) |
bool | readADVTreeData (void) |
bool | readAsteroidData (void) |
bool | readCBoundData (void) |
bool | readCityData (void) |
bool | readCLineData (void) |
bool | readCNameData (void) |
bool | readCometData (void) |
bool | readCustomCatalogs () |
bool | readDeepSkyData (void) |
bool | readINDIHosts (void) |
bool | readMWData (void) |
bool | readStarData (void) |
bool | readTimeZoneRulebook (void) |
bool | readURLData (QString url, int type=0, bool deepOnly=false) |
bool | readUserLog (void) |
bool | readVARData (void) |
bool | removeCatalog (int i) |
void | setFullTimeUpdate () |
void | setHourAngle (double ha) |
void | setLocation (const GeoLocation &l) |
void | setLocationFromOptions () |
void | setMagnitude (float newMagnitude, bool forceReload=false) |
void | setNextDSTChange (const KStarsDateTime &dt) |
void | setSnapNextFocus (bool b=true) |
bool | snapNextFocus () const |
void | syncLST () |
const KStarsDateTime & | ut () const |
virtual | ~KStarsData () |
Public Attributes | |
bool | startupComplete |
bool | useDefaultOptions |
Detailed Description
KStarsData manages all the data objects used by KStars: Lists of stars, deep-sky objects, planets, geographic locations, and constellations.Also, the milky way, and URLs for images and information pages.
- Version:
- 1.0
Definition at line 89 of file kstarsdata.h.
Constructor & Destructor Documentation
KStarsData::KStarsData | ( | ) |
KStarsData::~KStarsData | ( | ) | [virtual] |
Member Function Documentation
bool KStarsData::addCatalog | ( | QString | filename | ) |
Add a user-defined object catalog to the list of custom catalogs.
(Basically just calls createCustomCatalog() )
Definition at line 1124 of file kstarsdata.cpp.
void KStarsData::appendTelescopeObject | ( | SkyObject * | object | ) |
Appends telescope sky object to the list of INDI telescope objects.
This enables KStars to track all telescopes properly.
- Parameters:
-
object pointer to telescope sky object
Definition at line 2571 of file kstarsdata.cpp.
void KStarsData::changeDateTime | ( | const KStarsDateTime & | newDate | ) |
change the current simulation date/time to the KStarsDateTime argument.
Specified DateTime is always universal time.
- Parameters:
-
newDate the DateTime to set.
Definition at line 2266 of file kstarsdata.cpp.
void KStarsData::clearCache | ( | ) | [signal] |
If data changed, emit clearCache signal.
SimClock* KStarsData::clock | ( | ) | [inline] |
ColorScheme* KStarsData::colorScheme | ( | ) | [inline] |
CustomCatalog * KStarsData::createCustomCatalog | ( | QString | filename, | |
bool | showerrs = false | |||
) |
Read in and parse a custom object catalog.
Object data are read from a file, and parsed into a CustomCatalog object.
- Parameters:
-
filename name of the custom catalog file showerrs show GUI window summarizing parsing errors
- Returns:
- pointer to the new catalog
Definition at line 1166 of file kstarsdata.cpp.
QPtrList<CustomCatalog>& KStarsData::customCatalogs | ( | ) | [inline] |
KSPlanet* KStarsData::earth | ( | ) | [inline] |
Execute a script.
This function actually duplicates the DCOP functionality for those cases when invoking DCOP is not practical (i.e., when preparing a sky image in command-line dump mode).
- Parameters:
-
name the filename of the script to "execute". map pointer to the SkyMap object.
- Returns:
- TRUE if the script was successfully parsed.
Definition at line 2343 of file kstarsdata.cpp.
GeoLocation* KStarsData::geo | ( | ) | [inline] |
KLocale* KStarsData::getLocale | ( | ) | [inline] |
void KStarsData::initFinished | ( | bool | ) | [signal] |
Signal that the Data initialization has finished.
void KStarsData::initGuides | ( | KSNumbers * | num | ) |
Initialize celestial equator, horizon and ecliptic.
- Parameters:
-
num pointer to a KSNumbers object to use.
Definition at line 1955 of file kstarsdata.cpp.
void KStarsData::initialize | ( | ) | [slot] |
Create a timer and connect its timeout() signal to slotInitialize().
Definition at line 1761 of file kstarsdata.cpp.
bool KStarsData::isTimeRunningForward | ( | ) | [inline] |
Returns true if time is running forward else false.
Used by KStars to prevent 2 calculations of daylight saving change time.
Definition at line 441 of file kstarsdata.h.
dms* KStarsData::lst | ( | ) | [inline] |
- Returns:
- pointer to the local sidereal time: a dms object
Definition at line 500 of file kstarsdata.h.
const KStarsDateTime& KStarsData::lt | ( | ) | const [inline] |
Find object by name.
- Parameters:
-
name Object name to find
- Returns:
- pointer to SkyObject matching this name
Definition at line 2285 of file kstarsdata.cpp.
open a file containing URL links.
- Parameters:
-
urlfile string representation of the filename to open file reference to the QFile object which will be opened to this file.
- Returns:
- TRUE if file successfully opened.
Definition at line 926 of file kstarsdata.cpp.
bool KStarsData::parseCustomDataHeader | ( | QStringList | lines, | |
QStringList & | Columns, | |||
QString & | catName, | |||
QString & | catPrefix, | |||
QString & | catColor, | |||
float & | catEpoch, | |||
int & | iStart, | |||
bool | showerrs, | |||
QStringList & | errs | |||
) |
Parse the header of the custom object catalog.
- Parameters:
-
lines string list containing the lines from the custom catalog file Columns reference to list of descriptors of the data columns catName reference to the name of the catalog (read from header) catPrefix reference to the prefix for ID-number-based names (read from header) catColor reference to the color for the object symbols (read from header) catEpoch reference to the coordinate epoch of the catalog (read from header) iStart reference to the line number of the first data line (following the header) showerrs if true, notify user of problems parsing the header. errs reference to the cumulative list of error reports
Definition at line 1373 of file kstarsdata.cpp.
bool KStarsData::processCity | ( | QString & | line | ) |
Parse one line from a locations database file.
The line contains 10 or 11 fields separated by colons (":"). The fields are:
- City Name [string]
- Province Name (optional) [string]
- Country Name [string]
- Longitude degrees [int]
- Latitude arcminutes [int]
- Latitude arcseconds [int]
- Latitude sign [char; 'E' or 'W' ]
- Latitude degrees [int]
- Latitude arcminutes [int]
- Latitude arcseconds [int]
- Latitude sign [char; 'N' or 'S' ]
- Timezone [float; -12 <= TZ <= 12, or 'x' if TZ unknown]
- Parameters:
-
line The line from the geographic database to be parsed
- Returns:
- true if location successfully parsed; otherwise false.
- See also:
- KStarsData::readCityData()
Definition at line 1522 of file kstarsdata.cpp.
bool KStarsData::processCustomDataLine | ( | int | num, | |
QStringList | d, | |||
QStringList | Columns, | |||
QString | Prefix, | |||
QPtrList< SkyObject > & | objList, | |||
bool | showerrs, | |||
QStringList & | errs | |||
) |
Parse a line from custom object catalog.
If parsing is successful, add the object to the object list
- Parameters:
-
num the line number being processed d list of fields in the line Columns the list of field descriptors (read from the header) Prefix the string prefix to be prepended to ID numbers (read from the header) objList reference to the list of SkyObjects in the catalog showerrs if true, notify user of problems parsing the header. errs reference to the cumulative list of error reports
Definition at line 1263 of file kstarsdata.cpp.
void KStarsData::processStar | ( | QString * | line, | |
bool | reloadMode = false | |||
) |
Parse a line from a stars data file, constructing a StarObject from the data.
The StarObject is added to the list of stars.
Each line is parsed according to the column position in the line:
- 0-1 RA hours [int]
- 2-3 RA minutes [int]
- 4-8 RA seconds [float]
- 10 Dec sign [char; '+' or '-']
- 11-12 Dec degrees [int]
- 13-14 Dec minutes [int]
- 15-18 Dec seconds [float]
- 20-28 dRA/dt (milli-arcsec/yr) [float]
- 29-37 dDec/dt (milli-arcsec/yr) [float]
- 38-44 Parallax (milli-arcsec) [float]
- 46-50 Magnitude [float]
- 51-55 B-V color index [float]
- 56-57 Spectral type [string]
- 59 Multiplicity flag (1=true, 0=false) [int]
- 61-64 Variability range of brightness (magnitudes; bank if not variable) [float]
- 66-71 Variability period (days; blank if not variable) [float]
- 72-END Name(s) [string]. This field may be blank. The string is the common name for the star (e.g., "Betelgeuse"). If there is a colon, then everything after the colon is the genetive name for the star (e.g., "alpha Orionis").
- Parameters:
-
line pointer to the line of data to be processed as a StarObject reloadMode makes additional calculations in reload mode, not needed at start up
- See also:
- KStarsData::readStarData()
Definition at line 622 of file kstarsdata.cpp.
void KStarsData::progressText | ( | QString | ) | [signal] |
Signal that specifies the text that should be drawn in the KStarsSplash window.
bool KStarsData::readADVTreeData | ( | void | ) |
Read Advanced interface structure to be used later to construct the list view in the advanced tab in the Detail Dialog.
- KSLABEL designates a top-level parent label
- KSINTERFACE designates a common URL interface for several objects
- END designates the end of a sub tree structure read Advanted interface structure.
- Returns:
- true if data is successfully read.
Definition at line 195 of file kstarsdata.cpp.
bool KStarsData::readAsteroidData | ( | void | ) |
Populate the list of Asteroids from the data file.
Each line in the data file is parsed as follows:
- 6-23 Name [string]
- 24-29 Modified Julian Day of orbital elements [int]
- 30-39 semi-major axis of orbit in AU [double]
- 41-51 eccentricity of orbit [double]
- 52-61 inclination angle of orbit in degrees [double]
- 62-71 argument of perihelion in degrees [double]
- 72-81 Longitude of the Ascending Node in degrees [double]
- 82-93 Mean Anomaly in degrees [double]
- 94-98 Magnitude [double]
Definition at line 705 of file kstarsdata.cpp.
bool KStarsData::readCBoundData | ( | void | ) |
Read constellation boundary data.
The boundary data is defined by a series of RA,Dec coordinate pairs defining the "nodes" of the boundaries. The nodes are organized into "segments", such that each segment represents a continuous series of boundary-line intervals that divide two particular constellations.
The definition of a segment begins with an integer describing the number of Nodes in the segment. This is followed by that number of RA,Dec pairs (RA in hours, Dec in degrees). Finally, there is an integer indicating the number of constellations bordered by this segment (this number is always 2), followed by the IAU abbreviations of the two constellations.
Since the definition of a segment can span multiple lines, we parse this file word-by-word, rather than line-by-line as we do in other files.
Read in the constellation boundary data.
- Returns:
- TRUE if the boundary data is successfully parsed.
Definition at line 490 of file kstarsdata.cpp.
bool KStarsData::readCityData | ( | void | ) |
Populate list of geographic locations from "Cities.dat".
Also check for custom locations file "mycities.dat", but don't require it. Each line in the file provides the information required to create one GeoLocation object. Fill list of geographic locations from file(s)
- Returns:
- true if at least one city read successfully.
- See also:
- KStarsData::processCity()
Definition at line 1663 of file kstarsdata.cpp.
bool KStarsData::readCLineData | ( | void | ) |
Read in Constellation line data.
The constellations are represented as a list of SkyPoints and an associated list of chars that indicates whether to draw a line between points (i) and (i+1) or to simply move to point (i+1). The lines are parsed according to column position:
- 0-1 RA hours [int]
- 2-3 RA minutes [int]
- 4-5 RA seconds [int]
- 6 Dec sign [char; '+' or '-']
- 7-9 Dec degrees [int]
- 10-11 Dec minutes [int]
- 12-13 Dec seconds [int]
- 14 draw indicator [char; 'D' or 'M'] 'D'==draw line; 'M'==just move
- Returns:
- true if data file was successfully read
Definition at line 392 of file kstarsdata.cpp.
bool KStarsData::readCNameData | ( | void | ) |
Read constellation names.
The coordinates are where the constellation name text will be centered. The positions are imprecise, but that's okay since constellations are so large. The lines are parsed according to column position:
- 0-1 RA hours [int]
- 2-3 RA minutes [int]
- 4-5 RA seconds [int]
- 6 Dec sign [char; '+' or '-']
- 7-8 Dec degrees [int]
- 9-10 Dec minutes [int]
- 11-12 Dec seconds [int]
- 13-15 IAU Abbreviation [string] e.g., 'Ori' == Orion
- 17- Constellation name [string] Read in constellation name data.
- Returns:
- TRUE if data file was successfully read.
Definition at line 447 of file kstarsdata.cpp.
bool KStarsData::readCometData | ( | void | ) |
Populate the list of Comets from the data file.
Each line in the data file is parsed as follows:
- 3-37 Name [string]
- 38-42 Modified Julian Day of orbital elements [double]
- 44-54 Perihelion distance in AU [double]
- 55-65 Eccentricity of orbit [double]
- 66-75 inclination of orbit in degrees [double]
- 76-85 argument of perihelion in degrees [double]
- 86-95 longitude of the ascending node in degrees[double]
- 96-110 Period of orbit in years [double]
Definition at line 743 of file kstarsdata.cpp.
bool KStarsData::readCustomCatalogs | ( | ) |
Initialize custom object catalogs from the files listed in the config file.
Definition at line 1113 of file kstarsdata.cpp.
bool KStarsData::readDeepSkyData | ( | void | ) |
Populate the list of deep-sky objects from the database file.
Each line in the file is parsed according to column position:
- 0 IC indicator [char] If 'I' then IC object; if ' ' then NGC object
- 1-4 Catalog number [int] The NGC/IC catalog ID number
- 6-8 Constellation code (IAU abbreviation)
- 10-11 RA hours [int]
- 13-14 RA minutes [int]
- 16-19 RA seconds [float]
- 21 Dec sign [char; '+' or '-']
- 22-23 Dec degrees [int]
- 25-26 Dec minutes [int]
- 28-29 Dec seconds [int]
- 31 Type ID [int] Indicates object type; see TypeName array in kstars.cpp
- 33-36 Type details [string] (not yet used)
- 38-41 Magnitude [float] can be blank
- 43-48 Major axis length, in arcmin [float] can be blank
- 50-54 Minor axis length, in arcmin [float] can be blank
- 56-58 Position angle, in degrees [int] can be blank
- 60-62 Messier catalog number [int] can be blank
- 64-69 PGC Catalog number [int] can be blank
- 71-75 UGC Catalog number [int] can be blank
- 77-END Common name [string] can be blank Read the ngcic.dat deep-sky database.
- Returns:
- true if data file is successfully read.
Definition at line 783 of file kstarsdata.cpp.
bool KStarsData::readINDIHosts | ( | void | ) |
bool KStarsData::readMWData | ( | void | ) |
Read Milky Way data.
Coordinates for the Milky Way contour are divided into 11 files, each representing a simple closed curve that can be drawn with drawPolygon(). The lines in each file are parsed according to column position:
- 0-7 RA [float]
- 9-16 Dec [float] read Milky Way contour data.
- Returns:
- true if all MW files were successfully read
Definition at line 165 of file kstarsdata.cpp.
bool KStarsData::readStarData | ( | void | ) |
Populate list of star objects from the stars database file.
Each line in the file provides the information required to construct a SkyObject of type 'star'. read the stars database, constructing the list of SkyObjects that represent the stars.
- Returns:
- true if the data file was successfully opened and read.
- See also:
- KStarsData::processStar()
Definition at line 580 of file kstarsdata.cpp.
bool KStarsData::readTimeZoneRulebook | ( | void | ) |
Read the data file that contains daylight savings time rules.
Definition at line 1637 of file kstarsdata.cpp.
bool KStarsData::readURLData | ( | QString | url, | |
int | type = 0 , |
|||
bool | deepOnly = false | |||
) |
Read in URLs to be attached to a named object's right-click popup menu.
At this point, there is no way to attach URLs to unnamed objects. There are two kinds of URLs, each with its own data file: image links and webpage links. In addition, there may be user-specific versions with custom URLs. Each line contains 3 fields separated by colons (":"). Note that the last field is the URL, and as such it will generally contain a colon itself. Only the first two colons encountered are treated as field separators. The fields are:
- Object name. This must be the "primary" name of the object (the name at the top of the popup menu).
- Menu text. The string that should appear in the popup menu to activate the link.
- URL. Read in image and information URLs.
- Returns:
- true if data files were successfully read.
Definition at line 1076 of file kstarsdata.cpp.
bool KStarsData::readUserLog | ( | void | ) |
Read user logs.
The log file is formatted as following:
- KSLABEL designates the beginning of a log
- KSLogEnd designates the end of a log. read user logs.
- Returns:
- true if data is successfully read.
Definition at line 1035 of file kstarsdata.cpp.
bool KStarsData::readVARData | ( | void | ) |
Read Variable Stars data and stores them in structure of type VariableStarsInfo.
- 0-8 AAVSO Star Designation
- 10-20 Common star name read Variable Stars data.
- Returns:
- true if data is successfully read.
Definition at line 261 of file kstarsdata.cpp.
bool KStarsData::removeCatalog | ( | int | i | ) |
Remove a user-defined object catalog from the list of custom catalogs.
Also removes the objects from the ObjNames list.
- Parameters:
-
i the index identifier of the catalog to be removed
Definition at line 1150 of file kstarsdata.cpp.
void KStarsData::saveFocusBoxPos | ( | QPoint | p | ) | [slot] |
Save the screen position of the Time infobox.
- Parameters:
-
p the position of the box
Definition at line 2581 of file kstarsdata.cpp.
void KStarsData::saveFocusBoxShaded | ( | bool | b | ) | [slot] |
Save the shaded state of the Focus infobox.
- Parameters:
-
b TRUE if the box is shaded
Definition at line 2578 of file kstarsdata.cpp.
void KStarsData::saveGeoBoxPos | ( | QPoint | p | ) | [slot] |
Save the screen position of the Time infobox.
- Parameters:
-
p the position of the box
Definition at line 2580 of file kstarsdata.cpp.
void KStarsData::saveGeoBoxShaded | ( | bool | b | ) | [slot] |
Save the shaded state of the Geo infobox.
- Parameters:
-
b TRUE if the box is shaded
Definition at line 2577 of file kstarsdata.cpp.
void KStarsData::saveTimeBoxPos | ( | QPoint | p | ) | [slot] |
Save the screen position of the Time infobox.
- Parameters:
-
p the position of the box
Definition at line 2579 of file kstarsdata.cpp.
void KStarsData::saveTimeBoxShaded | ( | bool | b | ) | [slot] |
Save the shaded state of the Time infobox.
- Parameters:
-
b TRUE if the box is shaded
Definition at line 2576 of file kstarsdata.cpp.
void KStarsData::setFullTimeUpdate | ( | ) |
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
The date of the last update for each category is recorded so we know when we need to do it again (see KStars::updateTime()). Initializing these to -1000000.0 ensures they will be updated immediately on the first call to KStars::updateTime().
Definition at line 2231 of file kstarsdata.cpp.
void KStarsData::setHourAngle | ( | double | ha | ) | [inline] |
Set the HourAngle member variable according to the argument.
- Parameters:
-
ha The new HourAngle
Definition at line 486 of file kstarsdata.h.
void KStarsData::setLocation | ( | const GeoLocation & | l | ) |
Set the GeoLocation according to the argument.
- Parameters:
-
l reference to the new GeoLocation
Definition at line 2245 of file kstarsdata.cpp.
void KStarsData::setLocationFromOptions | ( | ) |
Set the GeoLocation according to the values stored in the configuration file.
Definition at line 2238 of file kstarsdata.cpp.
void KStarsData::setMagnitude | ( | float | newMagnitude, | |
bool | forceReload = false | |||
) |
reset the faint limit for the stellar database
- Parameters:
-
newMagnitude the new faint limit. forceReload will force a reload also if newMagnitude <= maxSetMagnitude it's needed to set internal maxSetMagnitude and reload data later; is used in checkDataPumpAction() and should not used outside.
Definition at line 1691 of file kstarsdata.cpp.
void KStarsData::setNextDSTChange | ( | const KStarsDateTime & | dt | ) | [inline] |
Set the NextDSTChange member.
Need this accessor because I could not make KStars::privatedata a friend class for some reason...:/
Definition at line 436 of file kstarsdata.h.
void KStarsData::setSnapNextFocus | ( | bool | b = true |
) | [inline] |
Disable or re-enable the slewing animation for the next Focus change.
- Note:
- If the user has turned off all animated slewing, setSnapNextFocus(false) will *NOT* enable animation on the next slew. A false argument would only be used if you have previously called setSnapNextFocus(true), but then decided you didn't want that after all. In other words, it's extremely unlikely you'd ever want to use setSnapNextFocus(false).
- Parameters:
-
b when TRUE (the default), the next Focus chnage will omit the slewing animation.
Definition at line 531 of file kstarsdata.h.
void KStarsData::setTimeDirection | ( | float | scale | ) | [slot] |
Sets the direction of time and stores it in bool TimeRunForwards.
If scale >= 0 time is running forward else time runs backward. We need this to calculate just one daylight saving change time (previous or next DST change).
Definition at line 2227 of file kstarsdata.cpp.
void KStarsData::slotConsoleMessage | ( | QString | s | ) | [inline, slot] |
bool KStarsData::snapNextFocus | ( | ) | const [inline] |
- Returns:
- whether the next Focus change will omit the slewing animation.
Definition at line 520 of file kstarsdata.h.
void KStarsData::syncLST | ( | ) |
void KStarsData::update | ( | ) | [signal] |
Should be used to refresh skymap.
void KStarsData::updateTime | ( | GeoLocation * | geo, | |
SkyMap * | skymap, | |||
const bool | automaticDSTchange = true | |||
) | [slot] |
Update the Simulation Clock.
Update positions of Planets. Update Alt/Az coordinates of objects. Update precession. Update Focus position. Draw new Skymap.
This is ugly. It _will_ change! (JH:)hey, it's much less ugly now...can we lose the comment yet? :p
Definition at line 2010 of file kstarsdata.cpp.
const KStarsDateTime& KStarsData::ut | ( | ) | const [inline] |
- Returns:
- reference to the current simulation universal time
Definition at line 477 of file kstarsdata.h.
Member Data Documentation
Definition at line 547 of file kstarsdata.h.
Definition at line 547 of file kstarsdata.h.
The documentation for this class was generated from the following files: