Results 1 to 8 of 8

Thread: QwtPolar change scale steps problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Mar 2016
    Posts
    14
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPolar change scale steps problem

    Nothing helped

    Qt Code:
    1. void Scale::changedScale()
    2. {
    3. // Zoom scale
    4. // if(qFuzzyCompare(m_cbScale->currentText().toDouble(), 600.0)) {
    5. // m_screen->zoom(QwtPointPolar(0, 0), MAX_DISPLAY_FACTOR);
    6. // } else {
    7. // m_screen->zoom(m_screen->zoomPos(), m_cbScale->currentText().toDouble() / 600.0);
    8. // }
    9. // Azimuth scale
    10. m_screen->setScale(QwtPolar::Azimuth, 360, 0, m_cbAzimuth->currentText().toDouble());
    11. // Distance scale
    12. m_scaleDiv.setLowerBound(0);
    13. m_scaleDiv.setUpperBound(m_cbScale->currentText().toDouble());
    14. m_scaleDiv.setTicks(QwtScaleDiv::MinorTick, getTicks(m_cbDistance->currentText().toDouble()));
    15. m_scaleDiv.setTicks(QwtScaleDiv::MediumTick, getTicks(m_cbDistance->currentText().toDouble()));
    16. m_scaleDiv.setTicks(QwtScaleDiv::MajorTick, getTicks(m_cbDistance->currentText().toDouble()));
    17. m_screen->setScaleDiv(QwtPolar::Radius, m_scaleDiv);
    18. m_screen->setScale(QwtPolar::Radius, 0, m_cbScale->currentText().toDouble());
    19.  
    20. m_screen->replot();
    21. }
    22.  
    23. QList<double> Scale::getTicks(double step) const
    24. {
    25. QList<double> ticks;
    26. if(qFuzzyCompare(step, 0)) {
    27. return ticks;
    28. }
    29. for(double i = 0; i <= m_cbScale->currentText().toDouble(); i += step) {
    30. ticks.append(i);
    31. }
    32.  
    33. return ticks;
    34. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void Scale::changedScale()
    2. {
    3. // Azimuth scale
    4. m_screen->setScale(QwtPolar::Azimuth, 360, 0, m_cbAzimuth->currentText().toDouble());
    5. // Distance scale
    6. m_screen->setScale(QwtPolar::Radius, 0, 600.0);
    7. double maxMajor = 600.0 / m_cbDistance->currentText().toDouble();
    8. m_screen->setScaleMaxMajor(QwtPolar::Radius,
    9. qFuzzyCompare(maxMajor, static_cast<int>(maxMajor))
    10. ? maxMajor : maxMajor + 1);
    11. // Zoom scale <-- This spoils everything!!!
    12. if(qFuzzyCompare(m_cbScale->currentText().toDouble(), 600.0)) {
    13. m_screen->zoom(QwtPointPolar(0, 0), MAX_DISPLAY_FACTOR);
    14. } else {
    15. m_screen->zoom(m_screen->zoomPos(), m_cbScale->currentText().toDouble() / 600.0);
    16. }
    17.  
    18. m_screen->replot();
    19. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by BulSV; 17th June 2017 at 21:24.

Similar Threads

  1. Replies: 5
    Last Post: 25th January 2021, 16:01
  2. Replies: 2
    Last Post: 13th November 2016, 18:30
  3. Replies: 7
    Last Post: 13th April 2011, 08:42
  4. Replies: 1
    Last Post: 19th May 2009, 11:14
  5. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47

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
  •  
Qt is a trademark of The Qt Company.