Adds rotation while selecting a dive.

This adds rotation, a very, very shinny feature.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-17 14:09:10 -03:00
parent 3a1a4c1874
commit b89265c7f0
2 changed files with 10 additions and 5 deletions

View file

@ -16,14 +16,12 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
setMapThemeId("earth/bluemarble/bluemarble.dgml"); setMapThemeId("earth/bluemarble/bluemarble.dgml");
setProjection( Marble::Spherical ); setProjection( Marble::Spherical );
// Enable the cloud cover and enable the country borders setAnimationsEnabled(true);
setShowClouds( false ); setShowClouds( false );
setShowBorders( false ); setShowBorders( false );
setShowPlaces( false ); setShowPlaces( false );
setShowCrosshairs( false ); setShowCrosshairs( false );
setShowGrid( false ); setShowGrid( false );
// Hide the FloatItems: Compass and StatusBar
setShowOverviewMap(false); setShowOverviewMap(false);
setShowScaleBar(false); setShowScaleBar(false);
@ -33,6 +31,7 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
floatItem->setContentSize( QSize( 50, 50 ) ); floatItem->setContentSize( QSize( 50, 50 ) );
} }
} }
} }
void GlobeGPS::reload() void GlobeGPS::reload()
@ -49,8 +48,11 @@ void GlobeGPS::reload()
struct dive *dive; struct dive *dive;
for_each_dive(idx, dive) { for_each_dive(idx, dive) {
if (dive_has_gps_location(dive)) { if (dive_has_gps_location(dive)) {
// don't add dive locations twice.
if( diveLocations.contains( QString(dive->location)))
continue;
GeoDataPlacemark *place = new GeoDataPlacemark( dive->location ); GeoDataPlacemark *place = new GeoDataPlacemark( dive->location );
place->setDescription(dive->notes);
place->setCoordinate(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0 , 0, GeoDataCoordinates::Degree ); place->setCoordinate(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0 , 0, GeoDataCoordinates::Degree );
loadedDives->append( place ); loadedDives->append( place );
} }
@ -60,5 +62,5 @@ void GlobeGPS::reload()
void GlobeGPS::centerOn(dive* dive) void GlobeGPS::centerOn(dive* dive)
{ {
centerOn(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0); centerOn(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0, true);
} }

View file

@ -2,6 +2,7 @@
#define GLOBE_H #define GLOBE_H
#include <marble/MarbleWidget.h> #include <marble/MarbleWidget.h>
#include <QHash>
namespace Marble{ namespace Marble{
class GeoDataDocument; class GeoDataDocument;
@ -16,6 +17,8 @@ public:
private: private:
Marble::GeoDataDocument *loadedDives; Marble::GeoDataDocument *loadedDives;
QStringList diveLocations;
}; };
#endif #endif