Results 1 to 2 of 2

Thread: how would you drawPolyLine that has missing segments

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default how would you drawPolyLine that has missing segments

    I have a QVector, "wellData", of QPoints that I render on a subclassed QWidget like so:

    Qt Code:
    1. void SkiggleLinePanel::paintEvent(QPaintEvent *e)
    2. {
    3.  
    4. // QVector<QPoint> wellData;
    5.  
    6. QPainter painter(this);
    7.  
    8. painter.drawPolyline(wellData.data(), wellData.size());
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    This works as expected. Suppose, however, that I have 7 QPoints with values like so:

    0 1
    2 2
    1 3
    3 -9
    7 5
    6 6
    2 3

    These are X and Y values, *except* -9 is actually a NULL data value, and this particular x,y coordinate pair should be thrown out... So instead of one longish line of 7 points, I would want 2 shorter lines of 3 points each. How to do this?

    One obvious fix: use QVector's members to find -9, then split it into 2 QVectors, and draw both of these. BUT: the actual problem involves a very long Polyline consisting of thousands of QPoints with many NULL values scattered throughout... so doing this would be very cumbersome. Are there other options here?
    Last edited by vonCZ; 6th May 2009 at 13:01.

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.