mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Added real support for the marble widget
The marble widget now shows the dive locations and also will center on the dive that the user clicked in the dive list. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
		
							parent
							
								
									4098922b55
								
							
						
					
					
						commit
						9038b3aa6e
					
				
					 3 changed files with 54 additions and 5 deletions
				
			
		|  | @ -1,16 +1,27 @@ | |||
| #include "globe.h" | ||||
| #include "../dive.h" | ||||
| 
 | ||||
| #include <QDebug> | ||||
| 
 | ||||
| #include <marble/AbstractFloatItem.h> | ||||
| #include <marble/GeoDataPlacemark.h> | ||||
| #include <marble/GeoDataDocument.h> | ||||
| #include <marble/MarbleModel.h> | ||||
| #include <marble/GeoDataTreeModel.h> | ||||
| 
 | ||||
| using namespace Marble; | ||||
| 
 | ||||
| GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent) | ||||
| GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0) | ||||
| { | ||||
| 	setMapThemeId("earth/bluemarble/bluemarble.dgml"); | ||||
| 	setProjection( Marble::Spherical ); | ||||
| 
 | ||||
| 	// Enable the cloud cover and enable the country borders
 | ||||
| 	setShowClouds( true ); | ||||
| 	setShowBorders( true ); | ||||
| 	setShowClouds( false ); | ||||
| 	setShowBorders( false ); | ||||
| 	setShowPlaces( false ); | ||||
| 	setShowCrosshairs( false ); | ||||
| 	setShowGrid( false ); | ||||
| 
 | ||||
| 	// Hide the FloatItems: Compass and StatusBar
 | ||||
| 	setShowOverviewMap(false); | ||||
|  | @ -23,3 +34,31 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent) | |||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void GlobeGPS::reload() | ||||
| { | ||||
| 	if (loadedDives){ | ||||
| 		model()->treeModel()->removeDocument(loadedDives); | ||||
| 		delete loadedDives; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	loadedDives = new GeoDataDocument; | ||||
| 
 | ||||
| 	int idx = 0; | ||||
| 	struct dive *dive; | ||||
| 	for_each_dive(idx, dive) { | ||||
| 		if (dive_has_gps_location(dive)) { | ||||
| 			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 ); | ||||
| 			loadedDives->append( place ); | ||||
| 		} | ||||
| 	} | ||||
| 	model()->treeModel()->addDocument( loadedDives ); | ||||
| } | ||||
| 
 | ||||
| void GlobeGPS::centerOn(dive* dive) | ||||
| { | ||||
| 	centerOn(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue