Results 1 to 4 of 4

Thread: Easiest way of Drawing Lines, Points on QwtPolarPlot - help needed.

  1. #1
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Easiest way of Drawing Lines, Points on QwtPolarPlot - help needed.

    Hi,
    Before asking my question, I must admit that I did not put much effort to understand the concept of plotting data at desired location (radiusValue, azimuthValue) on QwtPolarPlot from the examples and source code.
    My requirement is to divide the plot area into 3 equal circular regions as shown in the attached figure circular-regions.png (region1 - with radius R1, region2 with radius R2 and region3 with radius R3. Radius of the plot = R1 + R2 + R3 and R1=R2=R3) and plot points, lines and custom shapes within those regions.

    Please suggest the easiest way of drawing points, lines on QwtPolarPlot.

    Thanks in advance.

    swamy.

  2. #2
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Easiest way of Drawing Lines, Points on QwtPolarPlot - help needed.

    Hi,
    This is in continuation to my query. I think, I have concentrated more on my application requirement rather than asking for concept explanation. I really did not understand the concept of
    virtual QwtPointPolar sample( size_t i ) const
    of Rose/ Spiral Data Class of QwtPolarDemo example. I also have gone through the wiki reference of Polar Coordinate System basics. But I could not co-relate the equations of Rose/ Spiral equations with the ones that are implemented in demo example. I am poor at those equations. How to re-implement 'virtual QwtPointPolar sample( size_t i ) const' to derive my own classes to draw Line, Point or Circle on QwtPolarPlot using
    QwtSeriesData<QwtPointPolar> or QwtPolarItem
    or any relevant Class. Please take some time to explain and make me understand it clearly.
    Thank you in advance.

    swamy.

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

    Default Re: Easiest way of Drawing Lines, Points on QwtPolarPlot - help needed.

    QwtPointPolar is a point in polar coordinates, QwtPolarCurve represents a series of polar points on a polar coordinate system. What type of concept do you want to understand here ?

    The polardemo calculates its points on the fly, but the usual use case is that you have points in a buffer, that you set with QwtPolarCurve::setData(). F.e use a QwtArraySeriesData object. This is exactly the same as with QwtPlotCurve.

    QwtPolarPlot doesn't have as many plot items as QwtPlot - basically there are only curve, marker and spectrogram - but with Qwt 6.1 you have much more possibilities with writing custom symbols for a curve. If this is not enough for your requirements you have to implement your own deriving from QwtPolarItem. Guess a counter part of QwtPlotShapeItem, running the coordinates of a painter path through the polar transformation might be an interesting new class. ( I will add it when finalizing the next version ).

    Uwe

  4. The following user says thank you to Uwe for this useful post:

    swamyonline (9th March 2013)

  5. #4
    Join Date
    Dec 2012
    Posts
    90
    Thanks
    5
    Thanked 20 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Easiest way of Drawing Lines, Points on QwtPolarPlot - help needed.

    If you want to draw points/curves, first you need to subclass QwtSeriesData<QwtPointPolar>, overriding methods boundingRect, size and sample.
    boundingRect should return bounding rectangle of all your points, size the number of them and sample should return specific point.
    Then you use setData method of a QwtPolarCurve with your data class to supply it.
    Then you attach curve to your plot.

    Edit: It's of course better to use QwtArraySeriesData(then you don't need subclassing), as Uwe suggests.

    If you want to draw lines and circles (or markers) you should subclass QwtPolarItem, reimplementing its draw method to draw all you want atop the plot (don't forget to call setZ in constructor for it to have sensible value).
    Last edited by lanz; 7th March 2013 at 06:19.

  6. The following user says thank you to lanz for this useful post:

    swamyonline (9th March 2013)

Similar Threads

  1. Replies: 0
    Last Post: 3rd November 2011, 18:03
  2. drawing an Arc using points
    By chethana in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2009, 03:59
  3. how to make lines or points flicker?
    By lengshuang in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2009, 11:53
  4. How to draw some points and lines?
    By luffy27 in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2006, 16:47

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.