-
Notifications
You must be signed in to change notification settings - Fork 1
/
Visualiser.py
891 lines (821 loc) · 44 KB
/
Visualiser.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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
#-- Visualiser.py as part of Plugin
# -- Created by James Gripper
# -- November 2016
# -*- coding: utf-8 -*-#
from PyQt4 import QtCore, QtGui
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from geopy.distance import vincenty
import sys
def printf(format, *args):
sys.stdout.write(format % args)
num_tx = str(0)
num_rx = str(0)
a = []
b = []
x = []
y = []
z = []
num_transmitters = 0
num_receivers = 0
tx_names = []
rx_names = []
## tx arrays
tx = []
ty = []
tz = []
## rx arrays
rx = []
ry = []
rz = []
## target arrays
rcs =''
ox = ['0']
oy = ['0']
oz = ['0']
## caluclates the distance between two coordinates on earth
def distance(x,y,x1, y1, x2, y2):
x = (x1, y1)
y = (x2, y2)
print(vincenty(x, y).kilometers)
print 'kilometers'
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(583, 842)
MainWindow.setToolTip(_fromUtf8(""))
MainWindow.setStatusTip(_fromUtf8(""))
MainWindow.setWhatsThis(_fromUtf8(""))
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.gridLayout_3 = QtGui.QGridLayout()
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
self.FERS_Input_2 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.FERS_Input_2.sizePolicy().hasHeightForWidth())
self.FERS_Input_2.setSizePolicy(sizePolicy)
self.FERS_Input_2.setBaseSize(QtCore.QSize(7, 0))
font = QtGui.QFont()
font.setPointSize(14)
font.setBold(True)
font.setUnderline(True)
font.setWeight(75)
self.FERS_Input_2.setFont(font)
self.FERS_Input_2.setObjectName(_fromUtf8("FERS_Input_2"))
self.gridLayout_3.addWidget(self.FERS_Input_2, 0, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label = QtGui.QLabel(self.centralwidget)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout.addWidget(self.label)
self.Tx_Num = QtGui.QSpinBox(self.centralwidget)
self.Tx_Num.setObjectName(_fromUtf8("Tx_Num"))
self.horizontalLayout.addWidget(self.Tx_Num)
self.tx_num_btn = QtGui.QPushButton(self.centralwidget)
self.tx_num_btn.setObjectName(_fromUtf8("tx_num_btn"))
self.horizontalLayout.addWidget(self.tx_num_btn)
self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.label_2 = QtGui.QLabel(self.centralwidget)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.horizontalLayout_2.addWidget(self.label_2)
self.Rx_Num = QtGui.QSpinBox(self.centralwidget)
self.Rx_Num.setObjectName(_fromUtf8("Rx_Num"))
self.horizontalLayout_2.addWidget(self.Rx_Num)
self.rx_num_btn = QtGui.QPushButton(self.centralwidget)
self.rx_num_btn.setObjectName(_fromUtf8("rx_num_btn"))
self.horizontalLayout_2.addWidget(self.rx_num_btn)
self.gridLayout_3.addLayout(self.horizontalLayout_2, 2, 0, 1, 2)
self.line_6 = QtGui.QFrame(self.centralwidget)
self.line_6.setFrameShape(QtGui.QFrame.HLine)
self.line_6.setFrameShadow(QtGui.QFrame.Sunken)
self.line_6.setObjectName(_fromUtf8("line_6"))
self.gridLayout_3.addWidget(self.line_6, 3, 0, 2, 2)
self.T_Pulse_name_label_3 = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.T_Pulse_name_label_3.setFont(font)
self.T_Pulse_name_label_3.setObjectName(_fromUtf8("T_Pulse_name_label_3"))
self.gridLayout_3.addWidget(self.T_Pulse_name_label_3, 4, 1, 1, 1)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.gridLayout_3.addLayout(self.horizontalLayout_3, 5, 1, 1, 1)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
self.T_Pulse_name_label_4 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_4.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_4.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_4.setObjectName(_fromUtf8("T_Pulse_name_label_4"))
self.horizontalLayout_4.addWidget(self.T_Pulse_name_label_4)
self.rcs = QtGui.QLineEdit(self.centralwidget)
self.rcs.setObjectName(_fromUtf8("rcs"))
self.horizontalLayout_4.addWidget(self.rcs)
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.horizontalLayout_4.addWidget(self.pushButton_2)
self.gridLayout_3.addLayout(self.horizontalLayout_4, 6, 1, 1, 1)
self.horizontalLayout_5 = QtGui.QHBoxLayout()
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
self.T_Pulse_name_label_5 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_5.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_5.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_5.setBaseSize(QtCore.QSize(13, 0))
self.T_Pulse_name_label_5.setObjectName(_fromUtf8("T_Pulse_name_label_5"))
self.horizontalLayout_5.addWidget(self.T_Pulse_name_label_5)
self.x = QtGui.QLineEdit(self.centralwidget)
self.x.setObjectName(_fromUtf8("x"))
self.horizontalLayout_5.addWidget(self.x)
self.pushButton_3 = QtGui.QPushButton(self.centralwidget)
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
self.horizontalLayout_5.addWidget(self.pushButton_3)
self.gridLayout_3.addLayout(self.horizontalLayout_5, 7, 1, 1, 1)
self.horizontalLayout_6 = QtGui.QHBoxLayout()
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
self.T_Pulse_name_label_6 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_6.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_6.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_6.setObjectName(_fromUtf8("T_Pulse_name_label_6"))
self.horizontalLayout_6.addWidget(self.T_Pulse_name_label_6)
self.y = QtGui.QLineEdit(self.centralwidget)
self.y.setObjectName(_fromUtf8("y"))
self.horizontalLayout_6.addWidget(self.y)
self.pushButton_4 = QtGui.QPushButton(self.centralwidget)
self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
self.horizontalLayout_6.addWidget(self.pushButton_4)
self.gridLayout_3.addLayout(self.horizontalLayout_6, 8, 1, 1, 1)
self.horizontalLayout_7 = QtGui.QHBoxLayout()
self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
self.T_Pulse_name_label_7 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_7.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_7.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_7.setObjectName(_fromUtf8("T_Pulse_name_label_7"))
self.horizontalLayout_7.addWidget(self.T_Pulse_name_label_7)
self.alt = QtGui.QLineEdit(self.centralwidget)
self.alt.setObjectName(_fromUtf8("alt"))
self.horizontalLayout_7.addWidget(self.alt)
self.pushButton_5 = QtGui.QPushButton(self.centralwidget)
self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
self.horizontalLayout_7.addWidget(self.pushButton_5)
self.gridLayout_3.addLayout(self.horizontalLayout_7, 9, 1, 1, 1)
self.horizontalLayout_21 = QtGui.QHBoxLayout()
self.horizontalLayout_21.setObjectName(_fromUtf8("horizontalLayout_21"))
self.pushButton_6 = QtGui.QPushButton(self.centralwidget)
self.pushButton_6.setObjectName(_fromUtf8("pushButton_6"))
self.horizontalLayout_21.addWidget(self.pushButton_6)
self.target_remove = QtGui.QPushButton(self.centralwidget)
self.target_remove.setObjectName(_fromUtf8("target_remove"))
self.horizontalLayout_21.addWidget(self.target_remove)
self.gridLayout_3.addLayout(self.horizontalLayout_21, 10, 0, 1, 2)
self.line_5 = QtGui.QFrame(self.centralwidget)
self.line_5.setFrameShape(QtGui.QFrame.HLine)
self.line_5.setFrameShadow(QtGui.QFrame.Sunken)
self.line_5.setObjectName(_fromUtf8("line_5"))
self.gridLayout_3.addWidget(self.line_5, 11, 0, 1, 2)
self.gridLayout = QtGui.QGridLayout()
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.horizontalLayout_11 = QtGui.QHBoxLayout()
self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11"))
self.T_Pulse_name_label_11 = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.T_Pulse_name_label_11.setFont(font)
self.T_Pulse_name_label_11.setObjectName(_fromUtf8("T_Pulse_name_label_11"))
self.horizontalLayout_11.addWidget(self.T_Pulse_name_label_11)
self.gridLayout.addLayout(self.horizontalLayout_11, 0, 0, 1, 1)
self.horizontalLayout_14 = QtGui.QHBoxLayout()
self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14"))
self.T_Pulse_name_label_16 = QtGui.QLabel(self.centralwidget)
self.T_Pulse_name_label_16.setObjectName(_fromUtf8("T_Pulse_name_label_16"))
self.horizontalLayout_14.addWidget(self.T_Pulse_name_label_16)
self.Rx_sel_3 = QtGui.QComboBox(self.centralwidget)
self.Rx_sel_3.setObjectName(_fromUtf8("Rx_sel_3"))
self.horizontalLayout_14.addWidget(self.Rx_sel_3)
self.gridLayout.addLayout(self.horizontalLayout_14, 1, 0, 1, 1)
self.horizontalLayout_18 = QtGui.QHBoxLayout()
self.horizontalLayout_18.setObjectName(_fromUtf8("horizontalLayout_18"))
self.T_Pulse_name_label_20 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_20.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_20.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_20.setObjectName(_fromUtf8("T_Pulse_name_label_20"))
self.horizontalLayout_18.addWidget(self.T_Pulse_name_label_20)
self.tx_name = QtGui.QLineEdit(self.centralwidget)
self.tx_name.setObjectName(_fromUtf8("tx_name"))
self.horizontalLayout_18.addWidget(self.tx_name)
self.pushButton_12 = QtGui.QPushButton(self.centralwidget)
self.pushButton_12.setObjectName(_fromUtf8("pushButton_12"))
self.horizontalLayout_18.addWidget(self.pushButton_12)
self.gridLayout.addLayout(self.horizontalLayout_18, 2, 0, 1, 1)
self.horizontalLayout_12 = QtGui.QHBoxLayout()
self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12"))
self.T_Pulse_name_label_12 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_12.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_12.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_12.setObjectName(_fromUtf8("T_Pulse_name_label_12"))
self.horizontalLayout_12.addWidget(self.T_Pulse_name_label_12)
self.tx_x = QtGui.QLineEdit(self.centralwidget)
self.tx_x.setObjectName(_fromUtf8("tx_x"))
self.horizontalLayout_12.addWidget(self.tx_x)
self.pushButton_9 = QtGui.QPushButton(self.centralwidget)
self.pushButton_9.setObjectName(_fromUtf8("pushButton_9"))
self.horizontalLayout_12.addWidget(self.pushButton_9)
self.gridLayout.addLayout(self.horizontalLayout_12, 3, 0, 1, 1)
self.horizontalLayout_15 = QtGui.QHBoxLayout()
self.horizontalLayout_15.setObjectName(_fromUtf8("horizontalLayout_15"))
self.T_Pulse_name_label_17 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_17.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_17.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_17.setObjectName(_fromUtf8("T_Pulse_name_label_17"))
self.horizontalLayout_15.addWidget(self.T_Pulse_name_label_17)
self.tx_y = QtGui.QLineEdit(self.centralwidget)
self.tx_y.setObjectName(_fromUtf8("tx_y"))
self.horizontalLayout_15.addWidget(self.tx_y)
self.pushButton_10 = QtGui.QPushButton(self.centralwidget)
self.pushButton_10.setObjectName(_fromUtf8("pushButton_10"))
self.horizontalLayout_15.addWidget(self.pushButton_10)
self.gridLayout.addLayout(self.horizontalLayout_15, 4, 0, 1, 1)
self.horizontalLayout_19 = QtGui.QHBoxLayout()
self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19"))
self.tx_record = QtGui.QPushButton(self.centralwidget)
self.tx_record.setObjectName(_fromUtf8("tx_record"))
self.horizontalLayout_19.addWidget(self.tx_record)
self.tx_remove = QtGui.QPushButton(self.centralwidget)
self.tx_remove.setObjectName(_fromUtf8("tx_remove"))
self.horizontalLayout_19.addWidget(self.tx_remove)
self.gridLayout.addLayout(self.horizontalLayout_19, 5, 0, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout, 12, 0, 1, 2)
self.line = QtGui.QFrame(self.centralwidget)
self.line.setFrameShape(QtGui.QFrame.HLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName(_fromUtf8("line"))
self.gridLayout_3.addWidget(self.line, 13, 0, 1, 2)
self.gridLayout_2 = QtGui.QGridLayout()
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.horizontalLayout_8 = QtGui.QHBoxLayout()
self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
self.T_Pulse_name_label_8 = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.T_Pulse_name_label_8.setFont(font)
self.T_Pulse_name_label_8.setObjectName(_fromUtf8("T_Pulse_name_label_8"))
self.horizontalLayout_8.addWidget(self.T_Pulse_name_label_8)
self.gridLayout_2.addLayout(self.horizontalLayout_8, 0, 0, 1, 1)
self.horizontalLayout_13 = QtGui.QHBoxLayout()
self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13"))
self.T_Pulse_name_label_18 = QtGui.QLabel(self.centralwidget)
self.T_Pulse_name_label_18.setObjectName(_fromUtf8("T_Pulse_name_label_18"))
self.horizontalLayout_13.addWidget(self.T_Pulse_name_label_18)
self.Rx_sel_2 = QtGui.QComboBox(self.centralwidget)
self.Rx_sel_2.setObjectName(_fromUtf8("Rx_sel_2"))
self.horizontalLayout_13.addWidget(self.Rx_sel_2)
self.gridLayout_2.addLayout(self.horizontalLayout_13, 1, 0, 1, 1)
self.horizontalLayout_17 = QtGui.QHBoxLayout()
self.horizontalLayout_17.setObjectName(_fromUtf8("horizontalLayout_17"))
self.T_Pulse_name_label_19 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_19.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_19.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_19.setObjectName(_fromUtf8("T_Pulse_name_label_19"))
self.horizontalLayout_17.addWidget(self.T_Pulse_name_label_19)
self.rx_name = QtGui.QLineEdit(self.centralwidget)
self.rx_name.setObjectName(_fromUtf8("rx_name"))
self.horizontalLayout_17.addWidget(self.rx_name)
self.pushButton_11 = QtGui.QPushButton(self.centralwidget)
self.pushButton_11.setObjectName(_fromUtf8("pushButton_11"))
self.horizontalLayout_17.addWidget(self.pushButton_11)
self.gridLayout_2.addLayout(self.horizontalLayout_17, 2, 0, 1, 1)
self.horizontalLayout_9 = QtGui.QHBoxLayout()
self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9"))
self.T_Pulse_name_label_9 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_9.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_9.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_9.setObjectName(_fromUtf8("T_Pulse_name_label_9"))
self.horizontalLayout_9.addWidget(self.T_Pulse_name_label_9)
self.rx_x = QtGui.QLineEdit(self.centralwidget)
self.rx_x.setObjectName(_fromUtf8("rx_x"))
self.horizontalLayout_9.addWidget(self.rx_x)
self.pushButton_7 = QtGui.QPushButton(self.centralwidget)
self.pushButton_7.setObjectName(_fromUtf8("pushButton_7"))
self.horizontalLayout_9.addWidget(self.pushButton_7)
self.gridLayout_2.addLayout(self.horizontalLayout_9, 3, 0, 1, 1)
self.horizontalLayout_10 = QtGui.QHBoxLayout()
self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10"))
self.T_Pulse_name_label_10 = QtGui.QLabel(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.T_Pulse_name_label_10.sizePolicy().hasHeightForWidth())
self.T_Pulse_name_label_10.setSizePolicy(sizePolicy)
self.T_Pulse_name_label_10.setObjectName(_fromUtf8("T_Pulse_name_label_10"))
self.horizontalLayout_10.addWidget(self.T_Pulse_name_label_10)
self.rx_y = QtGui.QLineEdit(self.centralwidget)
self.rx_y.setObjectName(_fromUtf8("rx_y"))
self.horizontalLayout_10.addWidget(self.rx_y)
self.pushButton_8 = QtGui.QPushButton(self.centralwidget)
self.pushButton_8.setObjectName(_fromUtf8("pushButton_8"))
self.horizontalLayout_10.addWidget(self.pushButton_8)
self.gridLayout_2.addLayout(self.horizontalLayout_10, 4, 0, 1, 1)
self.horizontalLayout_20 = QtGui.QHBoxLayout()
self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20"))
self.rx_record = QtGui.QPushButton(self.centralwidget)
self.rx_record.setObjectName(_fromUtf8("rx_record"))
self.horizontalLayout_20.addWidget(self.rx_record)
self.rx_remove = QtGui.QPushButton(self.centralwidget)
self.rx_remove.setEnabled(True)
self.rx_remove.setStatusTip(_fromUtf8(""))
self.rx_remove.setWhatsThis(_fromUtf8(""))
self.rx_remove.setInputMethodHints(QtCore.Qt.ImhHiddenText)
self.rx_remove.setObjectName(_fromUtf8("rx_remove"))
self.horizontalLayout_20.addWidget(self.rx_remove)
self.gridLayout_2.addLayout(self.horizontalLayout_20, 5, 0, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout_2, 14, 0, 1, 2)
self.line_2 = QtGui.QFrame(self.centralwidget)
self.line_2.setFrameShape(QtGui.QFrame.HLine)
self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
self.line_2.setObjectName(_fromUtf8("line_2"))
self.gridLayout_3.addWidget(self.line_2, 15, 0, 1, 2)
self.View_btn = QtGui.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.View_btn.setFont(font)
self.View_btn.setObjectName(_fromUtf8("View_btn"))
self.gridLayout_3.addWidget(self.View_btn, 16, 0, 1, 2)
self.line_3 = QtGui.QFrame(self.centralwidget)
self.line_3.setFrameShape(QtGui.QFrame.HLine)
self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
self.line_3.setObjectName(_fromUtf8("line_3"))
self.gridLayout_3.addWidget(self.line_3, 17, 0, 1, 2)
self.horizontalLayout_16 = QtGui.QHBoxLayout()
self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16"))
self.T_Pulse_name_label_2 = QtGui.QLabel(self.centralwidget)
self.T_Pulse_name_label_2.setObjectName(_fromUtf8("T_Pulse_name_label_2"))
self.horizontalLayout_16.addWidget(self.T_Pulse_name_label_2)
self.Tx_sel = QtGui.QComboBox(self.centralwidget)
self.Tx_sel.setObjectName(_fromUtf8("Tx_sel"))
self.horizontalLayout_16.addWidget(self.Tx_sel)
self.T_Pulse_name_label_13 = QtGui.QLabel(self.centralwidget)
self.T_Pulse_name_label_13.setObjectName(_fromUtf8("T_Pulse_name_label_13"))
self.horizontalLayout_16.addWidget(self.T_Pulse_name_label_13)
self.Rx_sel = QtGui.QComboBox(self.centralwidget)
self.Rx_sel.setObjectName(_fromUtf8("Rx_sel"))
self.horizontalLayout_16.addWidget(self.Rx_sel)
self.T_Pulse_name_label_14 = QtGui.QLabel(self.centralwidget)
self.T_Pulse_name_label_14.setObjectName(_fromUtf8("T_Pulse_name_label_14"))
self.horizontalLayout_16.addWidget(self.T_Pulse_name_label_14)
self.distance_calc = QtGui.QPushButton(self.centralwidget)
self.distance_calc.setObjectName(_fromUtf8("distance_calc"))
self.horizontalLayout_16.addWidget(self.distance_calc)
self.gridLayout_3.addLayout(self.horizontalLayout_16, 18, 0, 1, 2)
self.line_4 = QtGui.QFrame(self.centralwidget)
self.line_4.setFrameShape(QtGui.QFrame.HLine)
self.line_4.setFrameShadow(QtGui.QFrame.Sunken)
self.line_4.setObjectName(_fromUtf8("line_4"))
self.gridLayout_3.addWidget(self.line_4, 19, 0, 1, 2)
self.show = QtGui.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.show.setFont(font)
self.show.setObjectName(_fromUtf8("show"))
self.gridLayout_3.addWidget(self.show, 20, 0, 1, 2)
self.verticalLayout.addLayout(self.gridLayout_3)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), self.rcs.clear)
QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL(_fromUtf8("clicked()")), self.x.clear)
QtCore.QObject.connect(self.pushButton_4, QtCore.SIGNAL(_fromUtf8("clicked()")), self.y.clear)
QtCore.QObject.connect(self.pushButton_5, QtCore.SIGNAL(_fromUtf8("clicked()")), self.alt.clear)
QtCore.QObject.connect(self.pushButton_11, QtCore.SIGNAL(_fromUtf8("clicked()")), self.rx_name.clear)
QtCore.QObject.connect(self.pushButton_7, QtCore.SIGNAL(_fromUtf8("clicked()")), self.rx_x.clear)
QtCore.QObject.connect(self.pushButton_8, QtCore.SIGNAL(_fromUtf8("clicked()")), self.rx_y.clear)
QtCore.QObject.connect(self.pushButton_12, QtCore.SIGNAL(_fromUtf8("clicked()")), self.tx_name.clear)
QtCore.QObject.connect(self.pushButton_9, QtCore.SIGNAL(_fromUtf8("clicked()")), self.tx_x.clear)
QtCore.QObject.connect(self.pushButton_10, QtCore.SIGNAL(_fromUtf8("clicked()")), self.tx_y.clear)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.Tx_Num, self.tx_num_btn)
MainWindow.setTabOrder(self.tx_num_btn, self.Rx_Num)
MainWindow.setTabOrder(self.Rx_Num, self.rx_num_btn)
MainWindow.setTabOrder(self.rx_num_btn, self.rcs)
MainWindow.setTabOrder(self.rcs, self.pushButton_2)
MainWindow.setTabOrder(self.pushButton_2, self.x)
MainWindow.setTabOrder(self.x, self.pushButton_3)
MainWindow.setTabOrder(self.pushButton_3, self.y)
MainWindow.setTabOrder(self.y, self.pushButton_4)
MainWindow.setTabOrder(self.pushButton_4, self.alt)
MainWindow.setTabOrder(self.alt, self.pushButton_5)
MainWindow.setTabOrder(self.pushButton_5, self.pushButton_6)
MainWindow.setTabOrder(self.pushButton_6, self.target_remove)
MainWindow.setTabOrder(self.target_remove, self.Rx_sel_3)
MainWindow.setTabOrder(self.Rx_sel_3, self.tx_name)
MainWindow.setTabOrder(self.tx_name, self.pushButton_12)
MainWindow.setTabOrder(self.pushButton_12, self.tx_x)
MainWindow.setTabOrder(self.tx_x, self.pushButton_9)
MainWindow.setTabOrder(self.pushButton_9, self.tx_y)
MainWindow.setTabOrder(self.tx_y, self.pushButton_10)
MainWindow.setTabOrder(self.pushButton_10, self.tx_record)
MainWindow.setTabOrder(self.tx_record, self.tx_remove)
MainWindow.setTabOrder(self.tx_remove, self.Rx_sel_2)
MainWindow.setTabOrder(self.Rx_sel_2, self.rx_name)
MainWindow.setTabOrder(self.rx_name, self.pushButton_11)
MainWindow.setTabOrder(self.pushButton_11, self.rx_x)
MainWindow.setTabOrder(self.rx_x, self.pushButton_7)
MainWindow.setTabOrder(self.pushButton_7, self.rx_y)
MainWindow.setTabOrder(self.rx_y, self.pushButton_8)
MainWindow.setTabOrder(self.pushButton_8, self.rx_record)
MainWindow.setTabOrder(self.rx_record, self.rx_remove)
MainWindow.setTabOrder(self.rx_remove, self.View_btn)
MainWindow.setTabOrder(self.View_btn, self.Tx_sel)
MainWindow.setTabOrder(self.Tx_sel, self.Rx_sel)
MainWindow.setTabOrder(self.Rx_sel, self.distance_calc)
MainWindow.setTabOrder(self.distance_calc, self.show)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "Radar Visualiser", None))
self.FERS_Input_2.setText(_translate("MainWindow", "Radar Visualiser", None))
self.label.setText(_translate("MainWindow", "Number of Transmitters", None))
self.tx_num_btn.setText(_translate("MainWindow", "Set", None))
self.label_2.setText(_translate("MainWindow", "Number of Receivers", None))
self.rx_num_btn.setText(_translate("MainWindow", "Set", None))
self.T_Pulse_name_label_3.setText(_translate("MainWindow", "Target information entry:", None))
self.T_Pulse_name_label_4.setText(_translate("MainWindow", "RCS Value:", None))
self.rcs.setPlaceholderText(_translate("MainWindow", "<Sample Value>", None))
self.pushButton_2.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_5.setText(_translate("MainWindow", "X Value (Longitude):", None))
self.x.setPlaceholderText(_translate("MainWindow", "< [-180 ; 180] >", None))
self.pushButton_3.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_6.setText(_translate("MainWindow", "Y Value (Latitude):", None))
self.y.setPlaceholderText(_translate("MainWindow", "< [-90 ; 90] >", None))
self.pushButton_4.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_7.setText(_translate("MainWindow", "Altitude", None))
self.alt.setPlaceholderText(_translate("MainWindow", "<Sample Value (km)>", None))
self.pushButton_5.setText(_translate("MainWindow", "Clear", None))
self.pushButton_6.setText(_translate("MainWindow", "Record Target Info", None))
self.target_remove.setToolTip(_translate("MainWindow", "<html><head/><body><p>Remove the target from the environment.</p></body></html>", None))
self.target_remove.setText(_translate("MainWindow", "Remove Target", None))
self.T_Pulse_name_label_11.setText(_translate("MainWindow", "Transmitter information entry", None))
self.T_Pulse_name_label_16.setText(_translate("MainWindow", "Transmitter number:", None))
self.T_Pulse_name_label_20.setText(_translate("MainWindow", "Name:", None))
self.tx_name.setPlaceholderText(_translate("MainWindow", "< Sample Name >", None))
self.pushButton_12.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_12.setText(_translate("MainWindow", "Longitude:", None))
self.tx_x.setPlaceholderText(_translate("MainWindow", "< Range [-180 ; 180] >", None))
self.pushButton_9.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_17.setText(_translate("MainWindow", "Latitude", None))
self.tx_y.setPlaceholderText(_translate("MainWindow", "< Range [-90 ; 90 ] >", None))
self.pushButton_10.setText(_translate("MainWindow", "Clear", None))
self.tx_record.setText(_translate("MainWindow", "Record Transmitter info", None))
self.tx_remove.setToolTip(_translate("MainWindow", "<html><head/><body><p>Removes transmitter corresponding to the selected number.</p></body></html>", None))
self.tx_remove.setText(_translate("MainWindow", "Remove Transmitter", None))
self.T_Pulse_name_label_8.setText(_translate("MainWindow", "Receiver information entry", None))
self.T_Pulse_name_label_18.setText(_translate("MainWindow", "Receiver number:", None))
self.T_Pulse_name_label_19.setText(_translate("MainWindow", "Name:", None))
self.rx_name.setPlaceholderText(_translate("MainWindow", "< Sample Name >", None))
self.pushButton_11.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_9.setText(_translate("MainWindow", "Longitude:", None))
self.rx_x.setPlaceholderText(_translate("MainWindow", "< Range [-180 ; 180] >", None))
self.pushButton_7.setText(_translate("MainWindow", "Clear", None))
self.T_Pulse_name_label_10.setText(_translate("MainWindow", "Latitude", None))
self.rx_y.setPlaceholderText(_translate("MainWindow", "< Range [-90 ; 90 ] >", None))
self.pushButton_8.setText(_translate("MainWindow", "Clear", None))
self.rx_record.setText(_translate("MainWindow", "Record Receiver Info", None))
self.rx_remove.setToolTip(_translate("MainWindow", "<html><head/><body><p>Removes the receiver corresponding to the selected number.</p></body></html>", "sdfssfsdf"))
self.rx_remove.setText(_translate("MainWindow", "Remove Receiver", None))
self.View_btn.setText(_translate("MainWindow", "View input data ", None))
self.T_Pulse_name_label_2.setText(_translate("MainWindow", "Distance between:", None))
self.T_Pulse_name_label_13.setText(_translate("MainWindow", "and", None))
self.T_Pulse_name_label_14.setText(_translate("MainWindow", "in kiometers", None))
self.distance_calc.setText(_translate("MainWindow", "Calculate", None))
self.show.setText(_translate("MainWindow", "Show Visualisation", None))
self.tx_remove.clicked.connect(self.removeTransmitter)
self.target_remove.clicked.connect(self.removeTarget)
self.rx_remove.clicked.connect(self.removeReceiver)
self.pushButton_6.clicked.connect(self.addTarget)
self.tx_record.clicked.connect(self.addTransmitter)
self.rx_record.clicked.connect(self.addReceiver)
self.tx_num_btn.clicked.connect(self.setTxNum)
self.rx_num_btn.clicked.connect(self.setRxNum)
self.show.clicked.connect(self.generatePlot)
self.View_btn.clicked.connect(self.showEnvironment)
self.distance_calc.clicked.connect(self.showDistance)
##generates 3d plot in XYZ all in metres
def generatePlot(self):
tx_val=[]
ty_val=[]
tz_val=[]
rx_val=[]
ry_val=[]
rz_val=[]
ox_val=[]
oy_val=[]
oz_val=[]
## figure object which plots are added to
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for i in range(len(tx)):
try:
##adding integer values to tx arrays
tx_val.insert(i,float(tx[i]))
ty_val.insert(i,float(ty[i]))
tz_val.insert(i,float(tz[i]))
except ValueError:
print '--Please insert correct transmitter information--'
return
## create scatter plot for transmitters within ax, which is in fig
ax.scatter(tx_val, ty_val, tz_val, c='yellow', depthshade=False, marker='o', label='transmitters')
for j in range(len(rx)):
##adding integer values to rx arrays
rx_val.insert(j,float(rx[j]))
ry_val.insert(j,float(ry[j]))
rz_val.insert(j,float(rz[j]))
## create scatter plot for receivers within ax, which is in fig
ax.scatter(rx_val, ry_val, rz_val, c='blue',depthshade=False, marker='o', label='receivers')
##adding integer values to target arrays
ox_val.insert(0,float(ox[0]))
oy_val.insert(0,float(oy[0]))
oz_val.insert(0,float(oz[0]))
## create scatter plot for target within ax, which is in fig
ax.scatter(ox_val, oy_val, oz_val, c='red',depthshade=False, marker='o', label = 'targets')
## create straight lines between tx positions and target
for i in range(len(tx_val)):
ax.plot([tx_val[i],ox_val[0]],[ty_val[i],oy_val[0]],[tz_val[i],oz_val[0]], c = 'r')
## create straight lines between rx positions and target
for i in range(len(rx_val)):
ax.plot([rx_val[i],ox_val[0]],[ry_val[i],oy_val[0]],[rz_val[i],oz_val[0]], c='g')
## axis labels
ax.set_xlabel('Longitude (degrees)')
ax.set_ylabel('Latitude (degrees)')
ax.set_zlabel('Height (km)')
plt.legend(loc='upper left') ## legend and position
plt.show()
## sets number of transmitters in environment
def setTxNum(self):
val = str(self.Tx_Num.text())
self.Rx_sel_3.clear()
self.Tx_sel.clear()
## a[] keeps record of the transmitter numbers. num_tx string populates a[]
if (int(val)>len(a)):
dif = (int(val)-len(a))
for i in range(dif):
global num_tx
a.append(num_tx)
lol = int(num_tx) +1## increment num_tx
num_tx=str(lol)
tx.insert(i+dif, '')
ty.insert(i+dif, '')
tz.insert(i+dif, '')
tx_names.insert(i,'')
elif(int(val)<len(a)):
while int(val)<len(a):
lol = int(num_tx) -1## decrement num_tx
num_tx = str(lol)
a.pop(len(a)-1)
tx.pop(len(a))
ty.pop(len(a))
tz.pop(len(a))
tx_names.pop(len(a))
##adds names to dropdown box
for i in range(len(a)):
self.Rx_sel_3.addItem(a[i])
self.Tx_sel.addItem(a[i])
print '--Number of transmitters set--'
## sets number of receivers in environment
def setRxNum(self):
val = str(self.Rx_Num.text())
self.Rx_sel_2.clear()
self.Rx_sel.clear()
## b[] keeps record of the transmitter numbers. num_rx string populates b[]
if (int(val)>len(b)):
dif = (int(val)-len(b))
for i in range(dif):
##num_rx used for drop downs
global num_rx
b.append(num_rx)
lol = int(num_rx) +1 ## increment num_rx
num_rx=str(lol)
##inserting blanks into rx
rx.insert(i+dif, '')
ry.insert(i+dif, '')
rz.insert(i+dif, '')
rx_names.insert(i+dif,'')
elif(int(val)<len(b)):
wiz = len(b)-int(val)
for i in range(wiz):
lol = int(num_rx) -1## decrement num_rx
num_rx = str(lol)
b.pop(len(b)-1)
rx.pop(len(b))
ry.pop(len(b))
rz.pop(len(b))
rx_names.pop(len(b))
##adds names to dropdown box
for i in range(len(b)):
self.Rx_sel_2.addItem(b[i])
self.Rx_sel.addItem(b[i])
print '--Number of receiver set--'
## removes recveivers from rx[], ry[], rz[], rz_names[]
def removeReceiver(self):
num = str(self.Rx_sel_2.currentText())
try:
rx_names[int(num)]='' ##removes name of receiver from rx_names
rx[int(num)] = '' ##removes longitude of receiver
ry[int(num)] = '' ##removes latitude of receiver
rz[int(num)] = '' ##removes altitude of receiver
print'--Receiver Removed--'
except KeyError:
print'--Please select correct receiver to remove--'
## removes transmitter from environment
def removeTransmitter(self):
num = str(self.Rx_sel_3.currentText())
try:
tx_names[int(num)]='' ##removes name of transmitter from tx_names
tx[int(num)] = '' ##removes longitude of transmitter
ty[int(num)] = '' ##removes latitude of transmitter
tz[int(num)] = '' ##removes altitude of transmitter
print'--Receiver Removed--'
except KeyError:
print'--Please select correct receiver to remove--'
## removes target from environment
def removeTarget(self):
rcs = ''
ox[0]=['']
oy[0]=['']
oz[0]=['']
print'--Target Removed--'
## removes receiver from environment
def addReceiver(self):
num = str(self.Rx_sel_2.currentText())
name = str(self.rx_name.text())
rx_names[int(num)]=name
longi = str(self.rx_x.text())
lat = str(self.rx_y.text())
if (float(longi)>=-180 and float(longi)<180):
rx[int(num)]=longi ##sets rx x coord
if (float(lat)>=-90 and float(lat)<90):
ry[int(num)]=lat ##sets rx y coord
else:
print '--Please enter correct latitude--'
return
else:
print '--Please enter correct longitude--'
return
rz[int(num)] = 0 ##sets rx z coord
print'--Receiver Added--'
## adds transmitter to environment
def addTransmitter(self):
num = str(self.Rx_sel_3.currentText())
name = str(self.tx_name.text())
tx_names[int(num)]=name
longi = str(self.tx_x.text())
lat = str(self.tx_y.text())
if (float(longi)>=-180 and float(longi)<180):
tx[int(num)]=longi ##sets tx x coord
if (float(lat)>=-90 and float(lat)<90):
ty[int(num)]=lat ##sets tx y coord
else:
print '--Please enter correct longitude--'
return
else:
print '--Please enter correct latitude--'
return
tz[int(num)] = 0 ##sets tx z coord
##add tx to array at position num
print'--Transmitter Added--'
## adds target to environment
def addTarget(self):
global rcs
rcs = str(self.rcs.text())
longit = str(self.x.text())
latt = str(self.y.text())
alti = str(self.alt.text())
if (float(longit)>=-180 and float(longit)<=180):
oy[0]=longit
if (float(latt)>=-90 and float(latt)<=90):
ox[0]=latt
oz[0]=alti
else:
print '--Please enter correct latitude--'
return
else:
print '--Please enter correct longitude--'
return
print'--Target Added--'
def showDistance(self):
t = str(self.Tx_sel.currentText())
print t
r = str(self.Rx_sel.currentText())
print r
try:
x1 = float(tx[int(t)])
y1 = float(ty[int(t)])
x2 = float(rx[int(r)])
y2 = float(ry[int(r)])
distance(t, r, x1, y1, x2, y2)
except ValueError:
print '--Please ensure the data for the selected tx and rx is valid--'
## prints the environment
def showEnvironment(self):
##print a ##tx_numbers
##print b ##rx_numbers
##print tx ##tx_x values []
##print ty ##tx_y values []
##print tz ##tx_z values []
##print rx ##rx_x values []
##print ry ##rx_y values []
##print rz ##rx_z values []
##print ox ##target x values []
##print oy ##target y values []
##print oz ##target z values []
print '--Environment for visualisation--'
print''
for i in range(len(a)):
print'--Transmitters--'
printf ('{: <20}'.format('Name:'))
printf ('%s\n',tx_names[i])
printf ('{: <20}'.format('Longitude:'))
printf ('%s\n',tx[i])
printf ('{: <20}'.format('Latitude:'))
printf ('%s\n',ty[i])
printf ('{: <20}'.format('Altitude:'))
printf ('%s\n',tz[i])
print''
for i in range(len(b)):
print'--Receivers--'
printf ('{: <20}'.format('Name:'))
printf ('%s\n',rx_names[i])
printf ('{: <20}'.format('Longitude:'))
printf ('%s\n',rx[i])
printf ('{: <20}'.format('Latitude:'))
printf ('%s\n',ry[i])
printf ('{: <20}'.format('Altitude:'))
printf ('%s\n',rz[i])
print''
print '--Target--'
printf ('{: <20}'.format('Name:'))
printf ('%s\n',rcs)
printf ('{: <20}'.format('Longitude:'))
printf ('%s\n',ox[0])
printf ('{: <20}'.format('Latitude:'))
printf ('%s\n',oy[0])
printf ('{: <20}'.format('Altitude:'))
printf ('%s\n',oz[0])
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())