version 2.21.1
Map download API mapviewer download feature
This commit is contained in:
@@ -1,72 +1,12 @@
|
||||
#include "mapitemellipse.h"
|
||||
#include "mapitemgeopolygon.h"
|
||||
#include "mapitemgeopolyline.h"
|
||||
#include "mapitemimage.h"
|
||||
#include "mapitempolygon.h"
|
||||
#include "mapitemtext.h"
|
||||
#include "mapview.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qad_types.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <math.h>
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
enableHighDPI();
|
||||
MapView w;
|
||||
w.resize(800, 600);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
/*QVector<QPointF> g = {QPointF(55.583055, 37.580008), QPointF(55.583055, 37.590008), QPointF(55.593055, 37.580008)};
|
||||
QVector<QPointF> p = {QPointF(0, 0), QPointF(200, 0), QPointF(0, 100)};
|
||||
MapItemPolygon * pol = new MapItemPolygon(QPolygonF(p));
|
||||
MapItemGeoPolyline * gpol = new MapItemGeoPolyline(QPolygonF(g));
|
||||
MapItemEllipse * ell = new MapItemEllipse(QPointF(), 50, 50);
|
||||
MapItemImage * im = new MapItemImage(QPixmap(":/icons/maps.png"));
|
||||
MapItemText * it = new MapItemText(QString::fromUtf8("Это Ваня!"));
|
||||
im->setPosition({55.583055, 37.580008});
|
||||
im->setScale(0.2, 0.5);
|
||||
im->setAlignment(Qt::AlignRight | Qt::AlignTop);
|
||||
im->setCursor(Qt::PointingHandCursor);
|
||||
im->setInteracive(true);
|
||||
it->setPosition({55.583055, 37.580008});
|
||||
it->setBrush(QColor(127, 0, 0, 127));
|
||||
it->setPen(QColor(64, 255, 64));
|
||||
it->setFont(QFont("times", 18));
|
||||
it->setCursor(Qt::OpenHandCursor);
|
||||
it->setInteracive(true);
|
||||
pol->setPosition({55.583055, 37.580008});
|
||||
pol->setUnits(MapItemNonGeoGeometryBase::Pixels);
|
||||
gpol->setBrush(QColor(0, 0, 255, 64));
|
||||
gpol->setPen(QPen(QColor(64, 64, 255), 3));
|
||||
ell->setPosition({55.583055, 37.580008});
|
||||
ell->setStartAngle(-20);
|
||||
ell->setEndAngle(20);
|
||||
ell->setEllipse(QPointF(100, 0), 50, 50);
|
||||
ell->setInteracive(true);
|
||||
QTimer t;
|
||||
QObject::connect(&w, &MapView::itemClicked, [](MapItemBase * item) { qDebug() << "click" << item; });
|
||||
QObject::connect(&w, &MapView::itemEntered, [](MapItemBase * item) { qDebug() << "enter" << item; });
|
||||
QObject::connect(&w, &MapView::itemLeaved, [](MapItemBase * item) { qDebug() << "leave" << item; });
|
||||
|
||||
QObject::connect(&t, &QTimer::timeout, [im, it, pol, ell]() {
|
||||
im->rotate(1);
|
||||
it->rotate(-0.1);
|
||||
// pol->rotate(0.2);
|
||||
ell->rotate(-0.2);
|
||||
static double t = 0.;
|
||||
t += 0.025;
|
||||
ell->setScale((sin(t) / 2. + 1.));
|
||||
});
|
||||
t.start(100);
|
||||
w.addItem(im);
|
||||
w.addItem(gpol);
|
||||
w.addItem(pol);
|
||||
w.addItem(it);
|
||||
w.addItem(ell);*/
|
||||
w.centerTo({55.583055, 37.580008});
|
||||
w.zoomTo(2);
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user