mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +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());
|
||||
{
|
||||
@ -217,10 +217,10 @@ namespace mapcontrol
|
||||
{
|
||||
|
||||
|
||||
|
||||
qDebug()<<event->modifiers();
|
||||
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.SetY(event->pos().y());
|
||||
@ -232,7 +232,7 @@ namespace mapcontrol
|
||||
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;
|
||||
SetSelectedArea (internals::RectLatLng::Empty);
|
||||
|
@ -28,7 +28,7 @@
|
||||
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())
|
||||
{
|
||||
@ -46,32 +46,49 @@ namespace mapcontrol
|
||||
connect(this,SIGNAL(finished()),this,SLOT(finish()));
|
||||
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;
|
||||
msgBox.setText(QString("Continue Ripping at zoom level %1?").arg(zoom));
|
||||
// msgBox.setInformativeText("Do you want to save your changes?");
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = msgBox.exec();
|
||||
if(ret==QMessageBox::Yes)
|
||||
{
|
||||
points.clear();
|
||||
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
||||
this->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
progressForm->close();
|
||||
delete progressForm;
|
||||
this->deleteLater();
|
||||
}
|
||||
}
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString("Continue Ripping at zoom level %1?").arg(zoom));
|
||||
// msgBox.setInformativeText("Do you want to save your changes?");
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::YesAll);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
ret = msgBox.exec();
|
||||
}
|
||||
else
|
||||
ret=QMessageBox::Yes;
|
||||
if(ret==QMessageBox::Yes)
|
||||
{
|
||||
points.clear();
|
||||
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
||||
this->start();
|
||||
}
|
||||
else if(ret==QMessageBox::YesAll)
|
||||
{
|
||||
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()
|
||||
|
@ -50,6 +50,7 @@ namespace mapcontrol
|
||||
MapRipForm * progressForm;
|
||||
int maxzoom;
|
||||
internals::Core * core;
|
||||
bool yesToAll;
|
||||
|
||||
signals:
|
||||
void percentageChanged(int const& perc);
|
||||
|
@ -431,6 +431,10 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
menu.addAction(reloadAct);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(ripAct);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
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"));
|
||||
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->setStatusTip(tr("Copy the mouse latitude and longitude to the clipboard"));
|
||||
connect(copyMouseLatLonToClipAct, SIGNAL(triggered()), this, SLOT(onCopyMouseLatLonToClipAct_triggered()));
|
||||
@ -1685,6 +1693,11 @@ void OPMapGadgetWidget::onReloadAct_triggered()
|
||||
m_map->ReloadMap();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onRipAct_triggered()
|
||||
{
|
||||
m_map->RipMap();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onCopyMouseLatLonToClipAct_triggered()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
|
@ -187,6 +187,7 @@ private slots:
|
||||
* @brief mouse right click context menu signals
|
||||
*/
|
||||
void onReloadAct_triggered();
|
||||
void onRipAct_triggered();
|
||||
void onCopyMouseLatLonToClipAct_triggered();
|
||||
void onCopyMouseLatToClipAct_triggered();
|
||||
void onCopyMouseLonToClipAct_triggered();
|
||||
@ -282,6 +283,7 @@ private:
|
||||
QAction *closeAct1;
|
||||
QAction *closeAct2;
|
||||
QAction *reloadAct;
|
||||
QAction *ripAct;
|
||||
QAction *copyMouseLatLonToClipAct;
|
||||
QAction *copyMouseLatToClipAct;
|
||||
QAction *copyMouseLonToClipAct;
|
||||
|
Loading…
x
Reference in New Issue
Block a user