Support inp in coord, vertex, label

This commit is contained in:
WQY\qiong
2023-03-16 00:15:34 +08:00
parent bf1aeff1fa
commit 1d720c5b6c
4 changed files with 39 additions and 6 deletions

View File

@@ -124,6 +124,22 @@ def inp_in_label(section: list[str]) -> ChangeSet:
return cs
def inp_in_label_new(name: str, line: str) -> None:
tokens = line.split()
num = len(tokens)
has_desc = tokens[-1].startswith(';')
num_without_desc = (num - 1) if has_desc else num
x = float(tokens[0])
y = float(tokens[1])
label = str(tokens[2])
node = str(tokens[3]) if num >= 4 else None
node = f"'{node}'" if node != None else 'null'
write(name, f"insert into labels (x, y, label, node) values ({x}, {y}, '{label}', {node});")
def inp_out_label(name: str) -> list[str]:
lines = []
objs = read_all(name, 'select * from labels')