import math import time import ezdxf import numpy as np from core import rotate_point_around_another, calculate_route, calculate_angle_with_x_axis class WindFlowDrawer: def __init__(self, msp, gap, center, route, type): self.msp = msp self.gap = gap self.center = center self.route = route self.type = type def draw_wind_flow(self): line_length = 2.55 * self.gap point_end = self.center[0] - line_length / 2, self.center[1] point_arrow = self.center[0] + line_length / 2, self.center[1] point_text = self.center[0] - 0.1 * line_length, self.center[1] + 0.0725 * line_length arrow = ezdxf.ARROWS.ez_arrow_filled color = str(self.type) point_end = rotate_point_around_another(point_end, self.center, self.route) point_arrow = rotate_point_around_another(point_arrow, self.center, self.route) point_text = rotate_point_around_another(point_text, self.center, self.route) angle = math.degrees(self.route) if self.type == 1: dxfattribs = { 'insert': point_text, 'style': 'LiberationSerif', 'color': color} self.msp.add_text(text="S", rotation=angle - 90, dxfattribs=dxfattribs) self.msp.add_line(point_end, point_arrow, { "color": color, }) self.msp.add_arrow(arrow, point_arrow, 2, angle, { "color": color, })