Changeset 8457:8f4f2273827d in orange
 Timestamp:
 07/25/11 22:04:19 (3 years ago)
 Branch:
 default
 Convert:
 515ac26fbef67575f2dc5217eb40a0cc90102082
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

orange/OrangeWidgets/plot/owplot3d.py
r8454 r8457 363 363 self.scale_factor = 100. 364 364 self.data_scale = numpy.array([1., 1., 1.]) 365 self.data_center = numpy.array([0 , 0, 0])365 self.data_center = numpy.array([0., 0., 0.]) 366 366 367 367 # Beside ngons, symbols should also include cubes, spheres and other stuff. TODO … … 384 384 385 385 self.zoom_stack = [] 386 self.translation = numpy.array([0 , 0, 0])386 self.translation = numpy.array([0., 0., 0.]) 387 387 388 388 def __del__(self): … … 542 542 if cmd == 'scatter': 543 543 vao_id, outline_vao_id, (X, Y, Z), labels = params 544 scale = numpy.maximum([0 , 0, 0], self.scale + self.additional_scale)544 scale = numpy.maximum([0., 0., 0.], self.scale + self.additional_scale) 545 545 546 546 self.symbol_shader.bind() … … 562 562 glDrawElements(GL_LINES, outline_vao_id.num_indices, GL_UNSIGNED_INT, c_void_p(0)) 563 563 glBindVertexArray(0) 564 565 # Draw colorpicking buffer.566 glBindVertexArray(vao_id)567 self.tooltip_fbo.bind()568 glClearColor(1, 1, 1, 1)569 glClear(GL_COLOR_BUFFER_BIT)570 glDisable(GL_BLEND)571 self.symbol_shader.setUniformValue(self.symbol_shader_tooltip_mode, True)572 glDrawArrays(GL_TRIANGLES, 0, vao_id.num_vertices)573 self.tooltip_fbo.release()574 glBindVertexArray(0)575 564 576 565 self.symbol_shader.release() … … 588 577 callback = params 589 578 callback() 579 580 for (cmd, params) in self.commands: 581 if cmd == 'scatter': 582 vao_id, outline_vao_id, (X, Y, Z), labels = params 583 # Draw into colorpicking buffer. 584 self.tooltip_fbo.bind() 585 self.symbol_shader.bind() 586 # Most uniforms retain their values. 587 self.symbol_shader.setUniformValue(self.symbol_shader_tooltip_mode, True) 588 glClearColor(1, 1, 1, 1) 589 glClear(GL_COLOR_BUFFER_BIT) 590 glDisable(GL_BLEND) 591 glBindVertexArray(vao_id) 592 glDrawArrays(GL_TRIANGLES, 0, vao_id.num_vertices) 593 glBindVertexArray(0) 594 self.symbol_shader.release() 595 self.tooltip_fbo.release() 590 596 591 597 glDisable(GL_BLEND) … … 1010 1016 self.translation = self.translation + translation_step 1011 1017 self.updateGL() 1012 start = time.time()1013 1018 for i in range(num_steps): 1014 1019 if time.time()  start > 1.: … … 1040 1045 vertex *= self.data_scale 1041 1046 vertex += self.translation 1042 vertex *= numpy.maximum([0 , 0, 0], self.scale + self.additional_scale)1047 vertex *= numpy.maximum([0., 0., 0.], self.scale + self.additional_scale) 1043 1048 return vertex 1044 1049 1045 1050 def transform_plot_to_data(self, vertex): 1046 vertex /= numpy.maximum([0 , 0, 0], self.scale + self.additional_scale)1051 vertex /= numpy.maximum([0., 0., 0.], self.scale + self.additional_scale) 1047 1052 vertex = self.translation 1048 1053 vertex /= self.data_scale … … 1090 1095 x, y, z = self.transform_data_to_plot((x,y,z)) 1091 1096 x_win, y_win = project(x, y, z) 1092 for selection in self.selections: 1093 if selection.contains(x_win, y_win): 1094 indices.append(i) 1095 break 1097 if any(sel.contains(x_win, y_win) for sel in self.selections): 1098 indices.append(i) 1096 1099 1097 1100 return indices … … 1106 1109 1107 1110 if buttons & Qt.LeftButton: 1108 if self. legend.contains(pos.x(), pos.y()):1111 if self.show_legend and self.legend.contains(pos.x(), pos.y()): 1109 1112 self.state = PlotState.DRAGGING_LEGEND 1110 1113 self.new_selection = None … … 1127 1130 self.state = PlotState.SCALING 1128 1131 self.scaling_init_pos = self.mouse_pos 1129 self.additional_scale = [0 , 0, 0]1132 self.additional_scale = [0., 0., 0.] 1130 1133 else: 1131 1134 self.pop_zoom() … … 1155 1158 1156 1159 if self.state == PlotState.IDLE: 1157 for selection in self.selections: 1158 if selection.contains(pos.x(), pos.y()): 1159 self.setCursor(Qt.OpenHandCursor) 1160 break 1160 if any(sel.contains(pos.x(), pos.y()) for sel in self.selections) or\ 1161 self.legend.contains(pos.x(), pos.y()): 1162 self.setCursor(Qt.OpenHandCursor) 1161 1163 else: 1162 1164 self.setCursor(Qt.ArrowCursor) … … 1202 1204 1203 1205 if self.state == PlotState.SCALING: 1204 self.scale = numpy.maximum([0 , 0, 0], self.scale + self.additional_scale)1205 self.additional_scale = [0 , 0, 0]1206 self.scale = numpy.maximum([0., 0., 0.], self.scale + self.additional_scale) 1207 self.additional_scale = [0., 0., 0.] 1206 1208 self.state = PlotState.IDLE 1207 1209 elif self.state == PlotState.SELECTING: … … 1253 1255 self.legend.clear() 1254 1256 self.zoom_stack = [] 1257 self.translation = numpy.array([0., 0., 0.]) 1258 self.scale = numpy.array([1., 1., 1.]) 1259 self.additional_scale = numpy.array([0., 0., 0.]) 1255 1260 self.x_axis_title = self.y_axis_title = self.z_axis_title = '' 1256 1261 self.x_axis_map = self.y_axis_map = self.z_axis_map = None
Note: See TracChangeset
for help on using the changeset viewer.