diff --git a/src/lib/marble/PlacemarkLayout.h b/src/lib/marble/PlacemarkLayout.h index 7a410691c..822295a8d 100644 --- a/src/lib/marble/PlacemarkLayout.h +++ b/src/lib/marble/PlacemarkLayout.h @@ -1,175 +1,175 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn // Copyright 2007 Inge Wallin // Copyright 2010-2012 Bernhard Beschow // // // PlacemarkLayout is responsible for drawing the Placemarks on the map // #ifndef MARBLE_PLACEMARKLAYOUT_H #define MARBLE_PLACEMARKLAYOUT_H #include #include #include #include #include #include "GeoDataPlacemark.h" #include class QAbstractItemModel; class QItemSelectionModel; class QPoint; class QModelIndex; namespace Marble { class GeoDataCoordinates; class GeoPainter; class MarbleClock; class PlacemarkPainter; class TileId; class VisiblePlacemark; class ViewportParams; class StyleBuilder; /** * Layouts the place marks with a passed QPainter. */ class PlacemarkLayout : public QObject { Q_OBJECT public: /** * Creates a new place mark layout. */ PlacemarkLayout( QAbstractItemModel *placemarkModel, QItemSelectionModel *selectionModel, MarbleClock *clock, const StyleBuilder* styleBuilder, QObject *parent = 0 ); /** * Destroys the place mark painter. */ ~PlacemarkLayout() override; /** * @reimp */ QVector generateLayout(const ViewportParams *viewport , int tileLevel); /** * Returns a list of model indexes that are at position @p pos. */ QVector whichPlacemarkAt( const QPoint &pos ); QString runtimeTrace() const; QList visiblePlacemarks() const; bool hasPlacemarkAt(const QPoint &pos); public Q_SLOTS: // earth void setShowPlaces( bool show ); void setShowCities( bool show ); void setShowTerrain( bool show ); void setShowOtherPlaces( bool show ); // other planets void setShowLandingSites( bool show ); void setShowCraters( bool show ); void setShowMaria( bool show ); void requestStyleReset(); void addPlacemarks( const QModelIndex& index, int first, int last ); void removePlacemarks( const QModelIndex& index, int first, int last ); void resetCacheData(); Q_SIGNALS: void repaintNeeded(); private: /** * Returns a the maximum height of all possible labels. * WARNING: This is a really slow method as it traverses all placemarks * to check the labelheight. * FIXME: Once a StyleManager that manages all styles has been implemented * just traverse all existing styles. */ int maxLabelHeight() const; void styleReset(); void clearCache(); QSet visibleTiles( const ViewportParams *viewport, int tileLevel ) const; bool layoutPlacemark(const GeoDataPlacemark *placemark, const GeoDataCoordinates &coordinates, qreal x, qreal y, bool selected ); /** * Returns the coordinates at which an icon should be drawn for the @p placemark. * @p ok is set to true if the coordinates are valid and should be used for drawing, - * it it set to false otherwise. + * it is set to false otherwise. */ GeoDataCoordinates placemarkIconCoordinates( const GeoDataPlacemark *placemark ) const; QRectF roomForLabel(const GeoDataStyle::ConstPtr &style, const qreal x, const qreal y, const QString &labelText , const VisiblePlacemark *placemark) const; bool hasRoomForPixmap(const qreal y, const VisiblePlacemark *placemark) const; bool placemarksOnScreenLimit( const QSize &screenSize ) const; private: Q_DISABLE_COPY( PlacemarkLayout ) QAbstractItemModel* m_placemarkModel; QItemSelectionModel *const m_selectionModel; MarbleClock *const m_clock; QVector m_paintOrder; QString m_runtimeTrace; int m_labelArea; QHash m_visiblePlacemarks; QVector< QVector< VisiblePlacemark* > > m_rowsection; /// map providing the list of placemark belonging in TileId as key QMap > m_placemarkCache; QSet m_osmIds; const QSet m_acceptedVisualCategories; // earth bool m_showPlaces; bool m_showCities; bool m_showTerrain; bool m_showOtherPlaces; // other planets bool m_showLandingSites; bool m_showCraters; bool m_showMaria; int m_maxLabelHeight; bool m_styleResetRequested; const StyleBuilder* m_styleBuilder; VisiblePlacemark* m_lastPlacemarkAt; }; } #endif diff --git a/src/lib/marble/QtMarbleConfigDialog.h b/src/lib/marble/QtMarbleConfigDialog.h index a013a0b05..d200ae122 100644 --- a/src/lib/marble/QtMarbleConfigDialog.h +++ b/src/lib/marble/QtMarbleConfigDialog.h @@ -1,170 +1,170 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Bastian Holst // #ifndef MARBLE_QTMARBLECONFIGDIALOG_H #define MARBLE_QTMARBLECONFIGDIALOG_H #include #include "marble_export.h" #include "MarbleGlobal.h" #include "MarbleLocale.h" namespace Marble { class MarbleWidget; class CloudSyncManager; class QtMarbleConfigDialogPrivate; class MARBLE_EXPORT QtMarbleConfigDialog : public QDialog { Q_OBJECT public: explicit QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *syncManager = 0, QWidget *parent = 0 ); ~QtMarbleConfigDialog() override; // View Settings MarbleLocale::MeasurementSystem measurementSystem() const; Marble::AngleUnit angleUnit() const; void setAngleUnit(Marble::AngleUnit unit); Marble::MapQuality stillQuality() const; Marble::MapQuality animationQuality() const; QFont mapFont() const; // Navigation Settings int onStartup() const; bool animateTargetVoyage() const; QString externalMapEditor() const; bool inertialEarthRotation() const; // Cache Settings int volatileTileCacheLimit() const; int persistentTileCacheLimit() const; QString proxyUrl() const; int proxyPort() const; QString proxyUser() const; QString proxyPass() const; bool proxyType() const; bool proxyAuth() const; // Time Settings /** * Read the value of 'Time/systemTime' key from settings */ bool systemTime() const; /** * Read the value of 'Time/lastSessionTime' key from settings */ bool lastSessionTime() const; /** * Read the value of 'Time/systemTimezone' key from settings */ bool systemTimezone() const; /** * Read the value of 'Time/UTC' key from settings */ bool UTC() const; /** * Read the value of 'Time/customTimezone' key from settings */ bool customTimezone() const; /** * Read the value of 'Time/chosenTimezone' key from settings */ int chosenTimezone() const; void initializeCustomTimezone(); // CloudSync settings bool syncEnabled() const; QString syncBackend() const; bool syncBookmarks() const; bool syncRoutes() const; QString owncloudServer() const; QString owncloudUsername() const; QString owncloudPassword() const; Q_SIGNALS: /** - * This signal is emitted when when the loaded settings were changed. + * This signal is emitted when the loaded settings were changed. * Either by the user or by loading them initially from disk. */ void settingsChanged(); /** * The user clicked on the button to clear volatile tile cache. */ void clearVolatileCacheClicked(); /** * The user clicked on the button to clear persistent tile cache. */ void clearPersistentCacheClicked(); /** * The user clicked on the button to manually synchronize bookmarks. */ void syncNowClicked(); public Q_SLOTS: /** * Disable "Sync Now" button while sync or for 30 sec of timout */ void disableSyncNow(); void enableSyncNow(); /** * Sets new title for the "Last Sync" label indicator */ void updateLastSync(); /** * Read settings and update interface. */ void readSettings(); /** * Show status on cloud sync settings tab */ void updateCloudSyncStatus( const QString &status ); /** * Write settings to disk. */ void writeSettings(); private Q_SLOTS: /** * Synchronize the loaded settings with the file on hard disk. */ void syncSettings(); void updateCloudSyncCredentials(); private: Q_DISABLE_COPY( QtMarbleConfigDialog ) QtMarbleConfigDialogPrivate * const d; }; } // Marble namespace #endif diff --git a/src/lib/marble/ScanlineTextureMapperContext.h b/src/lib/marble/ScanlineTextureMapperContext.h index bf35749f1..70b8a1e67 100644 --- a/src/lib/marble/ScanlineTextureMapperContext.h +++ b/src/lib/marble/ScanlineTextureMapperContext.h @@ -1,154 +1,154 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007 Andrew Manson // Copyright 2011 Bernhard Beschow #include #include "GeoSceneTileDataset.h" #include "MarbleMath.h" #include "MathHelper.h" namespace Marble { class StackedTile; class StackedTileLoader; class ViewportParams; class ScanlineTextureMapperContext { public: ScanlineTextureMapperContext( StackedTileLoader * const tileLoader, int tileLevel ); void pixelValueF( const qreal lon, const qreal lat, QRgb* const scanLine ); void pixelValue( const qreal lon, const qreal lat, QRgb* const scanLine ); void pixelValueApproxF( const qreal lon, const qreal lat, QRgb *scanLine, const int n ); void pixelValueApprox( const qreal lon, const qreal lat, QRgb *scanLine, const int n ); static int interpolationStep( const ViewportParams *viewport, MapQuality mapQuality ); static QImage::Format optimalCanvasImageFormat( const ViewportParams *viewport ); int globalWidth() const; int globalHeight() const; private: // method for fast integer calculation void nextTile( int& posx, int& posy ); // method for precise interpolation void nextTile( qreal& posx, qreal& posy ); // Converts Radian to global texture coordinates // ( with origin in center, measured in pixel) qreal rad2PixelX( const qreal lon ) const; qreal rad2PixelY( const qreal lat ) const; // Checks whether the pixelValueApprox method will make use of more than // one tile bool isOutOfTileRange( const int itLon, const int itLat, const int itStepLon, const int itStepLat, const int n ) const; bool isOutOfTileRangeF( const qreal itLon, const qreal itLat, const qreal itStepLon, const qreal itStepLat, const int n ) const; private: StackedTileLoader *const m_tileLoader; GeoSceneAbstractTileProjection::Type const m_textureProjection; - /// size of the tiles of of the current texture layer + /// size of the tiles of the current texture layer QSize const m_tileSize; int const m_tileLevel; int const m_globalWidth; int const m_globalHeight; qreal const m_normGlobalWidth; qreal const m_normGlobalHeight; const StackedTile *m_tile; // Coordinate transformations: // Position of the tile in global Texture Coordinates // ( with origin in upper left corner, measured in pixel) int m_tilePosX; int m_tilePosY; // Converts global texture coordinates // ( with origin in center, measured in pixel) // to tile coordinates ( measured in pixel ) qreal m_toTileCoordinatesLon; qreal m_toTileCoordinatesLat; // Previous coordinates qreal m_prevLat; qreal m_prevLon; qreal m_prevPixelX; qreal m_prevPixelY; }; inline int ScanlineTextureMapperContext::globalWidth() const { return m_globalWidth; } inline int ScanlineTextureMapperContext::globalHeight() const { return m_globalHeight; } inline qreal ScanlineTextureMapperContext::rad2PixelX( const qreal lon ) const { return lon * m_normGlobalWidth; } inline qreal ScanlineTextureMapperContext::rad2PixelY( const qreal lat ) const { switch ( m_textureProjection ) { case GeoSceneAbstractTileProjection::Equirectangular: return -lat * m_normGlobalHeight; case GeoSceneAbstractTileProjection::Mercator: if ( fabs( lat ) < 1.4835 ) { // We develop the inverse Gudermannian into a MacLaurin Series: // In spite of the many elements needed to get decent // accuracy this is still faster by far than calculating the // trigonometric expression: // return - asinh( tan( lat ) ) * 0.5 * m_normGlobalHeight; // We are using the Horner Scheme as a polynom representation return - gdInv( lat ) * 0.5 * m_normGlobalHeight; } if ( lat >= +1.4835 ) // asinh( tan (1.4835)) => 3.1309587 return - 3.1309587 * 0.5 * m_normGlobalHeight; if ( lat <= -1.4835 ) // asinh( tan( -1.4835 )) => −3.1309587 return 3.1309587 * 0.5 * m_normGlobalHeight; } // Dummy value to avoid a warning. return 0.0; } } #endif