1- # -*- coding: utf-8 -*-
1+ # -*- coding: utf-8 -*-# -*- coding: utf-8 -*-
2+ #
3+ # Licensed under the terms of the BSD 3-Clause
4+ # (see plotpy/LICENSE for details)
5+
6+ from __future__ import annotations
27
38from plotpy .items import (
49 AnnotatedCircle ,
1924
2025
2126class AnnotatedRectangleTool (RectangleTool ):
22- def create_shape (self ):
27+ """
28+ Tool for creating annotated rectangle shapes.
29+
30+ This tool extends the RectangleTool to create AnnotatedRectangle objects.
31+ """
32+
33+ def create_shape (self ) -> tuple [AnnotatedRectangle , int , int ]:
2334 """
35+ Create an annotated rectangle shape.
2436
25- :return:
37+ Returns:
38+ A tuple containing the AnnotatedRectangle object and its handle indices.
2639 """
2740 annotation = AnnotatedRectangle (0 , 0 , 1 , 1 )
2841 self .set_shape_style (annotation )
2942 return annotation , 0 , 2
3043
3144
3245class AnnotatedObliqueRectangleTool (ObliqueRectangleTool ):
33- AVOID_NULL_SHAPE = True
46+ """
47+ Tool for creating annotated oblique rectangle shapes.
48+
49+ This tool extends the ObliqueRectangleTool to create
50+ AnnotatedObliqueRectangle objects.
51+ """
3452
35- def create_shape (self ):
53+ AVOID_NULL_SHAPE : bool = True
54+
55+ def create_shape (self ) -> tuple [AnnotatedObliqueRectangle , int , int ]:
3656 """
57+ Create an annotated oblique rectangle shape.
3758
38- :return:
59+ Returns:
60+ A tuple containing the AnnotatedObliqueRectangle object
61+ and its handle indices.
3962 """
4063 annotation = AnnotatedObliqueRectangle (0 , 0 , 1 , 0 , 1 , 1 , 0 , 1 )
4164 self .set_shape_style (annotation )
4265 return annotation , 0 , 2
4366
4467
4568class AnnotatedCircleTool (CircleTool ):
46- def create_shape (self ):
69+ """
70+ Tool for creating annotated circle shapes.
71+
72+ This tool extends the CircleTool to create AnnotatedCircle objects.
73+ """
74+
75+ def create_shape (self ) -> tuple [AnnotatedCircle , int , int ]:
4776 """
77+ Create an annotated circle shape.
4878
49- :return:
79+ Returns:
80+ A tuple containing the AnnotatedCircle object and its handle indices.
5081 """
5182 annotation = AnnotatedCircle (0 , 0 , 1 , 1 )
5283 self .set_shape_style (annotation )
5384 return annotation , 0 , 1
5485
5586
5687class AnnotatedEllipseTool (EllipseTool ):
57- def create_shape (self ):
88+ """
89+ Tool for creating annotated ellipse shapes.
90+
91+ This tool extends the EllipseTool to create AnnotatedEllipse objects.
92+ """
93+
94+ def create_shape (self ) -> tuple [AnnotatedEllipse , int , int ]:
5895 """
96+ Create an annotated ellipse shape.
5997
60- :return:
98+ Returns:
99+ A tuple containing the AnnotatedEllipse object and its handle indices.
61100 """
62101 annotation = AnnotatedEllipse (0 , 0 , 1 , 1 )
63102 annotation .shape .switch_to_circle ()
@@ -66,21 +105,37 @@ def create_shape(self):
66105
67106
68107class AnnotatedPointTool (PointTool ):
69- def create_shape (self ):
108+ """
109+ Tool for creating annotated point shapes.
110+
111+ This tool extends the PointTool to create AnnotatedPoint objects.
112+ """
113+
114+ def create_shape (self ) -> tuple [AnnotatedPoint , int , int ]:
70115 """
116+ Create an annotated point shape.
71117
72- :return:
118+ Returns:
119+ A tuple containing the AnnotatedPoint object and its handle indices.
73120 """
74121 annotation = AnnotatedPoint (0 , 0 )
75122 self .set_shape_style (annotation )
76123 return annotation , 0 , 0
77124
78125
79126class AnnotatedSegmentTool (SegmentTool ):
80- def create_shape (self ):
127+ """
128+ Tool for creating annotated segment shapes.
129+
130+ This tool extends the SegmentTool to create AnnotatedSegment objects.
131+ """
132+
133+ def create_shape (self ) -> tuple [AnnotatedSegment , int , int ]:
81134 """
135+ Create an annotated segment shape.
82136
83- :return:
137+ Returns:
138+ A tuple containing the AnnotatedSegment object and its handle indices.
84139 """
85140 annotation = AnnotatedSegment (0 , 0 , 1 , 1 )
86141 self .set_shape_style (annotation )
0 commit comments