MCPcopy Create free account
hub / github.com/BIT-DataLab/Edit-Banana / create_geometry

Function create_geometry

modules/utils/xml_utils.py:29–41  ·  view source on GitHub ↗

创建 mxGeometry 元素

(
    x: float = 0,
    y: float = 0,
    width: float = 0,
    height: float = 0,
    relative: bool = False,
    as_type: str = "geometry",
)

Source from the content-addressed store, hash-verified

27
28
29def create_geometry(
30 x: float = 0,
31 y: float = 0,
32 width: float = 0,
33 height: float = 0,
34 relative: bool = False,
35 as_type: str = "geometry",
36) -> ET.Element:
37 """创建 mxGeometry 元素"""
38 g = ET.Element("mxGeometry", {"as": as_type, "x": str(x), "y": str(y), "width": str(width), "height": str(height)})
39 if relative:
40 g.set("relative", "1")
41 return g
42
43
44def prettify_xml(elem: ET.Element) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected