控制网复测平面基准归算程序(包含控制网复测平面基准计算,平面控制网稳定性计算,水准测段高差稳定计算三个程序功能)
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import sqlite3
  2. from PySide6.QtGui import QStandardItemModel
  3. def main_function(ui, db_path, utf_en):
  4. # 就用已有的选项卡
  5. ui.tabWidget.setTabVisible(0, True)
  6. ui.tabWidget.setTabVisible(1, True)
  7. ui.tabWidget.setTabVisible(2, True)
  8. # 重新设置文字名称
  9. ui.tabWidget.setTabText(0, '复测成果表')
  10. ui.tabWidget.setTabText(1, '基准归算模型')
  11. ui.tabWidget.setTabText(2, '复测基准归算表')
  12. # 连接到数据库
  13. db1 = sqlite3.connect(db_path)
  14. db1.text_factory = lambda x: str(x, 'utf-8')
  15. cursor1 = db1.cursor()
  16. # 查询表内符合的所有数据(分成两个结果分别显示)
  17. # 注意查询中的tablename,数据库中如果没有相同的表名,会报错,所以需要先判断一下
  18. # 复测成果表
  19. sqlstr1 = 'select PointName,Last_X,Last_Y,Result_X,Result_Y,Last_ResultX,Last_ResultY,Last_ResultP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  20. cursor1.execute(sqlstr1, (utf_en,))
  21. result1 = cursor1.fetchall()
  22. # 基准归算表
  23. sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  24. cursor1.execute(sqlstr11, (utf_en,))
  25. result2 = cursor1.fetchall()
  26. # 对结果集进行处理,把汉字转换过来, 添加表头部分
  27. nlist1, plist1 = ui.Arrange_Data1(result1)
  28. nlist2, plist2 = ui.Arrange_Data2(result2)
  29. # 创建一个数据模型(复测成果表)
  30. model1 = QStandardItemModel()
  31. model1 = ui.Data_in_Cell1(plist1)
  32. model1.setHorizontalHeaderLabels(
  33. ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
  34. model1.setVerticalHeaderLabels(nlist1)
  35. # 展示表格
  36. ui.resultTableView.setModel(model1)
  37. ui.resultTableView.show()
  38. # 隐藏 QLabel
  39. ui.default_remind.hide()
  40. # 创建一个数据模型(基准归算表)
  41. model2 = QStandardItemModel()
  42. model2 = ui.Data_in_Cell2(plist2)
  43. model2.setHorizontalHeaderLabels(
  44. ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
  45. model2.setVerticalHeaderLabels(nlist2)
  46. # 展示表格
  47. ui.reconTableView.setModel(model2)
  48. ui.reconTableView.show()
  49. # 富文本的html
  50. sqlstr2 = 'select Last_ResultName, New_ResultName, Formula_X1, Formula_X2, Formula_X3, Formula_Y1, Formula_Y2, Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
  51. cursor1.execute(sqlstr2, (utf_en,))
  52. result3 = cursor1.fetchone()
  53. # 检查 result3 是否为 None
  54. if result3 is None:
  55. str0 = "<p>未找到相关数据。</p>"
  56. else:
  57. str1 = result3[0].decode('utf-8') if isinstance(result3[0], bytes) else result3[0]
  58. str2 = result3[1].decode('utf-8') if isinstance(result3[1], bytes) else result3[1]
  59. n1, n2, n3, n4, n5, n6 = result3[2], result3[3], result3[4], result3[5], result3[6], result3[7]
  60. str0 = f"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  61. <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
  62. p, li {{ white-space: pre-wrap; }}
  63. hr {{ height: 1px; border-width: 0; }}
  64. li.unchecked::marker {{ content: "\\2610"; }}
  65. li.checked::marker {{ content: "\\2612"; }}
  66. </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
  67. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; color:#000000;">{str2}--{str1}</span><span style=" font-size:14pt;">已知系统转换公式:</span></p>
  68. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">X</span><span style=" font-size:14pt;">=({n1})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n2})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n3})</span></p>
  69. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">Y</span><span style=" font-size:14pt;">=({n4})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n5})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n6})</span></p>
  70. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为{str2}坐标;</span></p>
  71. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;"> </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为{str1}已知系统的{str2}归算坐标。</span></p></body></html>"""
  72. ui.printTableView.setHtml(str0)