class TunDrawer:
    def __init__(self, msp, layer, color, vec12, vec34, from_point, to_point):
        self.msp = msp
        self.layer = layer
        self.color = color
        self.vec12 = vec12
        self.vec34 = vec34
        self.from_point = from_point
        self.to_point = to_point

    def draw_tun(self):
        for i in range(0, len(self.vec12), 2):
            pair = self.vec12[i:i + 2]
            point1 = pair[0]["x"], pair[0]["y"]
            point2 = pair[1]["x"], pair[1]["y"]
            # 取出每两个元素
            self.msp.add_line(point1, point2, dxfattribs={
                'color': self.color
            })

        for i in range(0, len(self.vec34), 2):
            pair = self.vec34[i:i + 2]  # 取出每两个元素
            point1 = pair[0]["x"], pair[0]["y"]
            point2 = pair[1]["x"], pair[1]["y"]
            self.msp.add_line(point1, point2, dxfattribs={
                'color': self.color
            })

