Kstars

skymaplite.h
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#pragma once
7
8#include "skyobjects/skypoint.h"
9#include "skyobjects/skyline.h"
10
11#include <QTimer>
12#include <QPainter>
13
14#include <config-kstars.h>
15#include <QQuickItem>
16#include <QPolygonF>
17#include <QLinkedList>
18#include "kstarsdata.h"
19#include "kstarslite/skyitems/rootnode.h"
20
21#include <basedevice.h>
22
23class DeviceOrientation;
24
25class dms;
26class KStarsData;
27class SkyObject;
28class Projector;
30class PlanetsItem;
31class AsteroidsItem;
32class CometsItem;
34class HorizonItem;
35class LinesItem;
36class SkyNode;
37class RootNode;
38class TelescopeLite;
39
40class SkyObjectLite;
41class SkyPointLite;
42
43class QSGTexture;
44
45/** @class SkyMapLite
46*
47*This is the main item that displays all SkyItems. After its instantiation it is reparanted
48*to an object with objectName SkyMapLiteWrapper in main.qml. To display SkyItems they are reparanted
49*to instance of SkyMapLite.
50*
51*SkyMapLite handles most user interaction events (both mouse and keyboard).
52*
53*@short Item for displaying sky objects; also handles user interaction events.
54*@author Artem Fedoskin
55*@version 1.0
56*/
57
58class SkyMapLite : public QQuickItem
59{
61 /** magnitude limit. Used in QML **/
63
64 /** wrappers for clickedPoint and clickedObject. Used to set clicked object and point from QML **/
67 /** list of FOVSymbols that are currently available **/
69 /** true if SkyMapLite is being panned **/
71 /**
72 * @short true if SkyMapLite is centered on an object and only pinch-to-zoom needs to be available
73 **/
74 Q_PROPERTY(bool centerLocked READ getCenterLocked WRITE setCenterLocked NOTIFY centerLockedChanged)
75 Q_PROPERTY(bool automaticMode READ getAutomaticMode WRITE setAutomaticMode NOTIFY automaticModeChanged)
76 Q_PROPERTY(double skyRotation READ getSkyRotation WRITE setSkyRotation NOTIFY skyRotationChanged)
77
78 enum class SkyMapOrientation
79 {
80 Top0,
81 Right90,
82 Bottom180,
83 Left270
84 };
85
86 protected:
87 SkyMapLite();
88
89 /** Updates SkyMapLite by calling RootNode::update(), which in turn initiates update of all child nodes. **/
90 virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override;
91
92 public:
93 /** Creates instance of SkyMapLite (delete the old one if any) **/
94 static SkyMapLite *createInstance();
95
96 /** Bind size to parent's size and initialize star images **/
98
99 static SkyMapLite *Instance()
100 {
101 return pinstance;
102 }
103
104 static bool IsSlewing()
105 {
106 return pinstance->isSlewing();
107 }
108
109 /** Destructor. Clear star images.*/
110 ~SkyMapLite();
111
112 /**
113 * @short skyNode will be deleted on the next call to updatePaintNode (currently used only in
114 * StarNode(struct in StarBlock))
115 */
116 void deleteSkyNode(SkyNode *skyNode);
117
118 /** @short Update the focus position according to current options. */
119 void updateFocus();
120
121 /** @short Retrieve the Focus point; the position on the sky at the
122 *center of the skymap.
123 *@return a pointer to the central focus point of the sky map
124 */
126 {
127 return &Focus;
128 }
129
130 /** @short retrieve the Destination position.
131 *
132 *The Destination is the point on the sky to which the focus will be moved.
133 *@return a pointer to the destination point of the sky map
134 */
136 {
137 return &Destination;
138 }
139
140 /** @short retrieve the FocusPoint position.
141 *
142 *The FocusPoint stores the position on the sky that is to be
143 *focused next. This is not exactly the same as the Destination
144 *point, because when the Destination is set, it will begin slewing
145 *immediately.
146 *
147 *@return a pointer to the sky point which is to be focused next.
148 */
150 {
151 return &FocusPoint;
152 }
153
154 /** @short sets the central focus point of the sky map.
155 *@param f a pointer to the SkyPoint the map should be centered on
156 */
157 void setFocus(SkyPoint *f);
158
159 /** @short sets the focus point of the skymap, using ra/dec coordinates
160 *
161 *@note This function behaves essentially like the above function.
162 *It differs only in the data types of its arguments.
163 *
164 *@param ra the new right ascension
165 *@param dec the new declination
166 */
167 void setFocus(const dms &ra, const dms &dec);
168
169 /** @short sets the focus point of the sky map, using its alt/az coordinates
170 *@param alt the new altitude (actual, i.e. without refraction correction)
171 *@param az the new azimuth
172 */
173 void setFocusAltAz(const dms &alt, const dms &az);
174
175 /** @short sets the destination point of the sky map.
176 *@note setDestination() emits the destinationChanged() SIGNAL,
177 *which triggers the SLOT function SkyMap::slewFocus(). This
178 *function iteratively steps the Focus point toward Destination,
179 *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
180 *@param f a pointer to the SkyPoint the map should slew to
181 */
182 void setDestination(const SkyPoint &f);
183
184 /** @short sets the destination point of the skymap, using ra/dec coordinates.
185 *
186 *@note This function behaves essentially like the above function.
187 *It differs only in the data types of its arguments.
188 *
189 *@param ra the new right ascension
190 *@param dec the new declination
191 */
192 void setDestination(const dms &ra, const dms &dec);
193
194 /** @short sets the destination point of the sky map, using its alt/az coordinates.
195 *@param alt the new altitude
196 *@param az the new azimuth
197 *@param altIsRefracted set to true if the altitude supplied is apparent
198 */
199 void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted);
200
201 /** @short set the FocusPoint; the position that is to be the next Destination.
202 *@param f a pointer to the FocusPoint SkyPoint.
203 */
205 {
206 if (f)
207 FocusPoint = *f;
208 }
209
210 /** @short Retrieve the ClickedPoint position.
211 *
212 *When the user clicks on a point in the sky map, the sky coordinates of the mouse
213 *cursor are stored in the private member ClickedPoint. This function retrieves
214 *a pointer to ClickedPoint.
215 *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
216 */
218 {
219 return &ClickedPoint;
220 }
221
222 /** @short Set the ClickedPoint to the skypoint given as an argument.
223 *@param f pointer to the new ClickedPoint.
224 */
225 void setClickedPoint(SkyPoint *f);
226
227 /** @short Retrieve the object nearest to a mouse click event.
228 *
229 *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
230 *the private member ClickedObject. This function returns the ClickedObject pointer,
231 *or nullptr if there is no CLickedObject.
232 *@return a pointer to the object nearest to a user mouse click.
233 */
235 {
236 return ClickedObject;
237 }
238
239 /** @short Set the ClickedObject pointer to the argument.
240 *@param o pointer to the SkyObject to be assigned as the ClickedObject
241 */
243
244 /** @short Retrieve the object which is centered in the sky map.
245 *
246 *If the user centers the sky map on an object (by double-clicking or using the
247 *Find Object dialog), a pointer to the "focused" object is stored in
248 *the private member FocusObject. This function returns a pointer to the
249 *FocusObject, or nullptr if there is not FocusObject.
250 *@return a pointer to the object at the center of the sky map.
251 */
253 {
254 return FocusObject;
255 }
256
257 /** @short Set the FocusObject pointer to the argument.
258 *@param o pointer to the SkyObject to be assigned as the FocusObject
259 */
260 void setFocusObject(SkyObject *o);
261
262 /** @ Set zoom factor.
263 *@param factor zoom factor
264 */
265 void setZoomFactor(double factor);
266
267 /** @short Call to set up the projector before update of SkyItems positions begins. */
268 void setupProjector();
269
270 /** @short Returns index for a Harvard spectral classification */
271 int harvardToIndex(char c);
272
273 /** @short returns cache of star images
274 * @return star images cache
275 */
277
278 /**
279 * @short creates QImage from text and converts it to QSGTexture
280 * @param text the text string
281 * @param color text color
282 * @param zoomFont if true zoom-dependent font from SkyLabeler will be used else standart
283 * font is used
284 * @return QSGTexture with text
285 * @note font size is set in SkyLabeler::SkyLabeler() by initializing m_stdFont with default font
286 */
287 QSGTexture *textToTexture(QString text, QColor color = QColor(255, 255, 255), bool zoomFont = false);
288
289 /**
290 * @short returns cached texture from textureCache.
291 *
292 * Use outside of scene graph rendering thread (e.g. not during call to updatePaintNode)
293 * is prohibited!
294 * @param size size of the star
295 * @param spType spectral class
296 * @return cached QSGTexture from textureCache
297 */
298 QSGTexture *getCachedTexture(int size, char spType);
299
300 /** @short called when SkyMapComposite finished loading all SkyComponents */
301 inline void loadingFinished()
302 {
303 m_loadingFinished = true;
304 }
305
306 /** @return true if the map is in slewing mode or clock is active **/
307 bool isSlewing() const;
308
309 /** @return current magnitude limit **/
310 inline double getMagLim()
311 {
312 return m_magLim;
313 }
314
315 /** @short set magnitude limit **/
316 void setMagLim(double magLim);
317
318 /** @short Convenience function for shutting off tracking mode. Just calls KStars::slotTrack() **/
319 void stopTracking();
320
321 /** Get the current projector.
322 @return a pointer to the current projector. */
323 inline const Projector *projector() const
324 {
325 return m_proj;
326 }
327
328 /**
329 * @short used in QML
330 * @return type of current projection system
331 */
332 Q_INVOKABLE uint projType() const;
333
334 /** Set magnitude limit for size of stars. Used in StarItem **/
335 inline void setSizeMagLim(float sizeMagLim)
336 {
337 m_sizeMagLim = sizeMagLim;
338 }
339
340 /** Used in PointSourceNode **/
341 inline float sizeMagLim() const
342 {
343 return m_sizeMagLim;
344 }
345
346 static inline RootNode *rootNode()
347 {
348 return m_rootNode;
349 }
350
351 static inline void setRootNode(RootNode *root)
352 {
353 m_rootNode = root;
354 }
355
356 /** return limit of hides for the node to delete it **/
357 static double deleteLimit();
358
359 /**
360 * @short adds FOV symbol to m_FOVSymbols
361 * @param FOVName name of a FOV symbol
362 * @param initialState defines whether the state is initial
363 */
364 Q_INVOKABLE void addFOVSymbol(const QString &FOVName, bool initialState = false);
365
366 /**
367 * @param index of FOVSymbol in m_FOVSymbols
368 * @return true if FOV symbol with name FOVName should be drawn.
369 */
370 bool isFOVVisible(int index);
371
372 /**
373 * @param index of FOVSymbol in m_FOVSymbols
374 * @param visible defines whether the FOV symbol should be visible
375 * @short updates visibility of FOV symbol according to visible
376 */
377 Q_INVOKABLE void setFOVVisible(int index, bool visible);
378
379 /**
380 * @short this QList should be used as a model in QML to switch on/off FOV symbols
381 **/
383 {
384 return m_FOVSymbols;
385 }
386
387 /** @short Initializes images of Stars and puts them in cache (copied from SkyQPainter)*/
388 void initStarImages();
389
390 /**
391 * @short getter for clickedPointLite
392 */
394 {
395 return m_ClickedPointLite;
396 }
397
398 /**
399 * @short getter for clickedObjectLite
400 */
402 {
403 return m_ClickedObjectLite;
404 }
405
406 /**
407 * @short getter for centerLocked
408 */
410 {
411 return m_centerLocked;
412 }
413
414 /**
415 * @short Proxy method for SkyMapDrawAbstract::drawObjectLabels()
416 */
417 //inline void drawObjectLabels( QList< SkyObject* >& labelObjects ) { dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->drawObjectLabels( labelObjects ); }
418
419 /**
420 * @return true if SkyMapLite is being slewed
421 */
422 bool getSlewing() const
423 {
424 return m_slewing;
425 }
426
427 /**
428 * @short sets whether SkyMapLite is being slewed
429 */
430 void setSlewing(bool newSlewing);
431
432 /**
433 * @short sets whether SkyMapLite is centered on an object and locked(olny pinch-to-zoom is available)
434 */
435 void setCenterLocked(bool centerLocked);
436
437 /** True if automatic mode is on (SkyMapLite is controlled by smartphones accelerometer magnetometer) **/
438 bool getAutomaticMode() const
439 {
440 return m_automaticMode;
441 }
442
443 /**
444 * @short switch automatic mode on/off according to isOn parameter
445 */
446 Q_INVOKABLE void setAutomaticMode(bool automaticMode);
447
448 double getSkyRotation() const
449 {
450 return m_skyRotation;
451 }
452
453 public slots:
454 /** Called whenever wrappers' width or height are changed. Probably will be used to
455 * update positions of items.
456 */
457 void resizeItem();
458
459 /** Recalculates the positions of objects in the sky, and then repaints the sky map.
460 */
461 void forceUpdate();
462
463 /** @short Left for compatibility reasons
464 * @see forceUpdate()
465 */
467 {
468 forceUpdate();
469 }
470
471 /**
472 * @short Update the focus point and call forceUpdate()
473 * @param now is saved for compatibility reasons
474 */
475 void slotUpdateSky(bool now);
476
477 /** Step the Focus point toward the Destination point. Do this iteratively, redrawing the Sky
478 * Map after each step, until the Focus point is within 1 step of the Destination point.
479 * For the final step, snap directly to Destination, and redraw the map.
480 */
481 void slewFocus();
482
483 /** @short Center the display at the point ClickedPoint.
484 *
485 * The essential part of the function is to simply set the Destination point, which will emit
486 * the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT. Additionally, this
487 * function performs some bookkeeping tasks, such updating whether we are tracking the new
488 * object/position, adding a Planet Trail if required, etc.
489 *
490 * @see destinationChanged()
491 * @see slewFocus()
492 */
493 void slotCenter();
494
495 /** Checks whether the timestep exceeds a threshold value. If so, sets
496 * ClockSlewing=true and sets the SimClock to ManualMode.
497 */
498 void slotClockSlewing();
499
500 /** Zoom in one step. */
501 void slotZoomIn();
502
503 /** Zoom out one step. */
504 void slotZoomOut();
505
506 /** Set default zoom. */
507 void slotZoomDefault();
508 /**
509 * @short centres skyObj in SkyMap and opens context drawer with skyObj
510 * Used in FindDialogLite
511 */
512 void slotSelectObject(SkyObject *skyObj);
513
514 /** @short updates focus of SkyMapLite according to data from DeviceOrientation
515 (Smartphone's sensors)*/
516 void updateAutomaticMode();
517
518 void setSkyRotation(double skyRotation);
519
520 signals:
521 /** Emitted by setDestination(), and connected to slewFocus(). Whenever the Destination
522 * point is changed, slewFocus() will iteratively step the Focus toward Destination
523 * until it is reached.
524 * @see SkyMap::setDestination()
525 * @see SkyMap::slewFocus()
526 */
528
529 /** Emitted when zoom level is changed. */
531
532 /** Emitted when current object changed. */
534
535 /** Wrapper of ClickedObject for QML **/
537
538 /** Wrapper of ClickedPoint for QML **/
540
541 /** Emitted when pointing changed. (At least should) */
543
544 /** Emitted when position under mouse changed. */
546
547 /** Emitted when a position is clicked */
549
550 /** Emitted when user clicks on SkyMapLite (analogous to positionClicked but sends QPoint) */
552
553 /** Emitted when magnitude limit is changed */
554 void magLimChanged(double magLim);
555
556 /** Emitted when FOVSymbols list was changed (new value appended) **/
558
559 /** Emitted when SkyMapLite is being slewed or slewing is finished **/
560 void slewingChanged(bool);
561
562 void centerLockedChanged(bool);
563
564 void automaticModeChanged(bool);
565
566 /** Emitted when skyRotation used to rotate coordinates of SkyPoints is changed **/
567 void skyRotationChanged(double skyRotation);
568
569 protected:
570 /** Process keystrokes:
571 * @li arrow keys Slew the map
572 * @li +/- keys Zoom in and out
573 * @li <i>Space</i> Toggle between Horizontal and Equatorial coordinate systems
574 * @li 0-9 Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
575 * @li [ Place starting point for measuring an angular distance
576 * @li ] End point for Angular Distance; display measurement.
577 * @li <i>Escape</i> Cancel Angular measurement
578 * @li ,/< Step backward one time step
579 * @li ./> Step forward one time step
580 */
581 //virtual void keyPressEvent( QKeyEvent *e );
582
583 /** When keyRelease is triggered, just set the "slewing" flag to false,
584 * and update the display (to draw objects that are hidden when slewing==true). */
585 //virtual void keyReleaseEvent( QKeyEvent *e );
586
587 /** Determine RA, Dec coordinates of clicked location. Find the SkyObject
588 * which is nearest to the clicked location.
589 *
590 * If left-clicked: Set set mouseButtonDown==true, slewing==true; display
591 * nearest object name in status bar.
592 * If right-clicked: display popup menu appropriate for nearest object.
593 */
594 virtual void mousePressEvent(QMouseEvent *e) override;
595
596 /** set mouseButtonDown==false, slewing==false */
597 virtual void mouseReleaseEvent(QMouseEvent *e) override;
598
599 /** Center SkyMap at double-clicked location */
600 virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
601
602 /** This function does several different things depending on the state of the program:
603 * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor,
604 * and continue this function.
605 * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen,
606 * and return.
607 * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse
608 * cursor remains constant.
609 * @li If just moving the mouse, simply update the curso coordinates in the status bar.
610 */
611 virtual void mouseMoveEvent(QMouseEvent *e) override;
612
613 /** Zoom in and out with the mouse wheel. */
614 virtual void wheelEvent(QWheelEvent *e) override;
615
616 /**
617 * @short this function handles zooming in and out using "pinch to zoom" gesture
618 */
619 virtual void touchEvent(QTouchEvent *e) override;
620
621 private slots:
622 /** @short display tooltip for object under cursor. It's called by m_HoverTimer.
623 * if mouse didn't moved for last HOVER_INTERVAL milliseconds.
624 */
625 //void slotTransientLabel();
626
627 /** Set the shape of mouse cursor to a cross with 4 arrows. */
628 void setMouseMoveCursor();
629
630 private:
631 /** @short Sets the shape of the default mouse cursor to a cross. */
632 void setDefaultMouseCursor();
633
634 /** @short Sets the shape of the mouse cursor to a magnifying glass. */
635 void setZoomMouseCursor();
636
637 /** Calculate the zoom factor for the given keyboard modifier
638 */
639 double zoomFactor(const int modifier);
640
641 /** calculate the magnitude factor (1, .5, .2, or .1) for the given
642 * keyboard modifier.
643 */
644 double magFactor(const int modifier);
645
646 /** Decrease the magnitude limit by a step size determined by the
647 * keyboard modifier.
648 * @param modifier
649 */
650 void decMagLimit(const int modifier);
651
652 /** Increase the magnitude limit by a step size determined by the
653 * keyboard modifier.
654 * @param modifier
655 */
656 void incMagLimit(const int modifier);
657
658 /** Convenience routine to either zoom in or increase mag limit
659 * depending on the Alt modifier. The Shift and Control modifiers
660 * will adjust the size of the zoom or the mag step.
661 * @param modifier
662 */
663 void zoomInOrMagStep(const int modifier);
664
665 /** Convenience routine to either zoom out or decrease mag limit
666 * depending on the Alt modifier. The Shift and Control modifiers
667 * will adjust the size of the zoom or the mag step.
668 * @param modifier
669 */
670 void zoomOutOrMagStep(const int modifier);
671
672 /**
673 * pointer to RootNode. Use it to universally access RootNode
674 * @warning RootNode should be used solely during updatePaintNode! See Qt Quick Scene Graph documentation.
675 **/
676 static RootNode *m_rootNode;
677 static SkyMapLite *pinstance;
678 static int starColorMode;
679
680 /// True if SkyMapLite was initialized (star images were initialized etc.)
681 bool isInitialized { false };
682 bool mouseButtonDown { false };
683 bool midMouseButtonDown { false };
684 /// True if mouseMoveEvent; needed by setMouseMoveCursor
685 bool mouseMoveCursor { false };
686 bool m_slewing { false };
687 bool clockSlewing { false };
688 /// True if pinch to zoom or pinch to rotate is performed
689 bool pinch { false };
690 /// If false only old pixmap will repainted with bitBlt() to save a lot of CPU usage
691 bool computeSkymap { false };
692 double y0 { 0 };
693 int count { 0 };
694 KStarsData *data { nullptr };
695 /// True if SkyMapComposite has finished loading of SkyComponents
696 bool m_loadingFinished { false };
697 /// Coordinates of point under cursor. It's update in function mouseMoveEvent
698 SkyPoint m_MousePoint;
699 SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
700 SkyObject *ClickedObject { nullptr };
701 SkyObject *FocusObject { nullptr };
702 SkyPointLite *m_ClickedPointLite { nullptr };
703 SkyObjectLite *m_ClickedObjectLite { nullptr };
704 bool m_centerLocked { false };
705 //SkyLine AngularRuler; //The line for measuring angles in the map
706 QRect ZoomRect; //The manual-focus circle.
707 /// Mouse should not move for that interval to display tooltip
708 static const int HOVER_INTERVAL = 500;
709 /// Timer for tooltips
710 QTimer m_HoverTimer;
711 bool m_objPointingMode { false };
712 bool m_fovCaptureMode { false };
713 Projector *m_proj { nullptr };
714 QQuickItem *m_SkyMapLiteWrapper { nullptr };
715 /// Holds SkyNodes that need to be deleted
716 QLinkedList<SkyNode *> m_deleteNodes;
717 /// Used in PointSourceNode
718 float m_sizeMagLim { 10 };
719 /// Mag limit for all objects
720 double m_magLim { 0 };
721 /// Used to notify zoom-dependent labels about font size change
722 bool m_fontSizeChanged { false };
723 /// Used for drawing labels
724 QPainter m_painter;
725 /**
726 * This timer is triggered every time user touches the screen with one finger.
727 * If touch was released within 500 milliseconds than it is a tap, otherwise we pan.
728 **/
729 QTimer m_tapBeganTimer;
730 /// Good to keep the original ruler start-point for purposes of dynamic_cast
731 const SkyPoint *m_rulerStartPoint;
732 QStringList m_FOVSymbols;
733 QList<bool> m_FOVSymVisible;
734 /// Total number of sizes of stars.
735 const int nStarSizes { 15 };
736 /// Total number of spectral classes (N.B. Must be in sync with harvardToIndex)
737 const int nSPclasses { 7 };
738 /// Cache for star images.
739 QVector<QVector<QPixmap *>> imageCache;
740 /// Textures created from cached star images
741 QVector<QVector<QSGTexture *>> textureCache;
742 bool clearTextures { false };
743 bool tapBegan { false };
744 QList<INDI::BaseDevice *> m_newTelescopes;
745 QList<INDI::BaseDevice *> m_delTelescopes;
746 bool m_automaticMode { false };
747 double m_skyRotation { 0 };
748 SkyMapOrientation m_skyMapOrientation { SkyMapOrientation::Top0 };
749#if defined(Q_OS_ANDROID)
750 QTimer automaticModeTimer;
751 DeviceOrientation *m_deviceOrientation { nullptr };
752#endif
753};
This class handles asteroids in SkyMapLite.
This class handles comets in SkyMapLite.
Definition cometsitem.h:20
Handles representation of HorizonComponent in SkyMapLite (lines, filled polygon and compass labels).
Definition horizonitem.h:23
KStarsData is the backbone of KStars.
Definition kstarsdata.h:74
Class that handles lines (Constellation lines and boundaries and both coordinate grids) in SkyMapLite...
Definition linesitem.h:38
Represents the planetmoons on the sky map.
This class handles planets and their moons in SkyMapLite.
Definition planetsitem.h:22
The Projector class is the primary class that serves as an interface to handle projections.
Definition projector.h:58
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
This is the main item that displays all SkyItems.
Definition skymaplite.h:59
void setZoomFactor(double factor)
@ Set zoom factor.
SkyObjectLite * getClickedObjectLite()
getter for clickedObjectLite
Definition skymaplite.h:401
Q_INVOKABLE void setAutomaticMode(bool automaticMode)
switch automatic mode on/off according to isOn parameter
void setCenterLocked(bool centerLocked)
sets whether SkyMapLite is centered on an object and locked(olny pinch-to-zoom is available)
void loadingFinished()
called when SkyMapComposite finished loading all SkyComponents
Definition skymaplite.h:301
SkyPointLite * clickedPointLite
wrappers for clickedPoint and clickedObject.
Definition skymaplite.h:65
QStringList FOVSymbols
list of FOVSymbols that are currently available
Definition skymaplite.h:68
static SkyMapLite * createInstance()
Creates instance of SkyMapLite (delete the old one if any)
void slotCenter()
Center the display at the point ClickedPoint.
void updateFocus()
Update the focus position according to current options.
const Projector * projector() const
Get the current projector.
Definition skymaplite.h:323
void slewFocus()
Step the Focus point toward the Destination point.
QSGTexture * textToTexture(QString text, QColor color=QColor(255, 255, 255), bool zoomFont=false)
creates QImage from text and converts it to QSGTexture
Q_INVOKABLE uint projType() const
used in QML
void symbolsFOVChanged(QStringList)
Emitted when FOVSymbols list was changed (new value appended)
int harvardToIndex(char c)
Returns index for a Harvard spectral classification.
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition skymaplite.h:125
~SkyMapLite()
Destructor.
bool centerLocked
true if SkyMapLite is centered on an object and only pinch-to-zoom needs to be available
Definition skymaplite.h:74
void slotSelectObject(SkyObject *skyObj)
centres skyObj in SkyMap and opens context drawer with skyObj Used in FindDialogLite
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
void forceUpdate()
Recalculates the positions of objects in the sky, and then repaints the sky map.
void destinationChanged()
Emitted by setDestination(), and connected to slewFocus().
SkyPointLite * getClickedPointLite()
getter for clickedPointLite
Definition skymaplite.h:393
QVector< QVector< QPixmap * > > getImageCache()
returns cache of star images
virtual void mousePressEvent(QMouseEvent *e) override
Process keystrokes:
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
void slotZoomIn()
Zoom in one step.
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition skymaplite.h:149
virtual void mouseDoubleClickEvent(QMouseEvent *e) override
Center SkyMap at double-clicked location
QSGTexture * getCachedTexture(int size, char spType)
returns cached texture from textureCache.
void zoomChanged()
Emitted when zoom level is changed.
void setMagLim(double magLim)
set magnitude limit
Q_INVOKABLE QStringList getFOVSymbols()
this QList should be used as a model in QML to switch on/off FOV symbols
Definition skymaplite.h:382
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition skymaplite.h:234
virtual void touchEvent(QTouchEvent *e) override
this function handles zooming in and out using "pinch to zoom" gesture
void initStarImages()
Initializes images of Stars and puts them in cache (copied from SkyQPainter)
void slewingChanged(bool)
Emitted when SkyMapLite is being slewed or slewing is finished.
void magLimChanged(double magLim)
Emitted when magnitude limit is changed.
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
virtual void mouseReleaseEvent(QMouseEvent *e) override
set mouseButtonDown==false, slewing==false
void forceUpdateNow()
Left for compatibility reasons.
Definition skymaplite.h:466
bool getSlewing() const
Proxy method for SkyMapDrawAbstract::drawObjectLabels()
Definition skymaplite.h:422
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition skymaplite.h:204
void objectLiteChanged()
Wrapper of ClickedObject for QML.
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void posClicked(QPointF pos)
Emitted when user clicks on SkyMapLite (analogous to positionClicked but sends QPoint)
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Q_INVOKABLE void addFOVSymbol(const QString &FOVName, bool initialState=false)
adds FOV symbol to m_FOVSymbols
void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
sets the destination point of the sky map, using its alt/az coordinates.
void pointLiteChanged()
Wrapper of ClickedPoint for QML.
SkyPoint * destination()
retrieve the Destination position.
Definition skymaplite.h:135
virtual QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override
Updates SkyMapLite by calling RootNode::update(), which in turn initiates update of all child nodes.
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition skymaplite.h:217
void slotZoomDefault()
Set default zoom.
void skyRotationChanged(double skyRotation)
Emitted when skyRotation used to rotate coordinates of SkyPoints is changed.
void setClickedPoint(SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
virtual void mouseMoveEvent(QMouseEvent *e) override
This function does several different things depending on the state of the program:
bool slewing
true if SkyMapLite is being panned
Definition skymaplite.h:70
void setSizeMagLim(float sizeMagLim)
Set magnitude limit for size of stars.
Definition skymaplite.h:335
void positionChanged()
Emitted when pointing changed.
bool isSlewing() const
virtual void wheelEvent(QWheelEvent *e) override
Zoom in and out with the mouse wheel.
void initialize(QQuickItem *parent)
Bind size to parent's size and initialize star images.
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
void deleteSkyNode(SkyNode *skyNode)
skyNode will be deleted on the next call to updatePaintNode (currently used only in StarNode(struct i...
double getMagLim()
Definition skymaplite.h:310
void stopTracking()
Convenience function for shutting off tracking mode.
void objectChanged()
Emitted when current object changed.
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
bool getAutomaticMode() const
True if automatic mode is on (SkyMapLite is controlled by smartphones accelerometer magnetometer)
Definition skymaplite.h:438
void setupProjector()
Call to set up the projector before update of SkyItems positions begins.
bool isFOVVisible(int index)
void setSlewing(bool newSlewing)
sets whether SkyMapLite is being slewed
double magLim
magnitude limit.
Definition skymaplite.h:62
Q_INVOKABLE void setFOVVisible(int index, bool visible)
updates visibility of FOV symbol according to visible
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition skymaplite.h:252
void resizeItem()
Called whenever wrappers' width or height are changed.
void slotZoomOut()
Zoom out one step.
void setFocus(SkyPoint *f)
sets the central focus point of the sky map.
static double deleteLimit()
return limit of hides for the node to delete it
void updateAutomaticMode()
updates focus of SkyMapLite according to data from DeviceOrientation (Smartphone's sensors)
bool getCenterLocked()
getter for centerLocked
Definition skymaplite.h:409
void positionClicked(SkyPoint *)
Emitted when a position is clicked.
float sizeMagLim() const
Used in PointSourceNode.
Definition skymaplite.h:341
Provides virtual functions for update of coordinates and nodes hiding.
Definition skynode.h:28
Wrapper for SkyObject to allow access of some of its properties from QML.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Wrapper for SkyPoint to allow access of some of its properties from QML.
The sky coordinates of a point in the sky.
Definition skypoint.h:45
This class encapsulates some methods which are shared between all single-object solar system componen...
device handle controlling telescope.
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QSizeF size() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.