[Marble-commits] KDE/kdeedu/marble
Torsten Rahn
tackat at kde.org
Wed Jan 5 19:26:46 CET 2011
SVN commit 1212102 by rahn:
- Commit http://reviewboard.kde.org/r/6280/ by Daniel Marth.
M +1 -0 data/CMakeLists.txt
M +14 -1 src/plugins/render/positionmarker/PositionMarker.cpp
M +1 -0 src/plugins/render/positionmarker/PositionMarker.h
M +7 -0 src/plugins/render/positionmarker/PositionMarkerConfigWidget.ui
--- trunk/KDE/kdeedu/marble/data/CMakeLists.txt #1212101:1212102
@@ -37,6 +37,7 @@
svg/wikipedia.svg
svg/wikipedia_shadow.svg
svg/sunshine.png
+svg/track_turtle.svg
DESTINATION ${MARBLE_DATA_INSTALL_PATH}/svg)
FILE (GLOB SVG_FILES flags/*.svg)
--- trunk/KDE/kdeedu/marble/src/plugins/render/positionmarker/PositionMarker.cpp #1212101:1212102
@@ -19,7 +19,10 @@
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QColorDialog>
+#include <QtGui/QTransform>
+#include <cmath>
+
#include "ui_PositionMarkerConfigWidget.h"
#include "AbstractProjection.h"
#include "MarbleDataFacade.h"
@@ -195,6 +198,7 @@
// magnitude should be >0
qreal magnitude = sqrt( ( unitVector.x() * unitVector.x() )
+ ( unitVector.y() * unitVector.y() ) );
+ m_heading = atan( unitVector.y() / unitVector.x() ) + M_PI / 2.0;
unitVector = unitVector / magnitude;
QPointF unitVector2 = QPointF ( -unitVector.y(), unitVector.x() );
QPointF relativeLeft = - ( unitVector * 9 ) + ( unitVector2 * 9 );
@@ -248,8 +252,17 @@
{
QRect rect = m_arrow.boundingRect().toRect();
if( rect.isValid() )
- painter->drawPixmap( rect.topLeft(), m_customCursor );
+ {
+ QTransform transform;
+ transform.translate( -m_customCursor.width() / 2, -m_customCursor.height() / 2 );
+ transform.rotateRadians( m_heading );
+ transform.translate( m_customCursor.width() / 2, m_customCursor.height() / 2 );
+ if( painter->mapQuality() == HighQuality || painter->mapQuality() == PrintQuality )
+ painter->drawPixmap( rect.topLeft(), m_customCursor.transformed( transform, Qt::SmoothTransformation ) );
+ else
+ painter->drawPixmap( rect.topLeft(), m_customCursor.transformed( transform ) );
}
+ }
else
{
painter->setPen( Qt::black );
--- trunk/KDE/kdeedu/marble/src/plugins/render/positionmarker/PositionMarker.h #1212101:1212102
@@ -114,6 +114,7 @@
QHash<QString,QVariant> m_settings;
float m_cursorSize;
QColor m_acColor;
+ qreal m_heading;
static const int sm_defaultSizeStep;
static const int sm_numResizeSteps;
--- trunk/KDE/kdeedu/marble/src/plugins/render/positionmarker/PositionMarkerConfigWidget.ui #1212101:1212102
@@ -90,6 +90,13 @@
</layout>
</item>
<item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Position marker images indicating the direction should point north (top).</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="bottomMargin">
<number>0</number>
More information about the Marble-commits
mailing list