@@ -21,6 +21,7 @@ def __init__(
2121 outline_color : QtGui .QColor = Colors .DEFAULT_GRAPHICS_COLOR ,
2222 fill_color : Optional [QtGui .QColor ] = None ,
2323 line_width : float = LINE_WIDTH ,
24+ closed : bool = False
2425 ) -> None :
2526 """Initialize the GLPolygon
2627
@@ -30,6 +31,7 @@ def __init__(
3031 :param outline_color: The color of the polygon's outline
3132 :param fill_color: The color used to fill the polygon, or None if no fill
3233 :param line_width: The line width of the polygon's outline
34+ :param closed: whether the GLPolygon is closed or not
3335 """
3436 super ().__init__ (
3537 parent_item = parent_item ,
@@ -39,6 +41,7 @@ def __init__(
3941 )
4042
4143 self .set_points (points )
44+ self .is_closed = closed
4245
4346 def set_points (self , points : list [tuple [float , float ]]) -> None :
4447 """Update the point data representing the polygon to display.
@@ -62,7 +65,8 @@ def _update_shape_data(self) -> None:
6265 if not self .points :
6366 return
6467
65- vertices = [(point [0 ], point [1 ], 0 ) for point in self .points + [self .points [0 ]]]
68+ render_points = self .points + [self .points [0 ]] if self .is_closed else self .points
69+ vertices = [(point [0 ], point [1 ], 0 ) for point in render_points ]
6670 self .setData (pos = vertices )
6771
6872 if self .fill_graphic :
0 commit comments