• 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
ecliptic.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  ecliptic.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2007-08-09
5  copyright : (C) 2007 by James B. Bowlin
6  email : bowlin@mindspring.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 #include "ecliptic.h"
19 
20 #include "ksnumbers.h"
21 #include "kstarsdata.h"
22 #include "skymap.h"
23 #include "skyobjects/skypoint.h"
24 #include "dms.h"
25 #include "Options.h"
26 #include "linelist.h"
27 #include "skylabeler.h"
28 
29 #include "skypainter.h"
30 #include "projections/projector.h"
31 
32 Ecliptic::Ecliptic(SkyComposite *parent ) :
33  LineListIndex( parent, i18n("Ecliptic") ),
34  m_label( name() )
35 {
36  KStarsData *data = KStarsData::Instance();
37  KSNumbers num( data->ut().djd() );
38  dms elat(0.0), elng(0.0);
39 
40  const double eps = 0.1;
41  const double minRa = 0.0;
42  const double maxRa = 23.0;
43  const double dRa = 2.0;
44  const double dRa2 = 2. / 5.;
45 
46  for(double ra = minRa; ra < maxRa; ra += dRa ) {
47  LineList* lineList = new LineList();
48  for(double ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa2 ) {
49  elng.setH( ra2 );
50  SkyPoint* o = new SkyPoint();
51  o->setFromEcliptic( num.obliquity(), elng, elat );
52  o->setRA0( o->ra().Hours() );
53  o->setDec0( o->dec().Degrees() );
54  o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
55  lineList->append( o );
56  }
57  appendLine( lineList );
58  }
59 }
60 
61 bool Ecliptic::selected()
62 {
63  return Options::showEcliptic();
64 }
65 
66 void Ecliptic::draw( SkyPainter *skyp )
67 {
68  if ( ! selected() ) return;
69 
70  KStarsData *data = KStarsData::Instance();
71  QColor color( data->colorScheme()->colorNamed( "EclColor" ) );
72  skyp->setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
73 
74  m_label.reset();
75  drawLines( skyp );
76  SkyLabeler::Instance()->setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
77  m_label.draw();
78 
79  drawCompassLabels();
80 }
81 
82 void Ecliptic::drawCompassLabels() {
83  const Projector* proj = SkyMap::Instance()->projector();
84  KStarsData* data = KStarsData::Instance();
85  SkyLabeler* skyLabeler = SkyLabeler::Instance();
86  // Set proper color for labels
87  QColor color( data->colorScheme()->colorNamed( "CompassColor" ) );
88  skyLabeler->setPen( QPen( QBrush(color), 1, Qt::SolidLine) );
89 
90  KSNumbers num( data->ut().djd() );
91  dms elat(0.0), elng(0.0);
92  QString label;
93  for( int ra = 0; ra < 23; ra += 6 ) {
94  elng.setH( ra );
95  SkyPoint o;
96  o.setFromEcliptic( num.obliquity(), elng, elat );
97  o.setRA0( o.ra() );
98  o.setDec0( o.dec() );
99  o.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
100  bool visible;
101  QPointF cpoint = proj->toScreen( &o, false, &visible );
102  if( visible && proj->checkVisibility( &o ) ) {
103  label.setNum( o.ra().reduce().Degrees() );
104  skyLabeler->drawGuideLabel( cpoint, label, 0.0 );
105  }
106  }
107 }
ecliptic.h
Ecliptic::Ecliptic
Ecliptic(SkyComposite *parent)
Definition: ecliptic.cpp:32
SkyPoint::ra
const dms & ra() const
Definition: skypoint.h:171
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:149
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
ColorScheme::colorNamed
QColor colorNamed(const QString &name) const
Retrieve a color by name.
Definition: colorscheme.cpp:97
skypainter.h
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
Ecliptic::drawCompassLabels
virtual void drawCompassLabels()
Definition: ecliptic.cpp:82
LineList
Definition: linelist.h:35
Projector::checkVisibility
bool checkVisibility(SkyPoint *p) const
Determine if the skypoint p is likely to be visible in the display window.
Definition: projector.cpp:181
LineListIndex::appendLine
void appendLine(LineList *lineList, int debug=0)
Definition: linelistindex.cpp:73
dms.h
SkyLabeler::Instance
static SkyLabeler * Instance()
Definition: skylabeler.cpp:49
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
Projector
This class serves as an interface to handle projections.
Definition: projector.h:49
Projector::toScreen
QPointF toScreen(const SkyPoint *o, bool oRefract=true, bool *onVisibleHemisphere=0) const
This is exactly the same as toScreenVec but it returns a QPointF.
Definition: projector.cpp:93
linelist.h
KStarsDateTime::djd
long double djd() const
Definition: kstarsdatetime.h:145
Options::showEcliptic
static bool showEcliptic()
Get Draw ecliptic line in the sky map?
Definition: Options.h:1645
skymap.h
ksnumbers.h
SkyPoint::setFromEcliptic
void setFromEcliptic(const dms *Obliquity, const dms &EcLong, const dms &EcLat)
Set the current (RA, Dec) coordinates of the SkyPoint, given pointers to its Ecliptic (Long...
Definition: skypoint.cpp:151
LineListIndex::drawLines
void drawLines(SkyPainter *skyp)
Definition: linelistindex.cpp:177
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
SkyComposite
SkyComposite is a kind of container class for SkyComponent objects.
Definition: skycomposite.h:43
SkyPoint::dec
const dms & dec() const
Definition: skypoint.h:174
dms::Hours
double Hours() const
Definition: dms.h:125
skypoint.h
SkyLabeler::drawGuideLabel
bool drawGuideLabel(QPointF &o, const QString &text, double angle)
Tries to draw the text at the position and angle specified.
Definition: skylabeler.cpp:104
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
SkyPainter::setPen
virtual void setPen(const QPen &pen)=0
Set the pen of the painter.
Options.h
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
LineListLabel::reset
void reset()
Definition: linelistlabel.cpp:40
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
SkyPoint::setRA0
void setRA0(dms r)
Sets RA0, the catalog Right Ascension.
Definition: skypoint.h:97
LineListIndex
Definition: linelistindex.h:39
Ecliptic::label
virtual LineListLabel * label()
Definition: ecliptic.h:45
projector.h
LineListLabel::draw
void draw()
Definition: linelistlabel.cpp:92
SkyMap::Instance
static SkyMap * Instance()
Definition: skymap.cpp:141
SkyLabeler::setPen
void setPen(const QPen &pen)
sets the pen used for drawing labels on the sky.
Definition: skylabeler.cpp:173
Ecliptic::selected
virtual bool selected()
Definition: ecliptic.cpp:61
LineList::append
void append(SkyPoint *p)
Definition: linelist.h:55
kstarsdata.h
KStarsData::ut
const KStarsDateTime & ut() const
Definition: kstarsdata.h:140
SkyPoint::setDec0
void setDec0(dms d)
Sets Dec0, the catalog Declination.
Definition: skypoint.h:108
skylabeler.h
SkyLabeler
The purpose of this class is to prevent labels from overlapping.
Definition: skylabeler.h:112
SkyMap::projector
const Projector * projector() const
Get the current projector.
Definition: skymap.h:264
SkyPainter
Draws things on the sky, without regard to backend.
Definition: skypainter.h:47
Ecliptic::draw
virtual void draw(SkyPainter *skyp)
Draw the object on the SkyMap skyp a pointer to the SkyPainter to use.
Definition: ecliptic.cpp:66
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