Changeset 8835:e08a09710ff3 in orange


Ignore:
Timestamp:
08/29/11 18:13:01 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
e85750f23b90dfe6377836f1aee21907d301355b
Message:

Added set_valid_data method, takes numpy array address instead of QList<bool> for now because I couldnt get it to store True values

Location:
source/orangeqt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/plot3d.cpp

    r8821 r8835  
    2323{ 
    2424    vbos_generated = false; 
     25    data_array = NULL; 
     26    valid_data = NULL; 
    2527} 
    2628 
     
    8991} 
    9092 
     93void Plot3D::set_valid_data(quint64 valid_data_address) 
     94{ 
     95    valid_data = reinterpret_cast<bool*>(valid_data_address); 
     96} 
     97 
    9198void Plot3D::update_data(int x_index, int y_index, int z_index, 
    9299                         int color_index, int symbol_index, int size_index, int label_index, 
     
    123130    for (int index = 0; index < num_examples; ++index) 
    124131    { 
     132        if (valid_data != NULL and !valid_data[index]) // Skip invalid examples 
     133            continue; 
     134 
    125135        float* example = data_array + index*example_size; 
    126136        float x_pos = *(example + x_index); 
     
    143153            color = colors[clamp(int(color_value * num_colors), 0, num_colors-1)]; // TODO: garbage values sometimes? 
    144154        else if (color_index > -1) 
    145             color = QColor(0., 0., color_value*255); 
     155            color = QColor(0., 0., clamp(int(color_value*255), 0, 255)); 
    146156        else 
    147157            color = QColor(0., 0., 0); 
  • source/orangeqt/plot3d.h

    r8812 r8835  
    2323                  int num_examples, 
    2424                  int example_size); 
     25 
     26    void set_valid_data(quint64 valid_data_address); // Until I get QList<bool> to work, address of numpy array will have to do 
     27 
    2528    void update_data(int x_index, int y_index, int z_index, 
    2629                     int color_index, int symbol_index, int size_index, int label_index, 
    2730                     const QList<QColor>& colors, int num_symbols_used, 
    2831                     bool x_discrete, bool y_discrete, bool z_discrete, bool use_2d_symbols); 
    29     void draw_data(GLuint shader_id, 
    30                   float alpha_value); 
     32 
     33    void draw_data(GLuint shader_id, float alpha_value); 
    3134    void draw_data_solid(); // (only draws solid geometry as a performance optimization) 
    3235 
     
    5053private: 
    5154    float* data_array; 
     55    bool* valid_data; 
    5256    QVector<bool> selected_indices; // Array of length num_examples 
    5357    int num_examples; 
  • source/orangeqt/plot3d.sip

    r8812 r8835  
    1717                  int num_examples, 
    1818                  int example_size); 
     19 
     20    void set_valid_data(quint64 valid_data_address); // Until I get QList<bool> to work, address of numpy array will have to do 
     21 
    1922    void update_data(int x_index, int y_index, int z_index, 
    2023                     int color_index, int symbol_index, int size_index, int label_index, 
    2124                     const QList<QColor>& colors, int num_symbols_used, 
    2225                     bool x_discrete, bool y_discrete, bool z_discrete, bool use_2d_symbols); 
    23     void draw_data(GLuint shader_id, 
    24                   float alpha_value); 
     26 
     27    void draw_data(GLuint shader_id, float alpha_value); 
    2528    void draw_data_solid(); // (only draws solid geometry as a performance optimization) 
    2629 
Note: See TracChangeset for help on using the changeset viewer.