Beispiel #1
0
 def draw(self, component: Union["_BufferedLineSegment", "_BufferedArc"]):
     pos = self.path.currentPosition()
     pos = Vector(pos.x(), pos.y(), 0)
     start = component.start_point()
     jump_distance = pos.distance(start.xy)  # compare 2D to 2D
     if jump_distance > 1e-5:
         if not self.first_component:
             print(f'warning: non-contiguous polyline: {self.current_entity}. '
                   f'Jump from {pos} to {start} (distance of {jump_distance})')
         self.path.moveTo(start.x, start.y)
     component.draw(self.path)
     if self.color is None:
         self.color = component.color
     elif component.color != self.color:
         print(f'warning: component has different color to the polyline {component.color} != {self.color}')
     self.first_component = False