Compare commits

..

2 commits
main ... round

Author SHA1 Message Date
nathan d5d43a43fe fixed border margin on label dynamics 2022-01-12 17:39:31 -08:00
nathan e549aab7c4 setting up display for round screens 2022-01-12 16:12:28 -08:00
15 changed files with 136 additions and 377 deletions

2
.gitignore vendored
View file

@ -25,5 +25,3 @@ mapnames
viz1090 viz1090
result

View file

@ -161,21 +161,63 @@ void AircraftLabel::calculateForces(Aircraft *check_p) {
// screen edge // screen edge
if(p_left < edge_margin) { if(roundScreen) {
ddx += boundary_force * static_cast<float>(edge_margin - p_left); float radius = screen_width >> 1;
//left top
if((p_left - radius) * (p_left - radius) + (p_top - radius) * (p_top - radius) > ((radius - edge_margin) * (radius - edge_margin))) {
float pointnorm = sqrt((p_left - radius) * (p_left - radius) + (p_top - radius) * (p_top - radius));
ddx += boundary_force * ((radius - edge_margin) * (p_left - radius) / pointnorm - (p_left - radius));
ddy += boundary_force * ((radius - edge_margin) * (p_top - radius) / pointnorm - (p_top - radius));
}
//left bottom
if((p_left - radius) * (p_left - radius) + (p_bottom - radius) * (p_bottom - radius) > ((radius - edge_margin) * (radius - edge_margin))) {
float pointnorm = sqrt((p_left - radius) * (p_left - radius) + (p_bottom - radius) * (p_bottom - radius));
ddx += boundary_force * ((radius - edge_margin) * (p_left - radius) / pointnorm - (p_left - radius));
ddy += boundary_force * ((radius - edge_margin) * (p_bottom - radius) / pointnorm - (p_bottom - radius));
}
//right top
if((p_right - radius) * (p_right - radius) + (p_top - radius) * (p_top - radius) > ((radius - edge_margin) * (radius - edge_margin))) {
float pointnorm = sqrt((p_right - radius) * (p_right - radius) + (p_top - radius) * (p_top - radius));
ddx += boundary_force * ((radius - edge_margin) * (p_right - radius) / pointnorm - (p_right - radius));
ddy += boundary_force * ((radius - edge_margin) * (p_top - radius) / pointnorm - (p_top - radius));
}
//right bottom
if((p_right - radius) * (p_right - radius) + (p_bottom - radius) * (p_bottom - radius) > ((radius - edge_margin) * (radius - edge_margin))) {
float pointnorm = sqrt((p_right - radius) * (p_right - radius) + (p_bottom - radius) * (p_bottom - radius));
ddx += boundary_force * ((radius - edge_margin) * (p_right - radius) / pointnorm - (p_right- radius));
ddy += boundary_force * ((radius - edge_margin) * (p_bottom - radius) / pointnorm - (p_bottom - radius));
}
} else {
if(p_left < edge_margin) {
ddx += boundary_force * static_cast<float>(edge_margin - p_left);
}
if(p_right > screen_width - edge_margin) {
ddx += boundary_force * static_cast<float>(screen_width - edge_margin - p_right);
}
if(p_top < edge_margin) {
ddy += boundary_force * static_cast<float>(edge_margin - p_top);
}
if(p_bottom > screen_height - edge_margin) {
ddy += boundary_force * static_cast<float>(screen_height - edge_margin - p_bottom);
}
} }
if(p_right > screen_width - edge_margin) {
ddx += boundary_force * static_cast<float>(screen_width - edge_margin - p_right);
}
if(p_top < edge_margin) {
ddy += boundary_force * static_cast<float>(edge_margin - p_top);
}
if(p_bottom > screen_height - edge_margin) {
ddy += boundary_force * static_cast<float>(screen_height - edge_margin - p_bottom);
}
float all_x = 0; float all_x = 0;
@ -253,7 +295,7 @@ void AircraftLabel::calculateForces(Aircraft *check_p) {
// snprintf(buff, sizeof(buff), "%2.2f", labelLevel); // snprintf(buff, sizeof(buff), "%2.2f", labelLevel);
// debugLabel.setText(buff); // debugLabel.setText(buff);
float density_mult = 0.5f; float density_mult = 0.9f;
float level_rate = 0.25f; float level_rate = 0.25f;
if(elapsed(lastLevelChange) > 1000.0) { if(elapsed(lastLevelChange) > 1000.0) {
@ -504,10 +546,11 @@ void AircraftLabel::draw(SDL_Renderer *renderer, bool selected) {
} }
} }
AircraftLabel::AircraftLabel(Aircraft *p, bool metric, int screen_width, int screen_height, TTF_Font *font) { AircraftLabel::AircraftLabel(Aircraft *p, bool metric, bool roundScreen, int screen_width, int screen_height, TTF_Font *font) {
this->p = p; this->p = p;
this->metric = metric; this->metric = metric;
this->roundScreen = roundScreen;
x = p->x; x = p->x;
y = p->y + 20; //*screen_uiscale y = p->y + 20; //*screen_uiscale

View file

@ -18,7 +18,7 @@ class AircraftLabel {
void draw(SDL_Renderer *renderer, bool selected); void draw(SDL_Renderer *renderer, bool selected);
AircraftLabel(Aircraft *p, bool metric, int screen_width, int screen_height, TTF_Font *font); AircraftLabel(Aircraft *p, bool metric, bool roundScreen, int screen_width, int screen_height, TTF_Font *font);
private: private:
SDL_Rect getFullRect(int labelLevel); SDL_Rect getFullRect(int labelLevel);
@ -35,6 +35,8 @@ class AircraftLabel {
bool metric; bool metric;
bool roundScreen;
float x; float x;
float y; float y;
float w; float w;

View file

@ -16,11 +16,4 @@ viz1090: viz1090.o AppData.o AircraftList.o Aircraft.o Label.o AircraftLabel.o a
$(CXX) -o viz1090 viz1090.o AppData.o AircraftList.o Aircraft.o Label.o AircraftLabel.o anet.o interactive.o mode_ac.o mode_s.o net_io.o Input.o View.o Map.o parula.o monokai.o $(LIBS) $(LDFLAGS) $(CXX) -o viz1090 viz1090.o AppData.o AircraftList.o Aircraft.o Label.o AircraftLabel.o anet.o interactive.o mode_ac.o mode_s.o net_io.o Input.o View.o Map.o parula.o monokai.o $(LIBS) $(LDFLAGS)
clean: clean:
rm -f \ rm -f *.o viz1090
airportdata.bin \
airportnames \
mapdata/* \
mapdata.bin \
mapnames \
*.o \
viz1090

View file

@ -74,17 +74,6 @@ As WSL does not have an X server built in, you will need to install a 3rd party
``` ```
* Start viz1090 as described below. * Start viz1090 as described below.
#### Nix
Run without installing
```bash
nix shell git+https://git.vulpecula.zone/tasiaiso/viz1090
```
TODO docs
A shell is now open with viz1090 in the path
### RUNNING ### RUNNING
1. Start dump1090 (http://www.github.com/MalcolmRobb/dump1090) locally in network mode: 1. Start dump1090 (http://www.github.com/MalcolmRobb/dump1090) locally in network mode:

10
Style.h
View file

@ -68,15 +68,15 @@ typedef struct Style {
blue = {0,0,255,255}; blue = {0,0,255,255};
backgroundColor = black; backgroundColor = {0,0,0,255};
selectedColor = pink; selectedColor = pink;
planeColor = yellow; planeColor = {0,255,174};
planeGoneColor = grey; planeGoneColor = grey;
trailColor = yellow_dark; trailColor = {0,255,174};
geoColor = purple_dark; geoColor = grey_dark;
airportColor = purple; airportColor = grey;
labelColor = white; labelColor = white;
labelLineColor = grey_dark; labelLineColor = grey_dark;

View file

@ -135,7 +135,11 @@ void View::screenCoords(int *outX, int *outY, float dx, float dy) {
} }
int View::outOfBounds(int x, int y) { int View::outOfBounds(int x, int y) {
return outOfBounds(x, y, 0, 0, screen_width, screen_height); if(roundScreen) {
return outOfBounds(x, y, screen_width >> 1);
} else {
return outOfBounds(x, y, 0, 0, screen_width, screen_height);
}
} }
int View::outOfBounds(int x, int y, int left, int top, int right, int bottom) { int View::outOfBounds(int x, int y, int left, int top, int right, int bottom) {
@ -146,6 +150,21 @@ int View::outOfBounds(int x, int y, int left, int top, int right, int bottom) {
} }
} }
int View::outOfBounds(int x, int y, int radius) {
float f_radius = static_cast<float>(radius);
float f_x = static_cast<float>(x);
float f_y = static_cast<float>(y);
if((f_x - f_radius) * (f_x - f_radius) + (f_y - f_radius) * (f_y - f_radius) > (f_radius * f_radius)) {
return 1;
} else {
return 0;
}
}
// //
// Fonts should probably go in Style // Fonts should probably go in Style
// //
@ -290,6 +309,10 @@ void View::drawStatusBox(int *left, int *top, std::string label, std::string mes
void View::drawStatus() { void View::drawStatus() {
if(roundScreen) {
return;
}
int left = PAD; int left = PAD;
int top = screen_height - messageFontHeight - PAD; int top = screen_height - messageFontHeight - PAD;
@ -326,23 +349,30 @@ void View::drawPlaneOffMap(int x, int y, int *returnx, int *returny, SDL_Color p
outx = inx; outx = inx;
outy = iny; outy = iny;
if(abs(inx) > abs(y - (screen_height>>1)) * static_cast<float>(screen_width>>1) / static_cast<float>(screen_height>>1)) { //left / right quadrants
outx = (screen_width>>1) * ((inx > 0) ? 1.0 : -1.0);
outy = (outx) * iny / (inx);
} else { // up / down quadrants
outy = screen_height * ((iny > 0) ? 0.5 : -0.5 );
outx = (outy) * inx / (iny);
}
// circleRGBA (renderer,(screen_width>>1) + outx, screen_height * CENTEROFFSET + outy,50,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
// thickLineRGBA(renderer,screen_width>>1,screen_height * CENTEROFFSET, (screen_width>>1) + outx, screen_height * CENTEROFFSET + outy,arrowWidth,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
float inmag = sqrt(inx *inx + iny*iny); float inmag = sqrt(inx *inx + iny*iny);
float vec[3]; float vec[3];
vec[0] = inx / inmag; vec[0] = inx / inmag;
vec[1] = iny /inmag; vec[1] = iny /inmag;
vec[2] = 0; vec[2] = 0;
if(roundScreen) {
outx = vec[0] * (screen_width>>1);
outy = vec[1] * (screen_width>>1);
} else {
if(abs(inx) > abs(y - (screen_height>>1)) * static_cast<float>(screen_width>>1) / static_cast<float>(screen_height>>1)) { //left / right quadrants
outx = (screen_width>>1) * ((inx > 0) ? 1.0 : -1.0);
outy = (outx) * iny / (inx);
} else { // up / down quadrants
outy = screen_height * ((iny > 0) ? 0.5 : -0.5 );
outx = (outy) * inx / (iny);
}
}
// circleRGBA (renderer,(screen_width>>1) + outx, screen_height * CENTEROFFSET + outy,50,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
// thickLineRGBA(renderer,screen_width>>1,screen_height * CENTEROFFSET, (screen_width>>1) + outx, screen_height * CENTEROFFSET + outy,arrowWidth,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
float up[] = {0,0,1}; float up[] = {0,0,1};
float out[3]; float out[3];
@ -487,6 +517,10 @@ void View::drawTrails(int left, int top, int right, int bottom) {
void View::drawScaleBars() void View::drawScaleBars()
{ {
if(roundScreen) {
return;
}
int scalePower = 0; int scalePower = 0;
int scaleBarDist = screenDist((float)pow(10,scalePower)); int scaleBarDist = screenDist((float)pow(10,scalePower));
@ -737,7 +771,7 @@ void View::drawGeography() {
void View::drawPlaneText(Aircraft *p) { void View::drawPlaneText(Aircraft *p) {
if(!p->label) { if(!p->label) {
p->label = new AircraftLabel(p,metric,screen_width, screen_height, mapFont); p->label = new AircraftLabel(p,metric, roundScreen, screen_width, screen_height, mapFont);
} }
p->label->update(); p->label->update();
@ -838,7 +872,7 @@ void View::drawPlanes() {
//show latlon ping //show latlon ping
if(elapsed(p->msSeenLatLon) < 500) { if(elapsed(p->msSeenLatLon) < 500) {
circleRGBA(renderer, p->x, p->y, elapsed(p->msSeenLatLon) * screen_width / (8192), 127,127, 127, 255 - (uint8_t)(255.0 * elapsed(p->msSeenLatLon) / 500.0)); circleRGBA(renderer, p->x, p->y, 20 * elapsed(p->msSeenLatLon) / 500, 127,127, 127, 255 - (uint8_t)(255.0 * elapsed(p->msSeenLatLon) / 500.0));
} }
drawPlaneText(p); drawPlaneText(p);
@ -1088,11 +1122,14 @@ View::View(AppData *appData){
screen_width = 0; screen_width = 0;
screen_height = 0; screen_height = 0;
screen_depth = 32; screen_depth = 32;
metric = 0;
fps = 0; fps = 0;
fullscreen = 0; fullscreen = 0;
screen_index = 0; screen_index = 0;
metric = 0;
roundScreen = 0;
centerLon = 0; centerLon = 0;
centerLat = 0; centerLat = 0;

3
View.h
View file

@ -97,6 +97,7 @@ class View {
void screenCoords(int *outX, int *outY, float dx, float dy); void screenCoords(int *outX, int *outY, float dx, float dy);
int outOfBounds(int x, int y); int outOfBounds(int x, int y);
int outOfBounds(int x, int y, int left, int top, int right, int bottom); int outOfBounds(int x, int y, int left, int top, int right, int bottom);
int outOfBounds(int x, int y, int radius);
void drawPlaneOffMap(int x, int y, int *returnx, int *returny, SDL_Color planeColor); void drawPlaneOffMap(int x, int y, int *returnx, int *returny, SDL_Color planeColor);
void drawPlaneIcon(int x, int y, float heading, SDL_Color planeColor); void drawPlaneIcon(int x, int y, float heading, SDL_Color planeColor);
void drawTrails(int left, int top, int right, int bottom); void drawTrails(int left, int top, int right, int bottom);
@ -130,6 +131,8 @@ class View {
//////////////// ////////////////
bool metric; bool metric;
bool roundScreen;
bool fps; bool fps;
float maxDist; float maxDist;

View file

@ -1,61 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1739758141,
"narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c618e28f70257593de75a7044438efc1c1fc0791",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,50 +0,0 @@
{
# TODO desc
description = "viz1090";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
in rec
{
# Nix formatter, run using `$ nix fmt`
formatter = pkgs.alejandra;
# Exports the package
# Build with `$ nix build`
packages.viz1090 = pkgs.callPackage ./nix/viz1090.nix {inherit self system;};
packages.viz1090-mapdata = pkgs.callPackage ./nix/viz1090-mapdata.nix {};
packages.default = packages.viz1090;
# Creates a shell with the necessary dependencies
# Enter using `$ nix develop`
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
rtl-sdr-librtlsdr
SDL2
SDL2_ttf
SDL2_gfx
gdal
python3
python312Packages.pip
python312Packages.shapely
python312Packages.fiona
python312Packages.tqdm
unzip
python312Packages.requests
git
];
};
});
}

View file

@ -1,24 +1,12 @@
#!/bin/bash #!/bin/bash
mkdir -p mapdata wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces.zip
pushd mapdata > /dev/null wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip
wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_airports.zip
wget --no-verbose https://naciscdn.org/naturalearth/10m/cultural/ne_10m_admin_1_states_provinces.zip
wget --no-verbose https://naciscdn.org/naturalearth/10m/cultural/ne_10m_populated_places.zip
wget --no-verbose https://naciscdn.org/naturalearth/10m/cultural/ne_10m_airports.zip
#this may not be up to date #this may not be up to date
wget --no-verbose https://opendata.arcgis.com/datasets/4d8fa46181aa470d809776c57a8ab1f6_0.zip wget https://opendata.arcgis.com/datasets/4d8fa46181aa470d809776c57a8ab1f6_0.zip
for file in *.zip; do unzip '*.zip'
unzip -o "${file}"
rm "${file}"
done
popd > /dev/null python3 mapconverter.py --mapfile ne_10m_admin_1_states_provinces.shp --mapnames ne_10m_populated_places.shp --airportfile Runways.shp --airportnames ne_10m_airports.shp
python3 mapconverter.py \
--mapfile mapdata/ne_10m_admin_1_states_provinces.shp \
--mapnames mapdata/ne_10m_populated_places.shp \
--airportfile mapdata/Runways.shp \
--airportnames mapdata/ne_10m_airports.shp

View file

@ -38,7 +38,7 @@ def extractLines(shapefile, tolerance):
elif(simplified.geom_type == "MultiPolygon" or simplified.geom_type == "Polygon"): elif(simplified.geom_type == "MultiPolygon" or simplified.geom_type == "Polygon"):
if(simplified.boundary.geom_type == "MultiLineString"): if(simplified.boundary.geom_type == "MultiLineString"):
for boundary in simplified.boundary.geoms: for boundary in simplified.boundary:
outlist.extend(convertLinestring(boundary)) outlist.extend(convertLinestring(boundary))
else: else:
outlist.extend(convertLinestring(simplified.boundary)) outlist.extend(convertLinestring(simplified.boundary))

View file

@ -1,70 +0,0 @@
{
lib,
pkgs,
stdenv,
fetchFromGitea,
}: let
runways = fetchTarball {
url = "https://opendata.arcgis.com/datasets/4d8fa46181aa470d809776c57a8ab1f6_0.zip";
sha256 = "sha256:1ivwx8glk8yk68nmqz467yzvlb3l66l1s3ibmd9p41wz737lmz88";
};
provinces = fetchTarball {
url = "https://naciscdn.org/naturalearth/10m/cultural/ne_10m_admin_1_states_provinces.zip";
sha256 = "sha256:06ai02b8rfsfzpa0gq4nsg29lxvwy4zvjw44099hc78vr7dkfsdp";
};
places = fetchTarball {
url = "https://naciscdn.org/naturalearth/10m/cultural/ne_10m_populated_places.zip";
sha256 = "sha256:1dhh569520f02yml1m5zp2znjv85cqbccl4nvpmigynxd37kid3j";
};
airports = fetchTarball {
url = "https://naciscdn.org/naturalearth/10m/cultural/ne_10m_airports.zip";
sha256 = "sha256:0893zg63ygr2l2d1wpyigls1syfkryjlygvnbbjikpqk5i5cwr56";
};
in
stdenv.mkDerivation rec {
pname = "viz1090-mapdata";
version = "0.1.0";
src = fetchFromGitea {
domain = "git.vulpecula.zone";
owner = "tasiaiso";
repo = pname;
rev = "d1f53019b22a9e605506bed90fcffcdc5f7e6186";
hash = "sha256-gtv0u7o+5fqVgA0CHDWdZr0h9A1Nbky1+okHvSv1cVU=";
};
nativeBuildInputs = with pkgs; [
python3
python312Packages.pip
python312Packages.shapely
python312Packages.fiona
python312Packages.tqdm
python312Packages.requests
];
buildPhase = ''
mkdir -p mapdata
cp ${runways}/* mapdata
cp ${provinces}/* mapdata
cp ${places}/* mapdata
cp ${airports}/* mapdata
python3 mapconverter.py \
--mapfile mapdata/ne_10m_admin_1_states_provinces.shp \
--mapnames mapdata/ne_10m_populated_places.shp \
--airportfile mapdata/Runways.shp \
--airportnames mapdata/ne_10m_airports.shp
'';
installPhase = ''
mkdir -p $out $out/font
cp airportdata.bin $out
cp airportnames $out
cp mapdata.bin $out
cp mapnames $out
cp font/* $out/font
'';
}

View file

@ -1,116 +0,0 @@
{
lib,
pkgs,
stdenv,
fetchFromGitea,
self,
system,
}: let
viz1090-mapdata = self.packages.${system}.viz1090-mapdata;
in
stdenv.mkDerivation rec {
pname = "viz1090";
version = "0.1.0";
src = fetchFromGitea {
domain = "git.vulpecula.zone";
owner = "tasiaiso";
repo = pname;
rev = "1922324b40f84fd449cec3fbfdade8aa33597bf6";
hash = "sha256-bPVFKbGtPXOitzzHb3yJ6XW3fRh8PF/7kfP7EJkJX3c=";
};
nativeBuildInputs = with pkgs; [
rtl-sdr-librtlsdr
SDL2
SDL2_ttf
SDL2_gfx
gdal
git
];
buildInputs = [
viz1090-mapdata
];
buildPhase = ''
echo "diff --git a/Makefile b/Makefile
index 5e60779..d5b30ab 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
# sure that the variable PREFIX is defined, e.g. make PREFIX=/usr/local
#
-CXXFLAGS=-O2 -std=c++11 -g
+CXXFLAGS=-O2 -std=c++11 -g -I ${pkgs.SDL2.dev}/include/SDL2/
LIBS= -lm -lSDL2 -lSDL2_ttf -lSDL2_gfx -g
CXX=g++
diff --git a/Map.cpp b/Map.cpp
index cd798ec..c5736bd 100644
--- a/Map.cpp
+++ b/Map.cpp
@@ -189,7 +189,7 @@ std::vector<Line*> Map::getLines(float screen_lat_min, float screen_lat_max, flo
Map::Map() {
FILE *fileptr;
- if((fileptr = fopen(\"mapdata.bin\", \"rb\"))) {
+ if((fileptr = fopen(\"${viz1090-mapdata}/mapdata.bin\", \"rb\"))) {
fseek(fileptr, 0, SEEK_END);
@@ -255,7 +255,7 @@ Map::Map() {
//
- if((fileptr = fopen(\"airportdata.bin\", \"rb\"))) {
+ if((fileptr = fopen(\"${viz1090-mapdata}/airportdata.bin\", \"rb\"))) {
fseek(fileptr, 0, SEEK_END);
airportPoints_count = ftell(fileptr) / sizeof(float);
rewind(fileptr);
@@ -350,7 +350,7 @@ Map::Map() {
infile.close();
- infile.open(\"airportnames\");
+ infile.open(\"${viz1090-mapdata}/airportnames\");
while (std::getline(infile, line))
diff --git a/View.cpp b/View.cpp
index d5dace7..90f6165 100644
--- a/View.cpp
+++ b/View.cpp
@@ -174,13 +174,13 @@ void View::closeFont(TTF_Font *font)
void View::font_init() {
- mapFont = loadFont(\"font/TerminusTTF-4.46.0.ttf\", 12 * screen_uiscale);
- mapBoldFont = loadFont(\"font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
+ mapFont = loadFont(\"${viz1090-mapdata}/font/TerminusTTF-4.46.0.ttf\", 12 * screen_uiscale);
+ mapBoldFont = loadFont(\"${viz1090-mapdata}/font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
- listFont = loadFont(\"font/TerminusTTF-4.46.0.ttf\", 12 * screen_uiscale);
+ listFont = loadFont(\"${viz1090-mapdata}/font/TerminusTTF-4.46.0.ttf\", 12 * screen_uiscale);
- messageFont = loadFont(\"font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
- labelFont = loadFont(\"font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
+ messageFont = loadFont(\"${viz1090-mapdata}/font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
+ labelFont = loadFont(\"${viz1090-mapdata}/font/TerminusTTF-Bold-4.46.0.ttf\", 12 * screen_uiscale);
mapFontWidth = 5 * screen_uiscale;
mapFontHeight = 12 * screen_uiscale;
" | git apply -
cat Map.cpp | grep mapdata
make -j $NIX_BUILD_CORES
'';
installPhase = ''
mkdir -p $out/bin
cp -v viz1090 $out/bin
'';
}

View file

@ -55,6 +55,7 @@ void showHelp(void) {
"--lon <longitude> Longitude in degrees\n" "--lon <longitude> Longitude in degrees\n"
"--metric Use metric units\n" "--metric Use metric units\n"
"--port <port> TCP Beast output listen port (default: 30005)\n" "--port <port> TCP Beast output listen port (default: 30005)\n"
"--round Use round display outline (assumes square screen size\n"
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n" "--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n" "--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
"--screenindex <i> Set the index of the display to use (default: 0)\n" "--screenindex <i> Set the index of the display to use (default: 0)\n"
@ -99,6 +100,8 @@ int main(int argc, char **argv) {
view.fps = 1; view.fps = 1;
} else if (!strcmp(argv[j],"--fullscreen")) { } else if (!strcmp(argv[j],"--fullscreen")) {
view.fullscreen = 1; view.fullscreen = 1;
} else if (!strcmp(argv[j],"--round")) {
view.roundScreen = 1;
} else if (!strcmp(argv[j],"--screenindex")) { } else if (!strcmp(argv[j],"--screenindex")) {
view.screen_index = atoi(argv[++j]); view.screen_index = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--uiscale") && more) { } else if (!strcmp(argv[j],"--uiscale") && more) {