refactor in progress, builds currently
Former-commit-id: ad23161c72900be5a595ad004e133c67fa37df92 Former-commit-id: 284f7c0acd3b4322e33c215aa8a559c35f6daa65
This commit is contained in:
parent
af9cfce3ff
commit
8b23d25dd1
|
@ -1,5 +1,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "dump1090.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
class Aircraft {
|
class Aircraft {
|
||||||
|
|
|
@ -86,7 +86,7 @@ void AircraftData::update() {
|
||||||
|
|
||||||
interactiveRemoveStaleAircrafts(&modes);
|
interactiveRemoveStaleAircrafts(&modes);
|
||||||
|
|
||||||
aircraftList.update();
|
aircraftList.update(&modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
AircraftData::AircraftData(){
|
AircraftData::AircraftData(){
|
||||||
|
|
|
@ -21,10 +21,9 @@ Aircraft *AircraftList::find(uint32_t addr) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AircraftList::update
|
|
||||||
() {
|
|
||||||
//instead of this, net_io should call this class directly to update info
|
//instead of this, net_io should call this class directly to update info
|
||||||
struct aircraft *a = modes.aircrafts;
|
void AircraftList::update(Modes *modes) {
|
||||||
|
struct aircraft *a = modes->aircrafts;
|
||||||
|
|
||||||
Aircraft *p = head;
|
Aircraft *p = head;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class AircraftList {
|
||||||
Aircraft *head;
|
Aircraft *head;
|
||||||
|
|
||||||
Aircraft *find(uint32_t addr);
|
Aircraft *find(uint32_t addr);
|
||||||
void update();
|
void update(Modes *modes);
|
||||||
|
|
||||||
AircraftList();
|
AircraftList();
|
||||||
~AircraftList();
|
~AircraftList();
|
||||||
|
|
17
View.cpp
17
View.cpp
|
@ -148,7 +148,7 @@ int View::screenDist(float d) {
|
||||||
return round(0.95 * scale_factor * 0.5 * fabs(d) / appData.maxDist);
|
return round(0.95 * scale_factor * 0.5 * fabs(d) / appData.maxDist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pxFromLonLat(float *dx, float *dy, float lon, float lat) {
|
void View::pxFromLonLat(float *dx, float *dy, float lon, float lat) {
|
||||||
if(!lon || !lat) {
|
if(!lon || !lat) {
|
||||||
*dx = 0;
|
*dx = 0;
|
||||||
*dy = 0;
|
*dy = 0;
|
||||||
|
@ -391,7 +391,7 @@ void View::drawScaleBars()
|
||||||
while(scaleBarDist < appData.screen_width) {
|
while(scaleBarDist < appData.screen_width) {
|
||||||
lineRGBA(appData.renderer,10+scaleBarDist,8,10+scaleBarDist,16*appData.screen_uiscale,style.scaleBarColor.r, style.scaleBarColor.g, style.scaleBarColor.b, 255);
|
lineRGBA(appData.renderer,10+scaleBarDist,8,10+scaleBarDist,16*appData.screen_uiscale,style.scaleBarColor.r, style.scaleBarColor.g, style.scaleBarColor.b, 255);
|
||||||
|
|
||||||
if (modes.metric) {
|
if (aircraftData->modes.metric) {
|
||||||
snprintf(scaleLabel,13,"%dkm", (int)pow(10,scalePower));
|
snprintf(scaleLabel,13,"%dkm", (int)pow(10,scalePower));
|
||||||
} else {
|
} else {
|
||||||
snprintf(scaleLabel,13,"%dmi", (int)pow(10,scalePower));
|
snprintf(scaleLabel,13,"%dmi", (int)pow(10,scalePower));
|
||||||
|
@ -549,7 +549,7 @@ void View::drawPlaneText(Aircraft *p) {
|
||||||
|
|
||||||
if(p->pressure * appData.screen_width < 0.2f) {
|
if(p->pressure * appData.screen_width < 0.2f) {
|
||||||
char alt[10] = " ";
|
char alt[10] = " ";
|
||||||
if (modes.metric) {
|
if (aircraftData->modes.metric) {
|
||||||
currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
||||||
} else {
|
} else {
|
||||||
currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
||||||
|
@ -565,7 +565,7 @@ void View::drawPlaneText(Aircraft *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char speed[10] = " ";
|
char speed[10] = " ";
|
||||||
if (modes.metric) {
|
if (aircraftData->modes.metric) {
|
||||||
currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
||||||
} else {
|
} else {
|
||||||
currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
||||||
|
@ -627,7 +627,7 @@ void View::drawSelectedAircraftText(Aircraft *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char alt[10] = " ";
|
char alt[10] = " ";
|
||||||
if (modes.metric) {
|
if (aircraftData->modes.metric) {
|
||||||
currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
||||||
} else {
|
} else {
|
||||||
currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
||||||
|
@ -643,7 +643,7 @@ void View::drawSelectedAircraftText(Aircraft *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char speed[10] = " ";
|
char speed[10] = " ";
|
||||||
if (modes.metric) {
|
if (aircraftData->modes.metric) {
|
||||||
currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
||||||
} else {
|
} else {
|
||||||
currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
||||||
|
@ -853,10 +853,7 @@ void View::drawPlanes() {
|
||||||
// draw all trails first so they don't cover up planes and text
|
// draw all trails first so they don't cover up planes and text
|
||||||
// also find closest plane to selection point
|
// also find closest plane to selection point
|
||||||
while(p) {
|
while(p) {
|
||||||
if ((now - p->seen) < modes.interactive_display_ttl) {
|
|
||||||
drawTrail(p->oldLon, p->oldLat, p->oldHeading, p->oldSeen, p->oldIdx);
|
drawTrail(p->oldLon, p->oldLat, p->oldHeading, p->oldSeen, p->oldIdx);
|
||||||
}
|
|
||||||
|
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +865,6 @@ void View::drawPlanes() {
|
||||||
p = aircraftData->aircraftList.head;
|
p = aircraftData->aircraftList.head;
|
||||||
|
|
||||||
while(p) {
|
while(p) {
|
||||||
if ((now - p->seen) < modes.interactive_display_ttl) {
|
|
||||||
if (p->lon && p->lat) {
|
if (p->lon && p->lat) {
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -944,7 +940,6 @@ void View::drawPlanes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
View.h
2
View.h
|
@ -34,6 +34,8 @@ public:
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
View(AircraftData *aircraftData);
|
View(AircraftData *aircraftData);
|
||||||
|
|
||||||
|
bool metric;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
1
map1090.REMOVED.git-id
Normal file
1
map1090.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
a18a4bc87ddef182cd7d61470daf952ae025186b
|
|
@ -125,7 +125,6 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int go;
|
int go;
|
||||||
|
|
||||||
aircraftData.connect();
|
aircraftData.connect();
|
||||||
|
|
Loading…
Reference in a new issue