Commit 8b7b1334 authored by Patrick Spendrin's avatar Patrick Spendrin

sync again with trunk

svn path=/branches/work/marble-geodata-nt/marble/; revision=946595
parents 827f6932 5dc78cb3
There are some applications/applets/plasmoids using Marble. They might be
affected by changes of the Marble API.
So it is good practice to check if the following applications compile and
work after API changes:
- extragear/graphics/digikam
- extragear/graphics/kphotoalbum
- playground/base/plasma/applets/contacts
- playground/base/plasma/wallpapers/marble
- playground/office/geoshape
There is this link http://techbase.kde.org/Projects/Marble/MarbleUsedBy
listing also applications not hosted in KDE svn.
......@@ -147,6 +147,12 @@ void MainWindow::createActions()
m_statusBarAct->setStatusTip(tr("Show Status Bar"));
connect(m_statusBarAct, SIGNAL(triggered( bool )), this, SLOT( showStatusBar( bool )));
m_lockFloatItemsAct = new QAction( tr("Lock Position"),this);
m_lockFloatItemsAct->setCheckable( true );
m_lockFloatItemsAct->setStatusTip(tr("Lock Position of Floating Items"));
connect(m_lockFloatItemsAct, SIGNAL(triggered( bool )), this, SLOT( lockPosition( bool )));
m_showCloudsAct = new QAction( tr("&Clouds"), this);
m_showCloudsAct->setCheckable( true );
m_showCloudsAct->setStatusTip(tr("Show Real Time Cloud Cover"));
......@@ -241,6 +247,9 @@ void MainWindow::createMenus()
void MainWindow::createInfoBoxesMenu()
{
m_infoBoxesMenu->clear();
m_infoBoxesMenu->addAction(m_lockFloatItemsAct);
m_infoBoxesMenu->addSeparator();
QList<AbstractFloatItem *> floatItemList = m_controlView->marbleWidget()->floatItems();
QList<AbstractFloatItem *>::const_iterator i = floatItemList.constBegin();
......@@ -387,6 +396,19 @@ void MainWindow::showAtmosphere( bool isChecked )
m_showAtmosphereAct->setChecked( isChecked ); // Sync state with the GUI
}
void MainWindow::lockPosition( bool isChecked )
{
QList<AbstractFloatItem *> floatItemList = m_controlView->marbleWidget()->floatItems();
QList<AbstractFloatItem *>::const_iterator i;
for (i = floatItemList.constBegin(); i != floatItemList.constEnd(); ++i)
{
// Locking one would suffice as it affects all.
// Nevertheless go through all.
(*i)->setPositionLocked(isChecked);
}
}
void MainWindow::controlSun()
{
if (!m_sunControlDialog) {
......
......@@ -78,6 +78,7 @@ class MainWindow : public QMainWindow
void handbook();
void openFile();
void setupStatusBar();
void lockPosition( bool );
void createInfoBoxesMenu();
private:
......@@ -115,6 +116,7 @@ class MainWindow : public QMainWindow
QAction *m_aboutMarbleAct;
QAction *m_aboutQtAct;
QAction *m_openAct;
QAction *m_lockFloatItemsAct;
QAction *m_handbook;
QString m_position;
......
......@@ -315,6 +315,7 @@ else (APPLE AND QTONLY)
geodata/parser/GeoDocument.h
ExtDateTime.h
TileCreator.h
PluginInterface.h
RenderPlugin.h
RenderPluginInterface.h
marble_export.h
......
......@@ -18,7 +18,7 @@ using namespace Marble;
class Marble::HttpJobPrivate
{
public:
HttpJobPrivate();
HttpJobPrivate( const QUrl & sourceUrl, const QString & destFileName, const QString &id );
QUrl m_sourceUrl;
QString m_destinationFileName;
......@@ -32,22 +32,23 @@ class Marble::HttpJobPrivate
int m_trialsLeft;
};
HttpJobPrivate::HttpJobPrivate()
: m_status( NoStatus ),
m_priority( NoPriority ),
m_storagePolicy( 0 )
HttpJobPrivate::HttpJobPrivate( const QUrl & sourceUrl, const QString & destFileName,
const QString &id )
: m_sourceUrl( sourceUrl ),
m_destinationFileName( destFileName ),
m_originalDestinationFileName( destFileName ),
m_initiatorId( id ),
m_status( NoStatus ),
m_priority( NoPriority ),
m_storagePolicy( 0 ),
m_trialsLeft( 3 )
{
}
HttpJob::HttpJob( const QUrl & sourceUrl, const QString & destFileName, const QString &id )
: d( new HttpJobPrivate )
: d( new HttpJobPrivate( sourceUrl, destFileName, id ))
{
d->m_sourceUrl = sourceUrl;
d->m_destinationFileName = destFileName;
d->m_originalDestinationFileName = destFileName;
d->m_initiatorId = id;
d->m_trialsLeft = 3;
}
HttpJob::~HttpJob()
......
......@@ -96,6 +96,14 @@ void LayerManager::renderLayers( GeoPainter *painter, ViewParams *viewParams )
ViewportParams* viewport = viewParams->viewport();
foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
if ( renderPlugin && renderPlugin->renderPosition().contains("SURFACE") ){
if ( renderPlugin->enabled() && renderPlugin->visible() ) {
renderPlugin->render( painter, viewport, "SURFACE" );
}
}
}
foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
if ( renderPlugin ){
if ( renderPlugin->enabled() && renderPlugin->visible() ) {
......@@ -108,9 +116,9 @@ void LayerManager::renderLayers( GeoPainter *painter, ViewParams *viewParams )
// the float items displayed on top:
// FIXME: use d->m_floatItems here?
foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
if ( renderPlugin->renderPosition().contains("FLOAT_ITEM") ) {
if ( renderPlugin && renderPlugin->renderPosition().contains("FLOAT_ITEM") ) {
AbstractFloatItem *floatItem = qobject_cast<AbstractFloatItem *>(renderPlugin);
if ( floatItem->enabled() && floatItem->visible() ) {
if ( floatItem && floatItem->enabled() && floatItem->visible() ) {
floatItem->render( painter, viewport, "FLOAT_ITEM" );
}
}
......
......@@ -17,6 +17,8 @@
#include <QtCore/QtPlugin>
#include <QtGui/QIcon>
#include "marble_export.h"
namespace Marble
{
......@@ -24,7 +26,7 @@ namespace Marble
* @short This class specifies interface of a Marble plugin.
*/
class PluginInterface
class MARBLE_EXPORT PluginInterface
{
public:
virtual ~PluginInterface();
......
......@@ -194,13 +194,19 @@ QPolygonF AbstractProjection::tessellateLineSegment( const GeoDataCoordinates &p
lonDiff = currentLongitude - previousLongitude;
if ( fabs( lonDiff ) == 360.0 ) return path;
}
else {
// qDebug() << "Don't FollowLatitudeCircle";
}
}
else {
// qDebug() << "Don't RespectLatitudeCircle";
}
qreal altDiff = currentCoords.altitude() - previousAltitude;
// Take the clampToGround property into account
int startNode = clampToGround ? 0 : 1;
const int endNode = clampToGround ? count + 2 : count + 1;
int startNode = clampToGround ? 0 : 0;
const int endNode = clampToGround ? count + 0 : count + 0;
qreal lon = 0.0;
qreal lat = 0.0;
......@@ -210,9 +216,14 @@ QPolygonF AbstractProjection::tessellateLineSegment( const GeoDataCoordinates &p
Quaternion itpos;
bool globeHidesPoint = false;
bool previousGlobeHidesPoint = false;
bool previousVisible = false;
for ( int i = startNode; i < endNode; ++i ) {
qreal t = (qreal)(i) / (qreal)( count + 1 ) ;
QPointF point;
QPointF previousPoint;
for ( int i = startNode; i <= endNode; ++i ) {
qreal t = (qreal)(i) / (qreal)( count ) ;
// interpolate the altitude, too
qreal altitude = clampToGround ? 0 : altDiff * t + previousAltitude;
......@@ -232,9 +243,27 @@ QPolygonF AbstractProjection::tessellateLineSegment( const GeoDataCoordinates &p
}
bool visible = screenCoordinates( GeoDataCoordinates( lon, lat, altitude ), viewport, x, y, globeHidesPoint );
if ( visible ) {
path << QPointF( x, y );
point = QPointF( x, y );
// Initialize previous values with current values for the first node.
if ( i == startNode ) {
previousPoint = point;
previousVisible = visible;
previousGlobeHidesPoint = globeHidesPoint;
}
if ( visible && !previousVisible && !previousGlobeHidesPoint ) {
path << previousPoint;
}
// No "else" here, as this would not add the current point that is required.
if ( ( visible || (!visible && previousVisible ) ) && !globeHidesPoint ) {
path << point;
}
previousPoint = point;
previousVisible = visible;
previousGlobeHidesPoint = globeHidesPoint;
}
return path;
}
......@@ -244,7 +244,7 @@ bool SphericalProjection::screenCoordinates( const GeoDataLineString &lineString
// Assign the first or last horizon point to the current or
// previous point, so that we still get correct results for
// the case where we need to geoproject the line segment.
/*
if ( globeHidesPoint ) {
currentCoords = createHorizonCoordinates( previousCoords,
currentCoords,
......@@ -254,6 +254,7 @@ bool SphericalProjection::screenCoordinates( const GeoDataLineString &lineString
currentCoords,
viewport, lineString.tessellationFlags() );
}
*/
}
else {
// Both nodes are located on the planet's hemisphere that is
......@@ -265,7 +266,7 @@ bool SphericalProjection::screenCoordinates( const GeoDataLineString &lineString
// segments of a linestring. If you are about to learn how the code of
// this class works you can safely ignore this section for a start.
if ( lineString.tessellate() && ( isVisible || previousIsVisible ) ) {
if ( lineString.tessellate() /* && ( isVisible || previousIsVisible ) */ ) {
// let the line segment follow the spherical surface
// if the distance between the previous point and the current point
// on screen is too big
......@@ -286,14 +287,15 @@ bool SphericalProjection::screenCoordinates( const GeoDataLineString &lineString
// The latter can pretty safely be excluded for most projections if both points
// are located on the same side relative to the viewport boundaries and if they are
// located more than half the line segment distance away from the viewport.
/*
if ( !( x < safeDistance && previousX < safeDistance )
|| !( y < safeDistance && previousY < safeDistance )
|| !( x + safeDistance > viewport->width()
&& previousX + safeDistance > viewport->width() )
|| !( y + safeDistance > viewport->height()
&& previousY + safeDistance > viewport->height() )
){
) */
{
int suggestedCount = (int)( distance / precision );
if ( distance > precision ) {
......
......@@ -13,9 +13,9 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "SunLocator.h"
#include "global.h"
#include "SunLocator.h"
#include "ExtDateTime.h"
#include "Planet.h"
#include "MarbleMath.h"
......
# add_subdirectory( test )
# add_subdirectory( coordinategrid )
add_subdirectory( crosshairs )
add_subdirectory( geodata )
# add_subdirectory( placemarks )
add_subdirectory( compass )
#add_subdirectory( satellites )
# add_subdirectory( graticule )
# add_subdirectory( satellites )
add_subdirectory( overviewmap )
add_subdirectory( mapscale )
add_subdirectory( stars )
......@@ -14,5 +14,5 @@ add_subdirectory( stars )
add_subdirectory( navigation )
# add_subdirectory ( FITemplate )
#add_subdirectory( dataview )
# add_subdirectory( dataview )
add_subdirectory( fileview )
......@@ -61,7 +61,7 @@ QString GeoDataPlugin::renderPolicy() const
QStringList GeoDataPlugin::renderPosition() const
{
return QStringList( "ALWAYS_ON_TOP" );
return QStringList( "SURFACE" );
}
QString GeoDataPlugin::name() const
......@@ -102,6 +102,10 @@ bool GeoDataPlugin::isInitialized () const
bool GeoDataPlugin::render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer )
{
if ( renderPos != "SURFACE" ) {
return true;
}
if( !dataFacade() || !dataFacade()->renderModel() )
return false;
......
PROJECT(GraticulePlugin)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/render/graticule
${CMAKE_BINARY_DIR}/src/plugins/render/graticule
${QT_INCLUDE_DIR}
)
INCLUDE(${QT_USE_FILE})
set( marblegraticule_SRCS GraticulePlugin.cpp )
marble_add_plugin( GraticulePlugin ${marblegraticule_SRCS} )
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2009 Torsten Rahn <tackat@kde.org>"
//
#include "GraticulePlugin.h"
#include <QtCore/QDebug>
#include "GeoPainter.h"
#include "GeoDataLineString.h"
#include "MarbleDirs.h"
#include "Planet.h"
#include "MarbleDataFacade.h"
#include "ViewportParams.h"
namespace Marble
{
QStringList GraticulePlugin::backendTypes() const
{
return QStringList( "graticule" );
}
QString GraticulePlugin::renderPolicy() const
{
return QString( "ALWAYS" );
}
QStringList GraticulePlugin::renderPosition() const
{
return QStringList( "SURFACE" ); // although this is not a float item we choose the position of one
}
QString GraticulePlugin::name() const
{
// FIXME (once we are out of string freeze):
return tr( "Coordinate Grid" );
}
QString GraticulePlugin::guiString() const
{
return tr( "Coordinate &Grid" );
}
QString GraticulePlugin::nameId() const
{
return QString( "graticule" );
}
QString GraticulePlugin::description() const
{
return QString( "" ); // tr( "A plugin that shows a graticule." );
}
QIcon GraticulePlugin::icon () const
{
return QIcon();
}
void GraticulePlugin::initialize ()
{
}
bool GraticulePlugin::isInitialized () const
{
return true;
}
bool GraticulePlugin::render( GeoPainter *painter, ViewportParams *viewport,
const QString& renderPos,
GeoSceneLayer * layer )
{
if ( renderPos != "SURFACE" ) {
return true;
}
painter->save();
painter->autoMapQuality();
painter->setPen( QColor( Qt::white ) );
for ( int i = 0; i < 180.0 ; i+=10 ){
renderLongitudeCircle( painter, i );
renderLatitudeCircle( painter, i - 90.0 );
}
painter->setPen( QColor( Qt::yellow ) );
renderLatitudeCircle( painter, 0.0 );
renderLongitudeCircle( painter, 0.0 );
renderLongitudeCircle( painter, 90.0 );
qreal axialTilt = RAD2DEG * dataFacade()->planet()->epsilon();
// Setting the pen
QPen graticulePen = painter->pen();
graticulePen.setStyle( Qt::DotLine );
painter->setPen( graticulePen );
renderLatitudeCircle( painter, +axialTilt );
renderLatitudeCircle( painter, -axialTilt );
renderLatitudeCircle( painter, +90.0 - axialTilt );
renderLatitudeCircle( painter, -90.0 + axialTilt );
painter->restore();
return true;
}
void GraticulePlugin::renderLatitudeCircle( GeoPainter *painter, qreal latitude ) {
GeoDataCoordinates n1(-180.0, latitude, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n2(-90.0, latitude, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n3(0.0, latitude, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n4(+90.0, latitude, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n5(+180.0, latitude, 0.0, GeoDataCoordinates::Degree );
GeoDataLineString circle( 0, Tessellate | RespectLatitudeCircle ) ;
circle << &n1 << &n2 << &n3 << &n4 << &n5;
painter->drawPolyline( circle );
}
void GraticulePlugin::renderLongitudeCircle( GeoPainter *painter, qreal longitude ) {
GeoDataCoordinates n1(longitude, 90.0, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n2(longitude, 0.0, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n3(longitude, -90.0, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n4(longitude + 180.0, 0.0, 0.0, GeoDataCoordinates::Degree );
GeoDataCoordinates n5(longitude, 90.0, 0.0, GeoDataCoordinates::Degree );
GeoDataLineString circle( 0, Tessellate ) ;
circle << &n1 << &n2 << &n3 << &n4 << &n5;
painter->drawPolyline( circle );
}
}
Q_EXPORT_PLUGIN2(GraticulePlugin, Marble::GraticulePlugin)
#include "GraticulePlugin.moc"
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2009 Torsten Rahn <tackat@kde.org>"
//
//
// This class is a graticule plugin.
//
#ifndef MARBLEGRATICULEPLUGIN_H
#define MARBLEGRATICULEPLUGIN_H
#include <QtCore/QObject>
#include <QtCore/QVector>
#include "RenderPlugin.h"
namespace Marble
{
/**
* @short A plugin that creates a coordinate grid on top of the map.
*
*/
class GraticulePlugin : public RenderPlugin
{
Q_OBJECT
Q_INTERFACES( Marble::RenderPluginInterface )
MARBLE_PLUGIN(GraticulePlugin)
public:
QStringList backendTypes() const;
QString renderPolicy() const;
QStringList renderPosition() const;
QString name() const;
QString guiString() const;
QString nameId() const;
QString description() const;
QIcon icon () const;
void initialize ();
bool isInitialized () const;
bool render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer = 0 );
private:
void renderLatitudeCircle( GeoPainter *painter, qreal latitude );
void renderLongitudeCircle( GeoPainter *painter, qreal longitude );
};
}
#endif // MARBLEGRATICULEPLUGIN_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment