Results 1 to 8 of 8

Thread: QPainter; Setting correct coordinatesystem

  1. #1
    Join Date
    Feb 2011
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPainter; Setting correct coordinatesystem

    Hello!
    I have two questions and I hope someone here can help me out a bit.
    Question nr 1:
    I'm using ShapeLib to import a shape-file into a QGLWidget. At the moment the map is really small and positioned at the top left corner of the widget. The shapes coordinates are in wgs84 and I want my widget to have the same coordinates as the shapefile. Is this possible? (I have spent two days trying to understand QPainters window, viewport, matrix etc but I'm seriously starting to doubt myself because I just don't get it.)

    Question nr 2:
    If the above is possible and I would like to draw things on the map(Basic primitives really). How would I solve this? Some kind of overlay?

    /Robert

  2. #2
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    5

    Default Re: QPainter; Setting correct coordinatesystem

    I expect that you have already read the documentation about coordinate systems, but I also found this video quite helpful.

    http://qt.nokia.com/developer/learni...inate-systems/

    I am interested in how you are using ShapeLib in Qt - do you have a simple example project?

  3. #3
    Join Date
    Feb 2011
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPainter; Setting correct coordinatesystem

    Yes you are so right. I have read everything there is to read about this topic. Obviously not enough though... Very interesting video. I will look into it as soon as everything else is working. (I just posted a new thread about a problem I´m afraid).
    And I will post the code so you can see how I´m using shapelib when it´s working again Thank you for the reply sir it was very helpful

  4. #4
    Join Date
    Sep 2013
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: QPainter; Setting correct coordinatesystem

    Hi,

    I am also trying to render shapefile but fail using Shapelib and qgraphicsview. I can render shapefile using QtOpengl but this is not suitable for my ARM device so want to do that using qgraphicsview. Can you please share me the source code.

    Regards,

    Swapan ghosh

  5. #5
    Join Date
    Nov 2011
    Posts
    79
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter; Setting correct coordinatesystem

    wgs84 is coordinates on sphere, you need to transform all the points to x,y coordinates
    I have my own library to read and draw SHAPE files.
    I use QWidget to draw primitives and it very fast for me. For example, about 500 000 points(points, polylines, polygons) and it takes about 0.5 sec to draw. QgraphicsView was too slow.
    for coordination transformation i use proj.4.

  6. #6
    Join Date
    Sep 2013
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: QPainter; Setting correct coordinatesystem

    Is it possible to share your library ang usage to display shapefile.

    Swapan

  7. #7
    Join Date
    Sep 2013
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPainter; Setting correct coordinatesystem

    Hi folibis,
    till I am failed to display shape file. Can you please help me by supplying source code.

    Swapan

  8. #8
    Join Date
    Sep 2013
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPainter; Setting correct coordinatesystem

    yes I could..........

Similar Threads

  1. QPainter(&QPrinter) & QPainter(&QImage) communication
    By gufeatza in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2010, 07:25
  2. Replies: 5
    Last Post: 7th September 2009, 20:57
  3. QSetting value() not correct
    By bpetty in forum Newbie
    Replies: 1
    Last Post: 14th August 2006, 19:58
  4. QPainter::save and QPAinter::restore()
    By quickNitin in forum Newbie
    Replies: 2
    Last Post: 17th June 2006, 22:11
  5. Replies: 3
    Last Post: 30th April 2006, 19:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.