Results 1 to 4 of 4

Thread: How to plot filled polygons in QwtPlot

  1. #1
    Join Date
    Dec 2008
    Location
    California, USA
    Posts
    18
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to plot filled polygons in QwtPlot

    Hi,
    I'm looking for an example that will help me plot filled polygons from a Voronoi diagram in a QwtPlot chart widget.
    http://en.wikipedia.org/wiki/Voronoi_diagram

    I can currently generate the Voronoi diagrams, extract closed polygons for each Voronoi cell, and post the polylines in QwtPlot. I can also add RGB color attributes to these cells; however, I'd like to take this one step further by plotting each filled polygon in a QwtPolt widget by the colors I've generated.

    Any help is appreciated.

  2. The following user says thank you to EliGri for this useful post:


  3. #2
    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: How to plot filled polygons in QwtPlot

    Use Qwt 6.1 where you find QwtPlotShapeItem - or implement a new type of plot item for the complete diagram ( thought about having a Voronoi diagram plot item in Qwt myself ).

    By the way: what algorithm do you use for distributing colors to the cells ?

    Uwe

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


  5. #3
    Join Date
    Dec 2008
    Location
    California, USA
    Posts
    18
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to plot filled polygons in QwtPlot

    Thanks Uwe. I'm still on 6.0.2.

    I'm using the Voronoi algo in the Boost Polygon library, but not colorizing randomly. In our case, colors need to be assigned to each cell based on various site [control point] attributes, so just comparing site attribute values to a predefined RGB colormap, and using linear interpolation to get color for each site.

    Thanks again for the tip. Let me upgrade to 6.1 and play with it.

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


  7. #4
    Join Date
    Dec 2008
    Location
    California, USA
    Posts
    18
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to plot filled polygons in QwtPlot

    Uwe, I got the QwtPlotShapeItem class to work in our Voronoi tool.
    The itemEditor example application you provided in the 6.1rc3 release was very helpful.

    BTW - I just discovered your ColorMap classes, and they appear to have everything I need. I can't believe I never noticed them ...

    Thank you.

Similar Threads

  1. Vertical plot with qwtplot
    By alizadeh91 in forum Qwt
    Replies: 1
    Last Post: 1st February 2012, 07:24
  2. Replies: 13
    Last Post: 20th September 2011, 09:50
  3. Replies: 12
    Last Post: 31st October 2010, 17:08
  4. Performance with many filled polygons on screen
    By lni in forum Qt Programming
    Replies: 10
    Last Post: 14th September 2009, 10:53
  5. Replies: 4
    Last Post: 14th May 2009, 10:31

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.