No Description

map.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef MAP_H
  2. #define MAP_H
  3. #include <QWidget>
  4. #include <QMap>
  5. #include <QRgb>
  6. #include <country.h>
  7. #include <gispoi.h>
  8. #include <QVector>
  9. #include <QPair>
  10. /// This is the actual widget in charge of drawing the map
  11. /// Este es el "widget" encargado de dibujar el mapa
  12. class Map : public QWidget
  13. {
  14. Q_OBJECT
  15. public:
  16. /// \fn Map(QWidget *parent = 0);
  17. /// \~English
  18. /// \brief default constructor
  19. /// \~Spanish
  20. /// \brief constructor por defecto
  21. ///
  22. explicit Map(QWidget *parent = 0);
  23. /// \fn drawPoints(GISPOI *v, unsigned int size);
  24. /// \~English
  25. /// \brief sets the array of GIS locations and sets its size
  26. /// \~Spanish
  27. /// \brief establece el arreglo de localizaciones de GIS y su tamaño
  28. ///
  29. void drawPoints(GISPOI *v, unsigned int size)
  30. { gisLocations = v; numLocations = size; }
  31. /// \fn drawLine(const GISPOI &city01, const GISPOI &city02)
  32. /// \~English
  33. /// \brief adds a line from poi01 to poi02
  34. /// \~Spanish
  35. /// \brief añade una linea entre los centroides de city01 a city02
  36. ///
  37. void drawLine(const GISPOI &poi01, const GISPOI &poi02) {
  38. this->cityLines.push_back(
  39. QPair<const GISPOI *, const GISPOI *> (&poi01, &poi02));
  40. }
  41. /// \fn ~Map)()
  42. /// \~English
  43. /// \brief destructor
  44. /// \~Spanish
  45. /// \brief destructor
  46. ///
  47. ~Map();
  48. signals:
  49. private:
  50. Country *myCountry;
  51. QMap<QString,QRgb> *cityColorMap;
  52. GISPOI *gisLocations;
  53. unsigned int numLocations;
  54. bool drawRoutes;
  55. QVector < QPair<const GISPOI *,const GISPOI *> > cityLines;
  56. protected:
  57. /// \fn paintEvent(QPaintEvent *event);
  58. /// \~English
  59. /// \brief function that is called every time the map widget
  60. /// generates a paint event. It draws the polygons and lines
  61. /// of the map.
  62. /// \~Spanish
  63. /// \brief función que se invoca cada vez que el widget genera un
  64. /// evento de pintar. Dibuja los polígonos y las lineas en el
  65. /// mapa.
  66. ///
  67. void paintEvent(QPaintEvent *event);
  68. public slots:
  69. };
  70. #endif // MAP_H