1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@740 ebee16cc-31ac-478f-84a7-5cbb03baadba

This commit is contained in:
pip 2010-06-11 11:30:16 +00:00 committed by pip
parent b6160c8a9b
commit 740d322070
8 changed files with 69 additions and 31 deletions

View File

@ -27,8 +27,10 @@
namespace qmapcontrol
{
GoogleMapAdapter::GoogleMapAdapter()
: TileMapAdapter("mt0.google.com", "/vt/lyrs=&x=%2&s=&y=%3&z=%1", 256, 0, 17)
//: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17)
// : TileMapAdapter("mt0.google.com", "/vt/lyrs=&x=%2&s=&y=%3&z=%1", 256, 0, 17) // cmoss .. max_zoom increased
// found addresses at http://gc-livepedia.de/wiki/Map_servers .. cmoss
: TileMapAdapter("mt0.google.com", "/vt/x=%2&s=&y=%3&z=%1", 256, 0, 22) // cmoss .. max_zoom increased
{
}

View File

@ -23,14 +23,29 @@
*
*/
// http://code.google.com/apis/maps/terms.html ... cmoss
#include "googlesatmapadapter.h"
#include <math.h>
namespace qmapcontrol
{
GoogleSatMapAdapter::GoogleSatMapAdapter()
: TileMapAdapter("khm.google.com", "/kh?v=58&x=%2&s=&y=%3&z=%1", 256, 0, 17)
{
// : TileMapAdapter("khm.google.com", "/kh?v=58&x=%2&s=&y=%3&z=%1", 256, 0, 17)
// : TileMapAdapter("khm.google.com", "/kh?v=58&x=%2&s=&y=%3&z=%1", 256, 0, 22) // cmoss .. max_zoom increased
// found addresses at http://gc-livepedia.de/wiki/Map_servers .. cmoss
// : TileMapAdapter("khm1.google.com", "/kh/v=49&x=%2&s=&y=%3&z=%1", 256, 0, 22) // cmoss .. max_zoom increased .. satellite
: TileMapAdapter("mt1.google.com", "/vt/lyrs=y&x=%2&s=&y=%3&z=%1", 256, 0, 22) // cmoss .. max_zoom increased .. hybrid
// : TileMapAdapter("mt.google.com", "/vt/v=w2p.106&hl=en&x=%2&s=&y=%3&z=%1", 256, 0, 22) // cmoss .. max_zoom increased .. terrain
{
}
GoogleSatMapAdapter::~GoogleSatMapAdapter()

View File

@ -323,7 +323,7 @@ namespace qmapcontrol
QList<const MapAdapter*> doneadapters;
while (it.hasNext())
{
Layer* l = it.next();
Layer *l = it.next();
if (!doneadapters.contains(l->mapadapter()))
{
l->zoomOut();

View File

@ -24,21 +24,21 @@
*/
#include "mapcontrol.h"
namespace qmapcontrol
{
MapControl::MapControl(QSize size, MouseMode mousemode)
: size(size), mymousemode(mousemode), scaleVisible(false)
MapControl::MapControl(QSize size, MouseMode mousemode) :
size(size),
mymousemode(mousemode),
scaleVisible(false)
{
layermanager = new LayerManager(this, size);
screen_middle = QPoint(size.width()/2, size.height()/2);
mousepressed = false;
connect(ImageManager::instance(), SIGNAL(imageReceived()),
this, SLOT(updateRequestNew()));
connect(ImageManager::instance(), SIGNAL(loadingFinished()),
this, SLOT(loadingFinished()));
connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew()));
connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished()));
this->setMaximumSize(size.width()+1, size.height()+1);
}
@ -70,8 +70,7 @@ namespace qmapcontrol
void MapControl::followGeometry(const Geometry* geom) const
{
connect(geom, SIGNAL(positionChanged(Geometry*)),
this, SLOT(positionChanged(Geometry*)));
connect(geom, SIGNAL(positionChanged(Geometry*)), this, SLOT(positionChanged(Geometry*)));
}
void MapControl::positionChanged(Geometry* geom)
@ -106,7 +105,7 @@ namespace qmapcontrol
QPoint dest = layermanager->layer()->mapadapter()->coordinateToDisplay(target);
QPoint step = (dest-start)/steps;
QPointF next = currentCoordinate()- step;
QPointF next = currentCoordinate() - step;
// setView(Coordinate(next.x(), next.y()));
layermanager->scrollView(step);
@ -180,17 +179,34 @@ namespace qmapcontrol
}
}
painter.drawLine(screen_middle.x(), screen_middle.y()-10,
screen_middle.x(), screen_middle.y()+10); // |
painter.drawLine(screen_middle.x()-10, screen_middle.y(),
screen_middle.x()+10, screen_middle.y()); // -
painter.setPen(Qt::black);
painter.drawLine(screen_middle.x(), screen_middle.y()-10, screen_middle.x(), screen_middle.y()+10); // |
painter.drawLine(screen_middle.x()-10, screen_middle.y(), screen_middle.x()+10, screen_middle.y()); // -
// int cross_x = int(layermanager->getMapmiddle_px().x())%256;
// int cross_y = int(layermanager->getMapmiddle_px().y())%256;
// painter.drawLine(screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+0,
// screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+256); // |
// painter.drawLine(screen_middle.x()-cross_x+0, screen_middle.y()-cross_y+cross_y,
// screen_middle.x()-cross_x+256, screen_middle.y()-cross_y+cross_y); // -
// int cross_x = int(layermanager->getMapmiddle_px().x())%256;
// int cross_y = int(layermanager->getMapmiddle_px().y())%256;
// painter.drawLine(screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+0,
// screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+256); // |
// painter.drawLine(screen_middle.x()-cross_x+0, screen_middle.y()-cross_y+cross_y,
// screen_middle.x()-cross_x+256, screen_middle.y()-cross_y+cross_y); // -
// show the current lat/long position (center of the map) .. cathy
QPointF lat_lon = currentCoordinate();
QString ll_str = "lat " + QString::number(lat_lon.y(), 'f', 6) + ", lon " + QString::number(lat_lon.x(), 'f', 6) + ", zoom " + QString::number(currentZoom());
int x = 200;
int y = size.height() - 15;
QFontMetrics fm = QFontMetrics(painter.font());
QRect tr = fm.tightBoundingRect(ll_str);
int tw = tr.width();
int th = tr.height();
painter.setPen(Qt::NoPen);
painter.setBrush(QColor(255, 255, 255, 140));
painter.drawRect(x - 2, y - th - 2, tw + 4, th + 4); // draw a semi-transparent background for the text (to make it readable)
painter.setPen(Qt::black);
painter.drawText(x, y, ll_str);
// painter.drawRect(0,0, size.width(), size.height());
/*
@ -218,7 +234,7 @@ namespace qmapcontrol
layermanager->mouseEvent(evnt);
if (layermanager->layers().size()>0)
if (layermanager->layers().size() > 0)
{
if (evnt->button() == 1)
{
@ -282,8 +298,8 @@ namespace qmapcontrol
QPointF MapControl::clickToWorldCoordinate(QPoint click)
{
// click coordinate to image coordinate
QPoint displayToImage= QPoint(click.x()-screen_middle.x()+layermanager->getMapmiddle_px().x(),
click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y());
QPoint displayToImage = QPoint(click.x()-screen_middle.x()+layermanager->getMapmiddle_px().x(),
click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y());
// image coordinate to world coordinate
return layermanager->layer()->mapadapter()->displayToCoordinate(displayToImage);
}

View File

@ -225,7 +225,9 @@ namespace qmapcontrol
bool mousepressed;
MouseMode mymousemode;
bool scaleVisible;
bool latLonVisible;
bool m_loadingFlag;

View File

@ -27,7 +27,8 @@
namespace qmapcontrol
{
OpenAerialMapAdapter::OpenAerialMapAdapter()
: TileMapAdapter("tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%1/%2/%3.png", 256, 0, 17)
// : TileMapAdapter("tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%1/%2/%3.png", 256, 0, 17)
: TileMapAdapter("tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%1/%2/%3.png", 256, 0, 22) // cmoss .. max_zoom increased
{
}

View File

@ -27,7 +27,8 @@
namespace qmapcontrol
{
OSMMapAdapter::OSMMapAdapter()
: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17)
// : TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17)
: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 22) // cmoss .. max_zoom increased
{
}

View File

@ -27,7 +27,8 @@
namespace qmapcontrol
{
WMSMapAdapter::WMSMapAdapter(QString host, QString serverPath, int tilesize)
: MapAdapter(host, serverPath, tilesize, 0, 17)
// : MapAdapter(host, serverPath, tilesize, 0, 17)
: MapAdapter(host, serverPath, tilesize, 0, 22) // cmoss .. max_zoom increased
{
// param1 = serverPath.indexOf("%1");
// param2 = serverPath.indexOf("%2");