Changeset 10924:b5b1c0b30806 in orange


Ignore:
Timestamp:
06/17/12 15:28:32 (22 months ago)
Author:
mstajdohar
Branch:
default
Message:

Try FR with animation.

Location:
source/orangeqt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/networkcurve.cpp

    r10923 r10924  
    592592} 
    593593 
     594void NetworkCurve::scale_axes() 
     595{ 
     596    QRectF r2 = QRectF(plot()->contentsRect()); 
     597    r2.adjust(1, 1, -1, -1); 
     598    double t = r2.top(); 
     599    r2.setTop(r2.bottom()); 
     600    r2.setBottom(t); 
     601 
     602    QPair< int, int > axes_; 
     603    axes_ = axes(); 
     604    QRectF r1 = plot()->data_rect_for_axes(axes_.first, axes_.second); 
     605 
     606    double dx = r1.width() / 20.0; 
     607    double dy = r1.height() / 20.0; 
     608    r1.adjust(-dx, -dy, dx, dy); 
     609 
     610    QTransform tr1 = QTransform().translate(-r1.left(), -r1.top()); 
     611    QTransform ts = QTransform().scale(r2.width()/r1.width(), r2.height()/r1.height()); 
     612    QTransform tr2 = QTransform().translate(r2.left(), r2.top()); 
     613    set_graph_transform(tr1 * ts * tr2); 
     614} 
     615 
    594616int NetworkCurve::random() 
    595617{ 
     
    657679        fi = fi - step; 
    658680    } 
    659     //register_points(); 
     681 
    660682    return 0; 
    661683} 
     
    822844    vertices.clear(); 
    823845    qvertices.clear(); 
    824          
    825     //register_points(); 
    826          
     846 
    827847    return 0; 
    828848} 
     
    891911    //clock_t refresh_time = clock() + 0.05 * CLOCKS_PER_SEC; 
    892912    Plot *p = plot(); 
    893     bool animation_enabled = p->animate_points; 
    894     p->animate_points = false; 
     913    //bool animation_enabled = p->animate_points; 
     914    //p->animate_points = false; 
    895915 
    896916    QTime refresh_time = QTime::currentTime(); 
     
    9861006        if (before_refresh_time > refresh_time && i % 2 == 0) 
    9871007        { 
    988             QRectF r2 = QRectF(plot()->contentsRect()); 
    989             r2.adjust(1, 1, -1, -1); 
    990             double t = r2.top(); 
    991             r2.setTop(r2.bottom()); 
    992             r2.setBottom(t); 
    993  
    994             QPair< int, int > axes_; 
    995             axes_ = axes(); 
    996             QRectF r1 = plot()->data_rect_for_axes(axes_.first, axes_.second); 
    997  
    998             double dx = r1.width() / 20.0; 
    999             double dy = r1.height() / 20.0; 
    1000             r1.adjust(-dx, -dy, dx, dy); 
    1001  
    1002             QTransform tr1 = QTransform().translate(-r1.left(), -r1.top()); 
    1003             QTransform ts = QTransform().scale(r2.width()/r1.width(), r2.height()/r1.height()); 
    1004             QTransform tr2 = QTransform().translate(r2.left(), r2.top()); 
    1005             set_graph_transform(tr1 * ts * tr2); 
    1006  
     1008            scale_axes(); 
    10071009            update_properties(); 
    10081010            QCoreApplication::processEvents(); 
    10091011            int refresh_duration = before_refresh_time.msecsTo(QTime::currentTime()); 
    1010  
    10111012            refresh_time = before_refresh_time.addMSecs(qMax(refresh_duration * 3, 10)); 
    10121013        } 
     
    10251026    } 
    10261027 
    1027     p->animate_points = animation_enabled; 
    1028     //register_points(); 
     1028    //p->animate_points = animation_enabled; 
    10291029    return 0; 
    10301030} 
     
    10411041    m_labels = labels; 
    10421042    //Q_ASSERT(m_labels.uniqueKeys() == m_labels.keys()); 
    1043     //register_points(); 
    10441043} 
    10451044 
     
    10611060    m_labels.unite(labels); 
    10621061    Q_ASSERT(m_labels.uniqueKeys() == m_labels.keys()); 
    1063     //register_points(); 
    10641062} 
    10651063 
     
    10911089        remove_label(i); 
    10921090    } 
    1093  
    10941091} 
    10951092 
  • source/orangeqt/networkcurve.h

    r10872 r10924  
    137137    QList<EdgeItem*> m_connected_edges; 
    138138    QTransform m_graph_transform; 
     139    void scale_axes(); 
    139140}; 
    140141 
Note: See TracChangeset for help on using the changeset viewer.