1from __future__
import annotations
3from typing
import Union, Any
5from ids_peak_common
import exceptions
6from ids_peak_common._internal.utils
import is_equal, validate_parameter_types
12 A size consists of width and height where width and height have to be greater than or equal to zero.
14 @ingroup ids_peak_common_python_types_geometry
17 def __init__(self, width: Union[int, float], height: Union[int, float]):
20 Size constructor from width and height.
22 @param width: Width of the size.
23 @param height: Height of the size.
25 @exception OutOfRangeException: If width or height is less than zero.
27 validate_parameter_types(width, height, accepted_types=(int, float))
36 def __eq__(self, other: Any) -> bool:
39 Check if two Size objects are equal.
41 @param other: Another Size object OR List of width and height [width, height] OR Tuple of width and height (width, height)
43 @return True if both objects are equal, False otherwise.
45 if isinstance(other, Size):
47 if isinstance(other, (list, tuple)):
54 def __ne__(self, other: Any) -> bool:
57 Check if two Size objects are not equal.
59 @param other: Another Size object OR List/Tuple with width and height.
61 @return True if both objects are not equal, False otherwise.
63 return not self == other
68 Returns a string representation of the Size object.
70 @return String representation of the Size object.
72 return f
"(width={self.width}, height={self.height})"
77 Return an unambiguous string of the Size object.
79 return f
"{self.__class__.__name__}{str(self)}"
82 def width(self) -> Union[int, float]:
85 Get the width of the size.
87 @return The width value.
92 def height(self) -> Union[int, float]:
95 Get the height of the size.
97 @return The height value.
A size consists of width and height where width and height have to be greater than or equal to zero.
Union[int, float] _height
__init__(self, Union[int, float] width, Union[int, float] height)
Size constructor from width and height.
Union[int, float] height(self)
Get the height of the size.
bool __ne__(self, Any other)
Check if two Size objects are not equal.
Union[int, float] width(self)
Get the width of the size.
str __str__(self)
Returns a string representation of the Size object.
str __repr__(self)
Return an unambiguous string of the Size object.
bool __eq__(self, Any other)
Check if two Size objects are equal.
Thrown when a parameter is outside the valid range.