Kstars

mosaictilesmanager.h
1/*
2 SPDX-FileCopyrightText: 2021 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QGraphicsItem>
10#include <QBrush>
11#include <QPen>
12
13#include "skypoint.h"
14
15namespace Ekos
16{
17
18class MosaicTilesManager : public QObject, public QGraphicsItem
19{
22 public:
23 typedef struct
24 {
27 SkyPoint skyCenter;
28 double rotation;
29 int index;
30 } OneTile;
31
32 public:
33 MosaicTilesManager(QWidget *parent = nullptr);
34 ~MosaicTilesManager();
35
36 public:
37 void setSkyCenter(SkyPoint center);
38 void setPositionAngle(double positionAngle);
39 void setGridDimensions(int width, int height);
40 void setSingleTileFOV(double fov_x, double fov_y);
41 void setMosaicFOV(double mfov_x, double mfov_y);
42 void setOverlap(double value);
43 void setPixelScale(const QSizeF &scale) {m_PixelScale = scale;}
44
45 public:
46 int getWidth()
47 {
48 return m_HorizontalTiles;
49 }
50
51 int getHeight()
52 {
53 return m_VerticalTiles;
54 }
55
56 double getOverlap()
57 {
58 return overlap;
59 }
60
61 double getPA()
62 {
63 return pa;
64 }
65
66 void setPainterAlpha(int v)
67 {
68 m_PainterAlpha = v;
69 }
70
71 public:
72 /// @internal Returns scaled offsets for a pixel local coordinate.
73 ///
74 /// This uses the mosaic center as reference and the argument resolution of the sky map at that center.
75 QSizeF adjustCoordinate(QPointF tileCoord);
76 virtual QRectF boundingRect() const override;
77 void updateTiles(QPointF skymapCenter, bool s_shaped);
78 OneTile *getTile(int row, int col);
79
80 QList<OneTile *> getTiles() const
81 {
82 return tiles;
83 }
84
85 protected:
86 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
87 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
88 void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override;
89 QPointF rotatePoint(QPointF pointToRotate, QPointF centerPoint, double paDegrees);
90
91 signals:
92 void newOffset(const QPointF &offset);
93
94 private:
95 SkyPoint skyCenter;
96 double overlap { 0 };
97 uint8_t m_HorizontalTiles { 1 };
98 uint8_t m_VerticalTiles { 1 };
99 double fovW { 0 };
100 double fovH { 0 };
101 double mfovW { 0 };
102 double mfovH { 0 };
103 double pa { 0 };
104
105 QSizeF m_PixelScale;
106 QBrush brush;
107 QPen pen;
108
109 QBrush textBrush;
110 QPen textPen;
111
112 int m_PainterAlpha { 50 };
113
114 QPointF m_LastPosition;
115 QList<OneTile *> tiles;
116};
117
118}
The sky coordinates of a point in the sky.
Definition skypoint.h:45
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
QPointF pos() const const
qreal rotation() const const
qreal scale() const const
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
virtual bool event(QEvent *e)
QObject * parent() const const
QTextStream & center(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:51 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.