Results 1 to 3 of 3

Thread: Make a new QwtPlotCurve on a QwtPlot?

  1. #1
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Make a new QwtPlotCurve on a QwtPlot?

    I am interested in creating a new QwtPlotCurve on an existing set of overlaid QwtPlots. Something where the user can draw a line (or maybe a set of points and have it connect the dots?) on top of my plot. Looking at the Qwt docs/examples/playground, it seems like the closest thing is the spline editor to what I want as an interface, with the exception of the line drawing interface.

    Ideally, after the user has drawn a line, they would be able to change the points of the line like the spline editor where they are moving points up and down.

    What I am trying to do is allow a user to follow a certain feature in a plot and trace out where the peaks and valleys are.

    Anyway, I know I need to override the event filter and capture the mouse movements, but are there other things in Qwt that could help with this? Is it reasonable to have 1000 symbols across my plot that they can manipulate? Maybe someone has done something similar and can share experience or code?

    Thanks for any advice!
    Joey

  2. #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: Make a new QwtPlotCurve on a QwtPlot?

    You should also have a look the itemeditor example - it is about shape items, but the general idea of how to implement such an editor ( using a QwtWidgetOverly ) is similar. You could also have a look at QwtPlotPicker ( also using a widget overlay for the rubberband ), where you can create polygons interactively. In opposite the implementation of the spline editor does replots while moving a point - what of course is much easier to implement , but might be too slow for plots with more content.

    I have implemented several graphical editors using the widget overlay approach myself - unfortunately those are too specific to make an example that would help more than the itemeditor one. So if you have a good specification for an editor in combination with curves, that could qualify for a demo, let me know.

    Uwe

  3. #3
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Make a new QwtPlotCurve on a QwtPlot?

    Quote Originally Posted by Uwe View Post
    So if you have a good specification for an editor in combination with curves, that could qualify for a demo, let me know.
    I can tell you my specification, and maybe it is good enough. I kind of know where to start, but I feel like there is more in the Qwt source that I could be using and that's where I'm stuck. For instance, the QwtPicker and QwtOverlay should be used together to pick the points and hide/show them. I need to save each of the points, but then am I making a QwtPlotCurve or something else (the state machine?)?

    In my case, for every X value there should be a single unique Y value that the user has picked. Ideally, a user could click and drag a trace line and have it saved/exported. Alternatively, if he picks a few points across the plot, it would connect the points together and that would be a line. If the user picks in the middle of his trace, he could move the trace line up and down to position it perfectly in the right place. Using zooming/panning, the user could see very small details in the overall plot and make sure the line is picked perfectly!

    As I'm writing this, this seems very similar to the "Lasso" tool in Photoshop. You could also have a smart lasso which tries to follow the contours of the image as best it can and then let the user modify it?

    One other thing I've seen done is use a boxcar sliding window across a plot to average pixels together so features can be blended and highlighted while noise is removed. Once the noise is removed, tracing along the peaks is easier since there are fewer levels. For this, you might actually need real data which would be harder to do in a small demo.

    Joey

Similar Threads

  1. Selecting QwtPlotCurve from QwtPlot
    By Christoss in forum Qwt
    Replies: 11
    Last Post: 23rd July 2013, 12:32
  2. Replies: 1
    Last Post: 11th May 2012, 08:02
  3. Replies: 1
    Last Post: 13th July 2011, 08:55
  4. Replies: 1
    Last Post: 9th December 2009, 17:14
  5. Replies: 2
    Last Post: 7th July 2009, 07:44

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.