浏览代码

WDcompute.py

rmy 5 个月前
父节点
当前提交
26e820c8b2
共有 4 个文件被更改,包括 774 次插入166 次删除
  1. 二进制
      Back/GC/__pycache__/GC.cpython-312.pyc
  2. 二进制
      Back/GC/__pycache__/GCcompute.cpython-312.pyc
  3. 593
    0
      Back/WD/WDcompute.py
  4. 181
    166
      Front/main_new.py

二进制
Back/GC/__pycache__/GC.cpython-312.pyc 查看文件


二进制
Back/GC/__pycache__/GCcompute.cpython-312.pyc 查看文件


+ 593
- 0
Back/WD/WDcompute.py 查看文件

@@ -0,0 +1,593 @@
1
+import sqlite3
2
+import os
3
+import tkinter as tk
4
+from tkinter import messagebox
5
+import math
6
+import numpy as np
7
+import math
8
+import tkinter as tk
9
+import numpy as np
10
+from tkinter import messagebox
11
+from tkinter import *
12
+
13
+#region 各种方法
14
+def to_utf8(text):
15
+    str1 = text.encode('utf-8')
16
+    return str1
17
+
18
+def jzys1(listy, zxzby, listx, zxzbx, sf):
19
+    rlist = []
20
+    listlen = len(listy)
21
+    ll = 0
22
+    while ll < listlen:
23
+        # 第一个的值
24
+        # num1 = round(((listx[ll] - zxzbx) / sf),0)
25
+        # num2 = round(((listy[ll] - zxzby) / sf),0)
26
+        num1 = listx[ll] - zxzbx
27
+        num2 = listy[ll] - zxzby
28
+        rlist.append(num1)
29
+        rlist.append(num2)
30
+        ll = ll + 1
31
+    return rlist
32
+
33
+def jzys2(listy, zxzby, listx, zxzbx, sf):
34
+    rlist = []
35
+    listlen = len(listy)
36
+    ll = 0
37
+    while ll < listlen:
38
+        # 第一个的值
39
+        num2 = (-1) * (listx[ll] - zxzbx) / sf
40
+        num1 = (listy[ll] - zxzby) / sf
41
+        rlist.append(num1)
42
+        rlist.append(num2)
43
+        ll = ll + 1
44
+    return rlist
45
+
46
+def jzys3(listy, aa, bb):
47
+    rlist = []
48
+    listlen = len(listy)
49
+    ll = 0
50
+    while ll < listlen:
51
+        # 第一个的值
52
+        num1 = aa
53
+        num2 = bb
54
+        rlist.append(num1)
55
+        rlist.append(num2)
56
+        ll = ll + 1
57
+    return rlist
58
+
59
+def jzys4(listpasty, zxzbpasty, listpastx, zxzbpastx, listnewy, zxzbnewy, listnewx, zxzbnewx, sf):
60
+    rlist = []
61
+    listlen = len(listnewx)
62
+    ll = 0
63
+    while ll < listlen:
64
+        num1 = (listpastx[ll] - listnewx[ll] - zxzbpastx + zxzbnewx) / sf
65
+        num2 = (listpasty[ll] - listnewy[ll] - zxzbpasty + zxzbnewy) / sf
66
+        rlist.append(num1)
67
+        rlist.append(num2)
68
+        ll = ll + 1
69
+    return rlist
70
+
71
+def jzys5(listp, zxzbp, sf):
72
+    rlist = []
73
+    listlen = len(listp)
74
+    ll = 0
75
+    while ll < listlen:
76
+        num1 = (listp[ll] - zxzbp) / sf
77
+        rlist.append(num1)
78
+        ll = ll + 1
79
+    return rlist
80
+
81
+def jzys6(listp, num):
82
+    rlist = []
83
+    listlen = len(listp)
84
+    ll = 0
85
+    while ll < listlen:
86
+        num1 = listp[ll] * num
87
+        rlist.append(num1)
88
+        ll = ll + 1
89
+    return rlist
90
+
91
+def cjh(listp):
92
+    rp = 0
93
+    listlen = len(listp)
94
+    ll = 0
95
+    while ll < listlen:
96
+        num1 = listp[ll] * listp[ll]
97
+        rp = rp + num1
98
+        ll = ll + 1
99
+    return rp
100
+
101
+def cjh2(lista, listb):
102
+    rp = 0
103
+    listlen = len(lista)
104
+    ll = 0
105
+    while ll < listlen:
106
+        num1 = lista[ll] * listb[ll]
107
+        rp = rp + num1
108
+        ll = ll + 1
109
+    return rp
110
+
111
+def gsys(listnewp, jxlist1, jylist1, lxlist, lylist, arrz, sf, zxzbnewp, zxzbpastp, ii):
112
+    # 新x+(矩阵[jx1 jy1 lx1 ly1]*矩阵z)*缩放-新重心坐标x+旧重心坐标x
113
+    rlist = []
114
+    listlen = len(listnewp)
115
+    ll = 0
116
+    while ll < listlen:
117
+        arr0 = np.array((jxlist1[ll], jylist1[ll],
118
+                        lxlist[2*ll+ii], lylist[2*ll+ii]))
119
+        arr1 = np.matmul(arr0, arrz)
120
+        arr3 = sf * arr1
121
+        newp = listnewp[ll] + arr3 - zxzbnewp + zxzbpastp
122
+        rlist.append(newp)
123
+        ll = ll + 1
124
+    return rlist
125
+
126
+def xcys(newlist, pastlist):
127
+    listlen = len(newlist)
128
+    ll = 0
129
+    rlist = []
130
+    while ll < listlen:
131
+        num1 = newlist[ll] - pastlist[ll]
132
+        num2 = num1 * 1000
133
+        rlist.append(num2)
134
+        ll = ll + 1
135
+    return rlist
136
+
137
+def takeFirst(elem):
138
+    return elem[0]
139
+#endregion
140
+
141
+def insert_into_database1(database,pastname,newname,beforename,excelname,listname1,listpastx1,listpasty1,listcgcs1,listbex,listbey,sxylist,wypd,gsx,gsy,listcgcs):
142
+    #转换下汉字
143
+    utf_tn = to_utf8(excelname)
144
+    utf_nn = to_utf8(newname)
145
+    utf_pn = to_utf8(pastname)
146
+    utf_bn = to_utf8(beforename)
147
+    utf_bx = to_utf8('变形')
148
+    utf_wd = to_utf8('稳定')
149
+    #将结果输出到数据库
150
+    db1 = sqlite3.connect(database)
151
+    #获取游标
152
+    cursor1 = db1.cursor()
153
+    #先清除已有数据,用来更新
154
+    try:
155
+        sqlstr3 = 'delete from WD_Result_Param WHERE TableName = ?'
156
+        sqlstr4 = 'delete from WD_Result_Point WHERE TableName = ?'
157
+        cursor1.execute(sqlstr3,(utf_tn,))
158
+        cursor1.execute(sqlstr4,(utf_tn,))
159
+    except:
160
+        pass
161
+    cursor1.execute('INSERT INTO WD_Result_Param(TableName,Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3) VALUES(?,?,?,?,?,?,?,?,?)',(utf_tn,utf_pn,utf_nn,sxylist[0],sxylist[1],sxylist[2],sxylist[3],sxylist[4],sxylist[5],))
162
+    #WD_Result_Point的输入
163
+    kk = -1
164
+    kk1 = -1
165
+    if (-1) in listcgcs:
166
+        kk = 1
167
+    #记位移点个数
168
+    wyd = 0
169
+    for lname in listname1:
170
+        #获取对应索引号
171
+        index1 = listname1.index(lname)
172
+        PointName = lname
173
+        First_X = listbex[index1]
174
+        First_Y = listbey[index1]
175
+        Last_X = listpastx1[index1]
176
+        Last_Y = listpasty1[index1]
177
+        Last_Wight = listcgcs1[index1]
178
+        New_Wight = listcgcs[index1]
179
+        #位移点
180
+        if New_Wight == -1:
181
+            # 获取他原本的坐标和初始改算值进行对比
182
+            for smx in jslist:
183
+                if First_X == smx[0] and First_Y == smx[1]:
184
+                    numa3 = sxylist[0] * jslist1[index1][0]
185
+                    numa4 = sxylist[1] * jslist1[index1][1]
186
+                    numa5 = numa3 + numa4+ sxylist[2]
187
+                    numa6 = sxylist[3] * jslist1[index1][0]
188
+                    numa7 = sxylist[4] * jslist1[index1][1]
189
+                    numa8 = numa6 + numa7+sxylist[5]
190
+                    Result_X = numa5
191
+                    Result_Y = numa8
192
+                    New_Wight = 1
193
+                    numb1 = (numa5 - First_X) * 1000
194
+                    numb2 = (numa8 - First_Y) * 1000
195
+                    numb3 = numb1 *numb1
196
+                    numb4 = numb2 *numb2
197
+                    numb5 = math.sqrt(numb3 + numb4)
198
+                    New_FirstX = numb1
199
+                    New_FirstY = numb2
200
+                    New_FirstP = numb5
201
+                    #新-首有个位移判定
202
+                    if numb5 > wypd:
203
+                        NFDis_Ass = utf_bx
204
+                    else:
205
+                        NFDis_Ass = utf_wd
206
+                    
207
+                    numc1 = (numa5 - Last_X) * 1000
208
+                    numc2 = (numa8 - Last_Y) * 1000
209
+                    numc3 = numc1 *numc1
210
+                    numc4 = numc2 *numc2
211
+                    numc5 = math.sqrt(numc3 + numc4)
212
+                    New_LastX = numc1
213
+                    New_LastY = numc2
214
+                    New_LastP = numc5
215
+                    NLDis_Ass = utf_bx
216
+                    kk1 = 1
217
+                    wyd = wyd + 1
218
+                    break
219
+        #不是位移点
220
+        else:
221
+            #全部都是稳定点
222
+            if kk == -1:
223
+                num3 = Last_X * Last_Wight
224
+                num4 = num3 + gsx[index1]
225
+                num5 = Last_Wight + 1
226
+                num6 = num4 / num5
227
+                num7 = Last_Y * Last_Wight
228
+                num8 = num7 + gsy[index1]
229
+                num10 = num8 / num5
230
+                Result_X = num6
231
+                Result_Y = num10
232
+                New_Wight = num5
233
+                numd1 = (num6 - First_X) * 1000
234
+                numd2 = (num10 - First_Y) * 1000
235
+                numd3 = numd1 * numd1
236
+                numd4 = numd2 * numd2
237
+                numd5 = math.sqrt(numd3 + numd4)
238
+                New_FirstX = numd1
239
+                New_FirstY = numd2
240
+                New_FirstP = numd5
241
+                #新-首有个位移判定
242
+                if numd5 > wypd:
243
+                    NFDis_Ass = utf_bx
244
+                else:
245
+                    NFDis_Ass = utf_wd
246
+                nume1 = (num6 - Last_X) * 1000
247
+                nume2 = (num10 - Last_Y) * 1000
248
+                nume3 = nume1 *nume1
249
+                nume4 = nume2 *nume2
250
+                nume5 = math.sqrt(nume3 + nume4)
251
+                New_LastX = nume1
252
+                New_LastY = nume2
253
+                New_LastP = nume5
254
+                NLDis_Ass = utf_wd
255
+            #有位移点,且已经走过了
256
+            if kk == 1 and kk1 == 1:
257
+                num3 = Last_X * Last_Wight
258
+                num4 = num3 + gsx[index1 - wyd]
259
+                num5 = Last_Wight + 1
260
+                num6 = num4 / num5
261
+                num7 = Last_Y * Last_Wight
262
+                num8 = num7 + gsy[index1 - wyd]
263
+                num10 = num8 / num5
264
+                Result_X = num6
265
+                Result_Y = num10
266
+                New_Wight = num5
267
+                numd1 = (num6 - First_X) * 1000
268
+                numd2 = (num10 - First_Y) * 1000
269
+                numd3 = numd1 * numd1
270
+                numd4 = numd2 * numd2
271
+                numd5 = math.sqrt(numd3 + numd4)
272
+                New_FirstX = numd1
273
+                New_FirstY = numd2
274
+                New_FirstP = numd5
275
+                #新-首有个位移判定
276
+                if numd5 > wypd:
277
+                    NFDis_Ass = utf_bx
278
+                else:
279
+                    NFDis_Ass = utf_wd
280
+                nume1 = (num6 - Last_X) * 1000
281
+                nume2 = (num10 - Last_Y) * 1000
282
+                nume3 = nume1 *nume1
283
+                nume4 = nume2 *nume2
284
+                nume5 = math.sqrt(nume3 + nume4)
285
+                New_LastX = nume1
286
+                New_LastY = nume2
287
+                New_LastP = nume5
288
+                NLDis_Ass = utf_wd
289
+            #有位移点,但没有走过
290
+            if kk == 1 and kk1 == -1:
291
+                num3 = Last_X * Last_Wight
292
+                num4 = num3 + gsx[index1]
293
+                num5 = Last_Wight + 1
294
+                num6 = num4 / num5
295
+                num7 = Last_Y * Last_Wight
296
+                num8 = num7 + gsy[index1]
297
+                num10 = num8 / num5
298
+                Result_X = num6
299
+                Result_Y = num10
300
+                New_Wight = num5
301
+                numd1 = (num6 - First_X) * 1000
302
+                numd2 = (num10 - First_Y) * 1000
303
+                numd3 = numd1 * numd1
304
+                numd4 = numd2 * numd2
305
+                numd5 = math.sqrt(numd3 + numd4)
306
+                New_FirstX = numd1
307
+                New_FirstY = numd2
308
+                New_FirstP = numd5
309
+                #新-首有个位移判定
310
+                if numd5 > wypd:
311
+                    NFDis_Ass = utf_bx
312
+                else:
313
+                    NFDis_Ass = utf_wd
314
+                nume1 = (num6 - Last_X) * 1000
315
+                nume2 = (num10 - Last_Y) * 1000
316
+                nume3 = nume1 *nume1
317
+                nume4 = nume2 *nume2
318
+                nume5 = math.sqrt(nume3 + nume4)
319
+                New_LastX = nume1
320
+                New_LastY = nume2
321
+                New_LastP = nume5
322
+                NLDis_Ass = utf_wd
323
+        #在这里整体输出
324
+        cursor1.execute('INSERT INTO WD_Result_Point(TableName,First_ResultName,Last_ResultName,New_ResultName,First_X,First_Y,Last_X,Last_Y,Result_X,Result_Y,Last_Wight,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass,PointName) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',(utf_tn,utf_bn,utf_pn,utf_nn,First_X,First_Y,Last_X,Last_Y,Result_X,Result_Y,Last_Wight,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass,PointName,))
325
+    #数据库执行
326
+    db1.commit()
327
+    #做完一切后,先关闭游标,再关闭数据库
328
+    cursor1.close()
329
+    db1.close()
330
+
331
+
332
+gszbx = []
333
+gszby = []
334
+jslist = []
335
+jslist1 = []
336
+def bhjs(listcgcs1, listname1, listpastx1, listpasty1, wypd, listname, listnewx, listnewy, listpastx, listpasty, points, listcgcs, listbex, listbey, sf, dbpath, befname, finalname, lastname, js,file_name):
337
+    np.set_printoptions(suppress=False)
338
+    # pt用于给点数point计数
339
+    # point会随着回递函数而减少
340
+    pt = 0
341
+    sumnewx = 0
342
+    sumnewy = 0
343
+    sumpastx = 0
344
+    sumpasty = 0
345
+    while pt < points:
346
+        sumnewx = sumnewx + listnewx[pt]
347
+        sumnewy = sumnewy + listnewy[pt]
348
+        sumpastx = sumpastx + listpastx[pt]
349
+        sumpasty = sumpasty + listpasty[pt]
350
+        pt = pt + 1
351
+    # 计算4个重心坐标(最新一期和上一期的)
352
+    zxzbnewx = round((sumnewx / points), 7)
353
+    zxzbnewy = round((sumnewy / points), 7)
354
+    zxzbpastx = round((sumpastx / points), 7)
355
+    zxzbpasty = round((sumpasty / points), 7)
356
+    # 先计算平移参数
357
+    # pycsx = abs(zxzbnewx - zxzbpastx) * 1000
358
+    # pycsy = abs(zxzbnewy - zxzbpasty) * 1000
359
+    pycsx = abs(zxzbnewx - zxzbpastx)
360
+    pycsy = abs(zxzbnewy - zxzbpasty)
361
+    # 分别得k,sita的值
362
+    klist = jzys1(listnewy, zxzbnewy, listnewx, zxzbnewx, sf)
363
+    slist = jzys2(listnewy, zxzbnewy, listnewx, zxzbnewx, sf)
364
+    # 得dx,dy
365
+    dxlist = jzys3(listnewy, 1, 0)
366
+    dylist = jzys3(listnewy, 0, 1)
367
+    # 矩阵太难用了,还是手动计算
368
+    # 分别计算k、s、dx、dy的乘积和
369
+    k2 = cjh(klist)
370
+    s2 = cjh(slist)
371
+    dx2 = cjh(dxlist)
372
+    dy2 = cjh(dylist)
373
+    # 这里再创建矩阵1
374
+    arr1 = np.array(((k2, 0, 0, 0), (0, s2, 0, 0),
375
+                    (0, 0, dx2, 0), (0, 0, 0, dy2)))
376
+    # 矩阵1的逆矩阵矩阵2
377
+    arr2 = np.linalg.inv(arr1)
378
+    # 求矩阵l
379
+    llist = jzys4(listpasty, zxzbpasty, listpastx, zxzbpastx,
380
+                    listnewy, zxzbnewy, listnewx, zxzbnewx, sf)
381
+    # 得到数列e1,e2,e3,e4
382
+    e1 = cjh2(klist, llist)
383
+    e2 = cjh2(slist, llist)
384
+    e3 = cjh2(dxlist, llist)
385
+    e4 = cjh2(dylist, llist)
386
+    arrl = np.array(((e1), (e2), (e3), (e4)))
387
+    # 得到矩阵z
388
+    arrz = np.matmul(arr2, arrl)
389
+    # 求转换矩阵
390
+    jxlist1 = jzys5(listnewx, zxzbnewx, sf)
391
+    jylist1 = jzys5(listnewy, zxzbnewy, sf)
392
+    jxlist2 = jylist1
393
+    # jylist2 = jxlist1 * (-1)
394
+    jylist2 = jzys6(jxlist1, -1)
395
+    lxlist = jzys3(jylist1, 1, 0)
396
+    lylist = jzys3(jylist1, 0, 1)
397
+    # 求改算坐标
398
+    gsx = gsys(listnewx, jxlist1, jylist1, lxlist,
399
+                lylist, arrz, sf, zxzbnewx, zxzbpastx, 0)
400
+    gsy = gsys(listnewy, jxlist2, jylist2, lxlist,
401
+                lylist, arrz, sf, zxzbnewy, zxzbpasty, 1)
402
+    # 还是要先求较差
403
+    xcx = xcys(gsx, listpastx)
404
+    xcy = xcys(gsy, listpasty)
405
+    # 这里记录下第一次所有点的改算坐标
406
+    if js == 0:
407
+        lengs = len(gsx)
408
+        xx = 0
409
+        while xx < lengs:
410
+            gszbx.append(gsx[xx])
411
+            gszby.append(gsy[xx])
412
+            zblist1 = []
413
+            zblist1.append(listbex[xx])
414
+            zblist1.append(listbey[xx])
415
+            zblist1.append(gsx[xx])
416
+            zblist1.append(gsy[xx])
417
+            zblist1.append(xcx[xx])
418
+            zblist1.append(xcy[xx])
419
+            jslist.append(zblist1)
420
+            zblist2 = []
421
+            zblist2.append(listnewx[xx])
422
+            zblist2.append(listnewy[xx])
423
+            jslist1.append(zblist2)
424
+            xx = xx + 1
425
+        # 后面不需要经过这个if
426
+    # 判定方式是用差值平方和和位移对比
427
+    gxpd = 0
428
+    lenxc = len(xcx)
429
+    yy = 0
430
+    while yy < lenxc:
431
+        sumxcx = xcx[yy] * xcx[yy]
432
+        sumxcy = xcy[yy] * xcy[yy]
433
+        sumxc = sumxcx + sumxcy
434
+        xcpd = math.sqrt(sumxc)
435
+        if xcpd > wypd:
436
+            gxpd = -1
437
+            break
438
+        yy = yy + 1
439
+    if gxpd == 0:
440
+        # 输出之前把转换参数都算出来
441
+        # X=(z1+1)*x+z2*y+(旧重心坐标x-新重心坐标x-新重心坐标x*z1-新重心坐标y*z2+z3)
442
+        # Y=(-z2)*x+(z1+1)*y+(z1*新重心坐标y+新重心坐标x*z2+z4+旧重心坐标y-新重心坐标y)
443
+        n1 = float(arrz[0]) + 1
444
+        n2 = float(arrz[1])
445
+        s1 = zxzbnewx * float(arrz[0])
446
+        s2 = zxzbnewy * float(arrz[1])
447
+        n3 = zxzbpastx - zxzbnewx - s1 - s2 + float(arrz[2])
448
+        n4 = (-1) * float(arrz[1])
449
+        n5 = n1
450
+        s3 = (-1)*float(arrz[0])*zxzbnewy
451
+        s4 = float(arrz[1])*zxzbnewx
452
+        n6 = s3 + s4 + float(arrz[3])+zxzbpasty-zxzbnewy
453
+        sxylist = []
454
+        sxylist.append(n1)
455
+        sxylist.append(n2)
456
+        sxylist.append(n3)
457
+        sxylist.append(n4)
458
+        sxylist.append(n5)
459
+        sxylist.append(n6)
460
+        # 输出
461
+        relist1 = []
462
+        relist1.append(listname)
463
+        relist1.append(xcx)
464
+        relist1.append(xcy)
465
+        relist1.append(listcgcs)
466
+        relist1.append(gszbx)
467
+        relist1.append(gszby)
468
+        relist1.append(sxylist)
469
+        #存入数据库
470
+        insert_into_database1(dbpath,lastname,finalname,befname,file_name,listname1,listpastx1,listpasty1,listcgcs1,listbex,listbey,sxylist,wypd,gsx,gsy,listcgcs)
471
+    else:
472
+            # 先把所有的合在一起,方便删除
473
+            lenlist1 = len(xcx)
474
+            ii = 0
475
+            relist1 = []
476
+            while ii < lenlist1:
477
+                smlist1 = []
478
+                nn2 = xcx[ii] * xcx[ii]
479
+                mm2 = xcy[ii] * xcy[ii]
480
+                nm2 = math.sqrt(nn2 + mm2)
481
+                smlist1.append(nm2)
482
+                smlist1.append(listname[ii])
483
+                smlist1.append(listnewx[ii])
484
+                smlist1.append(listnewy[ii])
485
+                smlist1.append(listpastx[ii])
486
+                smlist1.append(listpasty[ii])
487
+                relist1.append(smlist1)
488
+                ii = ii + 1
489
+            # 直接删除最大的那个
490
+            relist1.sort(key=takeFirst, reverse=True)
491
+            num1 = relist1[0]
492
+            # 获取name
493
+            num2 = num1[1]
494
+            ii2 = 0
495
+            mm2 = 0
496
+            while ii2 < lenlist1:
497
+                if listname[ii2] == num2:
498
+                    del listname[ii2]
499
+                    del listnewx[ii2]
500
+                    del listnewy[ii2]
501
+                    del listpastx[ii2]
502
+                    del listpasty[ii2]
503
+                    points = points - 1
504
+                    break
505
+                else:
506
+                    ii2 = ii2 + 1
507
+            while mm2 < len(listcgcs):
508
+                if listname1[mm2] == num2:
509
+                    listcgcs[mm2] = -1
510
+                    break
511
+                else:
512
+                    mm2 = mm2 + 1
513
+            print(" Finish!")
514
+            js1 = 1
515
+            bhjs(listcgcs1, listname1, listpastx1, listpasty1, wypd, listname, listnewx, listnewy, listpastx,
516
+                 listpasty, points, listcgcs, listbex, listbey, sf, dbpath, befname, finalname, lastname, js1,file_name)
517
+
518
+def tablein(dbpath,file_name):
519
+    # 收集每一列的数据,方便后期计算
520
+    listname1 = []
521
+    listpastx1 = []
522
+    listpasty1 = []
523
+    listcgcs1 = []
524
+    listname = []
525
+    listnewx = []
526
+    listnewy = []
527
+    listpastx = []
528
+    listpasty = []
529
+    # 成果次数
530
+    listcgcs = []
531
+    # 最早的
532
+    listbex = []
533
+    listbey = []
534
+    points = 0
535
+    #查询,提取需要的数据
536
+    db2 = sqlite3.connect(dbpath)
537
+    cursor2 = db2.cursor()
538
+    utfstr1 = to_utf8(file_name)
539
+    sqlstr1 = 'SELECT * FROM WD_Input_Point WHERE TableName = ?'
540
+    cursor2.execute(sqlstr1,(utfstr1,))
541
+    all_da = cursor2.fetchall()
542
+    for da in all_da:
543
+        listbex.append(da[4])
544
+        listbey.append(da[5])
545
+        listpastx.append(da[6])
546
+        listpastx1.append(da[6])
547
+        listpasty.append(da[7])
548
+        listpasty1.append(da[7])
549
+        listnewx.append(da[8])
550
+        listnewy.append(da[9])
551
+        listcgcs.append(da[10])
552
+        listcgcs1.append(da[10])
553
+        points = points + 1
554
+        listname.append(da[11])
555
+        listname1.append(da[11])
556
+    sqlstr2 = 'SELECT * FROM WD_Input_Param WHERE TableName = ?'
557
+    cursor2.execute(sqlstr2,(utfstr1,))
558
+    all_par = cursor2.fetchall()
559
+    befname = all_par[0][0].decode('utf-8')
560
+    lastname = all_par[0][1].decode('utf-8')
561
+    finalname = all_par[0][2].decode('utf-8')    
562
+    # pjbc是平均边长
563
+    # fxzwc是方向中误差,zrbzwc是最弱边边长相对中误差,pjbcs是平均边数,pjfxs是平均方向数,sf是缩放值
564
+    # 新增总边数zbs,总方向数zfxs
565
+    # 先计算位移判断值
566
+    pjbc = all_par[0][3]
567
+    fxzwc = all_par[0][4]
568
+    zbs = all_par[0][5]
569
+    zfxs = all_par[0][7]
570
+    sf = all_par[0][9]
571
+    pjbcs = zbs / points
572
+    pjfxs = zfxs / points
573
+    # 再拆细点
574
+    wy1 = pjbc / 1000
575
+    wy2 = wy1 + 1
576
+    wypd1 = wy2 * wy2 / pjbcs
577
+    # 好像206.265是常数系数
578
+    wy3 = pjbc * fxzwc / 206.265
579
+    wypd2 = wy3 * wy3 / pjfxs
580
+    wypd3 = math.sqrt(wypd1 + wypd2)
581
+    wypd = round((wypd3 * 2 * math.sqrt(2)), 9)
582
+    wypd0 = wypd
583
+    js=0
584
+    return listcgcs1, listname1, listpastx1, listpasty1, wypd0, listname, listnewx, listnewy, listpastx,listpasty, points, listcgcs, listbex, listbey, sf, befname, finalname, lastname, js
585
+
586
+
587
+# 主函数 计算
588
+def main_function(dbpath,file_name):
589
+    #从数据库中调用
590
+    listcgcs1, listname1, listpastx1, listpasty1, wypd0, listname, listnewx, listnewy, listpastx,listpasty, points, listcgcs, listbex, listbey, sf, befname, finalname, lastname, js = tablein(dbpath,file_name)
591
+    #计算
592
+    bhjs(listcgcs1, listname1, listpastx1, listpasty1, wypd0, listname, listnewx, listnewy, listpastx,listpasty, points, listcgcs, listbex, listbey, sf, dbpath, befname, finalname, lastname, js,file_name)
593
+    messagebox.showinfo("提示",f"文件 '{file_name}' 计算成功!")

