Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best way to draw gps point with qt

Best way to draw gps point with qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 455 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bestrider14
    wrote on last edited by
    #1

    I dont really know how to ask this question but I will do my best to explain. I have a project on arduino with a gps, I transfere the geo point via serialdata on my pc. I can read it without probleme, but where I need help is how I can draw a path of that point. for the moment I use this:

    void MainWindow::paintEvent(QPaintEvent* p)
    {
        QPainter painter(this); //class must be implemented from QWidget
        painter.setPen(pen);
        painter.setRenderHint(QPainter::Antialiasing);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
        painter.translate(width() / 2-466133, height() / 2+727150);
        painter.scale(10000.0,10000.0);
    
        painter.drawPolyline(polyPoints);
    }
    
    void MainWindow::readData(QStringList data)
    {
        ui->textEdit->setText(data.join(","));
        polyPoints  << QPointF(data[0].toDouble(),data[1].toDouble());
        QWidget::update();
    }
    

    my point is something like that:

    46.612823, -72.702957
    46.612876, -72.702873
    46.612937, -72.702789

    like you see the difference between 2 point are very very small so I need to scalle this way up and a need to work with rediculous number for translate my origin. for the moment the translate is fixe but in the futur it will be dynamic.

    there an image to show more what I need at the end

    630593f0-0ca8-4b45-a97f-2379139fb4ae-image.png

    I hope that you understand my problem.

    thank you

    Pl45m4P 1 Reply Last reply
    0
    • B Bestrider14

      I dont really know how to ask this question but I will do my best to explain. I have a project on arduino with a gps, I transfere the geo point via serialdata on my pc. I can read it without probleme, but where I need help is how I can draw a path of that point. for the moment I use this:

      void MainWindow::paintEvent(QPaintEvent* p)
      {
          QPainter painter(this); //class must be implemented from QWidget
          painter.setPen(pen);
          painter.setRenderHint(QPainter::Antialiasing);
          painter.setRenderHint(QPainter::HighQualityAntialiasing);
          painter.translate(width() / 2-466133, height() / 2+727150);
          painter.scale(10000.0,10000.0);
      
          painter.drawPolyline(polyPoints);
      }
      
      void MainWindow::readData(QStringList data)
      {
          ui->textEdit->setText(data.join(","));
          polyPoints  << QPointF(data[0].toDouble(),data[1].toDouble());
          QWidget::update();
      }
      

      my point is something like that:

      46.612823, -72.702957
      46.612876, -72.702873
      46.612937, -72.702789

      like you see the difference between 2 point are very very small so I need to scalle this way up and a need to work with rediculous number for translate my origin. for the moment the translate is fixe but in the futur it will be dynamic.

      there an image to show more what I need at the end

      630593f0-0ca8-4b45-a97f-2379139fb4ae-image.png

      I hope that you understand my problem.

      thank you

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @Bestrider14

      Take all your data points you have in one set and normalize them to a range that matches your scale.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      B 1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Or take a proper widget which handles this all for you like ESRI ArcGIS runtime for Qt

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • Pl45m4P Pl45m4

          @Bestrider14

          Take all your data points you have in one set and normalize them to a range that matches your scale.

          B Offline
          B Offline
          Bestrider14
          wrote on last edited by Bestrider14
          #4

          @Christian-Ehrlicher Ho thanks I will try this widget. It look like is what I need at firt sight.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved