summarylogtreecommitdiffstats
path: root/0001-Fix-compilation.patch
blob: b790057a16aa12d0e2679a262caca9464feee862 (plain)
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
From 4a7eb91cb2ab2cc532998347f98ac9ce0fa63b2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20La=C3=9F?= <bevan@bi-co.net>
Date: Mon, 2 Oct 2023 22:15:45 +0200
Subject: [PATCH] Fix compilation

This is a squashed combination of
* typo (c04750429475fef7c66e39c66a2d48a3b3757873)
* update for tii-codes (80e7988160a96ca94e429c5ddb255969cdfce2e1)
* update for tii (e7b64d2632527de7aa995e01a390c9c422e48901)
all authored by JvanKatwijk <J.vanKatwijk@gmail.com>
---
 qt-dab-s6/qt-dab-6.pro                |  6 +++---
 src/support/tii-library/tii-codes.cpp | 16 ++++++++++++++++
 src/support/tii-library/tii-codes.h   | 13 ++++---------
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/qt-dab-s6/qt-dab-6.pro b/qt-dab-s6/qt-dab-6.pro
index 806e3d0..6252a4f 100755
--- a/qt-dab-s6/qt-dab-6.pro
+++ b/qt-dab-s6/qt-dab-6.pro
@@ -415,8 +415,8 @@ CONFIG		+= pluto-2
 #CONFIG		+= colibri
 CONFIG		+= faad
 #CONFIG		+= fdk-aac
-CONFIG		+= preCompiled
-#CONFIG		+= tiiLib
+#CONFIG		+= preCompiled
+CONFIG		+= tiiLib
 #very experimental, simple server for connecting to a tdc handler
 CONFIG		+= datastreamer
 #to handle output of embedded an IP data stream, uncomment
@@ -470,7 +470,7 @@ isEmpty(GITHASHSTRING) {
 #	DEFINES		+= __THREADED_BACKEND
 #
 #for win32, comment out the lines above
-	TARGET		= qt-dab32-6.0
+	TARGET		= qt-dab32-6.1
 	DESTDIR		= /usr/shared/w32-programs/windows-dab32-qt
 	INCLUDEPATH	+= /usr/i686-w64-mingw32/sys-root/mingw/include
 	INCLUDEPATH	+= /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/qwt
diff --git a/src/support/tii-library/tii-codes.cpp b/src/support/tii-library/tii-codes.cpp
index cbb0dde..6e025f2 100755
--- a/src/support/tii-library/tii-codes.cpp
+++ b/src/support/tii-library/tii-codes.cpp
@@ -169,6 +169,22 @@ double	d	= sqrt (x * x + y * y);
 	return (int)(R * d + 0.5);
 }
 
+
+int	tiiHandler::distance (position &target,
+	                      position &home) {
+bool	dy_sign	= target. latitude >  home. latitude;
+double	dx;
+double dy	= distance_2 (target. latitude,  home. longitude,	
+	                      home. latitude, home. longitude);
+	if (dy_sign)		// lat1 is "higher" than lat2
+	   dx = distance_2 (target. latitude, target. longitude,
+	                    target. latitude, home. longitude);
+	else
+	   dx = distance_2 (home. latitude, target. longitude,
+	                    home. latitude, home. longitude);
+	return sqrt (dx * dx + dy * dy);
+}
+	
 int	tiiHandler::distance (float latitude1, float longitude1,
 	                      float latitude2, float longitude2) {
 bool	dy_sign	= latitude1 > latitude2;
diff --git a/src/support/tii-library/tii-codes.h b/src/support/tii-library/tii-codes.h
index 33a8c76..59c7f8a 100755
--- a/src/support/tii-library/tii-codes.h
+++ b/src/support/tii-library/tii-codes.h
@@ -27,15 +27,9 @@
 #include	"dlfcn.h"
 typedef	void	*HINSTANCE;
 
-class position {
-public:
-	position	(float lat, float lon) {
-	   latitude	= lat;
-	   longitude	= lon;
-	}
-	~position	() {}
+typedef struct {
 	float latitude;
-	float longiture;
+	float longitude;
 } position;
 
 typedef struct {
@@ -71,9 +65,10 @@ public:
 	                                 uint16_t, uint8_t, uint8_t);
 	void	get_coordinates	(float *, float *, float *,
 	                         const QString &, const QString &);
-	void	get_coordinates	(position & float &,
+	void	get_coordinates	(position &, float &,
 	                         const QString &, const QString &);
         int     distance_2	(float, float, float, float);
+        int	distance	(position &, position &);
         int	distance	(float, float, float, float);
         int     corner		(position, position);
         bool    is_black        (uint16_t, uint8_t, uint8_t);
-- 
2.42.0