Skip to content

Commit

Permalink
map handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Jun 21, 2022
1 parent ff93480 commit 032438a
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 199 deletions.
6 changes: 4 additions & 2 deletions README.md
@@ -1,13 +1,15 @@
# Qt-DAB-4.4 [![Build Status](https://travis-ci.com/JvanKatwijk/qt-dab.svg?branch=master)](https://travis-ci.com/JvanKatwijk/qt-dab)
# Qt-DAB-4.4.1 [![Build Status](https://travis-ci.com/JvanKatwijk/qt-dab.svg?branch=master)](https://travis-ci.com/JvanKatwijk/qt-dab)

Qt-DAB-4.4 is software for Linux, Windows and Raspberry Pi for listening to terrestrial Digital Audio Broadcasting (DAB and DAB+). Qt-DAB is accompanied by its little sister dabMini, built on the same set of sources.

![4.4](/qt-dab-maps.png?raw=true)

----------------------------------------------------------------
What is new in Qt-DAB 4.4
What is new in Qt-DAB 4.4.1
----------------------------------------------------------------

The difference between 4.4.1 and 4.4 is is the map handling.

I was completely bored with searching on a map where the transmitter
location was that was detected by the Qt-DAB software.
So, I modified the http handler and the map from the 1090 software
Expand Down
2 changes: 1 addition & 1 deletion dab-maxi/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required( VERSION 2.8.11 )
set (objectName qt-dab-4.4)
set (objectName qt-dab-4.4.1)
set (CMAKE_CXX_FLAGS "${CMAKE_XCC_FLAGS} -Wall -std=c++14 -flto")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")

Expand Down
397 changes: 226 additions & 171 deletions dab-maxi/converted_map.h

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions dab-maxi/http-handler.cpp
Expand Up @@ -449,20 +449,22 @@ QString Jsontxt;
locker. lock ();
// the Target
snprintf (buf, 512,
"{\"lat\":%s, \"lon\":%s, \"name\":\"%s\", \"channel\":\"%s\"}",
"{\"lat\":%s, \"lon\":%s, \"name\":\"%s\", \"channel\":\"%s\", \"dist\":%d}",
dotNumber (real (t [0]. coords)). c_str (),
dotNumber (imag (t [0]. coords)). c_str (),
t [0]. transmitterName. toUtf8 (). data (),
t [0]. channelName. toUtf8 (). data ());
t [0]. channelName. toUtf8 (). data (),
t [0]. distance);

Jsontxt += QString (buf);
for (int i = 1; i < t. size (); i ++) {
snprintf (buf, 512,
",\n{\"lat\":%s, \"lon\":%s, \"name\":\"%s\", \"channel\":\"%s\"}",
",\n{\"lat\":%s, \"lon\":%s, \"name\":\"%s\", \"channel\":\"%s\", \"dist\":%d}",
dotNumber (real (t [i]. coords)). c_str (),
dotNumber (imag (t [i]. coords)). c_str (),
t [i]. transmitterName. toUtf8 (). data (),
t [i]. channelName. toUtf8 (). data ());
t [i]. channelName. toUtf8 (). data (),
t [i]. distance);
Jsontxt += QString (buf);
}
t. resize (0);
Expand All @@ -474,7 +476,8 @@ QString Jsontxt;

void httpHandler::putData (std::complex<float> target,
QString transmitterName,
QString channelName) {
QString channelName,
int distance) {
for (int i = 0; i < transmitterList. size (); i ++)
if (transmitterList [i]. coords == target)
return;
Expand All @@ -483,6 +486,7 @@ void httpHandler::putData (std::complex<float> target,
t. coords = target;
t. transmitterName = transmitterName;
t. channelName = channelName;
t. distance = distance;
locker. lock ();
transmitterList. push_back (t);
locker. unlock ();
Expand Down
3 changes: 2 additions & 1 deletion dab-maxi/http-handler.h
Expand Up @@ -38,6 +38,7 @@ typedef struct {
std::complex<float> coords;
QString transmitterName;
QString channelName;
int distance;
} httpData;

class httpHandler: public QObject {
Expand All @@ -54,7 +55,7 @@ Q_OBJECT
void run ();
void putData (std::complex<float>target,
QString transmittername,
QString channelName);
QString channelName, int distance);
private:
RadioInterface *parent;
int port;
Expand Down
22 changes: 18 additions & 4 deletions dab-maxi/map/qt-map.html
Expand Up @@ -98,6 +98,9 @@
let icon = getIconForTransmitter (0);
let target = Transmitters [i];
let targetMarker = L.marker([target.lat, target.lon], {icon: icon}).addTo(Map);
targetMarker.
addEventListener ('click',
function () { selectTransmitterCallback (target);});
Transmitters [i]. marker = targetMarker;
}
}
Expand All @@ -120,7 +123,9 @@
target. marker = targetMarker;
Transmitters [transmitterIndex] = target;
transmitterIndex ++;

target. marker.
addEventListener ('click',
function () { selectTransmitterCallback (target);});
let newChannel = '<span style=\"font-weight:bold;font-size:120%\">' + target. channel + '</span>';
let coords = '<span style=\"font-style: italic;\">' +
target. lat + '--' +
Expand Down Expand Up @@ -156,9 +161,17 @@
}, 2000);
}

