mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
GCS - Added support for map ripping
This commit is contained in:
parent
a89b880609
commit
25456e3b80
@ -196,7 +196,7 @@ namespace mapcontrol
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(isSelected && !selectionStart.IsEmpty() && (event->modifiers() == Qt::AltModifier || event->modifiers() == Qt::ShiftModifier))
|
else if(isSelected && !selectionStart.IsEmpty() && (event->modifiers() == Qt::ControlModifier || event->modifiers() == Qt::ShiftModifier))
|
||||||
{
|
{
|
||||||
selectionEnd = FromLocalToLatLng(event->pos().x(), event->pos().y());
|
selectionEnd = FromLocalToLatLng(event->pos().x(), event->pos().y());
|
||||||
{
|
{
|
||||||
@ -217,10 +217,10 @@ namespace mapcontrol
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
qDebug()<<event->modifiers();
|
||||||
if(!IsMouseOverMarker())
|
if(!IsMouseOverMarker())
|
||||||
{
|
{
|
||||||
if(event->button() == config->DragButton && CanDragMap()&& !((event->modifiers()==Qt::AltModifier)||(event->modifiers()==Qt::ShiftModifier)))
|
if(event->button() == config->DragButton && CanDragMap()&& !((event->modifiers()==Qt::ShiftModifier)||(event->modifiers()==Qt::ControlModifier)))
|
||||||
{
|
{
|
||||||
core->mouseDown.SetX(event->pos().x());
|
core->mouseDown.SetX(event->pos().x());
|
||||||
core->mouseDown.SetY(event->pos().y());
|
core->mouseDown.SetY(event->pos().y());
|
||||||
@ -232,7 +232,7 @@ namespace mapcontrol
|
|||||||
this->update();
|
this->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!isSelected && ((event->modifiers()==Qt::AltModifier)||(event->modifiers()==Qt::ShiftModifier)))
|
else if(!isSelected && ((event->modifiers()==Qt::ControlModifier)||(event->modifiers()==Qt::ShiftModifier)))
|
||||||
{
|
{
|
||||||
isSelected = true;
|
isSelected = true;
|
||||||
SetSelectedArea (internals::RectLatLng::Empty);
|
SetSelectedArea (internals::RectLatLng::Empty);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
namespace mapcontrol
|
namespace mapcontrol
|
||||||
{
|
{
|
||||||
|
|
||||||
MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect):sleep(100),cancel(false),progressForm(0),core(core)
|
MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect):sleep(100),cancel(false),progressForm(0),core(core),yesToAll(false)
|
||||||
{
|
{
|
||||||
if(!rect.IsEmpty())
|
if(!rect.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -46,32 +46,49 @@ namespace mapcontrol
|
|||||||
connect(this,SIGNAL(finished()),this,SLOT(finish()));
|
connect(this,SIGNAL(finished()),this,SLOT(finish()));
|
||||||
emit numberOfTilesChanged(0,0);
|
emit numberOfTilesChanged(0,0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
QMessageBox::information(new QWidget(),"No valid selection","Please select the area of the map to rip with Mouse+Control key");
|
||||||
}
|
}
|
||||||
void MapRipper::finish()
|
void MapRipper::finish()
|
||||||
|
{
|
||||||
|
if(zoom<maxzoom)
|
||||||
{
|
{
|
||||||
if(zoom<maxzoom)
|
++zoom;
|
||||||
|
int ret;
|
||||||
|
if(!yesToAll)
|
||||||
{
|
{
|
||||||
++zoom;
|
QMessageBox msgBox;
|
||||||
QMessageBox msgBox;
|
msgBox.setText(QString("Continue Ripping at zoom level %1?").arg(zoom));
|
||||||
msgBox.setText(QString("Continue Ripping at zoom level %1?").arg(zoom));
|
// msgBox.setInformativeText("Do you want to save your changes?");
|
||||||
// msgBox.setInformativeText("Do you want to save your changes?");
|
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::YesAll);
|
||||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
ret = msgBox.exec();
|
||||||
int ret = msgBox.exec();
|
}
|
||||||
if(ret==QMessageBox::Yes)
|
else
|
||||||
{
|
ret=QMessageBox::Yes;
|
||||||
points.clear();
|
if(ret==QMessageBox::Yes)
|
||||||
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
{
|
||||||
this->start();
|
points.clear();
|
||||||
}
|
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
||||||
else
|
this->start();
|
||||||
{
|
}
|
||||||
progressForm->close();
|
else if(ret==QMessageBox::YesAll)
|
||||||
delete progressForm;
|
{
|
||||||
this->deleteLater();
|
yesToAll=true;
|
||||||
}
|
points.clear();
|
||||||
}
|
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
||||||
|
this->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
progressForm->close();
|
||||||
|
delete progressForm;
|
||||||
|
this->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
yesToAll=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MapRipper::run()
|
void MapRipper::run()
|
||||||
|
@ -50,6 +50,7 @@ namespace mapcontrol
|
|||||||
MapRipForm * progressForm;
|
MapRipForm * progressForm;
|
||||||
int maxzoom;
|
int maxzoom;
|
||||||
internals::Core * core;
|
internals::Core * core;
|
||||||
|
bool yesToAll;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void percentageChanged(int const& perc);
|
void percentageChanged(int const& perc);
|
||||||
|
@ -431,6 +431,10 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
menu.addAction(reloadAct);
|
menu.addAction(reloadAct);
|
||||||
|
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
|
menu.addAction(ripAct);
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
QMenu maxUpdateRateSubMenu(tr("&Max Update Rate ") + "(" + QString::number(m_maxUpdateRate) + " ms)", this);
|
QMenu maxUpdateRateSubMenu(tr("&Max Update Rate ") + "(" + QString::number(m_maxUpdateRate) + " ms)", this);
|
||||||
@ -1413,6 +1417,10 @@ void OPMapGadgetWidget::createActions()
|
|||||||
reloadAct->setStatusTip(tr("Reload the map tiles"));
|
reloadAct->setStatusTip(tr("Reload the map tiles"));
|
||||||
connect(reloadAct, SIGNAL(triggered()), this, SLOT(onReloadAct_triggered()));
|
connect(reloadAct, SIGNAL(triggered()), this, SLOT(onReloadAct_triggered()));
|
||||||
|
|
||||||
|
ripAct = new QAction(tr("&Rip map"), this);
|
||||||
|
ripAct->setStatusTip(tr("Rip the map tiles"));
|
||||||
|
connect(ripAct, SIGNAL(triggered()), this, SLOT(onRipAct_triggered()));
|
||||||
|
|
||||||
copyMouseLatLonToClipAct = new QAction(tr("Mouse latitude and longitude"), this);
|
copyMouseLatLonToClipAct = new QAction(tr("Mouse latitude and longitude"), this);
|
||||||
copyMouseLatLonToClipAct->setStatusTip(tr("Copy the mouse latitude and longitude to the clipboard"));
|
copyMouseLatLonToClipAct->setStatusTip(tr("Copy the mouse latitude and longitude to the clipboard"));
|
||||||
connect(copyMouseLatLonToClipAct, SIGNAL(triggered()), this, SLOT(onCopyMouseLatLonToClipAct_triggered()));
|
connect(copyMouseLatLonToClipAct, SIGNAL(triggered()), this, SLOT(onCopyMouseLatLonToClipAct_triggered()));
|
||||||
@ -1685,6 +1693,11 @@ void OPMapGadgetWidget::onReloadAct_triggered()
|
|||||||
m_map->ReloadMap();
|
m_map->ReloadMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::onRipAct_triggered()
|
||||||
|
{
|
||||||
|
m_map->RipMap();
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::onCopyMouseLatLonToClipAct_triggered()
|
void OPMapGadgetWidget::onCopyMouseLatLonToClipAct_triggered()
|
||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
@ -187,6 +187,7 @@ private slots:
|
|||||||
* @brief mouse right click context menu signals
|
* @brief mouse right click context menu signals
|
||||||
*/
|
*/
|
||||||
void onReloadAct_triggered();
|
void onReloadAct_triggered();
|
||||||
|
void onRipAct_triggered();
|
||||||
void onCopyMouseLatLonToClipAct_triggered();
|
void onCopyMouseLatLonToClipAct_triggered();
|
||||||
void onCopyMouseLatToClipAct_triggered();
|
void onCopyMouseLatToClipAct_triggered();
|
||||||
void onCopyMouseLonToClipAct_triggered();
|
void onCopyMouseLonToClipAct_triggered();
|
||||||
@ -282,6 +283,7 @@ private:
|
|||||||
QAction *closeAct1;
|
QAction *closeAct1;
|
||||||
QAction *closeAct2;
|
QAction *closeAct2;
|
||||||
QAction *reloadAct;
|
QAction *reloadAct;
|
||||||
|
QAction *ripAct;
|
||||||
QAction *copyMouseLatLonToClipAct;
|
QAction *copyMouseLatLonToClipAct;
|
||||||
QAction *copyMouseLatToClipAct;
|
QAction *copyMouseLatToClipAct;
|
||||||
QAction *copyMouseLonToClipAct;
|
QAction *copyMouseLonToClipAct;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user