File indexing completed on 2025-01-05 03:58:57
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de> 0004 // 0005 0006 #ifndef MARBLE_GEODATALINESTRINGPRIVATE_H 0007 #define MARBLE_GEODATALINESTRINGPRIVATE_H 0008 0009 #include "GeoDataGeometry_p.h" 0010 0011 #include "GeoDataTypes.h" 0012 0013 namespace Marble 0014 { 0015 0016 class GeoDataLineStringPrivate : public GeoDataGeometryPrivate 0017 { 0018 public: 0019 explicit GeoDataLineStringPrivate( TessellationFlags f ) 0020 : m_rangeCorrected( nullptr ), 0021 m_dirtyRange( true ), 0022 m_dirtyBox( true ), 0023 m_tessellationFlags( f ), 0024 m_previousResolution( -1 ), 0025 m_level( -1 ) 0026 { 0027 } 0028 0029 GeoDataLineStringPrivate() 0030 : m_rangeCorrected( nullptr ), 0031 m_dirtyRange( true ), 0032 m_dirtyBox( true ) 0033 { 0034 } 0035 0036 ~GeoDataLineStringPrivate() override 0037 { 0038 delete m_rangeCorrected; 0039 } 0040 0041 GeoDataLineStringPrivate& operator=( const GeoDataLineStringPrivate &other) 0042 { 0043 GeoDataGeometryPrivate::operator=( other ); 0044 m_vector = other.m_vector; 0045 m_rangeCorrected = nullptr; 0046 m_dirtyRange = true; 0047 m_dirtyBox = other.m_dirtyBox; 0048 m_tessellationFlags = other.m_tessellationFlags; 0049 return *this; 0050 } 0051 0052 0053 GeoDataGeometryPrivate *copy() const override 0054 { 0055 GeoDataLineStringPrivate* copy = new GeoDataLineStringPrivate; 0056 *copy = *this; 0057 return copy; 0058 } 0059 0060 void toPoleCorrected( const GeoDataLineString & q, GeoDataLineString & poleCorrected ) const; 0061 0062 void toDateLineCorrected( const GeoDataLineString & q, 0063 QVector<GeoDataLineString*> & lineStrings ) const; 0064 0065 void interpolateDateLine( const GeoDataCoordinates & previousCoords, 0066 const GeoDataCoordinates & currentCoords, 0067 GeoDataCoordinates & previousAtDateline, 0068 GeoDataCoordinates & currentAtDateline, 0069 TessellationFlags f ) const; 0070 0071 GeoDataCoordinates findDateLine( const GeoDataCoordinates & previousCoords, 0072 const GeoDataCoordinates & currentCoords, 0073 int recursionCounter ) const; 0074 0075 quint8 levelForResolution(qreal resolution) const; 0076 static qreal resolutionForLevel(int level); 0077 void optimize(GeoDataLineString& lineString) const; 0078 0079 QVector<GeoDataCoordinates> m_vector; 0080 0081 mutable GeoDataLineString* m_rangeCorrected; 0082 mutable bool m_dirtyRange; 0083 0084 mutable bool m_dirtyBox; // tells whether there have been changes to the 0085 // GeoDataPoints since the LatLonAltBox has 0086 // been calculated. Saves performance. 0087 TessellationFlags m_tessellationFlags; 0088 mutable qreal m_previousResolution; 0089 mutable quint8 m_level; 0090 0091 }; 0092 0093 } // namespace Marble 0094 0095 #endif