1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import core
- class MeshTemplateDrawer:
- def __init__(self, msp, grid, left_top, right_bottom, color):
- self.msp = msp
- self.grid = grid
- self.left_top = left_top
- self.right_bottom = right_bottom
- self.margin_left = 2876
- self.margin_bottom = 1847
- self.color = color
- def draw_mesh(self):
- left_edge = self.left_top[0]
- right_edge = self.right_bottom[0]
- top_edge = self.left_top[1]
- bottom_edge = self.right_bottom[1]
- left_index = left_edge - self.margin_left
- bottom_index = bottom_edge - self.margin_bottom
- top_list = []
- bottom_list = []
- left_list = []
- right_list = []
- while left_index < right_edge:
- # top_list.append(core.rotate_point_around_another((left_index,self.left_top[1]),(0,0),self.route))
- top_list.append((left_index, self.left_top[1]+self.margin_bottom))
- # bottom_list.append(core.rotate_point_around_another((left_index,self.right_bottom[1]),(0,0),self.route))
- bottom_list.append((left_index, self.right_bottom[1]-self.margin_bottom))
- left_index = left_index + self.grid
- while bottom_index < top_edge:
- # left_list.append(core.rotate_point_around_another((self.left_top[0], bottom_index), (0, 0), self.route))
- left_list.append((self.left_top[0], bottom_index))
- right_list.append((self.right_bottom[0], bottom_index))
- # right_list.append(
- # (core.rotate_point_around_another((self.right_bottom[0], bottom_index), (0, 0), self.route)))
- bottom_index = bottom_index + self.grid
- for top_element, bottom_element in zip(top_list, bottom_list):
- self.msp.add_line(top_element, bottom_element)
- for left_element, right_element in zip(left_list, right_list):
- self.msp.add_line(left_element, right_element)
- # def draw_graph_unit():
|