Aucune description

map.h 2.1KB

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