• 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
  • kstars
  • skycomponents
listcomponent.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  listcomponent.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2005/10/01
5  copyright : (C) 2005 by Jason Harris
6  email : kstars@30doradus.org
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 #include "listcomponent.h"
19 
20 #include <QList>
21 
22 #include "kstarsdata.h"
23 #include "skymap.h"
24 #include "skyobjects/skyobject.h"
25 
26 ListComponent::ListComponent( SkyComposite *parent ) :
27  SkyComponent( parent )
28 {}
29 
30 ListComponent::~ListComponent() {
31  clear();
32 }
33 
34 void ListComponent::clear() {
35  while ( ! m_ObjectList.isEmpty() ) {
36  SkyObject *o = m_ObjectList.takeFirst();
37  removeFromNames( o );
38  delete o;
39  }
40 }
41 
42 void ListComponent::update( KSNumbers *num )
43 {
44  if ( ! selected() )
45  return;
46  KStarsData *data = KStarsData::Instance();
47  foreach ( SkyObject *o, m_ObjectList ) {
48  if( num )
49  o->updateCoords( num );
50  o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
51  }
52 }
53 
54 SkyObject* ListComponent::findByName( const QString &name ) {
55  foreach( SkyObject *o, m_ObjectList ) {
56  if( QString::compare( o->name(), name, Qt::CaseInsensitive ) == 0 ||
57  QString::compare( o->longname(), name, Qt::CaseInsensitive ) == 0 ||
58  QString::compare( o->name2(), name, Qt::CaseInsensitive ) == 0 )
59  return o;
60  }
61  //No object found
62  return 0;
63 }
64 
65 SkyObject* ListComponent::objectNearest( SkyPoint *p, double &maxrad ) {
66  if ( ! selected() )
67  return 0;
68 
69  SkyObject *oBest = 0;
70  foreach ( SkyObject *o, m_ObjectList ) {
71  double r = o->angularDistanceTo( p ).Degrees();
72  if ( r < maxrad ) {
73  oBest = o;
74  maxrad = r;
75  }
76  }
77  return oBest;
78 }
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
skyobject.h
SkyObject::longname
virtual QString longname(void) const
Definition: skyobject.h:140
ListComponent::m_ObjectList
QList< SkyObject * > m_ObjectList
Definition: listcomponent.h:64
KStarsData::lst
dms * lst()
Definition: kstarsdata.h:161
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
dms::Degrees
const double & Degrees() const
Definition: dms.h:98
SkyComponent
SkyComponent represents an object on the sky map.
Definition: skycomponent.h:44
SkyPoint::updateCoords
virtual void updateCoords(KSNumbers *num, bool includePlanets=true, const dms *lat=0, const dms *LST=0, bool forceRecompute=false)
Determine the current coordinates (RA, Dec) from the catalog coordinates (RA0, Dec0), accounting for both precession and nutation.
Definition: skypoint.cpp:317
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
ListComponent::update
virtual void update(KSNumbers *num=0)
Update the sky positions of this component.
Definition: listcomponent.cpp:42
ListComponent::findByName
virtual SkyObject * findByName(const QString &name)
Search the children of this SkyComponent for a SkyObject whose name matches the argument name the nam...
Definition: listcomponent.cpp:54
listcomponent.h
SkyComponent::removeFromNames
void removeFromNames(const SkyObject *obj)
Definition: skycomponent.cpp:58
skymap.h
ListComponent::ListComponent
ListComponent(SkyComposite *parent)
Definition: listcomponent.cpp:26
SkyComposite
SkyComposite is a kind of container class for SkyComponent objects.
Definition: skycomposite.h:43
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const dms *LST, const dms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:55
SkyObject::name2
QString name2(void) const
Definition: skyobject.h:132
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
ListComponent::objectNearest
virtual SkyObject * objectNearest(SkyPoint *p, double &maxrad)
Find the SkyObject nearest the given SkyPoint.
Definition: listcomponent.cpp:65
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
ListComponent::~ListComponent
virtual ~ListComponent()
Definition: listcomponent.cpp:30
kstarsdata.h
SkyObject::name
virtual QString name(void) const
Definition: skyobject.h:124
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
SkyComponent::selected
virtual bool selected()
Definition: skycomponent.h:79
SkyPoint::angularDistanceTo
dms angularDistanceTo(const SkyPoint *sp, double *const positionAngle=0) const
Computes the angular distance between two SkyObjects.
Definition: skypoint.cpp:608
ListComponent::clear
void clear()
Definition: listcomponent.cpp:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 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