Results 1 to 9 of 9

Thread: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

  1. #1
    Join Date
    Dec 2014
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    Hi,
    My application is having a requirement of receiving (on TCP socket) and plotting upto 1000 custom shape items (mostly rectangular/ circular shapes) on qwt ploar as well as qwt plot. The position (keeps changing every time) of these items has to be updated on the plot every 1 second. What is the best strategy to update, by position, the shape items on the plots?:

    1. Draw an item, delete it and redraw it at new position ( attach/ detach calls) or
    2. Use transformation to translate the painter path of the item to new position?

    It is not only required to draw the items on polar plot but also to display them in a table view/ widget as text. So keeping the performance in mind, I request you to suggest what is the best way of achieving this on a qwt ploar & qwt plot?

    Also; as the same data is being displayed in qwt polar plot, qwt plot and table widget; I am planning to implement Qt's model/ view concept classes. Is it feasible to derive view classes for qwt polar/qwt plot with QStandardItemView and QwtPolarPlot/ QwtPlot as base classes. Any ideas on this are most welcome. Thanks in advance.

  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: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    My application is having a requirement of receiving (on TCP socket) and plotting upto 1000 custom shape items (mostly rectangular/ circular shapes) on qwt ploar as well as qwt plot.
    First of all you need to be clear about the difference between a shape and a plot item using a symbol: A symbol represents a point ( plot coordinate ), while a shape is a figure made of plot coordinates. Thus position and size of a shape item depend on the scales of the plot, while for the symbol the size is fix only the position is related.

    What type of use case do you have ?

    Uwe
    Last edited by Uwe; 8th February 2015 at 10:29.

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

    vishaal_sss (9th February 2015)

  4. #3
    Join Date
    Feb 2015
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    What type of use case do you have ?
    Last edited by wysota; 8th February 2015 at 23:11. Reason: removed URL

  5. #4
    Join Date
    Dec 2014
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    Hi sandysandoro,
    I have just given the analogy of the use case, in my reply to Uwe.
    Thanks.

    Hi Uwe,
    Ya, now I am clear about the difference between a shape and a plot item. My requirement is more of plotting customized plot items on qwt polar and qwt plots. Right now, I am not allowed to give the exact use case of this application but I can give the analogy:

    There are different vehicles fitted with sensors. These vehicles (sensors) will be transmitting positional other parameters on Ethernet to this application, in a monitoring center. This application will receive date from those vehicles and display positional and other information including shape of the vehicle and update the position of the vehicles on the plots as on when they MOVE. Different symbols (customized) will be allocated to different vehicles and the symbol of the vehicle is fixed and predefined. No path tracing of the vehicles is required, only movement of the vehicles is to be depicted on the plots.
    Hope, this gives sufficient information of the use case of this application. Your suggestions are most welcome and could be vital for designing my application in better way using Qt, Qwt and QwtPolar. Thanks in advance.
    Last edited by vishaal_sss; 9th February 2015 at 07:58.

  6. #5
    Join Date
    Dec 2014
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    Hi Uwe,
    Any comments on this thread? What is the efficient way of moving (updating positions) around 1000 of plot items on qwt/ qwtpolar plot every second?

    Thanks.

  7. #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: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    When you don't need to scale the vehicles according to the scales I would go with symbols instead of shapes. QPainterPath can be use for both, but the advantage of QwtSymbols implements a pixmap cache, what might be of importance for the performance when having 1000 of them ( at least on graphic stacks running the raster paint engine ).

    Next you have to decide:


    • QwtPlotCurve
    • QwtPlotMarker
    • a customized plot item displaying 3D points ( like QwtPlotSpectroCurve ) - the z value would be for the vehicle type.


    When having a limited number of vehicle categories ( trucks, small car, big car ... ) you could implement it using one curve for each category. In terms of rendering performance this will be the most performant implementation, but might be a problem, when you need to implement operations on individual element ( f.e drag&drop or controlling an specific stacking order ). When using markers you will have 1000 plot items, what means some overhead, when the plot framework iterates over all items ( f.e. finding the combined bounding rectangle for autoscaling ).

    Uwe

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

    vishaal_sss (11th February 2015)

  9. #7
    Join Date
    Dec 2014
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    Thanks. From your reply:

    In terms of rendering performance this will be the most performant implementation, but might be a problem, when you need to implement operations on individual element ( f.e drag&drop or controlling an specific stacking order ).
    "most performant implementation" - is it best performance implementation?

    Ya, I will be trying these three options and see the performance in simulation. There will not be any graphical operations on the plot items; simply plot and move them on the display according to their instantaneous position. At most, tracker text/ context menu will be provided for mouse hover/ mouse right click on an item.
    Actually, also, a unique number is to be displayed along with symbol; that is why I was thinking of customizing a plot item by deriving from QwtPlotItem.
    So, I assume, the steps for movement of plot items on plot area would be: i. Create item. ii. Attach item to plot. iii. Detach/Delete and Attach it again at new position.

    Thanks for your suggestions.

  10. #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: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    "most performant implementation" - is it best performance implementation?
    No.
    Actually, also, a unique number is to be displayed along with symbol;
    A marker offers displaying symbol + text, but the text is not cached ( also QStaticText is not used ), so there will be room for optimizations. If you want to go with the one vehicle = one item approach customizing QwtPlotMarker is probably easier than implementing a new item from scratch ( also nothing difficult ).

    So, I assume, the steps for movement of plot items on plot area would be: i. Create item. ii. Attach item to plot. iii. Detach/Delete and Attach it again at new position.
    In case of a marker it would be:

    marker->setValue( ... )
    plot->replot();

    Detaching/reattaching only because of an attribute change is not necessary.

    Uwe
    Last edited by Uwe; 11th February 2015 at 14:02.

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

    vishaal_sss (12th February 2015)

  12. #9
    Join Date
    Dec 2014
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Plotting around 1000 shape items in qwt polar/ qwt plot. Help needed.

    Nice. Thanks Uwe.

Similar Threads

  1. Replies: 7
    Last Post: 15th May 2019, 09:44
  2. system gets struced when add 1000+ QPixmap items to scene
    By prasad.ece2 in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2014, 07:48
  3. Problem in plotting 3D plot using QWT
    By johnMick in forum Newbie
    Replies: 1
    Last Post: 15th July 2011, 11:19
  4. Replies: 1
    Last Post: 9th September 2010, 10:22
  5. Replies: 7
    Last Post: 22nd September 2008, 22:05

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.