Results 1 to 3 of 3

Thread: Drawing thousands of points with ability to seletc or click them??

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Drawing thousands of points with ability to seletc or click them??

    I'm trying to draw thousands of points on qwtpolt using qwt coordinates.

    so, after looking to the curvedemo1 example i saw i can use a curve to represnt all the points i need.

    each point i want to paint has (X,Y) and it ID.

    if i want to give the user ability to click a "point" on the curve and give him its ID?? can i do that ?? and can i use just one curve to display all of points or i need to use a curve for each point because i want to give the user ability to interact with it.

    the other thing is can i give the user the ability to select group of points .. like drawing a circle of rectangle (,or better a random shape) around them and give him the IDs of all the points inside this shape .. or not!!!


    all comments and questions are highly appreciated.

    Thank you so much

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Drawing thousands of points with ability to seletc or click them??

    if i want to give the user ability to click a "point" on the curve and give him its ID??
    You can use QwtPlotCurve::closestPoint() for this. You need to have some kind of lookup table that allows you to translate between point number in the series (the "int" returned by closestPoint()) and your ID.

    the other thing is can i give the user the ability to select group of points .. like drawing a circle of rectangle (,or better a random shape) around them and give him the IDs of all the points inside this shape .. or not!!!
    This is much harder. There is no built-in method for QwtPlotCurve that will do this. If your points are ordered (e.g. x[i] > x[i-1]), then you can look at the x-range of the selection rectangle and return all points between the left and right edges. If the points are not ordered (e.g., a scattergram or point cloud) then you need to either look at every point and ask if it is inside the selection area or create some kind of quadtree or other structure that can be examined quickly to check for points.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing thousands of points with ability to seletc or click them??

    thank you d_stranz, to be honest i was thinking if it is possible if i can assign different symbols to different points in a curve and in that i can subclass the QwtSymbol and have the Id with each point "symbol" i draw.

    or the other option i was think of each point would be a curve that has only one point!!!! but i really feel it is really bad idea especially that i would have to draw lots of points that may reach hundred thousands.

    the closest point, I'm not sure how well this would work as i have the points will be pretty close to each other.
    Please inform me if one of these approaches is possible or there are very bad idea.

    I have just saw the event_filter example in and it has an interactive plot and Symbols, ill be looking into it and see if i can under stand the approach and apply it on my case .

    Thank you so much

Similar Threads

  1. Replies: 4
    Last Post: 12th August 2011, 12:20
  2. drawing smooth curve to a set of points - without qwt
    By szisziszilvi in forum Qt Programming
    Replies: 0
    Last Post: 24th January 2011, 08:51
  3. Replies: 3
    Last Post: 12th May 2010, 13:11
  4. drawing an Arc using points
    By chethana in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2009, 03:59
  5. drawing points on canvas after a time period
    By quickNitin in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2006, 14:12

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.