diff --git a/README.md b/README.md index a36c562..1c9e999 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ cd spidr ### Runtime Options --server [domain name or ip] Specify a dump1090 server. Renamed from the view1090 "--net-bo-ip-addr" argument +--port [port number] Specify dump1090 server port. Renamed from the view1090 "--net-bo-port" argument --metric Display metric units rather than imperial. --screensize [width] [height] Specify a specific resolution to pass to SDL_RenderSetLogicalSize, otherwise use resolution of display diff --git a/draw.c b/draw.c index 0b536c8..5a2acf4 100644 --- a/draw.c +++ b/draw.c @@ -225,7 +225,7 @@ void drawPlaneOffMap(int x, int y, int *returnx, int *returny, SDL_Color planeCo *returny = y3; } -void drawPlaneHeading(int x, int y, float heading, SDL_Color planeColor) +void drawPlaneIcon(int x, int y, float heading, SDL_Color planeColor) { float body = 8.0 * appData.screen_uiscale; float wing = 6.0 * appData.screen_uiscale; @@ -245,11 +245,6 @@ void drawPlaneHeading(int x, int y, float heading, SDL_Color planeColor) int x1, x2, y1, y2; - - // tempCenter - - // circleRGBA(appData.renderer, x, y, 10, 255, 0, 0, 255); - //body x1 = x + round(-body*vec[0]); y1 = y + round(-body*vec[1]); @@ -277,14 +272,6 @@ void drawPlaneHeading(int x, int y, float heading, SDL_Color planeColor) filledTrigonRGBA (appData.renderer, x1, y1, x2, y2, x+round(-body*.5*vec[0]), y+round(-body*.5*vec[1]),planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE); } -void drawPlane(int x, int y, SDL_Color planeColor) -{ - int length = 3.0; - - rectangleRGBA (appData.renderer, x - length, y - length, x+length, y + length, planeColor.r, planeColor.g, planeColor.b, SDL_ALPHA_OPAQUE); -} - - void drawTrail(float *oldDx, float *oldDy, float *oldHeading, time_t * oldSeen, int idx) { int currentIdx, prevIdx; @@ -333,7 +320,14 @@ void drawTrail(float *oldDx, float *oldDy, float *oldHeading, time_t * oldSeen, uint8_t colorVal = (uint8_t)floor(255.0 * age); - thickLineRGBA(appData.renderer, prevX, prevY, currentX, currentY, 2 * appData.screen_uiscale, colorVal, colorVal, colorVal, 64); + thickLineRGBA(appData.renderer, prevX, prevY, currentX, currentY, 2 * appData.screen_uiscale, colorVal, colorVal, colorVal, 64); + + //most recent reported location + + if(i == 0) { + boxRGBA(appData.renderer,currentX - 2 * appData.screen_uiscale, currentY - 2 * appData.screen_uiscale, currentX + 2 * appData.screen_uiscale, currentY - 2 * appData.screen_uiscale, + orange.r, orange.g, orange.b, 255); + } //tick marks @@ -381,11 +375,9 @@ void drawScaleBars() char scaleLabel[13] = ""; - // thickLineRGBA(appData.renderer,10,10,10,10*appData.screen_uiscale,2,pink.r, pink.g, pink.b, 255); lineRGBA(appData.renderer,10,10,10,10*appData.screen_uiscale,pink.r, pink.g, pink.b, 255); while(scaleBarDist < appData.screen_width) { - // thickLineRGBA(appData.renderer,10+scaleBarDist,10,10+scaleBarDist,10*appData.screen_uiscale,2,pink.r, pink.g, pink.b, 255); lineRGBA(appData.renderer,10+scaleBarDist,8,10+scaleBarDist,16*appData.screen_uiscale,pink.r, pink.g, pink.b, 255); if (Modes.metric) { @@ -403,20 +395,7 @@ void drawScaleBars() scalePower--; scaleBarDist = screenDist((float)pow(10,scalePower)); - // thickLineRGBA(appData.renderer,10,10+5*appData.screen_uiscale,10+scaleBarDist,10+5*appData.screen_uiscale,2,pink.r, pink.g, pink.b, 255); lineRGBA(appData.renderer,10,10+5*appData.screen_uiscale,10+scaleBarDist,10+5*appData.screen_uiscale,pink.r, pink.g, pink.b, 255); - - // int p1km = screenDist(1.0); - // int p10km = screenDist(10.0); - // int p100km = screenDist(100.0); - - // circleRGBA (appData.renderer, appData.screen_width>>1, appData.screen_height * CENTEROFFSET, p1km, pink.r, pink.g, pink.b, 255); - // circleRGBA (appData.renderer, appData.screen_width>>1, appData.screen_height * CENTEROFFSET, p10km, pink.r, pink.g, pink.b, 195); - // circleRGBA (appData.renderer, appData.screen_width>>1, appData.screen_height * CENTEROFFSET, p100km, pink.r, pink.g, pink.b, 127); - - // drawString("1km", (appData.screen_width>>1) + (0.707 * p1km) + 5, (appData.screen_height * CENTEROFFSET) + (0.707 * p1km) + 5, appData.mapFont, pink); - // drawString("10km", (appData.screen_width>>1) + (0.707 * p10km) + 5, (appData.screen_height * CENTEROFFSET) + (0.707 * p10km) + 5, appData.mapFont, pink); - // drawString("100km", (appData.screen_width>>1) + (0.707 * p100km) + 5, (appData.screen_height * CENTEROFFSET) + (0.707 * p100km) + 5, appData.mapFont, pink); } void drawPolys(QuadTree *tree, float screen_lat_min, float screen_lat_max, float screen_lon_min, float screen_lon_max) { @@ -424,19 +403,6 @@ void drawPolys(QuadTree *tree, float screen_lat_min, float screen_lat_max, float return; } - if(appData.mapContinue && appData.mapContinue != tree) { - return; - } - - if(appData.mapContinue && appData.mapContinue == tree) { - appData.mapContinue = NULL; - } - - if(mstime() - appData.lastFrameTime > FRAMETIME) { - appData.mapContinue = tree; - return; - } - if (tree->lat_min > screen_lat_max || screen_lat_min > tree->lat_max) { return; } @@ -448,34 +414,10 @@ void drawPolys(QuadTree *tree, float screen_lat_min, float screen_lat_max, float drawPolys(tree->nw, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); drawPolys(tree->sw, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); drawPolys(tree->ne, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); - - //if we didn't make it to the last child then need to set mapContinue to this node to make sure all children get drawn next time - if(appData.mapContinue) { - appData.mapContinue = tree; - } - drawPolys(tree->se, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); float dx, dy; - //Draw quadtree bounds - // - // int x, y; - - // pxFromLonLat(&dx, &dy, tree->lon_min, tree->lat_min); - // screenCoords(&x, &y, dx, dy); - - // int top = y; - // int left = x; - - // pxFromLonLat(&dx, &dy, tree->lon_max, tree->lat_max); - // screenCoords(&x, &y, dx, dy); - - // int bottom = y; - // int right = x; - - // rectangleRGBA(appData.renderer, left, top, right, bottom, red.r, red.g, red.b, 255); - Polygon *currentPolygon = tree->polygons; while(currentPolygon != NULL) { @@ -553,11 +495,7 @@ void drawGeography() { latLonFromScreenCoords(&screen_lat_min, &screen_lon_min, 0, appData.screen_height * -0.2); latLonFromScreenCoords(&screen_lat_max, &screen_lon_max, appData.screen_width, appData.screen_height * 1.2); - if(appData.mapContinue) { - drawPolys(appData.mapContinue, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); - } else { - drawPolys(&root, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); - } + drawPolys(&root, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max); } void drawSignalMarks(struct planeObj *p, int x, int y) { @@ -1004,33 +942,20 @@ void drawPlanes() { } else { planeColor = lerpColor(green, grey, (now - p->seen) / (float) DISPLAY_ACTIVE); } - - // if((int)(now - p->seen) > DISPLAY_ACTIVE) { - // planeColor = grey; - // } if(outOfBounds(x,y)) { drawPlaneOffMap(x, y, &(p->cx), &(p->cy), planeColor); - - //lineRGBA(appData.renderer, p->cx, p->cy, p->x+(p->w/2), p->y, 200,200,200,SDL_ALPHA_OPAQUE); - } else { - drawPlaneHeading(usex, usey, p->track, planeColor); - - p->cx = usex;// + 5; - p->cy = usey;// + 10 * appData.screen_uiscale; - - //lineRGBA(appData.renderer, usex, usey, p->x+(p->w/2), p->y, 200,200,200, SDL_ALPHA_OPAQUE); - + drawPlaneIcon(usex, usey, p->track, planeColor); + p->cx = usex; + p->cy = usey; } if(p != selectedPlane) { drawPlaneText(p); } - } else { - //drawPlane(x, y, planeColor); - } + } } } } @@ -1065,14 +990,12 @@ void draw() { updateStatus(); - if(appData.mapMoved || appData.mapContinue) { + if(appData.mapMoved) { SDL_SetRenderTarget(appData.renderer, appData.mapTexture); - if(appData.mapContinue == NULL) { - SDL_SetRenderDrawColor(appData.renderer, 0, 0, 0, 0); - SDL_RenderClear(appData.renderer); - } - + SDL_SetRenderDrawColor(appData.renderer, 0, 0, 0, 0); + SDL_RenderClear(appData.renderer); + drawGeography(); drawScaleBars(); diff --git a/init.c b/init.c index 90c7fd3..a56f7f6 100644 --- a/init.c +++ b/init.c @@ -44,7 +44,6 @@ void init(char *title) { appData.mapMoved = 1; selectedPlane = NULL; - appData.mapContinue = NULL; if(appData.fullscreen) { //\SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. diff --git a/structs.h b/structs.h index 7e4b0d9..e5335dd 100644 --- a/structs.h +++ b/structs.h @@ -42,7 +42,6 @@ typedef struct AppData int touchy; int mapMoved; - QuadTree *mapContinue; uint64_t lastFrameTime; } AppData; diff --git a/view1090.REMOVED.git-id b/view1090.REMOVED.git-id index 4d508f9..abd6991 100644 --- a/view1090.REMOVED.git-id +++ b/view1090.REMOVED.git-id @@ -1 +1 @@ -ade669691e5258a9db857adaedb879bb3c653d1e \ No newline at end of file +cd3abc894d6c0a4ec31ca1210552bf4da06145a5 \ No newline at end of file