fix
This commit is contained in:
parent
e26f4e56ee
commit
e82574190e
@ -1 +1,272 @@
|
|||||||
[{"code": 1, "type": "250x1450", "x": 945, "y": 0, "center": 351, "w": 1450, "h": 250, "angle": "0"}, {"code": 2, "type": "300x300", "x": 923, "y": 0, "center": 754, "w": 300, "h": 300, "angle": "0"}, {"code": 3, "type": "501x500", "x": 1638, "y": 0, "center": 1054, "w": 500, "h": 501, "angle": "0"}, {"code": 4, "type": "250x648", "x": 717, "y": 0, "center": 1149, "w": 648, "h": 250, "angle": "0"}, {"code": 5, "type": "250x250", "x": 1337, "y": 0, "center": 1543, "w": 250, "h": 250, "angle": "0"}, {"code": 6, "type": "249x249", "x": 1780, "y": 0, "center": 1750, "w": 249, "h": 249, "angle": "0"}, {"code": 7, "type": "400x399", "x": 549, "y": 0, "center": 1955, "w": 399, "h": 400, "angle": "0"}, {"code": 8, "type": "300x302", "x": 1143, "y": 0, "center": 2159, "w": 302, "h": 300, "angle": "0"}, {"code": 9, "type": "300x302", "x": 1745, "y": 0, "center": 2157, "w": 302, "h": 300, "angle": "0"}, {"code": 10, "type": "248x1447", "x": 2939, "y": 0, "center": 345, "w": 1447, "h": 248, "angle": "0"}, {"code": 11, "type": "298x297", "x": 2947, "y": 0, "center": 747, "w": 297, "h": 298, "angle": "0"}, {"code": 12, "type": "499x499", "x": 3640, "y": 0, "center": 1040, "w": 499, "h": 499, "angle": "0"}, {"code": 13, "type": "245x648", "x": 2743, "y": 0, "center": 1146, "w": 648, "h": 245, "angle": "0"}, {"code": 14, "type": "247x247", "x": 3338, "y": 0, "center": 1550, "w": 247, "h": 247, "angle": "0"}, {"code": 15, "type": "246x247", "x": 3747, "y": 0, "center": 1757, "w": 247, "h": 246, "angle": "0"}, {"code": 16, "type": "398x392", "x": 2548, "y": 0, "center": 1955, "w": 392, "h": 398, "angle": "0"}, {"code": 17, "type": "300x293", "x": 3143, "y": 0, "center": 2147, "w": 293, "h": 300, "angle": "0"}, {"code": 18, "type": "298x297", "x": 3750, "y": 0, "center": 2144, "w": 297, "h": 298, "angle": "0"}, {"code": 19, "type": "245x1447", "x": 4940, "y": 0, "center": 344, "w": 1447, "h": 245, "angle": "0"}, {"code": 20, "type": "295x300", "x": 4924, "y": 0, "center": 743, "w": 300, "h": 295, "angle": "0"}, {"code": 21, "type": "498x495", "x": 5646, "y": 0, "center": 1030, "w": 495, "h": 498, "angle": "0"}, {"code": 22, "type": "245x648", "x": 4726, "y": 0, "center": 1150, "w": 648, "h": 245, "angle": "0"}, {"code": 23, "type": "245x246", "x": 5296, "y": 0, "center": 1541, "w": 246, "h": 245, "angle": "0"}, {"code": 24, "type": "245x245", "x": 5741, "y": 0, "center": 1735, "w": 245, "h": 245, "angle": "0"}, {"code": 25, "type": "398x392", "x": 4545, "y": 0, "center": 1955, "w": 392, "h": 398, "angle": "0"}, {"code": 26, "type": "298x296", "x": 5141, "y": 0, "center": 2142, "w": 296, "h": 298, "angle": "0"}, {"code": 27, "type": "297x295", "x": 5740, "y": 0, "center": 2146, "w": 295, "h": 297, "angle": "0"}]
|
[
|
||||||
|
{
|
||||||
|
"code": 1,
|
||||||
|
"type": "250x1450",
|
||||||
|
"x": 945,
|
||||||
|
"y": 0,
|
||||||
|
"center": 351,
|
||||||
|
"w": 1450,
|
||||||
|
"h": 250,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 2,
|
||||||
|
"type": "300x300",
|
||||||
|
"x": 923,
|
||||||
|
"y": 0,
|
||||||
|
"center": 754,
|
||||||
|
"w": 300,
|
||||||
|
"h": 300,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 3,
|
||||||
|
"type": "501x500",
|
||||||
|
"x": 1638,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1054,
|
||||||
|
"w": 500,
|
||||||
|
"h": 501,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 4,
|
||||||
|
"type": "250x648",
|
||||||
|
"x": 717,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1149,
|
||||||
|
"w": 648,
|
||||||
|
"h": 250,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 5,
|
||||||
|
"type": "250x250",
|
||||||
|
"x": 1337,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1543,
|
||||||
|
"w": 250,
|
||||||
|
"h": 250,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 6,
|
||||||
|
"type": "249x249",
|
||||||
|
"x": 1780,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1750,
|
||||||
|
"w": 249,
|
||||||
|
"h": 249,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 7,
|
||||||
|
"type": "400x399",
|
||||||
|
"x": 549,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1955,
|
||||||
|
"w": 399,
|
||||||
|
"h": 400,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 8,
|
||||||
|
"type": "300x302",
|
||||||
|
"x": 1143,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2159,
|
||||||
|
"w": 302,
|
||||||
|
"h": 300,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 9,
|
||||||
|
"type": "300x302",
|
||||||
|
"x": 1745,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2157,
|
||||||
|
"w": 302,
|
||||||
|
"h": 300,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 10,
|
||||||
|
"type": "248x1447",
|
||||||
|
"x": 2939,
|
||||||
|
"y": 0,
|
||||||
|
"center": 345,
|
||||||
|
"w": 1447,
|
||||||
|
"h": 248,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 11,
|
||||||
|
"type": "298x297",
|
||||||
|
"x": 2947,
|
||||||
|
"y": 0,
|
||||||
|
"center": 747,
|
||||||
|
"w": 297,
|
||||||
|
"h": 298,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 12,
|
||||||
|
"type": "499x499",
|
||||||
|
"x": 3640,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1040,
|
||||||
|
"w": 499,
|
||||||
|
"h": 499,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 13,
|
||||||
|
"type": "245x648",
|
||||||
|
"x": 2743,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1146,
|
||||||
|
"w": 648,
|
||||||
|
"h": 245,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 14,
|
||||||
|
"type": "247x247",
|
||||||
|
"x": 3338,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1550,
|
||||||
|
"w": 247,
|
||||||
|
"h": 247,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 15,
|
||||||
|
"type": "246x247",
|
||||||
|
"x": 3747,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1757,
|
||||||
|
"w": 247,
|
||||||
|
"h": 246,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 16,
|
||||||
|
"type": "398x392",
|
||||||
|
"x": 2548,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1955,
|
||||||
|
"w": 392,
|
||||||
|
"h": 398,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 17,
|
||||||
|
"type": "300x293",
|
||||||
|
"x": 3143,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2147,
|
||||||
|
"w": 293,
|
||||||
|
"h": 300,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 18,
|
||||||
|
"type": "298x297",
|
||||||
|
"x": 3750,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2144,
|
||||||
|
"w": 297,
|
||||||
|
"h": 298,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 19,
|
||||||
|
"type": "245x1447",
|
||||||
|
"x": 4940,
|
||||||
|
"y": 0,
|
||||||
|
"center": 344,
|
||||||
|
"w": 1447,
|
||||||
|
"h": 245,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 20,
|
||||||
|
"type": "295x300",
|
||||||
|
"x": 4924,
|
||||||
|
"y": 0,
|
||||||
|
"center": 743,
|
||||||
|
"w": 300,
|
||||||
|
"h": 295,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 21,
|
||||||
|
"type": "498x495",
|
||||||
|
"x": 5646,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1030,
|
||||||
|
"w": 495,
|
||||||
|
"h": 498,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 22,
|
||||||
|
"type": "245x648",
|
||||||
|
"x": 4726,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1150,
|
||||||
|
"w": 648,
|
||||||
|
"h": 245,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 23,
|
||||||
|
"type": "245x246",
|
||||||
|
"x": 5296,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1541,
|
||||||
|
"w": 246,
|
||||||
|
"h": 245,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 24,
|
||||||
|
"type": "245x245",
|
||||||
|
"x": 5741,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1735,
|
||||||
|
"w": 245,
|
||||||
|
"h": 245,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 25,
|
||||||
|
"type": "398x392",
|
||||||
|
"x": 4545,
|
||||||
|
"y": 0,
|
||||||
|
"center": 1955,
|
||||||
|
"w": 392,
|
||||||
|
"h": 398,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 26,
|
||||||
|
"type": "298x296",
|
||||||
|
"x": 5141,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2142,
|
||||||
|
"w": 296,
|
||||||
|
"h": 298,
|
||||||
|
"angle": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 27,
|
||||||
|
"type": "297x295",
|
||||||
|
"x": 5740,
|
||||||
|
"y": 0,
|
||||||
|
"center": 2146,
|
||||||
|
"w": 295,
|
||||||
|
"h": 297,
|
||||||
|
"angle": "0"
|
||||||
|
}
|
||||||
|
]
|
@ -48,8 +48,14 @@ for index, row in df.iloc[2:30].iterrows():
|
|||||||
center_y = row[col('L')]
|
center_y = row[col('L')]
|
||||||
width = row[col('D')]
|
width = row[col('D')]
|
||||||
height = row[col('E')]
|
height = row[col('E')]
|
||||||
|
# 左上角
|
||||||
x = center_x - width / 2
|
x = center_x - width / 2
|
||||||
y = center_y - height / 2
|
# 左上角
|
||||||
|
y = center_y + height / 2
|
||||||
|
# 左下角
|
||||||
|
x_left_bottom = center_x - width / 2
|
||||||
|
# 左下角
|
||||||
|
y_left_bottom = center_y - height / 2
|
||||||
|
|
||||||
|
|
||||||
# [{
|
# [{
|
||||||
@ -76,14 +82,8 @@ for index, row in df.iloc[2:30].iterrows():
|
|||||||
# 画出中心点
|
# 画出中心点
|
||||||
ax.scatter(center_x, center_y, color='red', marker='o', s=10)
|
ax.scatter(center_x, center_y, color='red', marker='o', s=10)
|
||||||
|
|
||||||
# 更新边界
|
|
||||||
x_min = min(x_min, x)
|
|
||||||
x_max = max(x_max, x + row[col('D')])
|
|
||||||
y_min = min(y_min, y)
|
|
||||||
y_max = max(y_max, y + row[col('E')])
|
|
||||||
|
|
||||||
# 绘制矩形
|
# 绘制矩形
|
||||||
rect = Rectangle((x, y), row[col('D')], row[col('E')], linewidth=1, edgecolor='r', facecolor='none')
|
rect = Rectangle((x_left_bottom, y_left_bottom),width, height, linewidth=1, edgecolor='r', facecolor='none')
|
||||||
ax.add_patch(rect)
|
ax.add_patch(rect)
|
||||||
|
|
||||||
# 在矩形中心绘制编号(A列)
|
# 在矩形中心绘制编号(A列)
|
||||||
@ -95,14 +95,14 @@ for index, row in df.iloc[2:30].iterrows():
|
|||||||
|
|
||||||
# 在矩形上边绘制宽度(D列)
|
# 在矩形上边绘制宽度(D列)
|
||||||
ax.text(
|
ax.text(
|
||||||
x + row[col('D')] / 2, y + row[col('E')], str(row[col('D')]),
|
x + row[col('D')] / 2, y_left_bottom + row[col('E')], str(row[col('D')]),
|
||||||
ha='center', va='bottom',
|
ha='center', va='bottom',
|
||||||
fontsize=6, color='green' # 宽度字体大小为10,颜色为绿色
|
fontsize=6, color='green' # 宽度字体大小为10,颜色为绿色
|
||||||
)
|
)
|
||||||
|
|
||||||
# 在矩形右边绘制高度(E列)
|
# 在矩形右边绘制高度(E列)
|
||||||
ax.text(
|
ax.text(
|
||||||
x + row[col('D')], y + row[col('E')] / 2, str(row[col('E')]),
|
x + width, y_left_bottom + height / 2, height,
|
||||||
ha='left', va='center',
|
ha='left', va='center',
|
||||||
fontsize=6, color='red' # 高度字体大小为10,颜色为红色
|
fontsize=6, color='red' # 高度字体大小为10,颜色为红色
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user