Exemple #1
0
 def create_by_diagonal(top_left: tuple, bottom_right: tuple):
     """
     :type top_left: (float | str, float | str)
     :type bottom_right: (float | str, float | str)
     :rtype: Rectangle
     """
     vs.Rect(Units.resolve_length_units(top_left),
             Units.resolve_length_units(bottom_right))
     return Rectangle(vs.LNewObj())
Exemple #2
0
 def create(point1: tuple, point2: tuple):
     """
     :type point1: (float | str, float | str)
     :type point2: (float | str, float | str)
     :rtype: Line
     """
     vs.MoveTo(Units.resolve_length_units(point1))
     vs.LineTo(Units.resolve_length_units(point2))
     return Line(vs.LNewObj())
Exemple #3
0
 def create(origin: tuple, direction: tuple, width, height):
     """
     :type origin: (float | str, float | str)
     :type direction: (float | str, float | str)
     :type width: float | str
     :type height: float | str
     :rtype: Rectangle
     """
     vs.RectangleN(Units.resolve_length_units(origin),
                   Units.resolve_length_units(direction),
                   Units.resolve_length_units(width),
                   Units.resolve_length_units(height))
     return Rectangle(vs.LNewObj())
Exemple #4
0
 def create(origin: tuple):
     """
     :type origin: (float | str, float | str)
     :rtype: Locus
     """
     vs.Locus(Units.resolve_length_units(origin))
     return Locus(vs.LNewObj())
Exemple #5
0
 def create(definition: SymbolDefinition, insertion_point: tuple,
            rotation: float):
     """
     :type insertion_point: (float | str, float | str)
     :rtype: Symbol
     """
     vs.Symbol(definition.name, Units.resolve_length_units(insertion_point),
               rotation)
     return Symbol(vs.LNewObj())
Exemple #6
0
 def create(vertices: tuple, closed: bool = True):
     """
     :type vertices: tuple[tuple[x: float|str, y: float|str]]
     """
     vs.ClosePoly() if closed else vs.OpenPoly()
     vs.Poly(*[
         Units.to_length_units(c) if isinstance(c, str) else c
         for vertex in vertices for c in vertex
     ])
     return Polygon(vs.LNewObj())
Exemple #7
0
 def create(text: str,
            origin: tuple,
            horizontal_alignment: int = None,
            vertical_alignment: int = None):
     """
     :type origin: (float | str, float | str)
     :type horizontal_alignment: TextHorizontalAlignmentEnum
     :type vertical_alignment: TextVerticalAlignmentEnum
     :rtype: Text
     """
     vs.TextOrigin(Units.resolve_length_units(origin))
     vs.TextJust(horizontal_alignment) if horizontal_alignment else None
     vs.TextVerticalAlign(
         vertical_alignment) if vertical_alignment else None
     vs.CreateText(text)
     return Text(vs.LNewObj())
Exemple #8
0
 def height(self, value):
     """:type value: float | str"""
     vs.SetHeight(self.handle, Units.resolve_length_units(value))
     vs.ResetBBox(
         self.handle)  # Needed, or the object doesn't reflect the change!