Results 1 to 10 of 10

Thread: QwtPolarSpectrogram: Plotting just the upper half circle

  1. #1
    Join Date
    Dec 2013
    Posts
    11
    Thanks
    8

    Question QwtPolarSpectrogram: Plotting just the upper half circle

    Hi Uwe, and everybody,

    I'm using a QwtPolarSpectrogram as a RADAR or SONAR PPI,it works faily well and is a great tool, thanks for this, btw.!!

    The thing is: I only need the "upper half" of the widged (0-180° of the polar circle). Is i t possiblie to only show the upper half? Any Ideas about this?


    Thank you!

    QTim

  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: QwtPolarSpectrogram: Plotting just the upper half circle

    Qt Code:
    1. class YourData: public QwtRasterData
    2. {
    3. public:
    4. virtual double value( double azimuth, double radius ) const
    5. {
    6. if ( azimuth > M_PI )
    7. return 0.0; // some value indicating invalid
    8.  
    9. ....
    10. }
    11. };
    To copy to clipboard, switch view to plain text mode 
    Then the rest is to use a color map where 0.0 is mapped to 0 ( = an rgb with an alpha of 0 )

    Uwe

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

    QTim (23rd April 2015)

  4. #3
    Join Date
    Dec 2013
    Posts
    11
    Thanks
    8

    Default Re: QwtPolarSpectrogram: Plotting just the upper half circle

    Thanks for your answer, Uwe, and sorry for bothering you again, but i really tried setting the value 0 to a certain color, but it didn't wok at all!
    (see one try below)

    Can you help me a little further?


    Qt Code:
    1. PlotPolarSpectrogramColorMap::PlotPolarSpectrogramColorMap():
    2. QwtLinearColorMap( Qt::darkBlue, Qt::darkRed )
    3. {
    4. addColorStop( 0.2, Qt::blue );
    5. addColorStop( 0.4, Qt::cyan );
    6. addColorStop( 0.6, Qt::yellow );
    7. addColorStop( 0.8, Qt::red );
    8.  
    9. rgb(QwtInterval(-0.01, 0.01), 200); // Just to try!
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 


    Thanks
    QTim

  5. #4
    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: QwtPolarSpectrogram: Plotting just the upper half circle

    An even easier solution would be to return Q_SNAN as NaN values are mapped to an RGB value of 0u. Then you don't need to change your color map.

    Uwe

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

    QTim (24th April 2015)

  7. #5
    Join Date
    Dec 2013
    Posts
    11
    Thanks
    8

    Default Re: QwtPolarSpectrogram: Plotting just the upper half circle

    Quote Originally Posted by Uwe View Post
    NaN values are mapped to an RGB value of 0u. Then you don't need to change your color map.

    But how do I map the NaN values? It doesn't seem to work. :/

    Thanks
    QTim

  8. #6
    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: QwtPolarSpectrogram: Plotting just the upper half circle

    Quote Originally Posted by QTim View Post
    But how do I map the NaN values?
    You don't - it is implemented in QwtLinearColorMap ( when using Qwt 6.1 ).

    Uwe

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

    QTim (24th April 2015)

  10. #7
    Join Date
    Dec 2013
    Posts
    11
    Thanks
    8

    Default Re: QwtPolarSpectrogram: Plotting just the upper half circle

    Hi Uwe,

    okay, the only thing I changed now is the value function:
    Qt Code:
    1. class YourData: public QwtRasterData
    2. {
    3. public:
    4. virtual double value( double azimuth, double radius ) const
    5. {
    6. if ( azimuth > M_PI )
    7. return Q_SNAN;
    8.  
    9. ....
    10. }
    11. };
    To copy to clipboard, switch view to plain text mode 

    but there is no transparency at all. It still looks like a standard polar spectrogram.
    I am on QWT 6.1.

    Thank you!!

    QTim

  11. #8
    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: QwtPolarSpectrogram: Plotting just the upper half circle

    Add the same to the spectrogram example. If it works there compare what is different to your application.

    Uwe

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

    QTim (24th April 2015)

  13. #9
    Join Date
    Dec 2013
    Posts
    11
    Thanks
    8

    Default Re: QwtPolarSpectrogram: Plotting just the upper half circle

    Quote Originally Posted by Uwe View Post
    Add the same to the spectrogram example. If it works there compare what is different to your application.

    Uwe
    Uwe, please have a look at the picture. As you can se, I use the plain spectrogram example, exept the
    Qt Code:
    1. if ( azimuth > M_PI )
    2. return Q_SNAN;
    To copy to clipboard, switch view to plain text mode 
    in the value function.


    It doesn't work.
    Last edited by QTim; 24th April 2015 at 15:01.

  14. #10
    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: QwtPolarSpectrogram: Plotting just the upper half circle

    I can see a picture, where the spectrogram covers the upper half - the lower half is empty ( the background of the canvas ).
    So maybe I misunderstood your question - you want to hide the lower half of the complete plot - not the spectrogram inside the plot ?

    This is not supported by QwtPolarPlot and you would have to solve it by giving the plot a geometry, where the lower half is below the bottom of its parent widget.

    Uwe

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

    QTim (24th April 2015)

Similar Threads

  1. QDataStream << QMultiHash upper bounds?
    By ucntcme in forum Qt Programming
    Replies: 2
    Last Post: 25th June 2009, 22:40
  2. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  3. Button on the Upper Right Corner of MainWindow?
    By vishal.chauhan in forum Qt Programming
    Replies: 10
    Last Post: 12th March 2008, 10:47
  4. upper case input
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2006, 09:44
  5. Upper case in QDateTime !!!!
    By paranoid_android in forum Qt Programming
    Replies: 4
    Last Post: 15th March 2006, 08:38

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.