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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import sqlite3
  2. from PySide6.QtGui import QStandardItemModel
  3. from Back.Program_Run.data_show import *
  4. def main_function(ui, db_path, utf_en):
  5. # 就用已有的选项卡
  6. ui.tabWidget.setTabVisible(0, True)
  7. ui.tabWidget.setTabVisible(1, True)
  8. ui.tabWidget.setTabVisible(2, True)
  9. # 重新设置文字名称
  10. ui.tabWidget.setTabText(0, '复测成果表')
  11. ui.tabWidget.setTabText(1, '基准归算模型')
  12. ui.tabWidget.setTabText(2, '复测基准归算表')
  13. # 连接到数据库
  14. db1 = sqlite3.connect(db_path)
  15. db1.text_factory = lambda x: str(x, 'utf-8')
  16. cursor1 = db1.cursor()
  17. # 隐藏 QLabel
  18. ui.default_remind.hide()
  19. # 查询表内符合的所有数据(分成两个结果分别显示)
  20. # 注意查询中的tablename,数据库中如果没有相同的表名,会报错,所以需要先判断一下
  21. # 复测成果表
  22. 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 = ?'
  23. cursor1.execute(sqlstr1, (utf_en,))
  24. result1 = cursor1.fetchall()
  25. # 基准归算表
  26. sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  27. cursor1.execute(sqlstr11, (utf_en,))
  28. result2 = cursor1.fetchall()
  29. # 对结果集进行处理,把汉字转换过来, 添加表头部分
  30. nlist1, plist1 = Arrange_Data1(result1)
  31. nlist2, plist2 = Arrange_Data2(result2)
  32. model1 = Data_in_Cell1(plist1)
  33. model1.setHorizontalHeaderLabels(
  34. ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
  35. model1.setVerticalHeaderLabels(nlist1)
  36. # 展示表格
  37. ui.resultTableView.setModel(model1)
  38. ui.resultTableView.show()
  39. # 隐藏 QLabel
  40. ui.default_remind.hide()
  41. model2 = Data_in_Cell2(plist2)
  42. model2.setHorizontalHeaderLabels(
  43. ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
  44. model2.setVerticalHeaderLabels(nlist2)
  45. # 展示表格
  46. ui.reconTableView.setModel(model2)
  47. ui.reconTableView.show()
  48. # 富文本的html
  49. sqlstr2 = 'select Last_ResultName, New_ResultName, Formula_X1, Formula_X2, Formula_X3, Formula_Y1, Formula_Y2, Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
  50. cursor1.execute(sqlstr2, (utf_en,))
  51. result3 = cursor1.fetchone()
  52. # 检查 result3 是否为 None
  53. if result3 is None:
  54. str0 = "<p>未找到相关数据。</p>"
  55. else:
  56. str1 = result3[0].decode('utf-8') if isinstance(result3[0], bytes) else result3[0]
  57. str2 = result3[1].decode('utf-8') if isinstance(result3[1], bytes) else result3[1]
  58. n1, n2, n3, n4, n5, n6 = result3[2], result3[3], result3[4], result3[5], result3[6], result3[7]
  59. str0 = f"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  60. <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
  61. p, li {{ white-space: pre-wrap; }}
  62. hr {{ height: 1px; border-width: 0; }}
  63. li.unchecked::marker {{ content: "\\2610"; }}
  64. li.checked::marker {{ content: "\\2612"; }}
  65. </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
  66. <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>
  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; 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>
  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;">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>
  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;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为{str2}坐标;</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;">X、Y</span><span style=" font-size:14pt;">为{str1}已知系统的{str2}归算坐标。</span></p></body></html>"""
  71. ui.printTableView.setHtml(str0)
  72. def main_function1(ui, db_path, utf_en):
  73. # 就用已有的选项卡
  74. ui.View.setTabVisible(0, True)
  75. ui.View.setTabVisible(1, True)
  76. ui.View.setTabVisible(2, True)
  77. ui.View.setTabVisible(3, True)
  78. # 重新设置文字名称
  79. ui.View.setTabText(0, '输入数据')
  80. ui.View.setTabText(1, '基准归算模型')
  81. ui.View.setTabText(2, '复测基准归算表')
  82. ui.View.setTabText(3, '复测成果表')
  83. # 连接到数据库
  84. db1 = sqlite3.connect(db_path)
  85. db1.text_factory = lambda x: str(x, 'utf-8')
  86. cursor1 = db1.cursor()
  87. #输入数据
  88. sqlstr00 = 'select PointName,Last_X,Last_Y,New_X,New_Y,cgcs from GS_Input_Point WHERE TableName = ?'
  89. sqlstr10 = 'select Last_ResultName,New_ResultName,Avg_SL,Ms_Dir,Ms_WSL,SL_Count,Dir_Count,Scale_Value from GS_Input_Param WHERE TableName = ?'
  90. cursor1.execute(sqlstr00, (utf_en,))
  91. result00 = cursor1.fetchall()
  92. cursor1.execute(sqlstr10, (utf_en,))
  93. result10 = cursor1.fetchall()
  94. model0,nlist0 = GS_In_Data(result00,result10[0])
  95. model0.setHorizontalHeaderLabels(
  96. ['点名', '前期X', '前期Y', '本期X', '本期Y','成果次数','上期成果名','本期成果名','平均边长','方向值中误差','最弱边边长相对中误差','总测边数','总方向观测数','缩放值'])
  97. model0.setVerticalHeaderLabels(nlist0)
  98. # 展示表格
  99. ui.resultTableView1.setModel(model0)
  100. ui.resultTableView1.show()
  101. # 隐藏 QLabel
  102. ui.default_remind1.hide()
  103. # 查询表内符合的所有数据(分成两个结果分别显示)
  104. # 注意查询中的tablename,数据库中如果没有相同的表名,会报错,所以需要先判断一下
  105. # 复测成果表
  106. 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 = ?'
  107. cursor1.execute(sqlstr1, (utf_en,))
  108. result1 = cursor1.fetchall()
  109. # 基准归算表
  110. sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  111. cursor1.execute(sqlstr11, (utf_en,))
  112. result2 = cursor1.fetchall()
  113. # 对结果集进行处理,把汉字转换过来, 添加表头部分
  114. nlist1, plist1 = Arrange_Data1(result1)
  115. nlist2, plist2 = Arrange_Data2(result2)
  116. model1 = Data_in_Cell1(plist1)
  117. model1.setHorizontalHeaderLabels(
  118. ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
  119. model1.setVerticalHeaderLabels(nlist1)
  120. # 展示表格
  121. ui.inputTableView1.setModel(model1)
  122. ui.inputTableView1.show()
  123. # 隐藏 QLabel
  124. ui.default_remind1.hide()
  125. model2 = Data_in_Cell2(plist2)
  126. model2.setHorizontalHeaderLabels(
  127. ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
  128. model2.setVerticalHeaderLabels(nlist2)
  129. # 展示表格
  130. ui.reconTableView1.setModel(model2)
  131. ui.reconTableView1.show()
  132. # 富文本的html
  133. sqlstr2 = 'select Last_ResultName, New_ResultName, Formula_X1, Formula_X2, Formula_X3, Formula_Y1, Formula_Y2, Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
  134. cursor1.execute(sqlstr2, (utf_en,))
  135. result3 = cursor1.fetchone()
  136. # 检查 result3 是否为 None
  137. if result3 is None:
  138. str0 = "<p>未找到相关数据。</p>"
  139. else:
  140. str1 = result3[0].decode('utf-8') if isinstance(result3[0], bytes) else result3[0]
  141. str2 = result3[1].decode('utf-8') if isinstance(result3[1], bytes) else result3[1]
  142. n1, n2, n3, n4, n5, n6 = result3[2], result3[3], result3[4], result3[5], result3[6], result3[7]
  143. str0 = f"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  144. <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
  145. p, li {{ white-space: pre-wrap; }}
  146. hr {{ height: 1px; border-width: 0; }}
  147. li.unchecked::marker {{ content: "\\2610"; }}
  148. li.checked::marker {{ content: "\\2612"; }}
  149. </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
  150. <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>
  151. <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>
  152. <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>
  153. <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>
  154. <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>"""
  155. ui.printTableView1.setHtml(str0)