[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble] /: Remove VectorComposer and lots of legacy code
From: Thibaut Gridel <tgridel () free ! fr>
Date: 2014-01-03 19:37:04
Message-ID: E1VzAYK-0004Jd-6f () scm ! kde ! org
[Download RAW message or body]
Git commit 7b5ee33b9333d92d668235083a1be52ed177c7ce by Thibaut Gridel.
Committed on 01/01/2013 at 09:58.
Pushed by tgridel into branch 'master'.
Remove VectorComposer and lots of legacy code
M +0 -3 src/lib/marble/CMakeLists.txt
D +0 -392 src/lib/marble/GeoPolygon.cpp
D +0 -137 src/lib/marble/GeoPolygon.h
D +0 -42 src/lib/marble/ScreenPolygon.h
D +0 -447 src/lib/marble/VectorComposer.cpp
D +0 -191 src/lib/marble/VectorComposer.h
D +0 -761 src/lib/marble/VectorMap.cpp
D +0 -82 src/lib/marble/VectorMap.h
M +0 -4 src/lib/marble/layers/CMakeLists.txt
D +0 -46 src/lib/marble/layers/VectorMapBaseLayer.cpp
D +0 -48 src/lib/marble/layers/VectorMapBaseLayer.h
D +0 -46 src/lib/marble/layers/VectorMapLayer.cpp
D +0 -48 src/lib/marble/layers/VectorMapLayer.h
M +0 -1 tests/CMakeLists.txt
D +0 -50 tests/GeoPolygonTest.cpp
http://commits.kde.org/marble/7b5ee33b9333d92d668235083a1be52ed177c7ce
diff --git a/src/lib/marble/CMakeLists.txt b/src/lib/marble/CMakeLists.txt
index f216fa5..fbec4d5 100644
--- a/src/lib/marble/CMakeLists.txt
+++ b/src/lib/marble/CMakeLists.txt
@@ -113,7 +113,6 @@ set(marblewidget_SRCS
DownloadPolicy.cpp
DownloadQueueSet.cpp
GeoPainter.cpp
- GeoPolygon.cpp
HttpDownloadManager.cpp
HttpJob.cpp
LayerManager.cpp
@@ -160,8 +159,6 @@ set(marblewidget_SRCS
TileCreator.cpp
TinyWebBrowser.cpp
#jsonparser.cpp
- VectorComposer.cpp
- VectorMap.cpp
FileLoader.cpp
FileManager.cpp
PositionTracking.cpp
diff --git a/src/lib/marble/GeoPolygon.cpp b/src/lib/marble/GeoPolygon.cpp
deleted file mode 100644
index 4a7fa1e..0000000
--- a/src/lib/marble/GeoPolygon.cpp
+++ /dev/null
@@ -1,392 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2004-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-//
-
-
-#include "GeoPolygon.h"
-
-#include <cstdlib>
-#include <fcntl.h>
-#include <cmath>
-using std::fabs;
-
-#include <QFile>
-#include <QDataStream>
-#include <QTime>
-#ifdef Q_OS_UNIX
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <sys/mman.h> /* mmap() is defined in this header */
-#endif
-
-#include "MarbleDebug.h"
-#include "Quaternion.h"
-
-using namespace Marble;
-
-const qreal ARCMINUTE = 10800; // distance of 180deg in arcminutes
-const qreal INT2RAD = M_PI / 10800.0;
-
-GeoPolygon::GeoPolygon()
- : m_dateLineCrossing( false ),
- m_closed( false ),
- m_index( 0 )
-{
-}
-
-GeoPolygon::~GeoPolygon()
-{
-// qDeleteAll( begin(), end() );
- qDeleteAll( m_boundary );
-}
-
-void GeoPolygon::setBoundary( qreal lonLeft, qreal latTop, qreal lonRight, qreal \
latBottom)
-{
- m_boundary.clear();
- if ( getDateLine() == GeoPolygon::Even ) {
- qreal xcenter = ( lonLeft + ( 2.0 * M_PI + lonRight) ) / 2.0;
-
- if ( xcenter > M_PI )
- xcenter -= 2.0 * M_PI;
- if ( xcenter < -M_PI )
- xcenter += 2.0 * M_PI;
-
- m_boundary.append( new GeoDataCoordinates( xcenter, 0.5 * (latTop + \
latBottom), 0.0,
- GeoDataCoordinates::Radian, 1 ) \
);
- }
- else
- m_boundary.append( new GeoDataCoordinates( 0.5 * (lonLeft + lonRight),
- 0.5 * (latTop + latBottom), 0.0,
- GeoDataCoordinates::Radian, 1 ) \
);
-
- m_boundary.append( new GeoDataCoordinates( lonLeft, latTop, 0.0, \
GeoDataCoordinates::Radian, 1 ));
- m_boundary.append( new GeoDataCoordinates( lonRight, latBottom, 0.0, \
GeoDataCoordinates::Radian, 1 ));
- m_boundary.append( new GeoDataCoordinates( lonRight, latTop, 0.0, \
GeoDataCoordinates::Radian, 1 ));
- m_boundary.append( new GeoDataCoordinates( lonLeft, latBottom, 0.0, \
GeoDataCoordinates::Radian, 1 ));
-
-}
-
-void GeoPolygon::displayBoundary()
-{
- Quaternion q;
- qreal lon;
- qreal lat;
- m_boundary.at(0)->geoCoordinates(lon, lat, GeoDataCoordinates::Degree);
- mDebug() << "Boundary:" << lon << ", " << lat;
- m_boundary.at(1)->geoCoordinates(lon, lat, GeoDataCoordinates::Degree);
- mDebug() << "Boundary:" << lon << ", " << lat;
- m_boundary.at(2)->geoCoordinates(lon, lat, GeoDataCoordinates::Degree);
- mDebug() << "Boundary:" << lon << ", " << lat;
- m_boundary.at(3)->geoCoordinates(lon, lat, GeoDataCoordinates::Degree);
- mDebug() << "Boundary:" << lon << ", " << lat;
- m_boundary.at(4)->geoCoordinates(lon, lat, GeoDataCoordinates::Degree);
- mDebug() << "Boundary:" << lon << ", " << lat;
-
-// mDebug() << "Points#: " << size() << " File: " << m_sourceFileName
-// << " dateline " << getDateLine() << " Index: " << getIndex();
-}
-
-// ================================================================
-// class PntMap
-
-
-PntMap::PntMap()
- : m_isInitialized( false ),
- m_loader( 0 )
-{
-}
-
-bool PntMap::isInitialized() const
-{
- return m_isInitialized;
-}
-
-PntMap::~PntMap()
-{
- if ( m_loader ) {
- m_loader->wait();
- }
- qDeleteAll( begin(), end() );
-}
-
-void PntMap::load(const QString &filename)
-{
- m_loader = new PntMapLoader( this, filename );
-
- connect ( m_loader, SIGNAL(pntMapLoaded(bool)), SLOT(setInitialized(bool)) );
- m_loader->start();
-}
-
-void PntMap::setInitialized( bool isInitialized )
-{
- if ( m_loader->isFinished() ) {
- delete m_loader;
- m_loader = 0;
- }
-
- m_isInitialized = isInitialized;
- emit initialized();
-}
-
-PntMapLoader::PntMapLoader( PntMap* parent, const QString& filename )
- : m_parent( parent ),
- m_filename( filename )
-{
-}
-
-void PntMapLoader::run()
-{
-// qDebug("PntMap::load trying to load: " + m_filename.toLocal8Bit());
- QTime timer;
- timer.restart();
-
-#ifdef Q_OS_UNIX
- // MMAP Start
- int fd;
- unsigned char* src;
- struct stat statbuf;
-
- if ( (fd = open (m_filename.toLatin1(), O_RDONLY) ) < 0) { // \
krazy:exclude=syscalls
- mDebug() << "cannot open" << m_filename << " for reading";
- return;
- }
-
- int filelength;
- if ( fstat (fd,&statbuf) < 0 ) { // krazy:exclude=syscalls
- filelength = 0;
- mDebug() << "fstat error";
- return;
- } else {
- filelength = statbuf.st_size;
- }
-
- if ((src = (unsigned char*) mmap (0, filelength, PROT_READ, MAP_SHARED, fd, 0))
- == (unsigned char*) (caddr_t) -1)
- mDebug() << "mmap error for input";
-
- int count = 0;
-
- //const int halfFileLength = filelength / 2;
-
- for (int i=0; i < filelength; i+=6){
- short header = src[i] | (src[i+1] << 8);
- short iLat = src[i+2] | (src[i+3] << 8);
- short iLon = src[i+4] | (src[i+5] << 8);
-
- // Transforming Range of Coordinates to iLat [0,ARCMINUTE] ,
- // iLon [0,2 * ARCMINUTE]
-
- //
- // 90 00N = -ARCMINUTE / 2
- // 90 00S = ARCMINUTE / 2
- // 180 00W = -ARCMINUTE
- // 180 00E = ARCMINUTE
- //
- if ( header > 5 ) {
-
- // qDebug(QString("header: %1 iLat: %2 iLon: \
%3").arg(header).arg(iLat).arg(iLon).toLatin1());
-
- GeoPolygon *polyline = new GeoPolygon();
- m_parent->append( polyline );
-
-// polyline->m_sourceFileName=filename;
- polyline->setIndex( header );
-
- // Find out whether the Polyline is a river or a closed polygon
- if ( ( header >= 7000 && header < 8000 )
- || ( header >= 9000 && header < 20000 ) )
- polyline->setClosed( false );
- else
- polyline->setClosed( true );
-
- polyline->append( GeoDataCoordinates( (qreal)(iLon) * INT2RAD, \
(qreal)(iLat) * INT2RAD,
- 0.0, GeoDataCoordinates::Radian, 5 \
) );
- }
- else {
- // qDebug(QString("header: %1 iLat: %2 iLon: \
%3").arg(header).arg(iLat).arg(iLon).toLatin1());
- m_parent->last()->append( GeoDataCoordinates( (qreal)(iLon) * INT2RAD,
- (qreal)(iLat) * INT2RAD, \
0.0,
- \
GeoDataCoordinates::Radian,
- (int)(header) ) );
- }
- ++count;
- }
- munmap(src,filelength);
- close(fd);
-
- // qDebug(QString("Opened %1 with %2 Polylines and %3 \
Points").arg(filename).arg(this->count()).arg(count).toLatin1());
- // MMAP End
-#else
-# ifdef Q_OS_WIN
-
- // qDebug("Loading PntMap ...");
- int count = 0;
- QFile file( m_filename );
-
- file.open( QIODevice::ReadOnly );
- QDataStream stream( &file ); // read the data serialized from the file
- stream.setByteOrder( QDataStream::LittleEndian );
-
- short header;
- short iLat;
- short iLon;
-
- // Iterator that points to current PolyLine in PntMap
- // QList<GeoPolygon*>::iterator it = begin();
- // int count = 0;
-
- while( !stream.atEnd() ){
- stream >> header >> iLat >> iLon;
- // Transforming Range of Coordinates to iLat [0,ARCMINUTE] , iLon [0,2 * \
ARCMINUTE]
-
- if ( header > 5 ) {
-
- // qDebug(QString("header: %1 iLat: %2 iLon: \
%3").arg(header).arg(iLat).arg(iLon).toLatin1());
- GeoPolygon *polyline = new GeoPolygon();
- m_parent->append( polyline );
-
- polyline->setIndex(header);
-
- // Find out whether the Polyline is a river or a closed polygon
- if ( ( header >= 7000 && header < 8000 )
- || ( header >= 9000 && header < 20000 ) )
- polyline->setClosed( false );
- else
- polyline->setClosed( true );
-
- polyline->append( GeoDataCoordinates( (qreal)(iLon) * INT2RAD, \
(qreal)(iLat) * INT2RAD,
- 0.0, GeoDataCoordinates::Radian, 5 \
) );
- }
- else {
- // qDebug(QString("header: %1 iLat: %2 iLon: \
%3").arg(header).arg(iLat).arg(iLon).toLatin1());
- m_parent->last()->append( GeoDataCoordinates( (qreal)(iLon) * INT2RAD,
- (qreal)(iLat) * INT2RAD, \
0.0,
- \
GeoDataCoordinates::Radian,
- (int)(header) ) );
- }
- ++count;
- }
-
- file.close();
- // qDebug(QString("Opened %1 with %2 Polylines and %3 \
Points").arg(filename).arg(this->count()).arg(count).toLatin1());
-
-# else
-# warning Your OS is not supported!
-# endif
-#endif
-
-
- // To optimize performance we compute the boundaries of the
- // polygons. To detect inside/outside we need to detect the
- // dateline first We probably won't need this for spherical
- // projection but for flat projection
- //
- // FIXME: Break this out into its own function.
-
- qreal lon = 0.0;
- qreal lastLon = 0.0;
- qreal lat = 0.0;
-
- GeoPolygon::PtrVector::ConstIterator itPolyLine;
- GeoPolygon::PtrVector::ConstIterator itEndPolyLine = m_parent->constEnd();
- GeoDataCoordinates::Vector::ConstIterator itPoint;
-
- // Now we calculate the boundaries
-
- for ( itPolyLine = m_parent->constBegin(); itPolyLine != itEndPolyLine; \
++itPolyLine ) {
-
- qreal lonLeft = +M_PI;
- qreal lonRight = -M_PI;
- qreal otherLonLeft = +M_PI;
- qreal otherLonRight = -M_PI;
- qreal latTop = -M_PI / 2.0;
- qreal latBottom = +M_PI / 2.0;
-
- bool isCrossingDateLine = false;
- bool isOriginalSide = true;
- int lastSign = 0;
-
- GeoDataCoordinates::Vector::ConstIterator itEndPoint = \
(*itPolyLine)->constEnd();
-
- for ( itPoint = (*itPolyLine)->constBegin();
- itPoint != itEndPoint;
- ++itPoint )
- {
- itPoint->geoCoordinates( lon, lat );
-
- int currentSign = ( lon > 0.0 ) ? 1 : -1 ;
-
- if( itPoint == (*itPolyLine)->constBegin() ) {
- lastSign = currentSign;
- lastLon = lon;
- }
-
- if ( lastSign != currentSign && fabs(lastLon) + fabs(lon) > M_PI ) {
- isOriginalSide = !isOriginalSide;
- isCrossingDateLine = true;
- }
-
- if ( isOriginalSide ) {
- if ( lon < lonLeft ) lonLeft = lon;
- if ( lon > lonRight ) lonRight = lon;
- } else {
- if ( lon < otherLonLeft ) otherLonLeft = lon;
- if ( lon > otherLonRight ) otherLonRight = lon;
- }
-
- if ( lat > latTop ) latTop = lat;
- if ( lat < latBottom ) latBottom = lat;
-
- lastSign = currentSign;
- lastLon = lon;
- }
-
- if ( !isOriginalSide ) {
- (*itPolyLine)->setDateLine( GeoPolygon::Odd );
-// mDebug() << "Odd >> File: " << (*itPolyLine)->m_sourceFileName;
- (*itPolyLine)->setBoundary( -M_PI, latTop, M_PI, -M_PI / 2.0 );
-// mDebug() << " lonLeft: " << lonLeft << " lonRight: " << lonRight << " \
otherLonLeft: " << otherLonLeft << " otherlonRight: " << \
otherLonRight;
- }
-
- if ( isOriginalSide && isCrossingDateLine ) {
- (*itPolyLine)->setDateLine( GeoPolygon::Even );
-// mDebug() << "Even >> File: " << (*itPolyLine)->m_sourceFileName << " \
Size: " << (*itPolyLine)->size();
-
-// mDebug() << " lonLeft: " << lonLeft << " lonRight: " << lonRight << " \
otherLonLeft: " << otherLonLeft << " otherlonRight: " << \
otherLonRight;
-
- qreal leftLonRight, rightLonLeft;
-
- if ( fabs( M_PI * lonRight/fabs(lonRight) - lonRight ) >
- fabs( M_PI * otherLonRight/fabs(otherLonRight) - otherLonRight ) ) \
{
- rightLonLeft = otherLonLeft;
- leftLonRight = lonRight;
- } else {
- rightLonLeft = lonLeft;
- leftLonRight = otherLonRight;
- }
-
- (*itPolyLine)->setBoundary( rightLonLeft, latTop, leftLonRight, \
latBottom );
-
-// mDebug() << "Crosses: lonLeft: " << rightLonLeft << " is right from: \
lonRight: " << leftLonRight;
-
- }
- if ( !isCrossingDateLine ) {
- (*itPolyLine)->setDateLine( GeoPolygon::None );
- (*itPolyLine)->setBoundary( lonLeft, latTop, lonRight, latBottom );
- }
- }
-
- mDebug() << Q_FUNC_INFO << "Loaded" << m_filename << "in" << timer.elapsed() << \
"ms";
-
- emit pntMapLoaded( true );
-}
-
-#include "GeoPolygon.moc"
diff --git a/src/lib/marble/GeoPolygon.h b/src/lib/marble/GeoPolygon.h
deleted file mode 100644
index d22e425..0000000
--- a/src/lib/marble/GeoPolygon.h
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2004-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-//
-
-#ifndef MARBLE_GEOPOLYGON_H
-#define MARBLE_GEOPOLYGON_H
-
-#include <QObject>
-#include <QString>
-#include <QThread>
-#include <QVector>
-#include "marble_export.h"
-
-#include "GeoDataCoordinates.h"
-
-namespace Marble
-{
-
-/*
- NOTE: USAGE OF THIS CLASS IS DEPRECATED
- Use GeoDataLineString, GeoDataLinearRing OR GeoDataPolygon instead!
-
- GeoDataPoint defines the nodes in a polyLine
-*/
-
-class MARBLE_EXPORT GeoPolygon : public GeoDataCoordinates::Vector
-{
- public:
- GeoPolygon();
- virtual ~GeoPolygon();
-
- /**
- * @brief enum used to specify how a polyline crosses the IDL
- *
- * "None" means that the polyline doesn't cross the
- * International Dateline (IDL).
- *
- * "Odd" means that the polyline crosses the IDL. The number
- * of times that the IDL is being crossed is odd. As a result
- * the polyline covers the whole range of longitude and the
- * feature described by the polyline contains one of the poles
- * (example: Antarctica).
- * International Dateline (IDL).
- * "Even" means that each time the polyline crosses the IDL it
- * also returns back to the original side later on by crossing
- * the IDL again (example: Russia).
- */
-
- enum DateLineCrossing{None, Odd, Even};
-
- int getIndex() const { return m_index; }
- bool getClosed() const { return m_closed; }
- void setClosed( bool closed ){ m_closed = closed; }
-
- void setIndex( int index ){ m_index = index; }
-
- int getDateLine() const { return m_dateLineCrossing; }
- void setDateLine( int dateLineCrossing ){ m_dateLineCrossing = dateLineCrossing; \
}
-
- void setBoundary( qreal, qreal, qreal, qreal );
- GeoDataCoordinates::PtrVector getBoundary() const { return m_boundary; }
-
- void displayBoundary();
-
- // Type definitions
- typedef QVector<GeoPolygon *> PtrVector;
-
-// QString m_sourceFileName;
-
- private:
- int m_dateLineCrossing;
- bool m_closed;
-
- GeoDataCoordinates::PtrVector m_boundary;
-
- int m_index;
-};
-
-
-/*
- * A PntMap is a collection of GeoPolygons, i.e. a complete map of vectors.
- *
- * FIXME: Rename it (into GeoPolygonMap?)
- */
-
-class PntMapLoader;
-
-class MARBLE_EXPORT PntMap : public QObject,
- public GeoPolygon::PtrVector
-{
- Q_OBJECT
- public:
- PntMap();
- ~PntMap();
-
- bool isInitialized() const;
-
- void load( const QString & );
-
- Q_SIGNALS:
- void initialized();
-
- private Q_SLOTS:
- void setInitialized( bool );
-
- private:
- bool m_isInitialized;
- PntMapLoader* m_loader;
-
- Q_DISABLE_COPY( PntMap )
-};
-
-class MARBLE_EXPORT PntMapLoader : public QThread
-{
- Q_OBJECT
- public:
- PntMapLoader( PntMap* parent, const QString& filename );
-
- void run();
- Q_SIGNALS:
- void pntMapLoaded( bool );
-
- private:
- PntMap *m_parent;
- QString m_filename;
-};
-
-}
-
-#endif
diff --git a/src/lib/marble/ScreenPolygon.h b/src/lib/marble/ScreenPolygon.h
deleted file mode 100644
index ec9ee07..0000000
--- a/src/lib/marble/ScreenPolygon.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2006-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-//
-
-#ifndef MARBLE_SCREENPOLYGON_H
-#define MARBLE_SCREENPOLYGON_H
-
-
-#include <QVector>
-#include <QPolygonF>
-
-namespace Marble
-{
-
-class ScreenPolygon : public QPolygonF
-{
- public:
- ScreenPolygon() : m_closed( false ) { }
- explicit ScreenPolygon( bool closed ) : m_closed( closed ) { }
- ~ScreenPolygon() { }
-
- bool closed() const { return m_closed; }
- void setClosed( bool closed ) { m_closed = closed; }
-
- // Type definitions
- typedef QVector<ScreenPolygon> Vector;
-
- protected:
- // true if the polygon is closed
- bool m_closed;
-};
-
-}
-
-#endif
diff --git a/src/lib/marble/VectorComposer.cpp b/src/lib/marble/VectorComposer.cpp
deleted file mode 100644
index 7a8d719..0000000
--- a/src/lib/marble/VectorComposer.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-//
-// This file is part of the Marble Project.
-//
-// 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 2006-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-// Copyright 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
-//
-
-#include "VectorComposer.h"
-
-#include <cmath>
-
-#include <QColor>
-
-#include "MarbleDebug.h"
-#include "GeoPolygon.h"
-#include "GeoPainter.h"
-#include "MarbleGlobal.h"
-#include "VectorMap.h"
-#include "ViewportParams.h"
-#include "MarbleDirs.h"
-
-using namespace Marble;
-
-QAtomicInt VectorComposer::refCounter( 0 );
-PntMap *VectorComposer::s_coastLines( 0 );
-PntMap *VectorComposer::s_islands( 0 );
-PntMap *VectorComposer::s_lakeislands( 0 );
-PntMap *VectorComposer::s_lakes( 0 );
-PntMap *VectorComposer::s_glaciers( 0 );
-PntMap *VectorComposer::s_rivers( 0 );
-PntMap *VectorComposer::s_countries( 0 );
-PntMap *VectorComposer::s_usaStates( 0 );
-PntMap *VectorComposer::s_dateLine( 0 );
-bool VectorComposer::s_coastLinesLoaded( false );
-bool VectorComposer::s_overlaysLoaded( false );
-
-VectorComposer::VectorComposer( QObject * parent )
- : QObject( parent ),
- m_vectorMap( new VectorMap() ),
- m_oceanPen( QPen( Qt::NoPen ) ),
- m_oceanBrush( QBrush( QColor( 153, 179, 204 ) ) ),
- m_landPen( QPen( Qt::NoPen ) ),
- m_landBrush( QBrush( QColor( 242, 239, 233 ) ) ),
- m_textureLandPen( QPen( Qt::NoPen ) ),
- m_textureLandBrush( QBrush( QColor( 255, 0, 0 ) ) ),
- m_textureGlacierBrush( QBrush( QColor( 0, 255, 0 ) ) ),
- m_textureLakeBrush( QBrush( QColor( 0, 0, 0 ) ) ),
- m_dateLineBrush( QBrush( Qt::NoBrush ) )
-{
-#if QT_VERSION < 0x050000
- if ( refCounter == 0 ) {
-#else
- if ( refCounter.load() == 0 ) {
-#endif
- s_coastLinesLoaded = false;
- s_overlaysLoaded = false;
-
- s_coastLines = new PntMap();
- s_islands = new PntMap();
- s_lakeislands = new PntMap();
- s_lakes = new PntMap();
- s_glaciers = new PntMap();
- s_rivers = new PntMap();
- s_countries = new PntMap();
- s_usaStates = new PntMap();
- s_dateLine = new PntMap();
- }
- refCounter.ref();
-
- m_textureBorderPen.setStyle( Qt::SolidLine );
- m_textureBorderPen.setColor( QColor( 0, 255, 0 ) );
- m_dateLinePen.setStyle( Qt::DashLine );
- m_dateLinePen.setColor( QColor( 0, 0, 0 ) );
-
- connect( s_coastLines, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_islands, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_lakeislands, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_lakes, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_glaciers, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_rivers, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_countries, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_usaStates, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
- connect( s_dateLine, SIGNAL(initialized()), SIGNAL(datasetLoaded()) );
-}
-
-VectorComposer::~VectorComposer()
-{
- delete m_vectorMap;
-
- refCounter.deref();
-#if QT_VERSION < 0x050000
- if (refCounter == 0) {
-#else
- if (refCounter.load() == 0) {
-#endif
- delete s_dateLine;
- delete s_usaStates; // The states of the USA
- delete s_countries; // The country borders
- delete s_rivers;
- delete s_glaciers;
- delete s_lakes;
- delete s_lakeislands;
- delete s_islands;
- delete s_coastLines;
-
- s_coastLinesLoaded = false;
- s_overlaysLoaded = false;
- }
-}
-
-void VectorComposer::loadCoastlines()
-{
- if ( s_coastLinesLoaded ) {
- return;
- }
- s_coastLinesLoaded = true;
-
- mDebug() << Q_FUNC_INFO;
-
- // Coastlines
- s_coastLines->load( MarbleDirs::path( "mwdbii/PCOAST.PNT" ) );
- s_islands->load( MarbleDirs::path( "mwdbii/PISLAND.PNT" ) );
- s_lakeislands->load( MarbleDirs::path( "mwdbii/PLAKEISLAND.PNT" ) );
- s_lakes->load( MarbleDirs::path( "mwdbii/PLAKE.PNT" ) );
-
- // Ice and snow ...
- s_glaciers->load( MarbleDirs::path( "mwdbii/PGLACIER.PNT" ) );
-}
-
-void VectorComposer::loadOverlays()
-{
- if ( s_overlaysLoaded ) {
- return;
- }
- s_overlaysLoaded = true;
-
- mDebug() << Q_FUNC_INFO;
-
- // The rivers.
- s_rivers->load( MarbleDirs::path( "mwdbii/RIVER.PNT" ) );
-
- // The countries.
- s_countries->load( MarbleDirs::path( "mwdbii/PDIFFBORDER.PNT" ) );
-
- // The States of the USA.
- s_usaStates->load( MarbleDirs::path( "mwdbii/PUSA48.DIFF.PNT" ) );
-
- // The date "line", which in reality is rather crooked.
- s_dateLine->load( MarbleDirs::path( "mwdbii/DATELINE.PNT" ) );
-}
-
-void VectorComposer::setShowWaterBodies( bool show )
-{
- m_showWaterBodies = show;
-}
-
-void VectorComposer::setShowLakes( bool show )
-{
- m_showLakes = show;
-}
-
-void VectorComposer::setShowIce( bool show )
-{
- m_showIce = show;
-}
-
-void VectorComposer::setShowCoastLines( bool show )
-{
- m_showCoastLines = show;
-}
-
-void VectorComposer::setShowRivers( bool show )
-{
- m_showRivers = show;
-}
-
-void VectorComposer::setShowBorders( bool show )
-{
- m_showBorders = show;
-}
-
-void VectorComposer::drawTextureMap( GeoPainter *painter, const ViewportParams \
*viewport )
-{
- loadCoastlines();
-
- // Coastlines
- m_vectorMap->setzBoundingBoxLimit( 0.4 );
- m_vectorMap->setzPointLimit( 0 ); // 0.6 results in green pacific
-
- // Draw the coast line vectors
- m_vectorMap->createFromPntMap( s_coastLines, viewport );
- painter->setPen( m_textureLandPen );
- painter->setBrush( m_textureLandBrush );
- m_vectorMap->paintMap( painter );
-
- // Islands
- m_vectorMap->setzBoundingBoxLimit( 0.8 );
- m_vectorMap->setzPointLimit( 0.9 );
-
- m_vectorMap->createFromPntMap( s_islands, viewport );
- painter->setPen( m_textureLandPen );
- painter->setBrush( m_textureLandBrush );
- m_vectorMap->paintMap( painter );
-
- if ( m_showWaterBodies && m_showLakes ) {
- // Lakes
- m_vectorMap->setzBoundingBoxLimit( 0.95 );
- m_vectorMap->setzPointLimit( 0.98 );
-
- m_vectorMap->createFromPntMap( s_lakes, viewport );
- painter->setPen( Qt::NoPen );
- painter->setBrush( m_textureLakeBrush );
- m_vectorMap->paintMap( painter );
-
- m_vectorMap->createFromPntMap( s_lakeislands, viewport );
- painter->setPen( Qt::NoPen );
- painter->setBrush( m_textureLandBrush );
- m_vectorMap->paintMap( painter );
- }
-
- if ( m_showIce ) {
- // Glaciers
- m_vectorMap->setzBoundingBoxLimit( 0.8 );
- m_vectorMap->setzPointLimit( 0.9 );
- m_vectorMap->createFromPntMap( s_glaciers, viewport );
- painter->setPen( Qt::NoPen );
- painter->setBrush( m_textureGlacierBrush );
-
- m_vectorMap->paintMap( painter );
- }
-
- // mDebug() << "TextureMap calculated nodes: " << m_vectorMap->nodeCount();
-}
-
-void VectorComposer::paintBaseVectorMap( GeoPainter *painter,
- const ViewportParams *viewport )
-{
- loadCoastlines();
-
- const bool antialiased = painter->mapQuality() == HighQuality
- || painter->mapQuality() == PrintQuality;
-
- painter->setRenderHint( QPainter::Antialiasing, antialiased );
-
- // Paint the background of it all, i.e. the water.
- painter->setPen( m_oceanPen );
- painter->setBrush( m_oceanBrush );
- painter->drawPath( viewport->mapShape() );
-
- // Coastlines
- m_vectorMap->setzBoundingBoxLimit( 0.4 );
- m_vectorMap->setzPointLimit( 0 ); // 0.6 results in green pacific
-
- if ( m_showCoastLines ) {
- painter->setPen( m_landPen );
- painter->setBrush( Qt::NoBrush );
- }
- else
- {
- painter->setPen( Qt::NoPen );
- painter->setBrush( m_landBrush );
- }
-
- m_vectorMap->createFromPntMap( s_coastLines, viewport );
- m_vectorMap->paintMap( painter );
-
- // Islands
- m_vectorMap->setzBoundingBoxLimit( 0.8 );
- m_vectorMap->setzPointLimit( 0.9 );
-
- m_vectorMap->createFromPntMap( s_islands, viewport );
-
- if ( m_showCoastLines ) {
- painter->setPen( m_landPen );
- painter->setBrush( Qt::NoBrush );
- }
- else
- {
- painter->setPen( Qt::NoPen );
- painter->setBrush( m_landBrush );
- }
-
- m_vectorMap->paintMap( painter );
-
- if ( ( m_showWaterBodies && m_showLakes ) || m_showCoastLines ) {
- // Lakes
- m_vectorMap->setzBoundingBoxLimit( 0.95 );
- m_vectorMap->setzPointLimit( 0.98 );
-
- m_vectorMap->createFromPntMap( s_lakes, viewport );
- painter->setPen( m_lakePen );
- painter->setBrush( m_lakeBrush );
- m_vectorMap->paintMap( painter );
-
- m_vectorMap->createFromPntMap( s_lakeislands, viewport );
- painter->setBrush( m_landBrush );
- m_vectorMap->paintMap( painter );
- }
-}
-
-void VectorComposer::paintVectorMap( GeoPainter *painter,
- const ViewportParams *viewport )
-{
- // m_vectorMap->clearNodeCount();
-
- const bool antialiased = painter->mapQuality() == HighQuality
- || painter->mapQuality() == PrintQuality;
-
- painter->setRenderHint( QPainter::Antialiasing, antialiased );
-
- // Coastlines
- if ( m_showCoastLines ) {
-
- loadCoastlines();
-
- m_vectorMap->setzBoundingBoxLimit( 0.4 );
- m_vectorMap->setzPointLimit( 0 ); // 0.6 results in green pacific
-
- m_vectorMap->createFromPntMap( s_coastLines, viewport );
- painter->setPen( m_landPen );
- painter->setBrush( Qt::NoBrush );
- m_vectorMap->paintMap( painter );
-
- m_vectorMap->setzBoundingBoxLimit( 0.8 );
- m_vectorMap->setzPointLimit( 0.9 );
-
- m_vectorMap->createFromPntMap( s_islands, viewport );
- painter->setPen( m_landPen );
- painter->setBrush( Qt::NoBrush );
- m_vectorMap->paintMap( painter );
-
- // Lakes
- m_vectorMap->setzBoundingBoxLimit( 0.95 );
- m_vectorMap->setzPointLimit( 0.98 );
-
- m_vectorMap->createFromPntMap( s_lakes, viewport );
- painter->setPen( m_landPen );
- painter->setBrush( Qt::NoBrush );
- m_vectorMap->paintMap( painter );
-
- m_vectorMap->createFromPntMap( s_lakeislands, viewport );
- m_vectorMap->paintMap( painter );
- }
-
- if ( m_showWaterBodies && m_showRivers ) {
- loadOverlays();
- // Rivers
- m_vectorMap->setzBoundingBoxLimit( -1.0 );
- m_vectorMap->setzPointLimit( -1.0 );
- m_vectorMap->createFromPntMap( s_rivers, viewport );
-
- painter->setPen( m_riverPen );
- painter->setBrush( m_riverBrush );
- m_vectorMap->paintMap( painter );
- }
-
- if ( m_showBorders ) {
- loadOverlays();
- // Countries
- m_vectorMap->setzBoundingBoxLimit( -1.0 );
- m_vectorMap->setzPointLimit( -1.0 );
- m_vectorMap->createFromPntMap( s_countries, viewport );
-
- // Fancy Boundaries Hack:
- // FIXME: Find a clean solution that allows for all the
- // tuning necessary for the different quality levels.
-
- int radius = viewport->radius();
- qreal penWidth = (double)(radius) / 400.0;
- if ( radius < 400.0 ) penWidth = 1.0;
- if ( radius > 800.0 ) penWidth = 1.75;
- if ( m_showCoastLines ) penWidth = 1.0;
-
- QPen countryPen( m_countryPen);
- countryPen.setWidthF( penWidth );
- QColor penColor = m_countryPen.color();
-
- QPen borderDashPen( Qt::black );
- painter->setBrush( m_countryBrush );
-
- if ( painter->mapQuality() == HighQuality
- || painter->mapQuality() == PrintQuality ) {
-
- countryPen.setColor( penColor );
- painter->setPen( countryPen );
- m_vectorMap->paintMap( painter );
-
- // Only paint fancy style if the coast line doesn't get painted as well
- // (as it looks a bit awkward otherwise)
-
- if ( !m_showCoastLines ) {
- borderDashPen.setDashPattern( QVector<qreal>() << 1 << 5 );
- borderDashPen.setWidthF( penWidth * 0.5 );
- painter->setPen( borderDashPen );
- m_vectorMap->paintMap( painter );
- }
- }
- if ( painter->mapQuality() == OutlineQuality
- || painter->mapQuality() == LowQuality
- || painter->mapQuality() == NormalQuality ) {
-
- if ( !m_showCoastLines ) {
- countryPen.setWidthF( 1.0 );
- countryPen.setColor( penColor.darker(115) );
- }
- painter->setPen( countryPen );
- m_vectorMap->paintMap( painter );
- }
-
- // US-States
- m_vectorMap->setzBoundingBoxLimit( -1.0 );
- m_vectorMap->setzPointLimit( -1.0 );
- m_vectorMap->createFromPntMap( s_usaStates, viewport );
-
- QPen statePen( m_statePen);
- if ( painter->mapQuality() == OutlineQuality
- || painter->mapQuality() == LowQuality ) {
- statePen.setStyle( Qt::SolidLine );
- }
- painter->setPen( statePen );
- painter->setBrush( m_stateBrush );
- m_vectorMap->paintMap( painter );
-
- // International Dateline
- m_vectorMap->setzBoundingBoxLimit( -1.0 );
- m_vectorMap->setzPointLimit( -1.0 );
- m_vectorMap->createFromPntMap( s_dateLine, viewport );
-
- QPen dateLinePen( m_dateLinePen);
- if ( painter->mapQuality() == OutlineQuality
- || painter->mapQuality() == LowQuality ) {
- dateLinePen.setStyle( Qt::SolidLine );
- }
- painter->setPen( dateLinePen );
- painter->setBrush( m_dateLineBrush );
- m_vectorMap->paintMap( painter );
- }
-
- // mDebug() << "M_VectorMap calculated nodes: " << m_vectorMap->nodeCount();
-}
-
-#include "VectorComposer.moc"
diff --git a/src/lib/marble/VectorComposer.h b/src/lib/marble/VectorComposer.h
deleted file mode 100644
index 986f1b6..0000000
--- a/src/lib/marble/VectorComposer.h
+++ /dev/null
@@ -1,191 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2005-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-//
-
-
-//
-// The VectorComposer maps the data stored as polylines onto the
-// respective projection.
-//
-// Author: Torsten Rahn
-//
-
-#ifndef MARBLE_VECTORCOMPOSER_H
-#define MARBLE_VECTORCOMPOSER_H
-
-
-#include <QObject>
-#include <QVector>
-#include <QBrush>
-#include <QPen>
-
-class QColor;
-
-namespace Marble
-{
-
-class GeoPainter;
-class PntMap;
-class VectorMap;
-class ViewportParams;
-
-
-class VectorComposer : public QObject
-{
- Q_OBJECT
- public:
- explicit VectorComposer( QObject * parent = 0 );
- virtual ~VectorComposer();
-
- void drawTextureMap( GeoPainter *painter, const ViewportParams *viewport );
- void paintBaseVectorMap( GeoPainter *, const ViewportParams * );
- void paintVectorMap( GeoPainter *, const ViewportParams * );
-
- void setShowWaterBodies( bool show );
- void setShowLakes( bool show );
- void setShowIce( bool show );
- void setShowCoastLines( bool show );
- void setShowRivers( bool show );
- void setShowBorders( bool show );
-
- /**
- * @brief Set color of the oceans
- * @param color ocean color
- */
- void setOceanColor( const QColor& color ){
- m_oceanBrush = QBrush( color );
- m_oceanPen = QPen( Qt::NoPen );
- }
-
- /**
- * @brief Set color of the land
- * @param color land color
- */
- void setLandColor( const QColor& color ){
- m_landBrush = QBrush( color );
- }
-
- /**
- * @brief Set color of the land
- * @param color land color
- */
- void setCoastColor( const QColor& color ){
- m_landPen = QPen( color );
- }
-
- /**
- * @brief Set color of the lakes
- * @param color lake color
- */
- void setLakeColor( const QColor& color ){
- m_lakeBrush = QBrush( color );
- m_lakePen = QPen( Qt::NoPen );
- }
-
- /**
- * @brief Set color of the rivers
- * @param color river color
- */
- void setRiverColor( const QColor& color ){
- m_riverBrush = QBrush( Qt::NoBrush );
- m_riverPen = QPen( color );
- }
-
- /**
- * @brief Set color of the country borders
- * @param color country border color
- */
- void setCountryBorderColor( const QColor& color ){
- m_countryBrush = QBrush( Qt::NoBrush );
- m_countryPen = QPen( color );
- }
-
- /**
- * @brief Set color of the state borders
- * @param color state border color
- */
- void setStateBorderColor( const QColor& color ){
- m_stateBrush = QBrush( Qt::NoBrush );
- m_statePen = QPen( color );
- m_statePen.setStyle( Qt::DotLine );
- }
-
- Q_SIGNALS:
- void datasetLoaded();
-
- private:
- // This method contains all the polygons that define the coast lines.
- static inline void loadCoastlines();
-
- // This method contains all the other polygons
- static inline void loadOverlays();
-
- private:
- Q_DISABLE_COPY( VectorComposer )
- VectorMap *m_vectorMap;
-
- bool m_showWaterBodies;
- bool m_showLakes;
- bool m_showIce;
- bool m_showCoastLines;
- bool m_showRivers;
- bool m_showBorders;
-
- static QAtomicInt refCounter;
-
- static PntMap *s_coastLines;
-
- static PntMap *s_islands;
- static PntMap *s_lakeislands;
- static PntMap *s_lakes;
- static PntMap *s_glaciers;
- static PntMap *s_rivers;
-
- static PntMap *s_countries; // The country borders
- static PntMap *s_usaStates; // The states of the USA
-
- static PntMap *s_dateLine;
-
- QPen m_oceanPen;
- QBrush m_oceanBrush;
-
- QPen m_landPen;
- QBrush m_landBrush;
-
- QPen m_lakePen;
- QBrush m_lakeBrush;
-
- QPen m_countryPen;
- QBrush m_countryBrush;
-
- QPen m_statePen;
- QBrush m_stateBrush;
-
- QPen m_riverPen;
- QBrush m_riverBrush;
-
- QPen m_textureLandPen;
- QBrush m_textureLandBrush;
- QPen m_textureBorderPen;
- QBrush m_textureGlacierBrush;
- QBrush m_textureLakeBrush;
-
- QPen m_dateLinePen;
- QBrush m_dateLineBrush;
-
- QVector<qreal> m_dashes;
-
- static bool s_coastLinesLoaded;
- static bool s_overlaysLoaded;
-};
-
-}
-
-#endif
diff --git a/src/lib/marble/VectorMap.cpp b/src/lib/marble/VectorMap.cpp
deleted file mode 100644
index eb38961..0000000
--- a/src/lib/marble/VectorMap.cpp
+++ /dev/null
@@ -1,761 +0,0 @@
-//
-// This file is part of the Marble Project.
-//
-// 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 2006-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007-2008 Inge Wallin <ingwa@kde.org>
-//
-
-
-#include "VectorMap.h"
-
-#include <cmath>
-#include <cstdlib>
-
-#include <QVector>
-#include <QColor>
-
-#include "MarbleDebug.h"
-#include "MarbleGlobal.h"
-#include "AbstractProjection.h"
-#include "GeoPainter.h"
-#include "GeoPolygon.h"
-#include "ViewportParams.h"
-#include "MathHelper.h"
-
-// #define VECMAP_DEBUG
-
-using namespace Marble;
-
-VectorMap::VectorMap()
- : m_zBoundingBoxLimit( 0.0 ),
- m_zPointLimit( 0.0 )
- // m_debugNodeCount( 0 )
-{
-}
-
-VectorMap::~VectorMap()
-{
-}
-
-
-void VectorMap::createFromPntMap( const PntMap* pntmap,
- const ViewportParams* viewport )
-{
- switch( viewport->projection() ) {
- case Spherical:
- sphericalCreateFromPntMap( pntmap, viewport );
- break;
- case Equirectangular:
- rectangularCreateFromPntMap( pntmap, viewport );
- break;
- case Mercator:
- mercatorCreateFromPntMap( pntmap, viewport );
- break;
- }
-}
-
-void VectorMap::sphericalCreateFromPntMap( const PntMap* pntmap,
- const ViewportParams* viewport )
-{
- m_polygons.clear();
-
- // We must use qreal or int64 for the calculations because we
- // square radius sometimes below, and it may cause an overflow. We
- // choose qreal because of some sqrt() calculations.
- qreal radius = viewport->radius();
- qreal imgradius2 = ( viewport->width() / 2 ) * ( viewport->width() / 2 ) + ( \
viewport->height() / 2 ) * ( viewport->height() / 2 );
-
- // zlimit: describes the lowest z value of the sphere that is
- // visible on the screen. This should happen in the
- // corners.
- qreal zlimit = ( ( imgradius2 < radius * radius )
- ? sqrt( 1 - imgradius2 / ( radius * radius ) )
- : 0.0 );
- // mDebug() << "zlimit: " << zlimit;
-
- m_zBoundingBoxLimit = ( ( m_zBoundingBoxLimit >= 0.0
- && zlimit < m_zBoundingBoxLimit )
- || m_zBoundingBoxLimit < 0.0 )
- ? zlimit : m_zBoundingBoxLimit;
- m_zPointLimit = ( ( m_zPointLimit >= 0.0 && zlimit < m_zPointLimit )
- || m_zPointLimit < 0.0 )
- ? zlimit : m_zPointLimit;
-
- GeoPolygon::PtrVector::ConstIterator itPolyLine = pntmap->constBegin();
- GeoPolygon::PtrVector::ConstIterator itEndPolyLine = pntmap->constEnd();
-
- // const int detail = 0;
- const int detail = getDetailLevel( viewport->radius() );
-
- for (; itPolyLine != itEndPolyLine; ++itPolyLine )
- {
- // This sorts out polygons by bounding box which aren't visible at all.
- GeoDataCoordinates::PtrVector boundary = (*itPolyLine)->getBoundary();
- // rather paint an invalid line then crashing here if the boundaries are not \
loaded yet
- if(boundary.size() < 5) continue;
-
- for ( int i = 0; i < 5; ++i ) {
- Quaternion qbound = boundary[i]->quaternion();
-
- qbound.rotateAroundAxis( viewport->planetAxisMatrix() );
- if ( qbound.v[Q_Z] > m_zBoundingBoxLimit ) {
- // if (qbound.v[Q_Z] > 0){
- // mDebug() << i << " Visible: YES";
- sphericalCreatePolyLine( *itPolyLine, detail, viewport );
-
- break; // abort foreach test of current boundary
- }
- // else
- // mDebug() << i << " Visible: NOT";
- }
- }
-}
-
-void VectorMap::rectangularCreateFromPntMap( const PntMap* pntmap,
- const ViewportParams* viewport )
-{
- m_polygons.clear();
- int radius = viewport->radius();
-
- // Calculate translation of center point
- const qreal centerLon = viewport->centerLongitude();
- const qreal centerLat = viewport->centerLatitude();
-
- const qreal rad2Pixel = (float)( 2 * radius ) / M_PI;
-
- GeoPolygon::PtrVector::ConstIterator itPolyLine = pntmap->constBegin();
- GeoPolygon::PtrVector::ConstIterator itEndPolyLine = pntmap->constEnd();
-
- const QRectF visibleArea ( 0, 0, viewport->width(), viewport->height() );
- const int detail = getDetailLevel( radius );
-
- for (; itPolyLine != itEndPolyLine; ++itPolyLine )
- {
- const GeoDataCoordinates::PtrVector boundary = \
(*itPolyLine)->getBoundary();
-
- // Let's just use the top left and the bottom right bounding
- // box point for this projection.
-
- // rather paint an invalid line then crashing here if the boundaries are not \
loaded yet
- if ( boundary.size() < 3 )
- continue;
-
- ScreenPolygon boundingPolygon;
-
- for ( int i = 1; i < 3; ++i ) {
- qreal lon, lat;
- boundary[i]->geoCoordinates(lon, lat);
- const qreal x = (qreal)(viewport->width()) / 2.0 - rad2Pixel * \
(centerLon - lon);
- const qreal y = (qreal)(viewport->height()) / 2.0 + rad2Pixel * \
(centerLat - lat);
- boundingPolygon << QPointF( x, y );
- }
-
- // This sorts out polygons by bounding box which aren't visible at all.
- int offset = 0;
-
- if ( boundingPolygon.at(0).x() < 0 || boundingPolygon.at(1).x() < 0 ) {
- boundingPolygon.translate( 4 * radius, 0 );
- offset += 4 * radius;
- }
-
- do {
- offset -= 4 * radius;
- boundingPolygon.translate( -4 * radius, 0 );
- // FIXME: Get rid of this really fugly code once we have a
- // proper LatLonBox check implemented and in place.
- } while( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even
- && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
- || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even
- && ( visibleArea.intersects( QRectF( boundingPolygon.at(1),
- QPointF( \
(qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( \
centerLon - M_PI )
- + offset,
- \
boundingPolygon.at(0).y() ) ) )
- || visibleArea.intersects( QRectF( QPointF( \
(qreal)(viewport->width()) / 2.0
- - rad2Pixel * \
( centerLon
- \
+ M_PI )
- + offset,
- \
boundingPolygon.at(1).y() ),
- boundingPolygon.at(0) \
) ) ) ) );
- offset += 4 * radius;
- boundingPolygon.translate( 4 * radius, 0 );
-
- // FIXME: Get rid of this really fugly code once we will have
- // a proper LatLonBox check implemented and in place.
- while ( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even
- && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
- || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even
- && ( visibleArea.intersects(
- QRectF( boundingPolygon.at(1),
- QPointF( (qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( centerLon - M_PI )
- + offset,
- boundingPolygon.at(0).y() ) ) )
- || visibleArea.intersects(
- QRectF( QPointF( (qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( centerLon + M_PI )
- + offset,
- boundingPolygon.at(1).y() ),
- boundingPolygon.at(0) ) ) ) )
- )
- {
- rectangularCreatePolyLine( *itPolyLine, detail, viewport, offset );
-
- offset += 4 * radius;
- boundingPolygon.translate( 4 * radius, 0 );
- }
- }
-}
-
-void VectorMap::mercatorCreateFromPntMap( const PntMap* pntmap,
- const ViewportParams* viewport )
-{
- m_polygons.clear();
- int radius = viewport->radius();
-
- // Calculate translation of center point
- const qreal centerLon = viewport->centerLongitude();
- const qreal centerLat = viewport->centerLatitude();
-
- const qreal rad2Pixel = (float)( 2 * radius ) / M_PI;
-
- GeoPolygon::PtrVector::ConstIterator itPolyLine = pntmap->constBegin();
- GeoPolygon::PtrVector::ConstIterator itEndPolyLine = pntmap->constEnd();
-
- const QRectF visibleArea ( 0, 0, viewport->width(), viewport->height() );
- const int detail = getDetailLevel( radius );
-
- for (; itPolyLine != itEndPolyLine; ++itPolyLine )
- {
- const GeoDataCoordinates::PtrVector boundary = (*itPolyLine)->getBoundary();
-
- // Let's just use the top left and the bottom right bounding box point for
- // this projection
-
- // rather paint an invalid line then crashing here if the boundaries are not \
loaded yet
- if ( boundary.size() < 3 )
- continue;
-
- ScreenPolygon boundingPolygon;
-
- for ( int i = 1; i < 3; ++i ) {
- qreal lon, lat;
- boundary[i]->geoCoordinates(lon, lat);
- const qreal x = (qreal)(viewport->width()) / 2.0 + rad2Pixel * (lon - \
centerLon);
- const qreal y = (qreal)(viewport->height()) / 2.0 - rad2Pixel * ( atanh( \
sin( lat ) )
- - atanh( \
sin( centerLat ) ) );
-
- boundingPolygon << QPointF( x, y );
- }
-
- // This sorts out polygons by bounding box which aren't visible at all.
- int offset = 0;
-
- if ( boundingPolygon.at(0).x() < 0 || boundingPolygon.at(1).x() < 0 ) {
- boundingPolygon.translate( 4 * radius, 0 );
- offset += 4 * radius;
- }
-
- do {
- offset -= 4 * radius;
- boundingPolygon.translate( -4 * radius, 0 );
- // FIXME: Get rid of this really fugly code once we have a
- // proper LatLonBox check implemented and in place.
- } while( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even
- && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
- || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even
- && ( visibleArea.intersects( QRectF( boundingPolygon.at(1),
- QPointF( \
(qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( \
centerLon
- \
- M_PI )
- + offset,
- \
boundingPolygon.at(0).y() ) ) )
- || visibleArea.intersects( QRectF( QPointF( \
(qreal)(viewport->width()) / 2.0
- - rad2Pixel * \
( centerLon
- \
+ M_PI )
- + offset,
- \
boundingPolygon.at(1).y() ),
- boundingPolygon.at(0) \
) ) ) ) );
- offset += 4 * radius;
- boundingPolygon.translate( 4 * radius, 0 );
-
- // FIXME: Get rid of this really fugly code once we will have
- // a proper LatLonBox check implemented and in place.
- while ( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even
- && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
- || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even
- && ( visibleArea.intersects(
- QRectF( boundingPolygon.at(1),
- QPointF( (qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( centerLon - M_PI )
- + offset,
- boundingPolygon.at(0).y() ) ) )
- || visibleArea.intersects(
- QRectF( QPointF( (qreal)(viewport->width()) / 2.0
- - rad2Pixel * ( centerLon + M_PI )
- + offset,
- boundingPolygon.at(1).y() ),
- boundingPolygon.at(0) ) ) ) )
- )
- {
- mercatorCreatePolyLine( *itPolyLine, detail, viewport, offset );
-
- offset += 4 * radius;
- boundingPolygon.translate( 4 * radius, 0 );
- }
- }
-}
-
-void VectorMap::sphericalCreatePolyLine( const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams \
*viewport )
-{
- const int radius = viewport->radius();
-
- const int rLimit = (int)( ( radius * radius )
- * (1.0 - m_zPointLimit * m_zPointLimit ) );
-
- ScreenPolygon polygon;
- polygon.reserve( geoPolygon->size() );
- polygon.setClosed( geoPolygon->getClosed() );
-
- GeoDataCoordinates::Vector::ConstIterator const &itStartPoint = \
geoPolygon->constBegin();
- GeoDataCoordinates::Vector::ConstIterator const &itEndPoint = \
geoPolygon->constEnd();
-
- QPointF lastPoint;
- bool firsthorizon = false;
- bool currentlyvisible = false;
- bool horizonpair = false;
- QPointF firstHorizonPoint;
- QPointF horizona;
-
- GeoDataCoordinates::Vector::const_iterator itPoint = itStartPoint;
- for (; itPoint != itEndPoint; ++itPoint ) {
- if ( itPoint->detail() < detail )
- continue;
-
- // Calculate polygon nodes
-#ifdef VECMAP_DEBUG
- ++m_debugNodeCount;
-#endif
- Quaternion qpos = itPoint->quaternion();
- qpos.rotateAroundAxis( viewport->planetAxisMatrix() );
- const QPointF currentPoint( ( viewport->width() / 2 ) + radius * \
qpos.v[Q_X] + 1.0,
- ( viewport->height() / 2 ) - radius * \
qpos.v[Q_Y] + 1.0 );
-
- // Take care of horizon crossings if horizon is visible
- bool lastvisible = currentlyvisible;
-
- // Less accurate:
- // currentlyvisible = (qpos.v[Q_Z] >= m_zPointLimit) ? true : false;
- currentlyvisible = ( qpos.v[Q_Z] >= 0 );
- if ( itPoint == itStartPoint ) {
- // qDebug("Initializing scheduled new PolyLine");
- lastvisible = currentlyvisible;
- lastPoint = QPointF( currentPoint.x() + 1.0,
- currentPoint.y() + 1.0 );
- }
-
- if ( currentlyvisible != lastvisible ) {
- // qDebug("Crossing horizon line");
- // if (!currentlyvisible) qDebug("Leaving visible hemisphere");
- // else qDebug("Entering visible hemisphere");
-
- if ( !horizonpair ) {
- // qDebug("Point A");
-
- if ( !currentlyvisible ) {
- horizona = horizonPoint(viewport, currentPoint, rLimit);
- horizonpair = true;
- }
- else {
- // qDebug("Orphaned");
- firstHorizonPoint = horizonPoint(viewport, currentPoint, \
rLimit);
- firsthorizon = true;
- }
- }
- else {
- // qDebug("Point B");
- const QPointF horizonb = horizonPoint(viewport, currentPoint, \
rLimit);
-
- createArc(viewport, horizona, horizonb, rLimit, polygon);
- horizonpair = false;
- }
- }
-
- // Take care of screencrossing crossings if horizon is visible.
- // Filter Points which aren't on the visible Hemisphere.
- if ( currentlyvisible && currentPoint != lastPoint ) {
- // most recent addition: currentPoint != lastPoint
- polygon << currentPoint;
- }
-#if 0
- else {
- // Speed burst on invisible hemisphere
- step = 1;
- if ( z < -0.2) step = 10;
- if ( z < -0.4) step = 30;
- if ( step > remain ) step = 1;
- }
-#endif
-
- lastPoint = currentPoint;
- }
-
- // In case of horizon crossings, make sure that we always get a
- // polygon closed correctly.
- if ( firsthorizon ) {
- const QPointF horizonb = firstHorizonPoint;
- if (polygon.closed())
- createArc(viewport, horizona, horizonb, rLimit, polygon);
-
- firsthorizon = false;
- }
-
- // Avoid polygons degenerated to Points.
- if ( polygon.size() >= 2 ) {
- m_polygons.append(polygon);
- }
-}
-
-void VectorMap::rectangularCreatePolyLine(
- const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams *viewport, int offset )
-{
- // Calculate translation of center point
- const qreal centerLon = viewport->centerLongitude();
- const qreal centerLat = viewport->centerLatitude();
-
- // Other convenience variables
- const qreal rad2Pixel = (float)( 2 * viewport->radius() ) / M_PI;
-
- ScreenPolygon polygon;
- polygon.reserve( geoPolygon->size() );
- polygon.setClosed( geoPolygon->getClosed() );
-
- ScreenPolygon otherPolygon;
- otherPolygon.setClosed ( geoPolygon->getClosed() );
-
- GeoDataCoordinates::Vector::ConstIterator const &itStartPoint = \
geoPolygon->constBegin();
- GeoDataCoordinates::Vector::ConstIterator const &itEndPoint = \
geoPolygon->constEnd();
-
- bool CrossedDateline = false;
- bool firstPoint = true;
- int lastSign = 0;
- qreal lastLon = 0.0;
- qreal lastLat = 0.0;
-
- GeoDataCoordinates::Vector::const_iterator itPoint = itStartPoint;
- for (; itPoint != itEndPoint; ++itPoint ) {
- // remain -= step;
- if ( itPoint->detail() < detail )
- continue;
-
- // Calculate polygon nodes
-#ifdef VECMAP_DEBUG
- ++m_debugNodeCount;
-#endif
-
- qreal lon, lat;
- itPoint->geoCoordinates( lon, lat);
- const qreal x = (qreal)(viewport->width()) / 2.0 - rad2Pixel * (centerLon - \
lon) + offset;
- const qreal y = (qreal)(viewport->height()) / 2.0 + rad2Pixel * (centerLat - \
lat);
- int currentSign = ( lon > 0.0 ) ? 1 : -1 ;
- if ( firstPoint ) {
- firstPoint = false;
- lastSign = currentSign;
- }
-
- const QPointF currentPoint = QPointF( x, y );
-
- // Correction of the Dateline
- if ( lastSign != currentSign && fabs(lastLon) + fabs(lon) > M_PI ) {
-
- // X coordinate on the screen for the points on the
- // dateline on both sides of the flat map.
- qreal lastXAtDateLine = (qreal)(viewport->width()) / 2.0
- + rad2Pixel * ( lastSign * M_PI - centerLon ) + offset;
- qreal xAtDateLine = (qreal)(viewport->width()) / 2.0
- + rad2Pixel * ( -lastSign * M_PI - centerLon ) + offset;
- qreal lastYAtDateLine = (qreal)(viewport->height()) / 2.0
- - ( lastLat - centerLat ) * rad2Pixel;
- qreal yAtSouthPole = (qreal)(viewport->height()) / 2.0
- - ( -viewport->currentProjection()->maxLat() - centerLat ) * \
rad2Pixel;
-
- //If the "jump" occurs in the Anctartica's latitudes
-
- if ( lat < - M_PI / 3 ) {
- // FIXME: This should actually need to get investigated
- // in GeoPainter. For now though we just help
- // GeoPainter to get the clipping right.
- if ( lastXAtDateLine > (qreal)(viewport->width()) - 1.0 )
- lastXAtDateLine = (qreal)(viewport->width()) - 1.0;
- if ( lastXAtDateLine < 0.0 )
- lastXAtDateLine = 0.0;
- if ( xAtDateLine > (qreal)(viewport->width()) - 1.0 )
- xAtDateLine = (qreal)(viewport->width()) - 1.0;
- if ( xAtDateLine < 0.0 )
- xAtDateLine = 0.0;
-
- polygon << QPointF( lastXAtDateLine, y );
- polygon << QPointF( lastXAtDateLine, yAtSouthPole );
- polygon << QPointF( xAtDateLine, yAtSouthPole );
- polygon << QPointF( xAtDateLine, y );
- }
- else {
- if ( CrossedDateline ) {
- polygon << QPointF( xAtDateLine, y );
- otherPolygon << QPointF( lastXAtDateLine, lastYAtDateLine);
- }
- else {
- polygon << QPointF( lastXAtDateLine, lastYAtDateLine );
- otherPolygon << QPointF( xAtDateLine, y );
- }
- CrossedDateline = !CrossedDateline;
- }
- }
-
- if ( CrossedDateline )
- otherPolygon << currentPoint;
- else
- polygon << currentPoint;
-
- lastLon = lon;
- lastLat = lat;
- lastSign = currentSign;
- }
-
- // Avoid polygons degenerated to Points.
- if ( polygon.size() >= 2 ) {
- m_polygons.append(polygon);
- }
-
- if ( otherPolygon.size() >= 2 ) {
- m_polygons.append( otherPolygon );
- }
-}
-
-void VectorMap::mercatorCreatePolyLine( const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams \
*viewport, int offset )
-{
- // Calculate translation of center point
- const qreal centerLon = viewport->centerLongitude();
- const qreal centerLat = viewport->centerLatitude();
-
- // Other convenience variables
- const qreal rad2Pixel = (qreal)( 2 * viewport->radius() ) / M_PI;
-
- ScreenPolygon polygon;
- polygon.reserve( geoPolygon->size() );
- polygon.setClosed( geoPolygon->getClosed() );
-
- ScreenPolygon otherPolygon;
- otherPolygon.setClosed ( geoPolygon->getClosed() );
-
- GeoDataCoordinates::Vector::ConstIterator const &itStartPoint = \
geoPolygon->constBegin();
- GeoDataCoordinates::Vector::ConstIterator const &itEndPoint = \
geoPolygon->constEnd();
-
- bool CrossedDateline = false;
- bool firstPoint = true;
- int lastSign = 0;
- qreal lastLon = 0.0;
- qreal lastLat = 0.0;
-
- GeoDataCoordinates::Vector::const_iterator itPoint = itStartPoint;
- for (; itPoint != itEndPoint; ++itPoint ) {
- // remain -= step;
- if ( itPoint->detail() < detail )
- continue;
-
- // Calculate polygon nodes
-#ifdef VECMAP_DEBUG
- ++m_debugNodeCount;
-#endif
-
- // FIXME: Call the projection. Unfortunately there is no
- // screenCoordinates taking qreals.
- qreal lon, lat;
- itPoint->geoCoordinates( lon, lat );
-
- // Removing all points beyond +/- 85 deg for Mercator:
- if ( fabs( lat ) > viewport->currentProjection()->maxLat() )
- continue;
-
- const qreal x = (qreal)(viewport->width()) / 2.0 + rad2Pixel * (lon - \
centerLon) + offset;
- const qreal y = (qreal)(viewport->height()) / 2.0
- - rad2Pixel * ( atanh( sin( lat ) ) - atanh( sin( centerLat ) ) );
- int currentSign = ( lon > 0.0 ) ? 1 : -1 ;
- if ( firstPoint ) {
- firstPoint = false;
- lastSign = currentSign;
- }
-
- const QPointF currentPoint = QPointF( x, y );
-
- //correction of the Dateline
-
- if ( lastSign != currentSign && fabs(lastLon) + fabs(lon) > M_PI ) {
-
- // x coordinate on the screen for the points on the dateline on both
- // sides of the flat map.
- // FIXME: mercator projection here too.
- qreal lastXAtDateLine = (qreal)(viewport->width()) / 2.0
- + rad2Pixel * ( lastSign * M_PI - centerLon ) + offset;
- qreal xAtDateLine = (qreal)(viewport->width()) / 2.0
- + rad2Pixel * ( -lastSign * M_PI - centerLon ) + offset;
- qreal lastYAtDateLine = (qreal)( viewport->height() / 2 - rad2Pixel
- * ( atanh( sin( lastLat ) )
- - atanh( sin( centerLat ) ) ) );
- qreal yAtSouthPole = (qreal)( viewport->height() / 2
- - rad2Pixel * ( atanh( sin( \
-viewport->currentProjection()->
- maxLat() ) )
- - atanh( sin( centerLat ) ) ) \
);
-
- //If the "jump" occurs in the Anctartica's latitudes
-
- if ( lat < - M_PI / 3 ) {
- // FIXME: This should actually need to get investigated
- // in GeoPainter. For now though we just help
- // GeoPainter to get the clipping right.
- if ( lastXAtDateLine > (qreal)(viewport->width()) - 1.0 )
- lastXAtDateLine = (qreal)(viewport->width()) - 1.0;
- if ( lastXAtDateLine < 0.0 )
- lastXAtDateLine = 0.0;
- if ( xAtDateLine > (qreal)(viewport->width()) - 1.0 )
- xAtDateLine = (qreal)(viewport->width()) - 1.0;
- if ( xAtDateLine < 0.0 )
- xAtDateLine = 0.0;
-
- polygon << QPointF( lastXAtDateLine, y );
- polygon << QPointF( lastXAtDateLine, yAtSouthPole );
- polygon << QPointF( xAtDateLine, yAtSouthPole );
- polygon << QPointF( xAtDateLine, y );
- }
- else {
- if ( CrossedDateline ) {
- polygon << QPointF( xAtDateLine, y );
- otherPolygon << QPointF( lastXAtDateLine, lastYAtDateLine);
- }
- else {
- polygon << QPointF( lastXAtDateLine, lastYAtDateLine );
- otherPolygon << QPointF( xAtDateLine, y );
- }
- CrossedDateline = !CrossedDateline;
- }
- }
-
- if ( CrossedDateline )
- otherPolygon << currentPoint;
- else
- polygon << currentPoint;
-
- lastLon = lon;
- lastLat = lat;
- lastSign = currentSign;
- }
-
- // Avoid polygons degenerated to Points.
- if ( polygon.size() >= 2 ) {
- m_polygons.append(polygon);
- }
-
- if ( otherPolygon.size() >= 2 ) {
- m_polygons.append( otherPolygon );
- }
-}
-
-
-// Paint the prepared vectors in screen coordinates.
-
-void VectorMap::paintMap(GeoPainter * painter)
-{
- ScreenPolygon::Vector::const_iterator itEndPolygon = m_polygons.constEnd();
-
- for ( ScreenPolygon::Vector::const_iterator itPolygon = m_polygons.constBegin();
- itPolygon != itEndPolygon;
- ++itPolygon )
- {
- if ( itPolygon->closed() )
- painter->drawPolygon( *itPolygon );
- else
- painter->drawPolyline( *itPolygon );
- }
-}
-
-
-QPointF VectorMap::horizonPoint( const ViewportParams *viewport, const QPointF \
¤tPoint, int rLimit ) const
-{
- // qDebug("Interpolating");
- const qreal xa = currentPoint.x() - ( ( viewport->width() / 2 ) + 1 );
-
- // Move the currentPoint along the y-axis to match the horizon.
- // ya = sqrt( ((qreal)m_radius + 1) * ( (qreal)m_radius + 1) - xa*xa);
- qreal ya = ( rLimit > xa * xa )
- ? sqrt( (qreal)(rLimit) - (qreal)( xa * xa ) ) : 0;
- // mDebug() << " m_rlimit" << m_rlimit << " xa*xa" << xa*xa << " ya: " << ya;
- if ( ( currentPoint.y() - ( ( viewport->height() / 2 ) + 1 ) ) < 0 )
- ya = -ya;
-
- return QPointF( ( viewport->width() / 2 ) + xa + 1, ( viewport->height() / 2 ) \
+ ya + 1 );
-}
-
-
-void VectorMap::createArc( const ViewportParams *viewport, const QPointF &horizona, \
const QPointF &horizonb, int rLimit, ScreenPolygon &polygon )
-{
-
- qreal beta = (qreal)( RAD2DEG
- * atan2( horizonb.y() - ( viewport->height() / 2 ) - \
1,
- horizonb.x() - ( viewport->width() / 2 ) - 1 \
) );
- qreal alpha = (qreal)( RAD2DEG
- * atan2( horizona.y() - ( viewport->height() / 2 ) - \
1,
- horizona.x() - ( viewport->width() / 2 ) - 1 \
) );
-
- qreal diff = beta - alpha;
-
- if ( diff != 0.0 && diff != 180.0 && diff != -180.0 ) {
-
- polygon.append( horizona );
-
- qreal sgndiff = diff / fabs(diff);
-
- if (fabs(diff) > 180.0)
- diff = - sgndiff * (360.0 - fabs(diff));
-
- // Reassigning sgndiff this way seems dull
- sgndiff = diff / fabs(diff);
- // mDebug() << "SGN: " << sgndiff;
-
- // qDebug () << " beta: " << beta << " alpha " << alpha << " diff: " << \
diff;
-
- // mDebug() << "r: " << (m_radius+1) << "rn: " << sqrt((qreal)(m_rlimit));
- qreal arcradius = sqrt( (qreal)( rLimit ) );
-
- for ( int it = 1; it < fabs(diff); ++it ) {
- qreal angle = DEG2RAD * (qreal)( alpha + (sgndiff * it) );
- int itx = (int)( ( viewport->width() / 2 ) + arcradius * cos( angle ) \
+ 1 );
- int ity = (int)( ( viewport->height() / 2 ) + arcradius * sin( angle ) \
+ 1 );
- // mDebug() << " ity: " << ity;
- polygon.append( QPoint( itx, ity ) );
- }
-
- polygon.append( horizonb );
- }
-}
-
-
-int VectorMap::getDetailLevel( int radius ) const
-{
- int detail = 5;
-
- if ( radius > 5000 ) detail = 0;
- else if ( radius > 2500 ) detail = 1;
- else if ( radius > 1000 ) detail = 2;
- else if ( radius > 600 ) detail = 3;
- else if ( radius > 50 ) detail = 4;
-
- bool const smallScreen = MarbleGlobal::getInstance()->profiles() & \
MarbleGlobal::SmallScreen;
- return smallScreen ? qMin( 5, detail + 1 ) : detail;
-}
diff --git a/src/lib/marble/VectorMap.h b/src/lib/marble/VectorMap.h
deleted file mode 100644
index ec66849..0000000
--- a/src/lib/marble/VectorMap.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2006-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007-2008 Inge Wallin <ingwa@kde.org>
-//
-
-#ifndef MARBLE_VECTORMAP_H
-#define MARBLE_VECTORMAP_H
-
-#include <QPointF>
-#include <QPen>
-#include <QBrush>
-
-#include "MarbleGlobal.h"
-#include "Quaternion.h"
-#include "GeoDataCoordinates.h"
-#include "ScreenPolygon.h"
-
-class QPaintDevice;
-
-namespace Marble
-{
-
-class GeoPainter;
-class GeoPolygon;
-class PntMap;
-class ViewportParams;
-
-class VectorMap
-{
- public:
- VectorMap();
- ~VectorMap();
- void createFromPntMap( const PntMap*, const ViewportParams *viewport );
-
- /**
- * @brief Paint the background, i.e. the water.
- */
- void paintMap( GeoPainter *painter );
-
- void setzBoundingBoxLimit ( const qreal zBoundingBoxLimit ) {
- m_zBoundingBoxLimit = zBoundingBoxLimit; }
- void setzPointLimit ( const qreal zPointLimit ) {
- m_zPointLimit = zPointLimit; }
-
- // void clearNodeCount(){ m_debugNodeCount = 0; }
- // int nodeCount(){ return m_debugNodeCount; }
-
- private:
- void sphericalCreateFromPntMap( const PntMap*, const ViewportParams *viewport );
- void rectangularCreateFromPntMap( const PntMap*, const ViewportParams *viewport \
);
- void mercatorCreateFromPntMap( const PntMap*, const ViewportParams *viewport );
-
- void sphericalCreatePolyLine( const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams *viewport \
);
- void rectangularCreatePolyLine( const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams \
*viewport, int offset );
- void mercatorCreatePolyLine( const GeoPolygon *geoPolygon,
- const int detail, const ViewportParams *viewport, \
int offset );
-
- QPointF horizonPoint( const ViewportParams *viewport, const QPointF \
¤tPoint, int rLimit ) const;
- static void createArc( const ViewportParams *viewport, const QPointF &horizona, \
const QPointF &horizonb, int rLimit, ScreenPolygon &polygon );
-
- int getDetailLevel( int radius ) const;
-
- private:
- qreal m_zBoundingBoxLimit;
- qreal m_zPointLimit;
-
- ScreenPolygon::Vector m_polygons;
-
- // int m_debugNodeCount;
-};
-
-}
-
-#endif
diff --git a/src/lib/marble/layers/CMakeLists.txt \
b/src/lib/marble/layers/CMakeLists.txt index 0b4aa34..d233b30 100644
--- a/src/lib/marble/layers/CMakeLists.txt
+++ b/src/lib/marble/layers/CMakeLists.txt
@@ -7,8 +7,6 @@ set( layers_HDRS
PlacemarkLayer.h
PopupLayer.h
TextureLayer.h
- VectorMapBaseLayer.h
- VectorMapLayer.h
VectorTileLayer.h
)
@@ -21,7 +19,5 @@ set( layers_SRCS
layers/PlacemarkLayer.cpp
layers/PopupLayer.cpp
layers/TextureLayer.cpp
- layers/VectorMapBaseLayer.cpp
- layers/VectorMapLayer.cpp
layers/VectorTileLayer.cpp
)
diff --git a/src/lib/marble/layers/VectorMapBaseLayer.cpp \
b/src/lib/marble/layers/VectorMapBaseLayer.cpp deleted file mode 100644
index 1bf1fbd..0000000
--- a/src/lib/marble/layers/VectorMapBaseLayer.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
-//
-
-#include "VectorMapBaseLayer.h"
-
-#include "VectorComposer.h"
-
-namespace Marble
-{
-
-VectorMapBaseLayer::VectorMapBaseLayer( VectorComposer *vectorComposer )
- : m_vectorComposer( vectorComposer )
-{
-}
-
-QStringList VectorMapBaseLayer::renderPosition() const
-{
- return QStringList() << "SURFACE";
-}
-
-bool VectorMapBaseLayer::render( GeoPainter *painter,
- ViewportParams *viewport,
- const QString &renderPos,
- GeoSceneLayer *layer )
-{
- Q_UNUSED( renderPos )
- Q_UNUSED( layer )
-
- m_vectorComposer->paintBaseVectorMap( painter, viewport );
-
- return true;
-}
-
-qreal VectorMapBaseLayer::zValue() const
-{
- return -1.0;
-}
-
-}
diff --git a/src/lib/marble/layers/VectorMapBaseLayer.h \
b/src/lib/marble/layers/VectorMapBaseLayer.h deleted file mode 100644
index 4934cb9..0000000
--- a/src/lib/marble/layers/VectorMapBaseLayer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
-//
-
-#ifndef MARBLE_VECTORMAPBASELAYER_H
-#define MARBLE_VECTORMAPBASELAYER_H
-
-#include "LayerInterface.h"
-
-namespace Marble
-{
-
-class VectorComposer;
-
-class VectorMapBaseLayer : public LayerInterface
-{
-public:
- explicit VectorMapBaseLayer( VectorComposer *vectorComposer );
-
- /**
- * @reimp
- */
- virtual QStringList renderPosition() const;
-
- /**
- * @reimp
- */
- virtual bool render( GeoPainter *painter, ViewportParams *viewport,
- const QString& renderPos = "NONE", GeoSceneLayer * layer = 0 );
-
- /**
- * @reimp
- */
- virtual qreal zValue() const;
-
-private:
- VectorComposer *const m_vectorComposer;
-};
-
-}
-
-#endif
diff --git a/src/lib/marble/layers/VectorMapLayer.cpp \
b/src/lib/marble/layers/VectorMapLayer.cpp deleted file mode 100644
index f05c88a..0000000
--- a/src/lib/marble/layers/VectorMapLayer.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
-//
-
-#include "VectorMapLayer.h"
-
-#include "VectorComposer.h"
-
-namespace Marble
-{
-
-VectorMapLayer::VectorMapLayer( VectorComposer *vectorComposer )
- : m_vectorComposer( vectorComposer )
-{
-}
-
-QStringList VectorMapLayer::renderPosition() const
-{
- return QStringList() << "SURFACE";
-}
-
-bool VectorMapLayer::render( GeoPainter *painter,
- ViewportParams *viewport,
- const QString &renderPos,
- GeoSceneLayer *layer )
-{
- Q_UNUSED( renderPos )
- Q_UNUSED( layer )
-
- m_vectorComposer->paintVectorMap( painter, viewport );
-
- return true;
-}
-
-qreal VectorMapLayer::zValue() const
-{
- return 100.0;
-}
-
-}
diff --git a/src/lib/marble/layers/VectorMapLayer.h \
b/src/lib/marble/layers/VectorMapLayer.h deleted file mode 100644
index 14e168d..0000000
--- a/src/lib/marble/layers/VectorMapLayer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
-//
-
-#ifndef MARBLE_VECTORMAPLAYER_H
-#define MARBLE_VECTORMAPLAYER_H
-
-#include "LayerInterface.h"
-
-namespace Marble
-{
-
-class VectorComposer;
-
-class VectorMapLayer : public LayerInterface
-{
-public:
- explicit VectorMapLayer( VectorComposer *vectorComposer );
-
- /**
- * @reimp
- */
- virtual QStringList renderPosition() const;
-
- /**
- * @reimp
- */
- virtual bool render( GeoPainter *painter, ViewportParams *viewport,
- const QString& renderPos = "NONE", GeoSceneLayer * layer = 0 );
-
- /**
- * @reimp
- */
- virtual qreal zValue() const;
-
-private:
- VectorComposer *const m_vectorComposer;
-};
-
-}
-
-#endif
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index eae4065..a6dad0c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -82,7 +82,6 @@ marble_add_test( MarbleMapTest ) # Check map theme and \
centering marble_add_test( MarbleWidgetTest ) # Check map theme, mouse move, \
repaint and multiple widgets marble_add_test( MapViewWidgetTest ) # Check \
mapview signals marble_add_test( TestGeoPainter ) # no tests!
-marble_add_test( GeoPolygonTest ) # Loads an empty pnt file
marble_add_test( GeoUriParserTest )
marble_add_test( BillboardGraphicsItemTest )
marble_add_test( ScreenGraphicsItemTest )
diff --git a/tests/GeoPolygonTest.cpp b/tests/GeoPolygonTest.cpp
deleted file mode 100644
index df75c33..0000000
--- a/tests/GeoPolygonTest.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// This file is part of the Marble Virtual 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 2006-2007 Torsten Rahn <tackat@kde.org>
-// Copyright 2007 Inge Wallin <ingwa@kde.org>
-// Copyright 2007 Tim Sutton <tim@linfiniti.com>
-//
-
-#include <QtGui> //needed because this is a gui test
-#include <QtTest>
-#include <QtCore>
-#include <QTime>
-
-#include "GeoPolygon.h"
-
-namespace Marble
-{
-
-class GeoPolygonTest: public QObject
-{
- Q_OBJECT
- private slots:
- void pointLoadTest();
- void initTestCase();// will be called before the first testfunction is executed.
- void cleanupTestCase();// will be called after the last testfunction was executed.
- void init(){};// will be called before each testfunction is executed.
- void cleanup(){};// will be called after every testfunction.
- private:
-};
-
-void GeoPolygonTest::initTestCase()
-{
-}
-void GeoPolygonTest::cleanupTestCase()
-{
-}
-void GeoPolygonTest::pointLoadTest()
-{
- PntMap myPntMap;
- myPntMap.load(""); //null filename test - marble should not crash!!!
-}
-
-}
-
-QTEST_MAIN(Marble::GeoPolygonTest)
-#include "GeoPolygonTest.moc"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic