[Marble-commits] KDE/kdeedu/marble
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Thu Sep 30 21:49:44 CEST 2010
SVN commit 1181358 by beschow:
move home location to MarbleModel
The home location is data, so it should be stored in the model.
This also allows non-GUI code to access the home location.
M +2 -0 docs/release_notes/APIChanges-0.11.txt
M +3 -23 src/lib/MarbleMap.cpp
M +0 -21 src/lib/MarbleMap.h
M +0 -4 src/lib/MarbleMap_p.h
M +24 -0 src/lib/MarbleModel.cpp
M +22 -0 src/lib/MarbleModel.h
M +4 -4 src/lib/MarbleWidget.cpp
M +1 -1 src/lib/routing/RoutingInputWidget.cpp
--- trunk/KDE/kdeedu/marble/docs/release_notes/APIChanges-0.11.txt #1181357:1181358
@@ -16,3 +16,5 @@
* From MarbleWidget remove setProxy(), proxyHost(), proxyPort(), user(), password().
These methods haven't been meaningful to MarbleWidget and have been commented to be removed a long time ago.
+
+* Move MarbleMap::home(...) and MarbleMap::setHome(...) to MarbleModel.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1181357:1181358
@@ -72,9 +72,6 @@
void MarbleMapPrivate::construct()
{
- // Some point that tackat defined. :-)
- m_parent->setHome( -9.4, 54.8, 1050 );
-
m_parent->connect( m_model, SIGNAL( themeChanged( QString ) ),
m_parent, SIGNAL( themeChanged( QString ) ) );
m_parent->connect( m_model, SIGNAL( modelChanged() ),
@@ -788,25 +785,7 @@
emit visibleLatLonAltBoxChanged( d->m_viewParams.viewport()->viewLatLonAltBox() );
}
-void MarbleMap::home( qreal &lon, qreal &lat, int& zoom )
-{
- d->m_homePoint.geoCoordinates( lon, lat, GeoDataCoordinates::Degree );
- zoom = d->m_homeZoom;
-}
-void MarbleMap::setHome( qreal lon, qreal lat, int zoom )
-{
- d->m_homePoint = GeoDataCoordinates( lon, lat, 0, GeoDataCoordinates::Degree );
- d->m_homeZoom = zoom;
-}
-
-void MarbleMap::setHome( const GeoDataCoordinates& homePoint, int zoom )
-{
- d->m_homePoint = homePoint;
- d->m_homeZoom = zoom;
-}
-
-
void MarbleMap::moveLeft()
{
int polarity = viewport()->polarity();
@@ -903,11 +882,12 @@
{
qreal homeLon = 0;
qreal homeLat = 0;
- d->m_homePoint.geoCoordinates( homeLon, homeLat );
+ int homeZoom = 1050;
+ d->m_model->home( homeLon, homeLat, homeZoom );
centerOn( homeLon * RAD2DEG, homeLat * RAD2DEG );
- zoomView( d->m_homeZoom ); // default 1050
+ zoomView( homeZoom ); // default 1050
}
QString MarbleMap::mapThemeId() const
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.h #1181357:1181358
@@ -563,27 +563,6 @@
void setProjection( Projection projection );
/**
- * @brief get the home point
- * @param lon the longitude of the home point.
- * @param lat the latitude of the home point.
- * @param zoom the default zoom level of the home point.
- */
- void home( qreal &lon, qreal &lat, int& zoom );
- /**
- * @brief Set the home point
- * @param lon the longitude of the new home point.
- * @param lat the latitude of the new home point.
- * @param zoom the default zoom level for the new home point.
- */
- void setHome( qreal lon, qreal lat, int zoom = 1050 );
- /**
- * @brief Set the home point
- * @param homePoint the new home point.
- * @param zoom the default zoom level for the new home point.
- */
- void setHome( const GeoDataCoordinates& homePoint, int zoom = 1050 );
-
- /**
* @brief Move left by the moveStep.
*/
void moveLeft();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap_p.h #1181357:1181358
@@ -62,10 +62,6 @@
bool m_justModified; // FIXME: Rename to isDirty
bool m_dirtyAtmosphere;
- // The home position
- GeoDataCoordinates m_homePoint;
- int m_homeZoom;
-
// zoom related
int m_logzoom;
int m_zoomStep;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1181357:1181358
@@ -92,6 +92,8 @@
m_dataFacade( 0 ),
m_pluginManager( new PluginManager( parent ) ),
m_mapThemeManager( new MapThemeManager( parent )),
+ m_homePoint( -9.4, 54.8 ), // Some point that tackat defined. :-)
+ m_homeZoom( 1050 ),
m_mapTheme( 0 ),
m_layerManager( 0 ),
m_downloadManager( new HttpDownloadManager( new FileStoragePolicy(
@@ -131,6 +133,10 @@
PluginManager *m_pluginManager;
MapThemeManager *m_mapThemeManager;
+ // The home position
+ GeoDataCoordinates m_homePoint;
+ int m_homeZoom;
+
// View and paint stuff
GeoSceneDocument *m_mapTheme;
LayerManager *m_layerManager;
@@ -559,6 +565,24 @@
d->notifyModelChanged();
}
+void MarbleModel::home( qreal &lon, qreal &lat, int& zoom )
+{
+ d->m_homePoint.geoCoordinates( lon, lat, GeoDataCoordinates::Degree );
+ zoom = d->m_homeZoom;
+}
+
+void MarbleModel::setHome( qreal lon, qreal lat, int zoom )
+{
+ d->m_homePoint = GeoDataCoordinates( lon, lat, 0, GeoDataCoordinates::Degree );
+ d->m_homeZoom = zoom;
+}
+
+void MarbleModel::setHome( const GeoDataCoordinates& homePoint, int zoom )
+{
+ d->m_homePoint = homePoint;
+ d->m_homeZoom = zoom;
+}
+
void MarbleModel::setupTextureMapper( Projection projection )
{
if ( !d->m_mapTheme || !d->m_mapTheme->map()->hasTextureLayers() )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1181357:1181358
@@ -68,6 +68,7 @@
class RenderPlugin;
class PluginManager;
class AbstractFloatItem;
+class GeoDataCoordinates;
class GeoDataDocument;
class GeoSceneDocument;
class GeoSceneTexture;
@@ -185,6 +186,27 @@
Projection currentProjection );
/**
+ * @brief get the home point
+ * @param lon the longitude of the home point.
+ * @param lat the latitude of the home point.
+ * @param zoom the default zoom level of the home point.
+ */
+ void home( qreal &lon, qreal &lat, int& zoom );
+ /**
+ * @brief Set the home point
+ * @param lon the longitude of the new home point.
+ * @param lat the latitude of the new home point.
+ * @param zoom the default zoom level for the new home point.
+ */
+ void setHome( qreal lon, qreal lat, int zoom = 1050 );
+ /**
+ * @brief Set the home point
+ * @param homePoint the new home point.
+ * @param zoom the default zoom level for the new home point.
+ */
+ void setHome( const GeoDataCoordinates& homePoint, int zoom = 1050 );
+
+ /**
* @brief Set the Projection used for the map
* @param projection projection type (e.g. Spherical, Equirectangular, Mercator)
*/
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1181357:1181358
@@ -667,17 +667,17 @@
void MarbleWidget::home( qreal &lon, qreal &lat, int& zoom )
{
- d->m_map->home( lon, lat, zoom );
+ d->m_model->home( lon, lat, zoom );
}
void MarbleWidget::setHome( qreal lon, qreal lat, int zoom )
{
- d->m_map->setHome( lon, lat, zoom );
+ d->m_model->setHome( lon, lat, zoom );
}
void MarbleWidget::setHome( const GeoDataCoordinates& homePoint, int zoom )
{
- d->m_map->setHome( homePoint, zoom );
+ d->m_model->setHome( homePoint, zoom );
}
@@ -860,7 +860,7 @@
qreal homeLon = 0;
qreal homeLat = 0;
int homeZoom = 0;
- d->m_map->home( homeLon, homeLat, homeZoom );
+ d->m_model->home( homeLon, homeLat, homeZoom );
GeoDataLookAt target;
target.setLongitude( homeLon, GeoDataCoordinates::Degree );
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1181357:1181358
@@ -363,7 +363,7 @@
{
qreal lon( 0.0 ), lat( 0.0 );
int zoom( 0 );
- d->m_marbleMap->home( lon, lat, zoom );
+ d->m_marbleModel->home( lon, lat, zoom );
GeoDataCoordinates home( lon, lat, 0.0, GeoDataCoordinates::Degree );
setTargetPosition( home );
requestActivity();
More information about the Marble-commits
mailing list