function selectTransmitterCallback (name) {
let xx = document. getElementById ('selinfo');
xx. innerHTML = name +'<br>';
function selectTransmitterCallback (target) {
let xx = document. getElementById ('selected');
let newChannel = '<span style=\"font-weight:bold;font-size:120%\">' + target. channel + '</span>';
let coords = '<span style=\"font-style: italic;\">' +
target. lat + '--' +
target. lon + '</span>';
xx. innerHTML = 'Selected: ' + '<br>' +
newChannel + '=>' +
target. name + '<br>' +
coords + '<br>' +
'Distance to home ' + target. dist + 'km<br>';
}

</script>
Expand All @@ -170,6 +183,7 @@
<h1>Qt-DAB</h1>
<p id="selinfo"></p>
<p id="selCount"></p>
<p id="selected"></p>
</div>
</div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions dab-maxi/qt-dab.pro
Expand Up @@ -298,7 +298,7 @@ SOURCES += ./main.cpp \
#
unix {
DESTDIR = ./linux-bin
TARGET = qt-dab-4.4
TARGET = qt-dab-4.4.1
exists ("../.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD)
!isEmpty(GITHASHSTRING) {
Expand Down Expand Up @@ -379,7 +379,7 @@ isEmpty(GITHASHSTRING) {
}

##for for 64 bit
# TARGET = qt-dab64-4.4
# TARGET = qt-dab64-4.4.1
# DEFINES += __BITS64__
# DESTDIR = /usr/shared/w64-programs/windows-dab64-qt
# INCLUDEPATH += /usr/x64-w64-mingw32/sys-root/mingw/include
Expand All @@ -399,7 +399,7 @@ isEmpty(GITHASHSTRING) {
# DEFINES += __THREADED_BACKEND
#
#for win32, comment out the lines above
TARGET = qt-dab32-4.4
TARGET = qt-dab32-4.4.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
Expand Down
22 changes: 12 additions & 10 deletions dab-maxi/radio.cpp
Expand Up @@ -309,9 +309,10 @@ uint8_t dabBand;
filePath = dabSettings -> value ("filePath", ""). toString ();
if ((filePath != "") && (!filePath. endsWith ("/")))
filePath = filePath + "/";

setWindowFlags (windowFlags () | Qt::WindowStaysOnTopHint);
// The settings are done, now creation of the GUI parts
setupUi (this);
QWidget::raise ();
//
// dataDisplay = new QFrame (nullptr);
techData. setupUi (&dataDisplay);
Expand Down Expand Up @@ -2132,10 +2133,6 @@ bool tiiChange = false;
theName);
channel. targetPos = std::complex<float> (latitude,
longitude);
if (mapHandler != nullptr)
mapHandler -> putData (channel. targetPos,
channel. transmitterName,
channel. channelName);
LOG ("transmitter ", channel. transmitterName);
LOG ("coordinates ",
QString::number (latitude) + " " +
Expand All @@ -2151,6 +2148,11 @@ bool tiiChange = false;
int distance = tiiProcessor.
distance (latitude, longitude,
ownLatitude, ownLongitude);
if (mapHandler != nullptr)
mapHandler -> putData (channel. targetPos,
channel. transmitterName,
channel. channelName,
distance);
int hoek = tiiProcessor.
corner (latitude, longitude,
ownLatitude, ownLongitude);
Expand Down Expand Up @@ -3413,10 +3415,10 @@ int tunedFrequency =
channel. frequency = tunedFrequency / 1000;
channel. targetPos = std::complex<float> (0, 0);
if (!transmitterTags_on && (mapHandler != nullptr))
mapHandler -> putData (std::complex<float> (0, 0), "", "");
mapHandler -> putData (std::complex<float> (0, 0), "", "", 0);
else
if (mapHandler != nullptr)
mapHandler -> putData (std::complex<float>(-1, -1), "", "");
mapHandler -> putData (std::complex<float>(-1, -1), "", "", 0);
show_for_safety ();
int switchDelay =
dabSettings -> value ("switchDelay", 8). toInt ();
Expand Down Expand Up @@ -3475,7 +3477,7 @@ void RadioInterface::stopChannel () {
channel. transmitterName = "";
channel. targetPos = std::complex<float> (0, 0);
if (!transmitterTags_on && (mapHandler != nullptr))
mapHandler -> putData (channel. targetPos, "", "");
mapHandler -> putData (channel. targetPos, "", "", 0);
transmitter_country -> setText ("");
transmitter_coordinates -> setText ("");

Expand Down Expand Up @@ -4678,7 +4680,7 @@ void RadioInterface::handle_transmitterTags () {
setText (transmitterTags_on ? "all transm" : "local transm");
dabSettings -> setValue ("transmitterTags", transmitterTags_on ? 1 : 0);
channel. targetPos = std::complex<float> (0, 0);
if (!transmitterTags_on)
mapHandler -> putData (channel. targetPos, "", "");
if ((!transmitterTags_on) && (mapHandler != nullptr))
mapHandler -> putData (channel. targetPos, "", "", 0);
}

2 changes: 1 addition & 1 deletion forms/dabradio.ui
Expand Up @@ -17,7 +17,7 @@
</sizepolicy>
</property>
<property name="windowTitle">
<string>Qt-DAB-4.4</string>
<string>Qt-DAB-4.4.1</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
Expand Down
2 changes: 1 addition & 1 deletion includes/dab-constants.h
Expand Up @@ -65,7 +65,7 @@ using namespace std;
#define MHz(x) (KHz (x) * 1000)
#define mHz(x) (kHz (x) * 1000)

#define CURRENT_VERSION "4.4"
#define CURRENT_VERSION "4.4.1"

#define DAB 0100
#define DAB_PLUS 0101
Expand Down

0 comments on commit 032438a

Please sign in to comment.