Changeset 8970:b8daa24b3327 in orange


Ignore:
Timestamp:
09/15/11 12:42:17 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
9a2998829015b0c434b4cb39186807e58de4ef0a
Message:

Work on plot3d docs

Location:
orange/OrangeWidgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Visualize Qt/OWScatterPlot3D.py

    r8967 r8970  
    9898        args['skipIfSame'] = False 
    9999        orngScaleScatterPlotData.set_data(self, data, subset_data, **args) 
     100        # Optimization: calling set_plot_data here (and not in update_data) because data won't change. 
    100101        OWPlot3D.set_plot_data(self, self.scaled_data, self.scaled_subset_data) 
    101102        OWPlot3D.initializeGL(self) 
  • orange/OrangeWidgets/plot/owplot3d.py

    r8969 r8970  
    2222 
    2323import orangeqt 
    24 from plot.owplotgui import OWPlotGUI 
     24from owplotgui import OWPlotGUI 
    2525from owtheme import PlotTheme 
    2626from owplot import OWPlot 
     
    147147    The base class behind 3D plots in Orange. Uses OpenGL as its rendering platform. 
    148148 
    149     **Plot layout** 
     149    **Settings** 
    150150 
    151151        .. attribute:: show_legend 
    152      
     152 
    153153            A boolean controlling whether the legend is displayed or not 
    154154 
    155     **Settings** 
    156      
    157     .. attribute:: gui 
    158      
     155        .. attribute:: gui 
     156 
    159157            An :obj:`.OWPlotGUI` object associated with this graph 
    160158 
    161159    **Data** 
    162         This is the most important part of the class API. :meth:`set_plot_data` is 
     160        This is the most important part of the Plot3D API. :meth:`set_plot_data` is 
    163161        used to (not surprisingly) set the data which will be drawn. 
    164162        :meth:`set_features` tells Plot3D how to interpret the data (this method must 
     
    166164        :meth:`set_valid_data` optionally informs the plot which examples are invalid and 
    167165        should not be drawn. It should be called after set_plot_data, but before set_features. 
     166        This separation permits certain optimizations, e.g. ScatterPlot3D sets data once only (at 
     167        the beginning), later on it calls set_features and set_valid_data only. 
    168168 
    169169        .. automethod:: set_plot_data 
     
    174174 
    175175    **Selections** 
    176  
    177         .. method: get_selected_indices 
    178  
    179         .. method: get_min_max_selected 
    180  
    181         .. method: set_selection_behavior 
    182  
    183         .. method: unselect_all_points 
     176        There are four possible selection behaviors used for selecting points in OWPlot3D.  
     177 
     178        .. data:: AddSelection 
     179 
     180            Points are added to the current selection, without affecting currently selected points. 
     181 
     182        .. data:: RemoveSelection 
     183 
     184            Points are removed from the current selection. 
     185 
     186        .. data:: ToggleSelection 
     187 
     188            The points' selection state is toggled. 
     189 
     190        .. data:: ReplaceSelection 
     191 
     192            The current selection is replaced with new one. 
     193 
     194        .. automethod:: select_points 
     195 
     196        .. automethod:: unselect_all_points 
     197 
     198        .. automethod:: get_selected_indices 
     199 
     200        .. automethod:: get_min_max_selected 
     201 
     202        .. automethod:: set_selection_behavior 
    184203 
    185204    **Callbacks** 
    186205 
    187206        Plot3D provides several callbacks which can be used to perform additional tasks ( 
    188         such as drawing geometry before the data is drawn). Callback provided: 
     207        such as drawing geometry before/after the data is drawn). Callback provided: 
    189208 
    190209        auto_send_selection_callback 
     
    895914 
    896915    def get_min_max_selected(self, area): 
     916        ''' 
     917        Returns min/max x/y/z coordinate values of currently selected points. 
     918 
     919        :param area: Rectangular area. 
     920        :type QRect 
     921        ''' 
    897922        viewport = [0, 0, self.width(), self.height()] 
    898923        area = [min(area.left(), area.right()), min(area.top(), area.bottom()), abs(area.width()), abs(area.height())] 
     
    903928 
    904929    def get_selected_indices(self): 
     930        ''' 
     931        Returns indices of currently selected points (examples). 
     932        ''' 
    905933        return orangeqt.Plot3D.get_selected_indices(self) 
    906934 
     935    def select_points(self, area, behavior): 
     936        ''' 
     937        Selects all points inside volume specified by rectangular area and current camera transform 
     938        using selection ``behavior``. 
     939 
     940        :param area: Rectangular area. 
     941        :type QRect 
     942 
     943        :param behavior: :data:`AddSelection`, :data:`RemoveSelection`, :data:`ToggleSelection` or :data:`ReplaceSelection`  
     944        :type behavior: int 
     945        ''' 
     946        viewport = [0, 0, self.width(), self.height()] 
     947        area = [min(area.left(), area.right()), min(area.top(), area.bottom()), abs(area.width()), abs(area.height())] 
     948        orangeqt.Plot3D.select_points(self, area, self.projection * self.view * self.model, 
     949                                      viewport, 
     950                                      QVector3D(*self.plot_scale), QVector3D(*self.plot_translation), 
     951                                      behavior) 
     952        orangeqt.Plot3D.update_data(self, self.x_index, self.y_index, self.z_index, 
     953                                    self.color_index, self.symbol_index, self.size_index, self.label_index, 
     954                                    self.colors, self.num_symbols_used, 
     955                                    self.x_discrete, self.y_discrete, self.z_discrete, self.use_2d_symbols) 
     956 
    907957    def unselect_all_points(self): 
     958        ''' 
     959        Unselects everything. 
     960        ''' 
    908961        orangeqt.Plot3D.unselect_all_points(self) 
    909962        orangeqt.Plot3D.update_data(self, self.x_index, self.y_index, self.z_index, 
     
    914967 
    915968    def set_selection_behavior(self, behavior): 
     969        ''' 
     970        Sets selection behavior. 
     971 
     972        :param behavior: :data:`AddSelection`, :data:`RemoveSelection`, :data:`ToggleSelection` or :data:`ReplaceSelection`  
     973        :type behavior: int 
     974        ''' 
    916975        self.selection_behavior = behavior 
    917976 
     
    10361095            else: 
    10371096                area = self._selection 
    1038                 viewport = [0, 0, self.width(), self.height()] 
    1039                 area = [min(area.left(), area.right()), min(area.top(), area.bottom()), abs(area.width()), abs(area.height())] 
    1040                 orangeqt.Plot3D.select_points(self, area, self.projection * self.view * self.model, 
    1041                                               viewport, 
    1042                                               QVector3D(*self.plot_scale), QVector3D(*self.plot_translation), 
    1043                                               self.selection_behavior) 
    1044                 self.makeCurrent() 
    1045                 orangeqt.Plot3D.update_data(self, self.x_index, self.y_index, self.z_index, 
    1046                                             self.color_index, self.symbol_index, self.size_index, self.label_index, 
    1047                                             self.colors, self.num_symbols_used, 
    1048                                             self.x_discrete, self.y_discrete, self.z_discrete, self.use_2d_symbols) 
     1097                self.select_points(area, self.selection_behavior) 
    10491098 
    10501099                if self.auto_send_selection_callback: 
Note: See TracChangeset for help on using the changeset viewer.