32 lines
675 B
Python
32 lines
675 B
Python
import formatter
|
|
|
|
class linear_type:
|
|
dtype = int
|
|
table = ["圆曲线", "直线", "缓和曲线"]
|
|
def __init__(self):
|
|
pass
|
|
def str2val(self, s):
|
|
return linear_type.table.index(s)
|
|
|
|
def val2str(self, v):
|
|
return linear_type.table[v]
|
|
|
|
#规定表格中的数据格式
|
|
def table_formatter(row, col):
|
|
if col in [2, 3]:
|
|
return formatter.integer()
|
|
elif col in [1, 7, 8]:
|
|
return formatter.decimal()
|
|
elif col in [0]:
|
|
return formatter.kdecimal()
|
|
elif col in [6]:
|
|
return formatter.angle()
|
|
elif col in [4, 5]:
|
|
return formatter.decimal(fmt = "%.8f")
|
|
elif col in [10]:
|
|
return formatter.decimal(fmt = "%.2f")
|
|
elif col in [9]:
|
|
return linear_type()
|
|
return None
|
|
|