File indexing completed on 2024-05-05 03:49:52

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
0004 // SPDX-FileCopyrightText: 2012 Cezar Mocan <mocancezar@gmail.com>
0005 //
0006 
0007 #ifndef MARBLE_CYLINDRICALPROJECTIONPRIVATE_H
0008 #define MARBLE_CYLINDRICALPROJECTIONPRIVATE_H
0009 
0010 #include "AbstractProjection_p.h"
0011 
0012 
0013 namespace Marble
0014 {
0015 
0016 class CylindricalProjection;
0017 
0018 class CylindricalProjectionPrivate : public AbstractProjectionPrivate
0019 {
0020   public:
0021     explicit CylindricalProjectionPrivate( CylindricalProjection * parent );
0022 
0023     // This method tessellates a line segment in a way that the line segment
0024     // follows great circles. The count parameter specifies the
0025     // number of nodes generated for the polygon. If the
0026     // clampToGround flag is added the polygon contains count + 2
0027     // nodes as the clamped down start and end node get added.
0028 
0029     int tessellateLineSegment(  const GeoDataCoordinates &aCoords,
0030                                 qreal ax, qreal ay,
0031                                 const GeoDataCoordinates &bCoords,
0032                                 qreal bx, qreal by,
0033                                 QVector<QPolygonF*> &polygons,
0034                                 const ViewportParams *viewport,
0035                                 TessellationFlags f = TessellationFlags(),
0036                                 int mirrorCount = 0,
0037                                 qreal repeatDistance = 0 ) const;
0038 
0039     int processTessellation(   const GeoDataCoordinates &previousCoords,
0040                                const GeoDataCoordinates &currentCoords,
0041                                int count,
0042                                QVector<QPolygonF*> &polygons,
0043                                const ViewportParams *viewport,
0044                                TessellationFlags f = TessellationFlags(),
0045                                int mirrorCount = 0,
0046                                qreal repeatDistance = 0 ) const;
0047 
0048     static int crossDateLine( const GeoDataCoordinates & aCoord,
0049                               const GeoDataCoordinates & bCoord,
0050                               qreal bx,
0051                               qreal by,
0052                               QVector<QPolygonF*> &polygons,
0053                               int mirrorCount = 0,
0054                               qreal repeatDistance = 0 );
0055 
0056     bool lineStringToPolygon( const GeoDataLineString &lineString,
0057                               const ViewportParams *viewport,
0058                               QVector<QPolygonF*> &polygons ) const;
0059 
0060     static void translatePolygons( const QVector<QPolygonF *> &polygons,
0061                                    QVector<QPolygonF *> &translatedPolygons,
0062                                    qreal xOffset );
0063 
0064     void repeatPolygons( const ViewportParams *viewport,
0065                          QVector<QPolygonF *> &polygons ) const;
0066 
0067     qreal repeatDistance( const ViewportParams *viewport ) const;
0068 
0069     CylindricalProjection * const q_ptr;
0070     Q_DECLARE_PUBLIC( CylindricalProjection )
0071 };
0072 
0073 } // namespace Marble
0074 
0075 #endif