Results 1 to 5 of 5

Thread: Semi-transparent multi-layered spectrogram plots

  1. #1
    Join Date
    Jul 2008
    Posts
    16
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Semi-transparent multi-layered spectrogram plots

    Hello,

    I have some two-dimensional arrays filled with data and want to display them using QwtSpectrogramPlot.
    It all works fine for one array at a time but now I would like to display several on top of each other, each with its distinct QwtColorMap.
    Imagine, maybe, that one array would be there to display the height of a geographical map and another array giving the flow rate of rivers.
    (Optionally, a third boolean array could be given as a marker whether a spot has a river or not.)

    What could be the best way to achieve this? Especially since I have not really understood how the QwtAlphaColorMap works in combination with a SpectrogramPlot. Can I use a SpectrogramPlot with an AlphaColorMap and a LinearColorMap together or how does it work?

    Thanks for your help.

  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: Semi-transparent multi-layered spectrogram plots

    spectrogram->setAlpha(...).

    HTH,
    Uwe

  3. #3
    Join Date
    Jul 2008
    Posts
    16
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Semi-transparent multi-layered spectrogram plots

    Quote Originally Posted by Uwe View Post
    spectrogram->setAlpha(...).
    Thanks, but doesn’t this set the opacity for the whole plot at once? How can I really exclude areas from being opaque or transparent?

  4. #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: Semi-transparent multi-layered spectrogram plots

    Thanks, but doesn’t this set the opacity for the whole plot at once?
    No, it sets the opacity of a spectrogram ( in your example the elevation ), but it doesn't affect any other plot items ( like your rivers or other spectrograms like population ...). When you lay your elevation item with an alpha value of 100 on top of your river item you can see both.

    You could add a slider/wheel to your plot widget, where the user can control the alpha value of the top raster item. I once wrote a GIS application this way
    How can I really exclude areas from being opaque or transparent?
    If you want to have gaps in your spectrogram use a color map, that returns qRgba(0, 0, 0, 0) for values outside the valid range ( or use a special invalid value like an elevation of 20000 ) and return invalid values in your raster data class.

    Uwe

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

    Debilski (23rd March 2009)

  6. #5
    Join Date
    Jul 2008
    Posts
    16
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Semi-transparent multi-layered spectrogram plots

    Ah, now I understand.
    I didn’t think of subclassing QwtColorMap in the first place, because I thought there would be some built-in method for accomplishing this. So now, I’ll just subclass the LinearColorMap, implement some more strict checking of the boundaries and return a transparent value if necessary. Think this should work for my needs. Thanks

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.