1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
4 // SPDX-FileCopyrightText: 2012 Cezar Mocan <mocancezar@gmail.com>
5 //
6 
7 #ifndef MARBLE_CYLINDRICALPROJECTIONPRIVATE_H
8 #define MARBLE_CYLINDRICALPROJECTIONPRIVATE_H
9 
10 #include "AbstractProjection_p.h"
11 
12 
13 namespace Marble
14 {
15 
16 class CylindricalProjection;
17 
18 class CylindricalProjectionPrivate : public AbstractProjectionPrivate
19 {
20   public:
21     explicit CylindricalProjectionPrivate( CylindricalProjection * parent );
22 
23     // This method tessellates a line segment in a way that the line segment
24     // follows great circles. The count parameter specifies the
25     // number of nodes generated for the polygon. If the
26     // clampToGround flag is added the polygon contains count + 2
27     // nodes as the clamped down start and end node get added.
28 
29     int tessellateLineSegment(  const GeoDataCoordinates &aCoords,
30                                 qreal ax, qreal ay,
31                                 const GeoDataCoordinates &bCoords,
32                                 qreal bx, qreal by,
33                                 QVector<QPolygonF*> &polygons,
34                                 const ViewportParams *viewport,
35                                 TessellationFlags f = nullptr,
36                                 int mirrorCount = 0,
37                                 qreal repeatDistance = 0 ) const;
38 
39     int processTessellation(   const GeoDataCoordinates &previousCoords,
40                                const GeoDataCoordinates &currentCoords,
41                                int count,
42                                QVector<QPolygonF*> &polygons,
43                                const ViewportParams *viewport,
44                                TessellationFlags f = nullptr,
45                                int mirrorCount = 0,
46                                qreal repeatDistance = 0 ) const;
47 
48     static int crossDateLine( const GeoDataCoordinates & aCoord,
49                               const GeoDataCoordinates & bCoord,
50                               qreal bx,
51                               qreal by,
52                               QVector<QPolygonF*> &polygons,
53                               int mirrorCount = 0,
54                               qreal repeatDistance = 0 );
55 
56     bool lineStringToPolygon( const GeoDataLineString &lineString,
57                               const ViewportParams *viewport,
58                               QVector<QPolygonF*> &polygons ) const;
59 
60     static void translatePolygons( const QVector<QPolygonF *> &polygons,
61                                    QVector<QPolygonF *> &translatedPolygons,
62                                    qreal xOffset );
63 
64     void repeatPolygons( const ViewportParams *viewport,
65                          QVector<QPolygonF *> &polygons ) const;
66 
67     qreal repeatDistance( const ViewportParams *viewport ) const;
68 
69     CylindricalProjection * const q_ptr;
70     Q_DECLARE_PUBLIC( CylindricalProjection )
71 };
72 
73 } // namespace Marble
74 
75 #endif
76