• 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
  • printing
shfovexporter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  shfovexporter.cpp - K Desktop Planetarium
3  -------------------
4  begin : Thu Aug 4 2011
5  copyright : (C) 2011 by Rafał Kułaga
6  email : rl.kulaga@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 #include "shfovexporter.h"
19 #include "starhopper.h"
20 #include "targetlistcomponent.h"
21 #include "kstars/kstarsdata.h"
22 #include "skymapcomposite.h"
23 #include "kstars/skymap.h"
24 #include "skypoint.h"
25 #include "printingwizard.h"
26 #include "Options.h"
27 
28 ShFovExporter::ShFovExporter(PrintingWizard *wizard, SkyMap *map) : m_Map(map), m_ParentWizard(wizard)
29 {}
30 
31 bool ShFovExporter::calculatePath(const SkyPoint &src, const SkyPoint &dest, double fov, double maglim)
32 {
33  m_Src = src;
34  m_Dest = dest;
35 
36  m_Path = m_StarHopper.computePath(src, dest, fov, maglim);
37  if(m_Path.isEmpty())
38  {
39  return false;
40  }
41 
42  return true;
43 }
44 
45 bool ShFovExporter::exportPath()
46 {
47  KStarsData::Instance()->clock()->stop();
48 
49  if(m_Path.isEmpty())
50  {
51  return false;
52  }
53 
54  // Show path on SkyMap
55  QList<SkyObject*> *mutablestarlist = new QList<SkyObject*>;
56  foreach(const StarObject *conststar, m_Path)
57  {
58  StarObject *mutablestar = const_cast<StarObject*>(conststar);
59  mutablestarlist->append(mutablestar);
60  }
61  TargetListComponent *t = KStarsData::Instance()->skyComposite()->getStarHopRouteList();
62  delete t->list;
63  t->list = mutablestarlist;
64 
65  // Update SkyMap now
66  m_Map->forceUpdate(true);
67 
68  // Capture FOV snapshots
69  centerBetweenAndCapture(m_Src, *m_Path.at(0));
70  for(int i = 0 ; i < m_Path.size() - 1; i++)
71  {
72  centerBetweenAndCapture(*m_Path.at(i), *m_Path.at(i+1));
73  }
74  centerBetweenAndCapture(*m_Path.last(), m_Dest);
75 
76  return true;
77 }
78 
79 void ShFovExporter::centerBetweenAndCapture(const SkyPoint &ptA, const SkyPoint &ptB)
80 {
81  // Calculate RA and Dec coordinates of point between ptA and ptB
82  dms ra(ptA.ra().Degrees() + 0.5 * (ptB.ra().Degrees() - ptA.ra().Degrees()));
83  dms dec(ptA.dec().Degrees() + 0.5 * (ptB.dec().Degrees() - ptA.dec().Degrees()));
84  SkyPoint between(ra, dec);
85 
86  // Center SkyMap
87  m_Map->setClickedPoint(&between);
88  m_Map->slotCenter();
89 
90  // Capture FOV snapshot
91  m_ParentWizard->captureFov();
92 }
SkyPoint::ra
const dms & ra() const
Definition: skypoint.h:171
KStarsData::clock
SimClock * clock()
Definition: kstarsdata.h:158
TargetListComponent
Highlights objects present in certain lists by drawing "target" symbols around them.
Definition: skycomponents/targetlistcomponent.h:50
SkyMap::slotCenter
void slotCenter()
Center the display at the point ClickedPoint.
Definition: skymap.cpp:373
PrintingWizard::captureFov
void captureFov()
Capture current contents of FOV symbol.
Definition: printingwizard.cpp:138
ShFovExporter::exportPath
bool exportPath()
Export FOV snapshots across calculated path.
Definition: shfovexporter.cpp:45
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
dms::Degrees
const double & Degrees() const
Definition: dms.h:98
StarHopper::computePath
QList< StarObject const * > computePath(const SkyPoint &src, const SkyPoint &dest, float fov_, float maglim_)
Definition: starhopper.cpp:30
SkyMap::forceUpdate
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition: skymap.cpp:985
shfovexporter.h
starhopper.h
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
ShFovExporter::calculatePath
bool calculatePath(const SkyPoint &src, const SkyPoint &dest, double fov, double maglim)
Calculate path between source and destination SkyPoints.
Definition: shfovexporter.cpp:31
skymapcomposite.h
ShFovExporter::ShFovExporter
ShFovExporter(PrintingWizard *wizard, SkyMap *map)
Constructor.
Definition: shfovexporter.cpp:28
skymap.h
SimClock::stop
Q_SCRIPTABLE Q_NOREPLY void stop()
DBUS function to stop the SimClock.
Definition: simclock.cpp:104
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:146
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
SkyPoint::dec
const dms & dec() const
Definition: skypoint.h:174
skypoint.h
PrintingWizard
Class representing Printing Wizard for KStars printed documents (currently only finder charts)...
Definition: printingwizard.h:66
printingwizard.h
Options.h
TargetListComponent::list
SkyObjectList * list
Definition: skycomponents/targetlistcomponent.h:75
SkyMap::setClickedPoint
void setClickedPoint(SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition: skymap.cpp:829
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:72
kstarsdata.h
StarObject
This is a subclass of SkyObject.
Definition: starobject.h:41
QList
SkyMapComposite::getStarHopRouteList
TargetListComponent * getStarHopRouteList()
Definition: skymapcomposite.h:195
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