Results 1 to 2 of 2

Thread: Draw line in PolarPlot

  1. #1
    Join Date
    Oct 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Draw line in PolarPlot

    Hi! Ive been trying to implement some code to draw a line from the origin to a given point in a polar plot but I couldnt do it, is there someone who can help me or give me some tips?

    Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Draw line in PolarPlot

    IMO QwtPolarMarker should be extended to offer to draw a line to the origin - but for the moment you have to use QwtPolarCurve ( with 2 points ) for this.
    Alternatively you could overload QwtPolarMarker::draw like this:

    Qt Code:
    1. void YourPolarMarker::draw( QPainter *painter,
    2. const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
    3. const QPointF &pole, double radius,
    4. const QRectF &canvasRect ) const
    5. {
    6. const double r = radialMap.transform( position().radius() );
    7. const double a = azimuthMap.transform( position().azimuth() );
    8.  
    9. const QPointF pos = qwtPolar2Pos( pole, r, a );
    10.  
    11. painter->setPen( ... );
    12. painter->drawLine( pole, pos );
    13.  
    14. QwtPolarMarker::draw( painter, ... );
    15. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

Similar Threads

  1. To draw a line
    By vinayaka in forum Qt Quick
    Replies: 1
    Last Post: 6th June 2011, 10:53
  2. Draw Line
    By sagirahmed in forum Newbie
    Replies: 5
    Last Post: 18th October 2010, 07:49
  3. Draw a line
    By Daan in forum KDE Forum
    Replies: 1
    Last Post: 27th August 2009, 17:29
  4. Draw Line
    By aloysiusjegan in forum Qwt
    Replies: 4
    Last Post: 12th February 2009, 11:02
  5. Best way to draw a Line
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2008, 09:57

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.