+ 181
- 166
Front/main_new.py 查看文件

@@ -13,6 +13,7 @@
13 13
 # https://doc.qt.io/qtforpython/licenses.html
14 14
 #
15 15
 # ///////////////////////////////////////////////////////////////
16
+from idlelib.searchengine import search_reverse
16 17
 
17 18
 from PySide6.QtWidgets import QFileDialog,QWidget, QVBoxLayout, QTreeWidget, QApplication, QTreeWidgetItem
18 19
 from PySide6.QtCore import Signal,  Qt, Slot, QObject
@@ -312,7 +313,7 @@ class MainWindow(QMainWindow):
312 313
     #绑定组件
313 314
     def bind(self):
314 315
         # 计算
315
-        widgets.compute.clicked.connect(self.computeClick)
316
+        # widgets.compute.clicked.connect(self.computeClick)
316 317
         widgets.search.clicked.connect(self.searchClick)
317 318
 
318 319
     #删除tableview
@@ -694,179 +695,193 @@ class MainWindow(QMainWindow):
694 695
             id = id + 1
695 696
         search_button = ElTree1(ElTreeData(sqlitem))
696 697
         search_button.itemClicked.connect(lambda extend: print("单击->扩展数据为:", extend))
697
-        search_button.itemDoubleClicked.connect(lambda extend: print("双击->扩展数据为:", extend))
698
+        search_button.itemDoubleClicked.connect(self.computeClick)
698 699
 
699 700
     #直接这个基础上改点选输出表格(未改)
700 701
     def computeClick(self):
701 702
         # GET BUTTON CLICKED
702 703
         btn = self.sender()
703 704
         btnName = btn.objectName()
705
+        #获取点击的item的text和它对应的上两个节点
706
+        select_item = self.ui.qureyTreeWidget.currentItem()
707
+        str1 = select_item.text(0)
708
+        pa_item = select_item.parent()
709
+        str2 = pa_item.text(0)
710
+        z_item = pa_item.parent()
711
+        str3 = z_item.text(0)
712
+        #数据库目录
713
+        inpath= os.path.abspath('../SQL')
714
+        dbpath= inpath + '/'+str3
715
+
716
+        jj = 0
704 717
         #处理选中的文件
705 718
         # print(file_path)
706
-        UIFunctions.compute_show_process_excel_file(self, file_path)
707
-        current_text = self.ui.comboBox_2.currentText()
708
-        db_path = r"D:\4work_now\20240819GS\ControlNetwork\ControlNetwork\UI\SQL\DataBase.db"
709
-        #转换下
710
-        excelname = os.path.basename(file_path)
711
-        utf_en = excelname.encode('utf-8')
712
-        # file_path = file_path
713
-        if current_text == "水准测段高差稳定计算":
714
-            #只显示一个tab
715
-            self.ui.tabWidget.setTabVisible(0,True)
716
-            self.ui.tabWidget.setTabVisible(1,False)
717
-            self.ui.tabWidget.setTabVisible(2,False)
718
-            #重新设置文字名称
719
-            self.ui.tabWidget.setTabText(0,'测段高差计算表')
720
-
721
-            # 计算结束自动跳转结果页面,并保留查询内容,以便输出
722
-            widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
723
-            UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
724
-            btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
725
-        elif current_text == "控制网复测平面基准计算":
726
-            #就用已有的选项卡
727
-            self.ui.tabWidget.setTabVisible(0,True)
728
-            self.ui.tabWidget.setTabVisible(1,True)
729
-            self.ui.tabWidget.setTabVisible(2,True)
730
-            #重新设置文字名称
731
-            self.ui.tabWidget.setTabText(0,'复测成果表')
732
-            self.ui.tabWidget.setTabText(1,'基准归算模型')
733
-            self.ui.tabWidget.setTabText(2,'复测基准归算表')
734
-
735
-            #链接数据库并显示
736
-            # 连接到数据库
737
-            #将结果输出到数据库
738
-            db1 = sqlite3.connect(db_path)
739
-            #获取游标
740
-            cursor1 = db1.cursor()
741
-            #查询表内符合的所有数据(分成两个结果分别显示)
742
-            #复测成果表
743
-            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 = ?'
744
-            cursor1.execute(sqlstr1,(utf_en,))
745
-            #获取结果集
746
-            result1 = cursor1.fetchall()
747
-            #基准归算表
748
-            sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
749
-            cursor1.execute(sqlstr11,(utf_en,))
750
-            #获取结果集
751
-            result2 = cursor1.fetchall()
752
-            #对结果集进行处理,把汉字转换过来,添加表头部分
753
-            nlist1,plist1 = self.Arrange_Data1(result1)    
754
-            nlist2,plist2 = self.Arrange_Data2(result2)     
755
-            # 创建一个数据模型(复测成果表)
756
-            self.model1 = QStandardItemModel()
757
-            #把数据放进去
758
-            model1 = self.Data_in_Cell1(plist1)
759
-            model2 = self.Data_in_Cell2(plist2)
760
-            #设置表头
761
-            model1.setHorizontalHeaderLabels(['点名', '前期X','前期Y','本期X', '本期Y','前期-本期X','前期-本期Y','前期-本期P','位移判定'])
762
-            model1.setVerticalHeaderLabels(nlist1)
763
-            #QTableView并将数据模型与之关联
764
-            self.ui.resultTableView.setModel(model1)
765
-            self.ui.resultTableView.show()
766
-            #设置表头
767
-            model2.setHorizontalHeaderLabels(['点名', '基准归算X','基准归算Y','前期-归算X','前期-归算Y','前期-归算P','位移判定'])
768
-            model2.setVerticalHeaderLabels(nlist2)
769
-            #QTableView并将数据模型与之关联
770
-            self.ui.reconTableView.setModel(model2)
771
-            self.ui.reconTableView.show()
772
-
773
-            #富文本的html
774
-            sqlstr2 = 'select Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
775
-            cursor1.execute(sqlstr2,(utf_en,))
776
-            #获取结果集
777
-            result1 = cursor1.fetchall() 
778
-            str1 = result1[0][0].decode('utf-8')
779
-            str2 = result1[0][1].decode('utf-8')
780
-            n1 = result1[0][2]
781
-            n2 = result1[0][3]
782
-            n3 = result1[0][4]
783
-            n4 = result1[0][5]
784
-            n5 = result1[0][6]
785
-            n6 = result1[0][7]
786
-            str0 = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
787
-<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
788
-p, li { white-space: pre-wrap; }
789
-hr { height: 1px; border-width: 0; }
790
-li.unchecked::marker { content: "\2610"; }
791
-li.checked::marker { content: "\2612"; }
792
-</style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
793
-<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>
794
-<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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n1)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n2)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n3)+"""</span><span style=" font-size:14pt;">)</span></p>
795
-<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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n4)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n5)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n6)+"""</span><span style=" font-size:14pt;">)</span></p>
796
-<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;">为</span><span style=" font-size:14pt; color:#000000;">"""+str2+"""</span><span style=" font-size:14pt;">坐标;</span></p>
797
-<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>"""
798
-            self.ui.printTableView.setHtml(str0)
799
-
800
-            # 计算结束自动跳转结果页面,并保留查询内容,以便输出
801
-            widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
802
-            UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
803
-            btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
804
-        # GS.main_function(file_path, db_path)
805
-        # 添加控制网执行代码
806
-        elif current_text=="平面控制网稳定性计算":
807
-            #只显示头两个tab
808
-            self.ui.tabWidget.setTabVisible(0,True)
809
-            self.ui.tabWidget.setTabVisible(1,True)
810
-            self.ui.tabWidget.setTabVisible(2,False)
811
-            #重新设置文字名称
812
-            self.ui.tabWidget.setTabText(0,'稳定性分析成果表')
813
-            self.ui.tabWidget.setTabText(1,'自由网成果归算模型')
814
-            #链接数据库并显示
815
-            # 连接到数据库
816
-            #将结果输出到数据库
817
-            db1 = sqlite3.connect(db_path)
818
-            #获取游标
819
-            cursor1 = db1.cursor()
820
-            #查询表内符合的所有数据
821
-            sqlstr1 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Last_Wight,Result_X,Result_Y,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass from WD_Result_Point WHERE TableName = ?'
822
-            cursor1.execute(sqlstr1,(utf_en,))
823
-            #获取结果集
824
-            result = cursor1.fetchall()
825
-            #对结果集进行处理,把汉字转换过来,添加表头部分
826
-            nlist,plist = self.Arrange_Data(result)        
827
-            # 创建一个数据模型
828
-            self.model = QStandardItemModel()
829
-            #把数据放进去
830
-            model1 = self.Data_in_Cell(plist)
831
-            #设置表头
832
-            model1.setHorizontalHeaderLabels(['点名', '首期X','首期Y','上期X', '上期Y','权','本期X','本期Y','权','本期-首期X','本期-首期Y','本期-首期P','位移判定', '本期-上期X','本期-上期Y','本期-上期P','位移判定'])
833
-            model1.setVerticalHeaderLabels(nlist)
834
-            #QTableView并将数据模型与之关联
835
-            self.ui.resultTableView.setModel(model1)
836
-            self.ui.resultTableView.show()
837
-
838
-            #富文本的html
839
-            sqlstr2 = 'select Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3 from WD_Result_Param WHERE TableName = ?'
840
-            cursor1.execute(sqlstr2,(utf_en,))
841
-            #获取结果集
842
-            result1 = cursor1.fetchall() 
843
-            str1 = result1[0][0].decode('utf-8')
844
-            str2 = result1[0][1].decode('utf-8')
845
-            n1 = result1[0][2]
846
-            n2 = result1[0][3]
847
-            n3 = result1[0][4]
848
-            n4 = result1[0][5]
849
-            n5 = result1[0][6]
850
-            n6 = result1[0][7]
851
-            str0 = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
852
-<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
853
-p, li { white-space: pre-wrap; }
854
-hr { height: 1px; border-width: 0; }
855
-li.unchecked::marker { content: "\2610"; }
856
-li.checked::marker { content: "\2612"; }
857
-</style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
858
-<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>
859
-<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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n1)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n2)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n3)+"""</span><span style=" font-size:14pt;">)</span></p>
860
-<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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n4)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n5)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n6)+"""</span><span style=" font-size:14pt;">)</span></p>
861
-<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;">为</span><span style=" font-size:14pt; color:#000000;">"""+str2+"""</span><span style=" font-size:14pt;">坐标;</span></p>
862
-<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>"""
863
-            self.ui.printTableView.setHtml(str0)
864
-
865
-        #----------------------------------------------------------
866
-        # 计算结束自动跳转结果页面,并保留查询内容,以便输出
867
-            widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
868
-            UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
869
-            btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
719
+        # print(self.extend)
720
+#         file_path = ''
721
+#         UIFunctions.compute_show_process_excel_file(self, file_path)
722
+#         current_text = self.ui.comboBox_2.currentText()
723
+#         db_path = r"D:\4work_now\20240819GS\ControlNetwork\ControlNetwork\UI\SQL\DataBase.db"
724
+#         #转换下
725
+#         excelname = os.path.basename(file_path)
726
+#         utf_en = excelname.encode('utf-8')
727
+#         # file_path = file_path
728
+#         if current_text == "水准测段高差稳定计算":
729
+#             #只显示一个tab
730
+#             self.ui.tabWidget.setTabVisible(0,True)
731
+#             self.ui.tabWidget.setTabVisible(1,False)
732
+#             self.ui.tabWidget.setTabVisible(2,False)
733
+#             #重新设置文字名称
734
+#             self.ui.tabWidget.setTabText(0,'测段高差计算表')
735
+#
736
+#             # 计算结束自动跳转结果页面,并保留查询内容,以便输出
737
+#             widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
738
+#             UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
739
+#             btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
740
+#         elif current_text == "控制网复测平面基准计算":
741
+#             #就用已有的选项卡
742
+#             self.ui.tabWidget.setTabVisible(0,True)
743
+#             self.ui.tabWidget.setTabVisible(1,True)
744
+#             self.ui.tabWidget.setTabVisible(2,True)
745
+#             #重新设置文字名称
746
+#             self.ui.tabWidget.setTabText(0,'复测成果表')
747
+#             self.ui.tabWidget.setTabText(1,'基准归算模型')
748
+#             self.ui.tabWidget.setTabText(2,'复测基准归算表')
749
+#
750
+#             #链接数据库并显示
751
+#             # 连接到数据库
752
+#             #将结果输出到数据库
753
+#             db1 = sqlite3.connect(db_path)
754
+#             #获取游标
755
+#             cursor1 = db1.cursor()
756
+#             #查询表内符合的所有数据(分成两个结果分别显示)
757
+#             #复测成果表
758
+#             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 = ?'
759
+#             cursor1.execute(sqlstr1,(utf_en,))
760
+#             #获取结果集
761
+#             result1 = cursor1.fetchall()
762
+#             #基准归算表
763
+#             sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
764
+#             cursor1.execute(sqlstr11,(utf_en,))
765
+#             #获取结果集
766
+#             result2 = cursor1.fetchall()
767
+#             #对结果集进行处理,把汉字转换过来,添加表头部分
768
+#             nlist1,plist1 = self.Arrange_Data1(result1)
769
+#             nlist2,plist2 = self.Arrange_Data2(result2)
770
+#             # 创建一个数据模型(复测成果表)
771
+#             self.model1 = QStandardItemModel()
772
+#             #把数据放进去
773
+#             model1 = self.Data_in_Cell1(plist1)
774
+#             model2 = self.Data_in_Cell2(plist2)
775
+#             #设置表头
776
+#             model1.setHorizontalHeaderLabels(['点名', '前期X','前期Y','本期X', '本期Y','前期-本期X','前期-本期Y','前期-本期P','位移判定'])
777
+#             model1.setVerticalHeaderLabels(nlist1)
778
+#             #QTableView并将数据模型与之关联
779
+#             self.ui.resultTableView.setModel(model1)
780
+#             self.ui.resultTableView.show()
781
+#             #设置表头
782
+#             model2.setHorizontalHeaderLabels(['点名', '基准归算X','基准归算Y','前期-归算X','前期-归算Y','前期-归算P','位移判定'])
783
+#             model2.setVerticalHeaderLabels(nlist2)
784
+#             #QTableView并将数据模型与之关联
785
+#             self.ui.reconTableView.setModel(model2)
786
+#             self.ui.reconTableView.show()
787
+#
788
+#             #富文本的html
789
+#             sqlstr2 = 'select Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
790
+#             cursor1.execute(sqlstr2,(utf_en,))
791
+#             #获取结果集
792
+#             result1 = cursor1.fetchall()
793
+#             str1 = result1[0][0].decode('utf-8')
794
+#             str2 = result1[0][1].decode('utf-8')
795
+#             n1 = result1[0][2]
796
+#             n2 = result1[0][3]
797
+#             n3 = result1[0][4]
798
+#             n4 = result1[0][5]
799
+#             n5 = result1[0][6]
800
+#             n6 = result1[0][7]
801
+#             str0 = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
802
+# <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
803
+# p, li { white-space: pre-wrap; }
804
+# hr { height: 1px; border-width: 0; }
805
+# li.unchecked::marker { content: "\2610"; }
806
+# li.checked::marker { content: "\2612"; }
807
+# </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
808
+# <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>
809
+# <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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n1)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n2)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n3)+"""</span><span style=" font-size:14pt;">)</span></p>
810
+# <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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n4)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n5)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n6)+"""</span><span style=" font-size:14pt;">)</span></p>
811
+# <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;">为</span><span style=" font-size:14pt; color:#000000;">"""+str2+"""</span><span style=" font-size:14pt;">坐标;</span></p>
812
+# <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>"""
813
+#             self.ui.printTableView.setHtml(str0)
814
+#
815
+#             # 计算结束自动跳转结果页面,并保留查询内容,以便输出
816
+#             widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
817
+#             UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
818
+#             btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
819
+#         # GS.main_function(file_path, db_path)
820
+#         # 添加控制网执行代码
821
+#         elif current_text=="平面控制网稳定性计算":
822
+#             #只显示头两个tab
823
+#             self.ui.tabWidget.setTabVisible(0,True)
824
+#             self.ui.tabWidget.setTabVisible(1,True)
825
+#             self.ui.tabWidget.setTabVisible(2,False)
826
+#             #重新设置文字名称
827
+#             self.ui.tabWidget.setTabText(0,'稳定性分析成果表')
828
+#             self.ui.tabWidget.setTabText(1,'自由网成果归算模型')
829
+#             #链接数据库并显示
830
+#             # 连接到数据库
831
+#             #将结果输出到数据库
832
+#             db1 = sqlite3.connect(db_path)
833
+#             #获取游标
834
+#             cursor1 = db1.cursor()
835
+#             #查询表内符合的所有数据
836
+#             sqlstr1 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Last_Wight,Result_X,Result_Y,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass from WD_Result_Point WHERE TableName = ?'
837
+#             cursor1.execute(sqlstr1,(utf_en,))
838
+#             #获取结果集
839
+#             result = cursor1.fetchall()
840
+#             #对结果集进行处理,把汉字转换过来,添加表头部分
841
+#             nlist,plist = self.Arrange_Data(result)
842
+#             # 创建一个数据模型
843
+#             self.model = QStandardItemModel()
844
+#             #把数据放进去
845
+#             model1 = self.Data_in_Cell(plist)
846
+#             #设置表头
847
+#             model1.setHorizontalHeaderLabels(['点名', '首期X','首期Y','上期X', '上期Y','权','本期X','本期Y','权','本期-首期X','本期-首期Y','本期-首期P','位移判定', '本期-上期X','本期-上期Y','本期-上期P','位移判定'])
848
+#             model1.setVerticalHeaderLabels(nlist)
849
+#             #QTableView并将数据模型与之关联
850
+#             self.ui.resultTableView.setModel(model1)
851
+#             self.ui.resultTableView.show()
852
+#
853
+#             #富文本的html
854
+#             sqlstr2 = 'select Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3 from WD_Result_Param WHERE TableName = ?'
855
+#             cursor1.execute(sqlstr2,(utf_en,))
856
+#             #获取结果集
857
+#             result1 = cursor1.fetchall()
858
+#             str1 = result1[0][0].decode('utf-8')
859
+#             str2 = result1[0][1].decode('utf-8')
860
+#             n1 = result1[0][2]
861
+#             n2 = result1[0][3]
862
+#             n3 = result1[0][4]
863
+#             n4 = result1[0][5]
864
+#             n5 = result1[0][6]
865
+#             n6 = result1[0][7]
866
+#             str0 = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
867
+# <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
868
+# p, li { white-space: pre-wrap; }
869
+# hr { height: 1px; border-width: 0; }
870
+# li.unchecked::marker { content: "\2610"; }
871
+# li.checked::marker { content: "\2612"; }
872
+# </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
873
+# <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>
874
+# <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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n1)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n2)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n3)+"""</span><span style=" font-size:14pt;">)</span></p>
875
+# <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;">=(</span><span style=" font-size:14pt; color:#aa0000;">"""+str(n4)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">"""+str(n5)+"""</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">"""+str(n6)+"""</span><span style=" font-size:14pt;">)</span></p>
876
+# <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;">为</span><span style=" font-size:14pt; color:#000000;">"""+str2+"""</span><span style=" font-size:14pt;">坐标;</span></p>
877
+# <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>"""
878
+#             self.ui.printTableView.setHtml(str0)
879
+#
880
+#         #----------------------------------------------------------
881
+#         # 计算结束自动跳转结果页面,并保留查询内容,以便输出
882
+#             widgets.stackedWidget.setCurrentWidget(widgets.new_page)  # SET PAGE
883
+#             UIFunctions.resetStyle(self, btnName)  # RESET ANOTHERS BUTTONS SELECTED
884
+#             btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))  # SELECT MENU
870 885
 
871 886
 
872 887
     # 点击事件

正在加载...
取消
保存