[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/marble
From: Torsten Rahn <tackat () kde ! org>
Date: 2007-08-11 14:00:22
Message-ID: 1186840822.952453.9114.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 698931 by rahn:
Adding "Set Home Location" to the RMB menu.
Something is strange with the sign of the
longitude stored in Radians .... I have to check that.
* src/lib/MarbleWidget.cpp
* src/lib/MarbleWidgetPopupMenu.h
* src/lib/MarbleWidgetPopupMenu.cpp
M +13 -0 ChangeLog
M +7 -6 src/lib/MarbleWidget.cpp
M +22 -2 src/lib/MarbleWidgetPopupMenu.cpp
M +2 -0 src/lib/MarbleWidgetPopupMenu.h
--- trunk/KDE/kdeedu/marble/ChangeLog #698930:698931
@@ -1,5 +1,18 @@
2007-08-11 Torsten Rahn <rahn@kde.org>
+ Adding "Set Home Location" to the RMB menu.
+ (Wanted to have this in before the message string freeze).
+ Something is strange with the sign of the
+ longitude stored in Radians .... I have to check that.
+
+ TODO: store in configuration file.
+
+ * src/lib/MarbleWidget.cpp
+ * src/lib/MarbleWidgetPopupMenu.h
+ * src/lib/MarbleWidgetPopupMenu.cpp
+
+2007-08-11 Torsten Rahn <rahn@kde.org>
+
* src/lib/MarbleWidget.{cpp,h}:
- Introduce setProjection() and projection()
- introduce homePoint( double& lon, double& lat )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #698930:698931
@@ -702,7 +702,7 @@
if ( unit == GeoPoint::Degree )
{
lat *= -RAD2DEG;
- lon *= +RAD2DEG;
+ lon *= -RAD2DEG; // FIXME: Something is wrong here ...
}
return noerr;
@@ -897,11 +897,12 @@
void MarbleWidget::goHome()
{
// d->m_model->rotateTo(0, 0);
-#if 1
- rotateTo( -9.4, 54.8 );
-#else
- rotateTo( d->m_homePoint.quaternion() );
-#endif
+ double homeLon = 0;
+ double homeLat = 0;
+ d->m_homePoint.geoCoordinates( homeLon, homeLat );
+
+ rotateTo( homeLon * RAD2DEG, homeLat * -RAD2DEG );
+
zoomView( d->m_homeZoom ); // default 1050
repaint(); // not obsolete in case the zoomlevel stays unaltered
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.cpp #698930:698931
@@ -20,10 +20,10 @@
#include "placemark.h"
#include "placemarkinfodialog.h"
-MarbleWidgetPopupMenu::MarbleWidgetPopupMenu(MarbleWidget *view,
+MarbleWidgetPopupMenu::MarbleWidgetPopupMenu(MarbleWidget *widget,
MarbleModel *model)
: m_model(model),
- m_widget(view)
+ m_widget(widget)
{
m_lmbMenu = new QMenu( m_widget );
m_rmbMenu = new QMenu( m_widget );
@@ -49,10 +49,15 @@
this);
m_rmbMenu->addAction( m_pRemoveMeasurePointsAction );
m_rmbMenu->addSeparator();
+ m_pSetHomePointAction = new QAction( tr( "&Set Home Location" ), this);
+ m_rmbMenu->addAction( m_pSetHomePointAction );
+ m_rmbMenu->addSeparator();
m_pAboutDialogAction = new QAction( tr( "&About" ), this );
m_rmbMenu->addAction( m_pAboutDialogAction );
+ connect( m_pSetHomePointAction, SIGNAL( triggered() ),
+ SLOT( slotSetHomePoint() ) );
connect( m_pAddMeasurePointAction, SIGNAL( triggered() ),
SLOT( slotAddMeasurePoint() ) );
connect( m_pRemoveMeasurePointsAction, SIGNAL( triggered() ),
@@ -105,6 +110,7 @@
void MarbleWidgetPopupMenu::showRmbMenu( int xpos, int ypos )
{
QPoint curpos = QPoint( xpos, ypos );
+ m_pSetHomePointAction->setData( curpos );
m_pAddMeasurePointAction->setData( curpos );
m_rmbMenu->popup( m_widget->mapToGlobal( curpos ) );
}
@@ -123,7 +129,21 @@
}
}
+void MarbleWidgetPopupMenu::slotSetHomePoint()
+{
+ QPoint p = m_pSetHomePointAction->data().toPoint();
+ double lat;
+ double lon;
+
+ bool valid = m_widget->geoCoordinates( p.x(), p.y(), lon, lat, GeoPoint::Degree );
+ if ( valid == true )
+ {
+// qDebug() << "Setting Home Location: " << lon << ", " << lat;
+ m_widget->setHome( lon, lat, m_widget->zoom() );
+ }
+}
+
void MarbleWidgetPopupMenu::slotAddMeasurePoint()
{
QPoint p = m_pAddMeasurePointAction->data().toPoint();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.h #698930:698931
@@ -47,6 +47,7 @@
void removeMeasurePoints();
protected Q_SLOTS:
+ void slotSetHomePoint();
void slotAddMeasurePoint();
void slotAboutDialog();
@@ -64,6 +65,7 @@
QAction *m_earthaction;
QAction *m_posaction;
+ QAction *m_pSetHomePointAction;
QAction *m_pAddMeasurePointAction;
QAction *m_pRemoveMeasurePointsAction;
QAction *m_pAboutDialogAction;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic