-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclosedPolygonal.py
699 lines (636 loc) · 42.2 KB
/
closedPolygonal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
# -*- coding: utf-8 -*-
"""
closedPolygonal.py
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Leandro França'
__date__ = '2019-10-06'
__copyright__ = '(C) 2019, Leandro França'
from PyQt5.QtCore import QCoreApplication, QVariant
from qgis.core import *
import processing
from numpy import sin, cos, modf, radians, sqrt, floor
class ClosedPolygonal(QgsProcessingAlgorithm):
TABLE = 'TABLE'
POINT = 'POINT'
AZIMUTH_0 = 'AZIMUTH_0'
STATION = 'STATION'
FWD = 'FWD'
ANGLE = 'ANGLE'
DISTANCE = 'DISTANCE'
POINTS = 'POINTS'
CRS = 'CRS'
HTML = 'HTML'
LOC = QgsApplication.locale()
def translate(self, string):
return QCoreApplication.translate('Processing', string)
def tr(self, *string):
# Traduzir para o portugês: arg[0] - english (translate), arg[1] - português
if self.LOC == 'pt':
if len(string) == 2:
return string[1]
else:
return self.translate(string[0])
else:
return self.translate(string[0])
def createInstance(self):
return ClosedPolygonal()
def name(self):
return 'planimetry'
def displayName(self):
return self.tr('Closed Polygonal', 'Poligonal Fechada')
def group(self):
return self.tr('LF Survey', 'LF Agrimensura')
def groupId(self):
return 'lf_survey'
def shortHelpString(self):
return self.tr("")
def shortHelpString(self):
txt_en = 'Calculates the adjusted coordinates from angles and horizontal distances of a Closed Polygonal'
txt_pt = 'Cálculo das coordenadas ajustadas a partir de medições de ângulos e distâncias de uma poligonal fechada.'
dic_BW = {'face': 'iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAMMwAADDMBUlqVhwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIUSURBVEiJvZa9quJAGIbfMfEYTUSUQAqLYOnehJobsBTlHLbRQtKKlY3lObegxRa7pRdg7y0saiuoKAErMZif2Squ2eTEOCfsC1Pk+3uYb2YyQwCg1+u9UUqHAKoAOCQrB8ASwPt0Ov1JdF3/bprmj4QhoXp5eXnjTdMcUEr/Bw+WZQ15Smn1q4UIIZBlGaIoghBys2+3W1yv19u367rfeAAc6ww5jkOz2USj0YAoigH/aDTCbrfzpfCUUrAC2+02NE2LjPm3NjNQkiTU6/WHsFAgi1RVRSqVCthd171BwmozA/P5fMA2n88xm81g2zYAwHGccCAL9H43elosFrhcLpE5zMCwHMdxImtRSp8DptNpZDIZAIAgCAG/IAi+42Ga5q29nkin06FxgZqmodvtxooFgPF4jPV67bM9NcNnW384HJI7h49kWRZOp9PXgOfzGfv9HgCQy+VQKBR8fsMwYFkWAOB4PMJ13UAN0mq1Yq/hfVytVoOu6z7/YDDAZrP5Wzzk6CR6LOLEJLqGcWrxYX2OW5wJmOQOjQX0ApOERgIrlQoTUJblgK1cLodeWZ4IIeDDngZx5P1T75XNZiFJUmQeTyl1wPAW/awrD7rlpDiOW3qL/cz4DBY1CCG/U4qifDw7O1YpivJBAGAymbwahjG0bbtKKeXjJJdKJaiq6rOtVqvAjU8IsTmOWxa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qt93x3v++e3f/3TvhGgYHBx/UarUUEAMeA48A/3WxDagBf4A9EdmsVqsfd3d3j64GyeWDZDJpFAqFKWAC6G6haCPKIjKTzWbfA+4/Ev39/V2dnZ3LwNP/UPwqaycnJy9yuVwFQF2cVIFA4PMdCQAMBQKBL8lk0gAwACzLmtJav7kjgTp95XK5ViwWf0g0Gg36/f7fQLBRltYaEWkU5hkRKTmO06dM03ztRaAuEQ6H0Vq3RUJrHTIM46XR29v7jvNt2BClFEtLS0QiEfb39ymVSrfujIg4Cog0mxiPx1lYWGBycpKenh5c122cdANa64gCHra6QCKRYHl5mfHxcYLBII7jtLJMWAEdrUrUSaVSrK6uMjo6SigU4uzsrJn0DtU4xhs+n4+xsTFWVlYYHh6mq6vL821qm0Qd0zSZmJggk8kQi8XuR6LO1tYW+XzeUzd87S6ey+WYnZ0ln88jIijV+DrbJnF4eMj09DTb29u4rtvU+8MHVLnFDjk+PiadTrO+vs7p6WkrS1R9QAGPb8zLaK2Zm5tjcXGRSqXiqe03sO8D9pqVyGQyzM/PUywWMQzjNgIAv3xa600Ree4l2nEcRkZGODg4QCmFYRi3KQ6AiGzIwMBAt2EYB9znp9y27bLWesZjUtsELkjbtl2ur6osy/qqtX7W7io3ISIb2Wx2CHDrT5TrOE4SWLsjgW+O4yS4mLiv9ldZljWptX6Lx2mrSY6A9M7OzgeuG/kvE41Gg6ZpvhKROPCE85mj5Z8fEfnpuu5313U/2bZdvhr0F9Fo9phaoDu9AAAAAElFTkSuQmCC'}
footer = '''<div align="right">
<p align="right"><b>'''+self.tr('Author: Leandro Franca', 'Autor: Leandro França')+'''</b></p>
<div align="right">
<a target="_blank" rel="noopener noreferrer" href="https://www.udemy.com/user/leandro-luiz-silva-de-franca/"><img title="Udemy" src="data:image/png;base64,'''+dic_BW['udemy']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="https://www.facebook.com/GEOCAPT/"><img title="Facebook" src="data:image/png;base64,'''+dic_BW['face']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="https://www.youtube.com/channel/UCLrewDGciytcBG9r0OxTW2w"><img title="Youtube" src="data:image/png;base64,'''+dic_BW['youtube']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="https://www.researchgate.net/profile/Leandro_Franca2"><img title="ResearchGate" src="data:image/png;base64,'''+dic_BW['RG']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="https://github.com/LEOXINGU"><img title="GitHub" src="data:image/png;base64,'''+dic_BW['github']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="https://www.linkedin.com/in/leandro-fran%C3%A7a-93093714b/"><img title="Linkedin" src="data:image/png;base64,'''+dic_BW['linkedin']+'''"></a> <a target="_blank" rel="noopener noreferrer" href="http://lattes.cnpq.br/8559852745183879"><img title="Lattes" src="data:image/png;base64,'''+dic_BW['lattes']+'''"></a>
</div>
</div>'''
return self.tr(txt_en, txt_pt) + footer
def initAlgorithm(self, config=None):
# INPUT
self.addParameter(
QgsProcessingParameterFeatureSource(
self.TABLE,
self.tr('Table of observations'),
[QgsProcessing.TypeVector]
)
)
self.addParameter(
QgsProcessingParameterPoint(
self.POINT,
self.tr('Origin Point Coordinates', 'Coordenadas do ponto inicial'),
defaultValue = QgsPoint(1000.0, 1000.0)
)
)
self.addParameter(
QgsProcessingParameterString(
self.AZIMUTH_0,
self.tr('Azimuth (origin)'),
defaultValue = '''0°00'00.0"'''
)
)
self.addParameter(
QgsProcessingParameterField(
self.STATION,
self.tr('Station'),
parentLayerParameterName=self.TABLE,
type=QgsProcessingParameterField.Numeric
)
)
self.addParameter(
QgsProcessingParameterField(
self.FWD,
self.tr('Forward'),
parentLayerParameterName=self.TABLE,
type=QgsProcessingParameterField.Numeric
)
)
self.addParameter(
QgsProcessingParameterField(
self.ANGLE,
self.tr('Angle'),
parentLayerParameterName=self.TABLE,
type=QgsProcessingParameterField.String
)
)
self.addParameter(
QgsProcessingParameterField(
self.DISTANCE,
self.tr('Distance'),
parentLayerParameterName=self.TABLE,
type=QgsProcessingParameterField.Numeric
)
)
self.addParameter(
QgsProcessingParameterCrs(
self.CRS,
self.tr('Coordinates Reference System'),
'ProjectCrs'
)
)
# OUTPUT
self.addParameter(
QgsProcessingParameterFeatureSink(
self.POINTS,
self.tr('Adjusted Points')
)
)
self.addParameter(
QgsProcessingParameterFileDestination(
'HTML',
self.tr('Adjustment Report'),
self.tr('HTML files (*.html)')
)
)
def azimute(self, A,B):
# Cálculo dos Azimutes entre dois pontos (Vetor AB origem A extremidade B)
if ((B.x()-A.x())>=0 and (B.y()-A.y())>0): #1º quadrante
AzAB=atan((B.x()-A.x())/(B.y()-A.y()))
AzBA=AzAB+pi
elif ((B.x()-A.x())>0 and(B.y()-A.y())<0): #2º quadrante
AzAB=pi+atan((B.x()-A.x())/(B.y()-A.y()))
AzBA=AzAB+pi
elif ((B.x()-A.x())<=0 and(B.y()-A.y())<0): #3º quadrante
AzAB=atan((B.x()-A.x())/(B.y()-A.y()))+pi
AzBA=AzAB-pi
elif ((B.x()-A.x())<0 and(B.y()-A.y())>0): #4º quadrante
AzAB=2*pi+atan((B.x()-A.x())/(B.y()-A.y()))
AzBA=AzAB+pi
elif ((B.x()-A.x())>0 and(B.y()-A.y())==0): # no eixo positivo de x (90º)
AzAB=pi/2
AzBA=1.5*pi
else: # ((B.x()-A.x())<0 and(B.y()-A.y())==0) # no eixo negativo de x (270º)
AzAB=1.5*pi
AzBA=pi/2
# Correção dos ângulos para o intervalo de 0 a 2pi
if AzAB<0 or AzAB>2*pi:
if (AzAB<0):
AzAB=AzAB+2*pi
else:
AzAB=AzAB-2*pi
if AzBA<0 or AzBA>2*pi:
if (AzBA<0):
AzBA=AzBA+2*pi
else:
AzBA=AzBA-2*pi
return (AzAB, AzBA)
def dms2dd(self, txt):
txt = txt.replace(' ','').replace(',','.')
newtxt =''
for letter in txt:
if not letter.isnumeric() and letter != '.' and letter != '-':
newtxt += '|'
else:
newtxt += letter
lista = newtxt[:-1].split('|')
if len(lista) != 3: # GMS
return None
else:
if '-' in lista[0]:
return -1*(abs(float(lista[0])) + float(lista[1])/60 + float(lista[2])/3600)
else:
return float(lista[0]) + float(lista[1])/60 + float(lista[2])/3600
def dd2dms(self, dd, n_digits):
if dd != 0:
graus = int(floor(abs(dd)))
resto = round(abs(dd) - graus, 10)
if dd < 0:
texto = '-' + str(graus) + '°'
else:
texto = str(graus) + '°'
minutos = int(floor(60*resto))
resto = round(resto*60 - minutos, 10)
texto = texto + '{:02d}'.format(minutos) + "'"
segundos = resto*60
if n_digits < 1:
texto = texto + '{:02d}'.format(int(segundos)) + '"'
else:
texto = texto + ('{:0' + str(3+n_digits) + '.' + str(n_digits) + 'f}').format(segundos) + '"'
return texto
else:
return "0°00'" + ('{:0' + str(3+n_digits) + '.' + str(n_digits) + 'f}').format(0)
def str2HTML(self, texto):
if texto:
dicHTML = {'Á': 'Á', 'á': 'á', 'Â': 'Â', 'â': 'â', 'À': 'À', 'à': 'à', 'Å': 'Å', 'å': 'å', 'Ã': 'Ã', 'ã': 'ã', 'Ä': 'Ä', 'ä': 'ä', 'Æ': 'Æ', 'æ': 'æ', 'É': 'É', 'é': 'é', 'Ê': 'Ê', 'ê': 'ê', 'È': 'È', 'è': 'è', 'Ë': 'Ë', 'ë': 'Ë', 'Ð': 'Ð', 'ð': 'ð', 'Í': 'Í', 'í': 'í', 'Î': 'Î', 'î': 'î', 'Ì': 'Ì', 'ì': 'ì', 'Ï': 'Ï', 'ï': 'ï', 'Ó': 'Ó', 'ó': 'ó', 'Ô': 'Ô', 'ô': 'ô', 'Ò': 'Ò', 'ò': 'ò', 'Ø': 'Ø', 'ø': 'ø', 'Ù': 'Ù', 'ù': 'ù', 'Ü': 'Ü', 'ü': 'ü', 'Ç': 'Ç', 'ç': 'ç', 'Ñ': 'Ñ', 'ñ': 'ñ', 'Ý': 'Ý', 'ý': 'ý', '"': '"', '”': '"', '<': '<', '>': '>', '®': '®', '©': '©', '\'': ''', 'ª': 'ª', 'º': 'º', '°':'°'}
for item in dicHTML:
if item in texto:
texto = texto.replace(item, dicHTML[item])
return texto
else:
return ''
def processAlgorithm(self, parameters, context, feedback):
table = self.parameterAsSource(
parameters,
self.TABLE,
context
)
if table is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.TABLE))
ponto = self.parameterAsPoint(
parameters,
self.POINT,
context
)
E_0 = ponto.x()
N_0 = ponto.y()
Az_0 = self.parameterAsString(
parameters,
self.AZIMUTH_0,
context
)
stations = self.parameterAsFields(
parameters,
self.STATION,
context
)
fwds = self.parameterAsFields(
parameters,
self.FWD,
context
)
angles = self.parameterAsFields(
parameters,
self.ANGLE,
context
)
distances = self.parameterAsFields(
parameters,
self.DISTANCE,
context
)
html_output = self.parameterAsFileOutput(
parameters,
self.HTML,
context
)
CRS = self.parameterAsCrs(
parameters,
self.CRS,
context
)
# Field index
station_id = table.fields().indexFromName(stations[0])
#back_id = table.fields().indexFromName('Pto_Ré')
fwd_id = table.fields().indexFromName(fwds[0])
angle_id = table.fields().indexFromName(angles[0])
dist_id = table.fields().indexFromName(distances[0])
readings = {}
SomaAng = 0
for feat in table.getFeatures():
att = feat.attributes()
SomaAng += self.dms2dd(att[angle_id])
readings[att[station_id]] = {'fwd':att[fwd_id] , 'angle': self.dms2dd(att[angle_id]) , 'dist':att[dist_id]}
n = len(readings)
# Erro de Fechamento Angular (ângulos internos - sentido anti-horário)
E_alfa = SomaAng - (n-2)*180
# Compensação do Erro de Fechamento Angular
C_alfa = - E_alfa/n
SomaAng_Comp = 0
for est in readings:
readings[est]['angle_comp'] = readings[est]['angle'] + C_alfa
SomaAng_Comp += readings[est]['angle'] + C_alfa
# Cálculo dos Azimutes e Deltas
Az_0 = self.dms2dd(Az_0)
Az = Az_0
soma_delta_x = 0
soma_delta_y = 0
perimetro = 0
for est in readings:
if est !=1:
Az = readings[est]['angle_comp'] + Az + 180
readings[est]['Az'] = Az%360
delta_x = readings[est]['dist']*cos(radians(90-Az))
delta_y = readings[est]['dist']*sin(radians(90-Az))
readings[est]['delta_x'] = delta_x
readings[est]['delta_y'] = delta_y
soma_delta_x += delta_x
soma_delta_y += delta_y
perimetro += readings[est]['dist']
E_linear = sqrt(soma_delta_x**2 + soma_delta_y**2)
Precisao = '1/'+ str(round(perimetro/E_linear,4))
soma_delta_x, soma_delta_y = 0,0 ################################## APAGAR
# Compensação Linear
for est in readings:
readings[est]['delta_x_comp'] = readings[est]['delta_x'] - soma_delta_x*readings[est]['dist']/perimetro
readings[est]['delta_y_comp'] = readings[est]['delta_y'] - soma_delta_y*readings[est]['dist']/perimetro
# Coordenadas Finais
E = E_0
N = N_0
for est in readings:
if est ==1:
readings[est]['E'] = E
readings[est]['N'] = N
else:
readings[est]['E'] = readings[est-1]['E'] + readings[est-1]['delta_x_comp']
readings[est]['N'] = readings[est-1]['N'] + readings[est-1]['delta_y_comp']
# Relatório
texto_inicial = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Traditional</title>
</head>
<body>
<p style="line-height: 107%;" align="center"><font
style="font-size: 12pt;" size="3"><b>ADJUSTMENT
BY TRADITIONAL METHOD</b></font></p>
<p align="center"> </p>
<p align="center"><u>ANALYTICAL CALCULATION
TOPOGRAPHY</u></p>
<table cellpadding="2" cellspacing="0" width="1204">
<colgroup><col width="96"></colgroup> <colgroup><col
width="96"><col width="96"><col width="96"><col
width="96"><col width="96"><col width="96"><col
width="96"><col width="96"><col width="96"><col
width="96"><col width="96"></colgroup> <tbody>
<tr valign="top">
<td style="border: 1pt solid rgb(0, 0, 0); padding: 0.05cm;"
width="96">
<p align="center">Station</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Forward</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Angle</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Distance</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Corrected Angle</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Azimuth</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">dE</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">dN</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Corrected </p>
<p align="center">dE</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Corrected </p>
<p align="center">dN</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Final E</p>
</td>
<td
style="border-style: solid solid solid none; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0.05cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">Final N</p>
</td>
</tr>'''
texto_tabela =''' <tr valign="top">
<td
style="border-style: none solid solid; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0); border-width: medium 1pt 1pt; padding: 0cm 0.05cm 0.05cm;"
width="96">
<p align="center">[Sn]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[fSn]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[An]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[d]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[cA]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[Az]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[dE]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[dN]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[cdE]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[cdN]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[fE]</p>
</td>
<td
style="border-style: none solid solid none; border-color: -moz-use-text-color rgb(0, 0, 0) rgb(0, 0, 0) -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 0.05cm 0.05cm 0cm;"
width="96">
<p align="center">[fN]</p>
</td>
</tr>'''
texto_final =''' <tr valign="top">
<td colspan="2"
style="border: medium none ; padding: 0cm;" width="197">
<p style="text-align: right;">Sum:</p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center">[SumAn] </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> [SumD]</p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center">[SumCAng] </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> [SumdE]</p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> [SumdN]</p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center">[SumCdE] </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> [SumCdN] </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> </p>
</td>
<td style="border: medium none ; padding: 0cm;"
width="96">
<p align="center"> </p>
</td>
</tr>
</tbody>
</table>
<p align="center"> </p>
<p lang="en-US">Angular closure error: [Ace]</p>
<p lang="en-US">Linear closure error: [Lce]</p>
<p lang="en-US">Linear relative error: [Lre]</p>
<p> </p>
<p> </p>
<p align="center" lang="en-US">_________________________________________</p>
<p align="center" lang="en-US">LEANDRO
FRANÇA</p>
<p align="center" lang="en-US">Cartographic Engineer</p>
<p> </p>
<p><a href="mailto:[email protected]"><span
lang="en-US">[email protected]</span></a></p>
<p><a href="https://www.facebook.com/GEOCAPT/"><span
lang="en-US">https://www.facebook.com/GEOCAPT/</span></a></p>
<p> </p>
<p style="margin-bottom: 0cm; line-height: 100%;"><br>
</p>
</body>
</html>
'''
texto = texto_inicial
# Alimentando tabela
for est in readings:
tableRowN = texto_tabela
itens = {
'[Sn]' : str(est),
'[fSn]': str(readings[est]['fwd']),
'[An]': self.str2HTML(self.dd2dms(readings[est]['angle'],1)),
'[d]': str(round(readings[est]['dist'],4)),
'[cA]': self.str2HTML(self.dd2dms(readings[est]['angle_comp'],1)),
'[Az]': self.str2HTML(self.dd2dms(readings[est]['Az'],1)),
'[dE]': str(round(readings[est]['delta_x'],4)),
'[dN]': str(round(readings[est]['delta_y'],4)),
'[cdE]': str(round(readings[est]['delta_x_comp'],4)),
'[cdN]': str(round(readings[est]['delta_y_comp'],4)),
'[fE]': str(round(readings[est]['E'],4)),
'[fN]': str(round(readings[est]['N'],4))
}
for item in itens:
tableRowN = tableRowN.replace(item, itens[item])
texto += tableRowN
# Dados finais
itens = {
'[SumAn]' : self.str2HTML(self.dd2dms(SomaAng,1)),
'[SumD]': str(perimetro),
'[SumCAng]': self.str2HTML(self.dd2dms(SomaAng_Comp,1)),
'[SumdE]': str(round(soma_delta_x,4)),
'[SumdN]': str(round(soma_delta_y,4)),
'[SumCdE]': str(0),
'[SumCdN]': str(0),
'[Ace]': self.str2HTML(self.dd2dms(E_alfa,2)),
'[Lce]': str(round(E_linear,4)),
'[Lre]': Precisao
}
for item in itens:
texto_final = texto_final.replace(item, itens[item])
texto += texto_final
# Exportar HTML
arq = open(html_output, 'w')
arq.write(texto)
arq.close()
# Camada de Saída
GeomType = QgsWkbTypes.Point
Fields = QgsFields()
itens = {
'estation' : QVariant.Int,
'forward': QVariant.Int,
'angle': QVariant.String,
'distance': QVariant.Double,
'corrAng': QVariant.String,
'azimuth': QVariant.String,
'deltaE': QVariant.Double,
'deltaN': QVariant.Double,
'CdeltaE': QVariant.Double,
'CdeltaN': QVariant.Double,
'E': QVariant.Double,
'N': QVariant.Double,
}
for item in itens:
Fields.append(QgsField(item, itens[item]))
(sink, dest_id) = self.parameterAsSink(
parameters,
self.POINTS,
context,
Fields,
GeomType,
CRS
)
if sink is None:
raise QgsProcessingException(self.invalidSinkError(parameters, self.POINTS))
# Criar pontos ajustados
feat = QgsFeature(Fields)
for est in readings:
itens = {
'estation' : str(est),
'forward': str(readings[est]['fwd']),
'angle': self.dd2dms(readings[est]['angle'],1),
'distance': str(round(readings[est]['dist'],4)),
'corrAng': self.dd2dms(readings[est]['angle_comp'],1),
'azimuth': self.dd2dms(readings[est]['Az'],1),
'deltaE': str(round(readings[est]['delta_x'],4)),
'deltaN': str(round(readings[est]['delta_y'],4)),
'CdeltaE': str(round(readings[est]['delta_x_comp'],4)),
'CdeltaN': str(round(readings[est]['delta_y_comp'],4)),
'E': str(round(readings[est]['E'],4)),
'N': str(round(readings[est]['N'],4))
}
for item in itens:
feat[item] = itens[item]
geom = QgsGeometry.fromPointXY(QgsPointXY(readings[est]['E'], readings[est]['N']))
feat.setGeometry(geom)
sink.addFeature(feat, QgsFeatureSink.FastInsert)
if feedback.isCanceled():
break
feedback.pushInfo(self.tr('Operation completed successfully!'))
feedback.pushInfo('Leandro França - Eng Cart')
return {self.POINTS: dest_id,
self.HTML: html_output}