1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-37 GCS/MapPlugin cleaning and bug hunting

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@704 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2010-06-02 20:22:31 +00:00 committed by zedamota
parent 59250845ea
commit f31cd81a8d
6 changed files with 597 additions and 577 deletions

View File

@ -27,7 +27,9 @@
*/
#include "core.h"
#ifdef DEBUG_CORE
qlonglong internals::Core::debugcounter=0;
#endif
using namespace projections;
@ -38,18 +40,18 @@ Core::Core():currentPosition(0,0),currentPositionPixel(0,0),LastLocationInBounds
mousewheelzoomtype=MouseWheelZoomType::MousePositionAndCenter;
SetProjection(new MercatorProjection());
this->setAutoDelete(false);
ProcessLoadTaskCallback.setMaxThreadCount(10);
renderOffset=Point(0,0);
dragPoint=Point(0,0);
CanDragMap=true;
}
void Core::run()
{
#ifdef DEBUG_CORE
qlonglong debug;
Mdebug.lock();
debug=++debugcounter;
Mdebug.unlock();
#ifdef DEBUG_CORE
qDebug()<<"core:run"<<" ID="<<debug;
#endif //DEBUG_CORE
bool last = false;
@ -106,10 +108,12 @@ void Core::run()
}
else // ok
{
#ifdef DEBUG_CORE
qDebug()<<"start getting image"<<" ID="<<debug;
#endif //DEBUG_CORE
img = OPMaps::Instance()->GetImageFrom(tl, task.Pos, task.Zoom);
#ifdef DEBUG_CORE
qDebug()<<"Core::run:gotimage size:"<<img.count()<<" ID="<<debug;
qDebug()<<"Core::run:gotimage size:"<<img.count()<<" ID="<<debug<<" time="<<t.elapsed();
#endif //DEBUG_CORE
}
@ -189,7 +193,9 @@ void Core::run()
}
#ifdef DEBUG_CORE
qDebug()<<"loaderLimit release:"+loaderLimit.available()<<" ID="<<debug;
#endif
loaderLimit.release();
}
}

View File

@ -28,9 +28,7 @@
#ifndef CORE_H
#define CORE_H
#define DEBUG_CORE
//#define DEBUG_TILE
//#define DEBUG_TILEMATRIX
#include "debugheader.h"
#include "../internals/PointLatlng.h"
#include "mousewheelzoomtype.h"
@ -56,11 +54,16 @@
//#include <QObject>
namespace mapcontrol
{
class OPMapControl;
}
namespace internals {
class Core:public QObject,public QRunnable
{
Q_OBJECT
friend class mapcontrol::OPMapControl;
public:
Core();
void run();
@ -179,12 +182,7 @@ public:
TileMatrix Matrix;
Rectangle tileRect;
Point mouseDown;
bool CanDragMap;
Point mouseCurrent;
PointLatLng LastLocationInBounds;
Point mouseLastZoom;
signals:
void OnCurrentPositionChanged(PointLatLng point);
void OnTileLoadComplete();
@ -197,14 +195,19 @@ signals:
private:
static qlonglong debugcounter;
PointLatLng currentPosition;
Point currentPositionPixel;
Point renderOffset;
Point centerTileXYLocation;
Point centerTileXYLocationLast;
Point dragPoint;
Rectangle tileRect;
Point mouseDown;
bool CanDragMap;
Point mouseCurrent;
PointLatLng LastLocationInBounds;
Point mouseLastZoom;
MouseWheelZoomType::Types mousewheelzoomtype;
@ -233,9 +236,10 @@ private:
QMutex Moverlays;
QMutex MtileDrawingList;
#ifdef DEBUG_CORE
QMutex Mdebug;
static qlonglong debugcounter;
#endif
Size TooltipTextPadding;
MapType::Types mapType;

View File

@ -0,0 +1,8 @@
#ifndef DEBUGHEADER_H
#define DEBUGHEADER_H
//#define DEBUG_CORE
//#define DEBUG_TILE
//#define DEBUG_TILEMATRIX
#endif // DEBUGHEADER_H

View File

@ -9,7 +9,8 @@ HEADERS += core.h \
pureprojection.h \
pointlatlng.h \
rectlatlng.h \
sizelatlng.h
sizelatlng.h \
debugheader.h
SOURCES += core.cpp \
rectangle.cpp \
tile.cpp \
@ -19,7 +20,7 @@ SOURCES += core.cpp \
sizelatlng.cpp \
pointlatlng.cpp \
loadtask.cpp \
MouseWheelZoomType.cpp
mousewheelzoomtype.cpp
HEADERS += ./projections/lks94projection.h \
./projections/mercatorprojection.h \
./projections/mercatorprojectionyandex.h \

View File

@ -33,6 +33,7 @@
#include "../core/point.h"
#include <QMutex>
#include <QDebug>
#include "debugheader.h"
using namespace core;
namespace internals
{

View File

@ -32,7 +32,7 @@
#include "tile.h"
#include <QList>
#include "../core/point.h"
#include "debugheader.h"
namespace internals {
class TileMatrix
{