Ticket #206: RadialNet.py.patch
| File RadialNet.py.patch, 3.2 kB (added by ignotus, 17 months ago) |
|---|
-
umitGUI/radialnet/RadialNet.py
old new 1137 1137 while group.get_draw_info('group_node') is not None: 1138 1138 group = group.get_draw_info('group_node') 1139 1139 1140 r ing = group.get_draw_info('ring')1141 node.set_coordinate_radius(self.__calc_radius(ring))1140 radius = self.__calc_radius(group.get_draw_info('ring')) 1141 flip = group.get_draw_info('flip') 1142 1142 1143 1143 else: 1144 ring = node.get_draw_info('ring') 1145 node.set_coordinate_radius(self.__calc_radius(ring)) 1144 1145 radius = self.__calc_radius(node.get_draw_info('ring')) 1146 flip = node.get_draw_info('flip') 1147 1148 if flip: 1149 radius += flip 1150 1151 node.set_coordinate_radius(radius) 1146 1152 1147 1153 1148 1154 @graph_is_not_empty … … 1295 1301 node_total = max - min 1296 1302 children_need = node.get_draw_info('children_need') 1297 1303 1304 flip = 1 1305 1298 1306 for child in children: 1299 1307 1300 1308 child_need = child.get_draw_info('space_need') 1301 1309 child_total = node_total * child_need / children_need 1302 1310 1311 print node_total, children_need 1312 1313 if node_total < children_need: 1314 1315 r = child.get_draw_info('radius') 1316 child.set_draw_info({'flip':(r * flip)}) 1317 1318 flip *= -1 1319 1320 else: 1321 child.set_draw_info({'flip':0}) 1322 1303 1323 theta = child_total / 2 + min + self.__rotate 1304 1324 1305 1325 child.set_coordinate_theta(theta) … … 1391 1411 # set nodes' coordinate radius 1392 1412 for node in self.__graph.get_nodes(): 1393 1413 1394 ring = node.get_draw_info('ring') 1395 node.set_coordinate_radius(self.__calc_radius(ring)) 1414 radius = self.__calc_radius(node.get_draw_info('ring')) 1415 flip = node.get_draw_info('flip') 1416 1417 if flip: 1418 radius += flip 1419 1420 node.set_coordinate_radius(radius) 1396 1421 1397 1422 # set nodes' coordinate theta 1398 1423 self.__calc_layout(reference) … … 1565 1590 self.__graph = graph 1566 1591 1567 1592 self.__calc_node_positions() 1593 1594 # [TODO] Perform computation and set best values for: 1595 # - base ring gap; 1596 # - rotation; 1597 # - use or not fisheye? 1598 1568 1599 self.queue_draw() 1569 1600 1570 1601 else: … … 1842 1873 def angle_from_object(distance, size): 1843 1874 """ 1844 1875 """ 1845 return math.degrees(math.atan2(size / 2.0, distance))1876 return math.degrees(math.atan2(size, distance)) 1846 1877 1847 1878 # End of Geometry 1848 1879 … … 2010 2041 sum_angle += child.get_draw_info('space_need') 2011 2042 2012 2043 distance = self.get_coordinate_radius() 2013 size = self.get_draw_info('radius') * 2 2044 size = self.get_draw_info('radius') * 2.0 2014 2045 own_angle = RadialNet.angle_from_object(distance, size) 2015 2046 2016 2047 self.set_draw_info({'children_need':sum_angle})
