mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
GCS some improvements to the ripping function of the map library.
This commit is contained in:
parent
25456e3b80
commit
c95eeb92bb
@ -216,8 +216,6 @@ namespace mapcontrol
|
||||
void MapGraphicItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
|
||||
|
||||
qDebug()<<event->modifiers();
|
||||
if(!IsMouseOverMarker())
|
||||
{
|
||||
if(event->button() == config->DragButton && CanDragMap()&& !((event->modifiers()==Qt::ShiftModifier)||(event->modifiers()==Qt::ControlModifier)))
|
||||
@ -431,11 +429,6 @@ namespace mapcontrol
|
||||
}
|
||||
}
|
||||
}
|
||||
// painter->drawRect(core->GetrenderOffset().X()-lastimagepoint.X()-3,core->GetrenderOffset().Y()-lastimagepoint.Y()-3,lastimage.width(),lastimage.height());
|
||||
// painter->setPen(Qt::red);
|
||||
// painter->drawLine(-10,-10,10,10);
|
||||
// painter->drawLine(10,10,-10,-10);
|
||||
// painter->drawRect(boundingRect().adjusted(100,100,-100,-100));
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@ MapRipForm::MapRipForm(QWidget *parent) :
|
||||
ui(new Ui::MapRipForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->cancelButton,SIGNAL(clicked()),this,SIGNAL(cancelRequest()));
|
||||
}
|
||||
|
||||
MapRipForm::~MapRipForm()
|
||||
|
@ -44,6 +44,8 @@ public slots:
|
||||
void SetPercentage(int const& perc);
|
||||
void SetProvider(QString const& prov,int const& zoom);
|
||||
void SetNumberOfTiles(int const& total,int const& actual);
|
||||
signals:
|
||||
void cancelRequest();
|
||||
private:
|
||||
Ui::MapRipForm *ui;
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>392</width>
|
||||
<width>521</width>
|
||||
<height>133</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -18,7 +18,7 @@
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>371</width>
|
||||
<width>481</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -31,7 +31,7 @@
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>10</y>
|
||||
<width>321</width>
|
||||
<width>481</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -55,7 +55,7 @@
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<x>220</x>
|
||||
<y>100</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
|
@ -34,11 +34,13 @@ MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect)
|
||||
{
|
||||
type=core->GetMapType();
|
||||
progressForm=new MapRipForm;
|
||||
connect(progressForm,SIGNAL(cancelRequest()),this,SLOT(stopFetching()));
|
||||
area=rect;
|
||||
zoom=core->Zoom();
|
||||
maxzoom=core->MaxZoom();
|
||||
points=core->Projection()->GetAreaTileList(area,zoom,0);
|
||||
this->start();
|
||||
cancel=false;
|
||||
progressForm->show();
|
||||
connect(this,SIGNAL(percentageChanged(int)),progressForm,SLOT(SetPercentage(int)));
|
||||
connect(this,SIGNAL(numberOfTilesChanged(int,int)),progressForm,SLOT(SetNumberOfTiles(int,int)));
|
||||
@ -51,7 +53,7 @@ MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect)
|
||||
}
|
||||
void MapRipper::finish()
|
||||
{
|
||||
if(zoom<maxzoom)
|
||||
if(zoom<maxzoom && !cancel)
|
||||
{
|
||||
++zoom;
|
||||
int ret;
|
||||
@ -87,7 +89,12 @@ void MapRipper::finish()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yesToAll=false;
|
||||
progressForm->close();
|
||||
delete progressForm;
|
||||
this->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -136,4 +143,10 @@ void MapRipper::finish()
|
||||
QThread::msleep(sleep);
|
||||
}
|
||||
}
|
||||
|
||||
void MapRipper::stopFetching()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
cancel=true;
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ namespace mapcontrol
|
||||
int maxzoom;
|
||||
internals::Core * core;
|
||||
bool yesToAll;
|
||||
QMutex mutex;
|
||||
|
||||
signals:
|
||||
void percentageChanged(int const& perc);
|
||||
@ -59,6 +60,7 @@ namespace mapcontrol
|
||||
|
||||
|
||||
public slots:
|
||||
void stopFetching();
|
||||
void finish();
|
||||
};
|
||||
}
|
||||
|
@ -477,12 +477,14 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
menu.addSeparator();
|
||||
*/
|
||||
|
||||
menu.addAction(showSafeAreaAct);
|
||||
QMenu safeArea("Safety Area definitions");
|
||||
// menu.addAction(showSafeAreaAct);
|
||||
QMenu safeAreaSubMenu(tr("Safe Area Radius") + " (" + QString::number(m_map->Home->SafeArea()) + "m)", this);
|
||||
for (int i = 0; i < safeAreaAct.count(); i++)
|
||||
safeAreaSubMenu.addAction(safeAreaAct.at(i));
|
||||
menu.addMenu(&safeAreaSubMenu);
|
||||
safeArea.addMenu(&safeAreaSubMenu);
|
||||
safeArea.addAction(showSafeAreaAct);
|
||||
menu.addMenu(&safeArea);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user