• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • datahandlers
catalogdb.h
Go to the documentation of this file.
1 /***************************************************************************
2  catalogDB.h - K Desktop Planetarium
3  -------------------
4  begin : 2012/03/08
5  copyright : (C) 2012 by Rishab Arora
6  email : ra.rishab@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef CATALOGDB_H
19 #define CATALOGDB_H
20 
21 #include <datahandlers/ksparser.h>
22 #include <datahandlers/catalogdata.h>
23 #include <datahandlers/catalogentrydata.h>
24 #include "kstars/skyobjects/starobject.h"
25 #include "kstars/skyobjects/deepskyobject.h"
26 #include "kstars/skycomponents/skycomponent.h"
27 #include <kstandarddirs.h>
28 #include <klocale.h>
29 #include <KDebug>
30 #include <KMessageBox>
31 #include <QSqlDatabase>
32 #include <QDebug>
33 #include <QSqlQuery>
34 #include <QSqlRecord>
35 #include <QSqlTableModel>
36 #include <QString>
37 #include <QHash>
38 #include <QSqlError>
39 #include <QVariant>
40 #include <QFile>
41 #include <QDir>
42 
43 
44 /* Some notes about the database. (skycomponents.db)
45  * 1) The uid for Object Designation is the uid being used by objects in KStars
46  * hence, the uid is a qint64 i.e. a 64 bit signed integer. Coincidentaly,
47  * this is the max limit of an int in Sqlite3.
48  * Hence, the db is compatible with the uid, but doesn't use it as of now.
49  */
50 
51 class CatalogDB {
52  public:
65  bool Initialize();
70  ~CatalogDB();
76  QStringList* Catalogs();
83  void RefreshCatalogList();
90  bool AddCatalogContents(const QString &filename);
91 
100  int FindFuzzyEntry(const double ra, const double dec,
101  const double magnitude);
102 
109  void AddEntry(const CatalogEntryData &catalog_entry);
110 
117  void RemoveCatalog(const QString& catalog_name);
118 
129  void GetAllObjects(const QString &catalog_name,
130  QList< SkyObject* > &sky_list,
131  QList < QPair <int, QString> > &object_names,
132  CatalogComponent *catalog_pointer);
133 
141  void GetCatalogData(const QString& catalog_name,
142  CatalogData& catalog_data);
143 
144  private:
149  QSqlDatabase skydb_;
150 
156  QSqlError LastError();
157 
162  QStringList catalog_list_;
163 
171  int FindCatalog(const QString &catalog_name);
172 
184  bool ParseCatalogInfoToDB(const QStringList &lines, QStringList &columns,
185  QString &catalog_name, char &delimiter);
186 
193  void AddCatalog(const CatalogData& catalog_data);
194 
202  QList< QPair< QString, KSParser::DataTypes > >
203  buildParserSequence(const QStringList& Columns);
210  void ClearDSOEntries(int catalog_id);
216  void FirstRun();
217 };
218 
219 #endif // CATALOGDB_H
CatalogDB::AddCatalogContents
bool AddCatalogContents(const QString &filename)
Add contents of custom catalog to the program database.
Definition: catalogdb.cpp:339
CatalogEntryData
Class to store details of a Catalog Entry.
Definition: catalogentrydata.h:59
deepskyobject.h
CatalogDB::GetAllObjects
void GetAllObjects(const QString &catalog_name, QList< SkyObject * > &sky_list, QList< QPair< int, QString > > &object_names, CatalogComponent *catalog_pointer)
Creates objects of type SkyObject and assigns them to references.
Definition: catalogdb.cpp:674
CatalogDB::AddEntry
void AddEntry(const CatalogEntryData &catalog_entry)
Used to add a cross referenced entry into the database.
Definition: catalogdb.cpp:261
CatalogDB::RefreshCatalogList
void RefreshCatalogList()
Rechecks the database and builds the Catalog listing.
Definition: catalogdb.cpp:117
CatalogDB::Catalogs
QStringList * Catalogs()
Accessor for list of all available catalogs in db.
Definition: catalogdb.cpp:111
CatalogData
Add the catalog with given details into the database.
Definition: catalogdata.h:38
CatalogComponent
Represents a custom user-defined catalog.
Definition: catalogcomponent.h:39
catalogdata.h
skycomponent.h
catalogentrydata.h
CatalogDB::~CatalogDB
~CatalogDB()
Attempt to close database and remove reference from the DB List.
Definition: catalogdb.cpp:100
CatalogDB
Definition: catalogdb.h:51
CatalogDB::Initialize
bool Initialize()
Initializes the database and sets up pointers to Catalog DB Performs the following actions: ...
Definition: catalogdb.cpp:22
starobject.h
ksparser.h
CatalogDB::GetCatalogData
void GetCatalogData(const QString &catalog_name, CatalogData &catalog_data)
Get information about the catalog like Prefix etc.
Definition: catalogdb.cpp:654
QList
CatalogDB::FindFuzzyEntry
int FindFuzzyEntry(const double ra, const double dec, const double magnitude)
returns the id of the row if it matches with certain fuzz.
Definition: catalogdb.cpp:228
CatalogDB::RemoveCatalog
void RemoveCatalog(const QString &catalog_name)
Removes the catalog from the database and refreshes the listing.
Definition: catalogdb.cpp:184
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal