地图默认值设置:

This commit is contained in:
hm
2022-09-17 15:58:01 +08:00
8 changed files with 56 additions and 20 deletions
+2 -2
View File
@@ -41,11 +41,11 @@ UrlFactory::UrlFactory()
//QNetworkProxy( QNetworkProxy::HttpProxy, host, port );
// QNetworkProxy Proxy;
QNetworkProxy Proxy;
Proxy.setType (QNetworkProxy::HttpProxy);
Proxy.setHostName ("127.0.0.1");
Proxy.setPort (33210);
// QNetworkProxy::setApplicationProxy (Proxy);
QNetworkProxy::setApplicationProxy (Proxy);
/// <summary>
+5 -1
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file pureprojection.cpp
@@ -83,13 +83,17 @@ QList<Point> PureProjection::GetAreaTileList(const RectLatLng &rect, const int &
QList<Point> ret;
Point topLeft = FromPixelToTileXY(FromLatLngToPixel(rect.LocationTopLeft(), zoom));
Point rightBottom = FromPixelToTileXY(FromLatLngToPixel(rect.Bottom(), rect.Right(), zoom));
for (int x = (topLeft.X() - padding); x <= (rightBottom.X() + padding); x++) {
for (int y = (topLeft.Y() - padding); y <= (rightBottom.Y() + padding); y++) {
Point p = Point(x, y);
if (!ret.contains(p) && p.X() >= 0 && p.Y() >= 0) {
ret.append(p);
}
}
}
+41 -12
View File
@@ -53,43 +53,64 @@ MapRipper::MapRipper(internals::Core *core, const internals::RectLatLng & rect,i
}
MapRipper::MapRipper(internals::Core *core, const internals::RectLatLng &area, const QList<int> &grades):
sleep(1), cancel(false), core(core), yesToAll(true), _area(area), zoom(0), _grades(grades)
sleep(0), cancel(false), core(core), yesToAll(true), _area(area), zoom(0), _grades(grades)
{
qDebug() << "缓存级别:";
foreach(int v, _grades)
{
qDebug() << v;
}
if(!_grades.isEmpty() )
{
qDebug() << u8"开始获取1";
type = core->GetMapType();
points = core->Projection()->GetAreaTileList(area, _grades[zoom], 0);
qDebug() << u8"开始获取2";
points = core->Projection()->GetAreaTileList(_area, _grades[zoom], 0);
qDebug() << u8"获取完成";
cancel = false;
connect(this, SIGNAL(finished()), this, SLOT(finish()));
emit numberOfTilesChanged(0, 0);
}
}
MapRipper::~MapRipper()
{
qDebug() << u8"MapRipper: 析构函数";
}
void MapRipper::finish()
{
if (zoom < _grades.size() && !cancel) {
if (zoom < (_grades.size() -1) && !cancel)
{
++zoom;
emit zoomChanged(_grades[zoom]);
int ret = QMessageBox::Yes;
if (!yesToAll) {
if (!yesToAll)
{
QMessageBox msgBox;
msgBox.setText(QString(tr("Continue Ripping at zoom level %1?")).arg(_grades[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 {
}
else
{
ret = QMessageBox::Yes;
}
if (ret == QMessageBox::Yes) {
if (ret == QMessageBox::Yes)
{
points.clear();
points = core->Projection()->GetAreaTileList(_area, _grades[zoom], 0);
//qDebug() << zoom << maxzoom << ret;
this->start();
} else if (ret == QMessageBox::YesAll) {
}
else if (ret == QMessageBox::YesAll)
{
yesToAll = true;
points.clear();
points = core->Projection()->GetAreaTileList(_area, _grades[zoom], 0);
@@ -97,19 +118,24 @@ void MapRipper::finish()
} else {
}
else
{
//progressForm->close();
//delete progressForm;
emit ripfinished();
this->deleteLater();
}
} else {
}
else
{
//yesToAll = false;
//progressForm->close();
//delete progressForm;
emit ripfinished();
this->quit();
this->deleteLater();
}
}
@@ -125,6 +151,8 @@ void MapRipper::run()
// Stuff.Shuffle<Point>(ref list);
QVector<core::MapType::Types> types = OPMaps::Instance()->GetAllLayersOfType(type);
int all = points.count();
emit zoomChanged(_grades[zoom]);
qDebug() << "mapripper: run的次数: " << zoom;
for (int i = 0; i < all; i++)
{
qDebug() << u8"mappripperrunning" ;
@@ -141,8 +169,7 @@ void MapRipper::run()
{
emit providerChanged(core::MapType::StrByType(type), _grades[zoom]);
qDebug() << "type: " << type;
qDebug() << "zoom: " << zoom;
QByteArray img = OPMaps::Instance()->GetImageFrom(type, p, _grades[zoom]);
qDebug() << u8"img" << img;
@@ -178,6 +205,8 @@ void MapRipper::run()
}
}
void MapRipper::stopFetching()
+3 -1
View File
@@ -45,10 +45,12 @@ class MapRipper : public QThread {
public:
MapRipper(internals::Core *, internals::RectLatLng const &,int const & maxz);
MapRipper(internals::Core *core, internals::RectLatLng const &area, QList<int> const &grades);
void run();
~MapRipper();
void run() override;
private:
QList<core::Point> points;
int zoom;
int gradeIndex;
core::MapType::Types type;
int sleep;
internals::RectLatLng _area;
+2
View File
@@ -1623,6 +1623,7 @@ void OPMapWidget::userRipMap(bool start, qreal lat_l, qreal lng_l, qreal lat_r,
void OPMapWidget::RipMap(internals::RectLatLng const &area, QList<int> const &grades)
{
qDebug() << u8"地图开始缓存";
MapRipper *ripper = new MapRipper(core, area, grades);
connect(ripper, SIGNAL(zoomChanged(int) ), this, SIGNAL(mapSaveGradeChanged(int) ) );
connect(ripper, SIGNAL(percentageChanged(int)), this, SIGNAL(mapSaveProgressValue(int)) );
@@ -1631,6 +1632,7 @@ void OPMapWidget::RipMap(internals::RectLatLng const &area, QList<int> const &gr
{
qDebug() << u8"保存进度百分比:" << value;
});
qDebug() << u8"地图开始缓存";
ripper->start();
qDebug() << "opmapwidget: RipMap";