No Description

mainwindow.cpp 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QPainter>
  4. #include <QPen>
  5. #include <QCoreApplication>
  6. //#include <QJsonDocument>
  7. #include <QFile>
  8. #include <QDebug>
  9. //#include <QJsonArray>
  10. //#include <QJsonObject>
  11. #include <QDesktopWidget>
  12. #include <QVector>
  13. #include <QPoint>
  14. #include <string>
  15. #include <QPolygon>
  16. #include <city.h>
  17. #include <country.h>
  18. #include <doublepoint.h>
  19. #include <gispoi.h>
  20. using namespace std;
  21. Country PR;
  22. MainWindow::MainWindow(QWidget *parent) :
  23. QMainWindow(parent),
  24. ui(new Ui::MainWindow)
  25. {
  26. srand(time(NULL));
  27. myMap = new Map(this);
  28. myMap->show();
  29. ui->setupUi(this);
  30. // just hidding the toolbars to have a bigger drawing area.
  31. QList<QToolBar *> toolbars = this->findChildren<QToolBar *>();
  32. foreach(QToolBar *t, toolbars) t->hide();
  33. QList<QStatusBar *> statusbars = this->findChildren<QStatusBar *>();
  34. foreach(QStatusBar *t, statusbars) t->hide();
  35. resize(myMap->width(), myMap->height());
  36. }
  37. void MainWindow::drawPoints(GISPOI* gisLocations, unsigned int size) {
  38. myMap->drawPoints(gisLocations, size);
  39. }
  40. void MainWindow::drawLine(const GISPOI &poi01, const GISPOI &poi02) {
  41. myMap->drawLine(poi01, poi02);
  42. }
  43. MainWindow::~MainWindow() {
  44. delete ui;
  45. if (myMap != NULL) delete myMap;
  46. }