• 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
  • projections
projector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Henry de Valence <hdevalence@gmail.com>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 
20 #ifndef PROJECTOR_H
21 #define PROJECTOR_H
22 
23 #include <cstddef>
24 #include <Eigen/Core>
25 USING_PART_OF_NAMESPACE_EIGEN
26 
27 #include <cmath>
28 
29 #include <QPointF>
30 
31 #include "skyobjects/skypoint.h"
32 #include "skymap.h"
33 
34 class KStarsData;
35 
37 class ViewParams
38 {
39 public:
40  float width, height;
41  float zoomFactor;
42  bool useRefraction;
43  bool useAltAz;
44  bool fillGround;
45  SkyPoint *focus;
46 };
47 
49 class Projector
50 {
51 public:
55  explicit Projector( const ViewParams& p );
56 
57  virtual ~Projector();
58 
60  void setViewParams( const ViewParams& p );
61 
63  virtual SkyMap::Projection type() const = 0;
64 
66  double fov() const;
67 
73  virtual bool unusablePoint( const QPointF &p ) const;
74 
98  virtual Vector2f toScreenVec( const SkyPoint *o,
99  bool oRefract = true,
100  bool* onVisibleHemisphere = 0) const;
101 
106  QPointF toScreen( const SkyPoint *o,
107  bool oRefract = true,
108  bool* onVisibleHemisphere = 0) const;
109 
116  virtual SkyPoint fromScreen( const QPointF &p, dms *LST, const dms *lat ) const;
117 
118 
122  QPointF clipLine( SkyPoint *p1, SkyPoint *p2 ) const;
123 
127  Vector2f clipLineVec( SkyPoint *p1, SkyPoint *p2 ) const;
128 
130  bool onScreen( const QPointF& p ) const;
131  bool onScreen( const Vector2f& p ) const;
132 
179  bool checkVisibility( SkyPoint *p ) const;
180 
188  double findPA( SkyObject *o, float x, float y ) const;
189 
190 
196  virtual QVector<Vector2f> groundPoly( SkyPoint* labelpoint = 0, bool* drawLabel = 0 ) const;
197 
198 protected:
202  virtual double radius() const { return 2*M_PI; }
203 
207  virtual double projectionK(double x) const { return x; }
208 
212  virtual double projectionL(double x) const { return x; }
213 
219  virtual double cosMaxFieldAngle() const { return 0; }
220 
224  static SkyPoint pointAt(double az, KStarsData* data);
225 
226  KStarsData *m_data;
227  ViewParams m_vp;
228  double m_sinY0, m_cosY0;
229  double m_fov;
230 private:
231  //Used by CheckVisibility
232  double m_xrange;
233  bool m_isPoleVisible;
234 };
235 
236 #endif // PROJECTOR_H
SkyMap::Projection
Projection
Definition: skymap.h:96
Projector::~Projector
virtual ~Projector()
Definition: projector.cpp:55
Projector::onScreen
bool onScreen(const QPointF &p) const
Check whether the projected point is on-screen.
Definition: projector.cpp:98
Projector::toScreenVec
virtual Vector2f toScreenVec(const SkyPoint *o, bool oRefract=true, bool *onVisibleHemisphere=0) const
Given the coordinates of the SkyPoint argument, determine the pixel coordinates in the SkyMap...
Definition: projector.cpp:402
Projector::groundPoly
virtual QVector< Vector2f > groundPoly(SkyPoint *labelpoint=0, bool *drawLabel=0) const
Get the ground polygon.
Definition: projector.cpp:252
Projector::m_sinY0
double m_sinY0
Definition: projector.h:228
ViewParams::useRefraction
bool useRefraction
Definition: projector.h:42
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
Projector::type
virtual SkyMap::Projection type() const =0
Return the type of this projection.
ViewParams::focus
SkyPoint * focus
Definition: projector.h:45
Projector::m_cosY0
double m_cosY0
Definition: projector.h:228
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
Projector::cosMaxFieldAngle
virtual double cosMaxFieldAngle() const
This function returns the cosine of the maximum field angle, i.e., the maximum angular distance from ...
Definition: projector.h:219
Projector::findPA
double findPA(SkyObject *o, float x, float y) const
Determine the on-screen position angle of a SkyObject.
Definition: projector.cpp:227
Projector::Projector
Projector(const ViewParams &p)
Constructor.
Definition: projector.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
ViewParams::width
float width
Definition: projector.h:40
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
Projector::pointAt
static SkyPoint pointAt(double az, KStarsData *data)
Helper function for drawing ground.
Definition: projector.cpp:40
ViewParams::useAltAz
bool useAltAz
Definition: projector.h:43
Projector::fromScreen
virtual SkyPoint fromScreen(const QPointF &p, dms *LST, const dms *lat) const
Determine RA, Dec coordinates of the pixel at (dx, dy), which are the screen pixel coordinate offsets...
Definition: projector.cpp:353
Projector::fov
double fov() const
Return the FOV of this projection.
Definition: projector.cpp:88
ViewParams::height
float height
Definition: projector.h:40
skymap.h
Projector::projectionL
virtual double projectionL(double x) const
This function handles some of the projection-specific code.
Definition: projector.h:212
Projector::m_data
KStarsData * m_data
Definition: projector.h:226
Projector::clipLineVec
Vector2f clipLineVec(SkyPoint *p1, SkyPoint *p2) const
ASSUMES *p1 did not clip but *p2 did.
Definition: projector.cpp:115
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
Projector::clipLine
QPointF clipLine(SkyPoint *p1, SkyPoint *p2) const
ASSUMES *p1 did not clip but *p2 did.
Definition: projector.cpp:110
Projector::radius
virtual double radius() const
Get the radius of this projection's sky circle.
Definition: projector.h:202
Projector::m_vp
ViewParams m_vp
Definition: projector.h:227
skypoint.h
Projector::projectionK
virtual double projectionK(double x) const
This function handles some of the projection-specific code.
Definition: projector.h:207
ViewParams::zoomFactor
float zoomFactor
Definition: projector.h:41
Projector::unusablePoint
virtual bool unusablePoint(const QPointF &p) const
Check if the current point on screen is a valid point on the sky.
Definition: projector.cpp:338
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
Projector::m_fov
double m_fov
Definition: projector.h:229
Projector::setViewParams
void setViewParams(const ViewParams &p)
Update cached values for projector.
Definition: projector.cpp:60
ViewParams
This is just a container that holds infromation needed to do projections.
Definition: projector.h:37
ViewParams::fillGround
bool fillGround
If the ground is filled, then points below horizon are invisible.
Definition: projector.h:44
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