diff --git a/Makefile b/Makefile index 1a67371..21e5a7e 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ all: view1090 %.o: %.c $(CC) $(CFLAGS) $(EXTRACFLAGS) -c $< -view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o planeObj.o input.o draw.o font.o init.o mapdata.o status.o list.o parula.o monokai.o - $(CC) -g -o view1090 view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o planeObj.o input.o draw.o font.o init.o mapdata.o status.o list.o parula.o monokai.o $(LIBS) $(LDFLAGS) +view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o planeObj.o input.o draw.o font.o init.o mapdata.o status.o list.o parula.o monokai.o allstates.o + $(CC) -g -o view1090 view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o planeObj.o input.o draw.o font.o init.o mapdata.o status.o list.o parula.o monokai.o allstates.o $(LIBS) $(LDFLAGS) clean: rm -f *.o view1090 diff --git a/allstates.c.REMOVED.git-id b/allstates.c.REMOVED.git-id new file mode 100644 index 0000000..9bbece1 --- /dev/null +++ b/allstates.c.REMOVED.git-id @@ -0,0 +1 @@ +e1983f2439326aba30a2576504aac03b2f3cd2fc \ No newline at end of file diff --git a/allstates.o.REMOVED.git-id b/allstates.o.REMOVED.git-id new file mode 100644 index 0000000..76f110e --- /dev/null +++ b/allstates.o.REMOVED.git-id @@ -0,0 +1 @@ +9bee8f55a87c0c25e624b913e8e728619074d9ee \ No newline at end of file diff --git a/draw.c b/draw.c index 99f78a1..43414bc 100644 --- a/draw.c +++ b/draw.c @@ -373,13 +373,6 @@ void drawGrid() void drawPolys(QuadTree *tree, double screen_lat_min, double screen_lat_max, double screen_lon_min, double screen_lon_max) { - // int skip = (int)(appData.maxDist / 25.0f); - // if(skip < 2) { - // skip = 2; - // } - int skip = 1; - - if(tree == NULL) { return; } @@ -429,57 +422,82 @@ void drawPolys(QuadTree *tree, double screen_lat_min, double screen_lat_max, dou while(currentPolygon != NULL) { - Sint16 *px = (Sint16*)malloc(sizeof(Sint16*)*currentPolygon->numPoints); - Sint16 *py = (Sint16*)malloc(sizeof(Sint16*)*currentPolygon->numPoints); + ////polygon mode + // Sint16 *px = (Sint16*)malloc(sizeof(Sint16*)*currentPolygon->numPoints); + // Sint16 *py = (Sint16*)malloc(sizeof(Sint16*)*currentPolygon->numPoints); - Point *currentPoint = currentPolygon->points; + // Point *currentPoint = currentPolygon->points; - int i = 0; - while(currentPoint != NULL){ - pxFromLonLat(&dx, &dy, currentPoint->lon, currentPoint->lat); - screenCoords(&x, &y, dx, dy); + // int i = 0; + // while(currentPoint != NULL){ + // pxFromLonLat(&dx, &dy, currentPoint->lon, currentPoint->lat); + // screenCoords(&x, &y, dx, dy); - px[i] = x; - py[i] = y; + // px[i] = x; + // py[i] = y; - i++; + // i++; - for(int k = 0; k < skip; k++) { - currentPoint = currentPoint->next; - if(currentPoint == NULL) - break; - } - } + // for(int k = 0; k < skip; k++) { + // currentPoint = currentPoint->next; + // if(currentPoint == NULL) + // break; + // } + // } - double alpha = 1.0; - //filledPolygonRGBA (appData.renderer, px, py, i, 0, 0, 0, 255); + // double alpha = 1.0; + // //filledPolygonRGBA (appData.renderer, px, py, i, 0, 0, 0, 255); - polygonRGBA (appData.renderer, px, py, i, alpha * purple.r + (1.0-alpha) * blue.r, alpha * purple.g + (1.0-alpha) * blue.g, alpha * purple.b + (1.0-alpha) * blue.b, 255 * alpha); + // polygonRGBA (appData.renderer, px, py, i, alpha * purple.r + (1.0-alpha) * blue.r, alpha * purple.g + (1.0-alpha) * blue.g, alpha * purple.b + (1.0-alpha) * blue.b, 255 * alpha); //// line version - // int x1,y1,x2,y2; + int x1,y1,x2,y2; - // if(currentPolygon->points == NULL) - // continue; + if(currentPolygon->points == NULL) + continue; - // Point *prevPoint = currentPolygon->points; - // Point *currentPoint = prevPoint->next; + Point *prevPoint = currentPolygon->points; + Point *currentPoint = prevPoint->next; - // while(currentPoint != NULL){ - // pxFromLonLat(&dx, &dy, prevPoint->lon, prevPoint->lat); - // screenCoords(&x1, &y1, dx, dy); + while(currentPoint != NULL){ + pxFromLonLat(&dx, &dy, prevPoint->lon, prevPoint->lat); + screenCoords(&x1, &y1, dx, dy); + + if(outOfBounds(x1,y1)) { + prevPoint = currentPoint; + currentPoint = currentPoint->next; + continue; + } + + double d1 = dx* dx + dy * dy; + + pxFromLonLat(&dx, &dy, currentPoint->lon, currentPoint->lat); + screenCoords(&x2, &y2, dx, dy); + + if(outOfBounds(x2,y2)) { + prevPoint = currentPoint; + currentPoint = currentPoint->next; + continue; + } + + + if((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1) < 100){ + currentPoint = currentPoint->next; + continue; + } + + double d2 = dx* dx + dy * dy; - // pxFromLonLat(&dx, &dy, currentPoint->lon, currentPoint->lat); - // screenCoords(&x2, &y2, dx, dy); + double alpha = 1.0 - (d1+d2) / (3* appData.maxDist * appData.maxDist); - // double alpha = 1.0; - // thickLineRGBA(appData.renderer, x1, y1, x2, y2, appData.screen_uiscale, alpha * purple.r + (1.0-alpha) * blue.r, alpha * purple.g + (1.0-alpha) * blue.g, alpha * purple.b + (1.0-alpha) * blue.b, 255 * alpha); + lineRGBA(appData.renderer, x1, y1, x2, y2, alpha * purple.r + (1.0-alpha) * blue.r, alpha * purple.g + (1.0-alpha) * blue.g, alpha * purple.b + (1.0-alpha) * blue.b, 255 * alpha); - // prevPoint = currentPoint; - // currentPoint = currentPoint->next; - // } + prevPoint = currentPoint; + currentPoint = currentPoint->next; + + } ////bounding boxes diff --git a/draw.o.REMOVED.git-id b/draw.o.REMOVED.git-id index f1ac2e9..e4b7902 100644 --- a/draw.o.REMOVED.git-id +++ b/draw.o.REMOVED.git-id @@ -1 +1 @@ -b44aeb09f69d729d671d17f19bfd669b615a3702 \ No newline at end of file +876851c7cb19383223314e1599b55727c8695ce2 \ No newline at end of file diff --git a/font.o b/font.o index 75c233b..3cc27a7 100644 Binary files a/font.o and b/font.o differ diff --git a/input.o.REMOVED.git-id b/input.o.REMOVED.git-id index ce4b4dd..9dd6b32 100644 --- a/input.o.REMOVED.git-id +++ b/input.o.REMOVED.git-id @@ -1 +1 @@ -bb8d618a3de2096192e6fd03ba715f6346df1193 \ No newline at end of file +16d52890261f72e78ba71c37bea36a5c18405767 \ No newline at end of file diff --git a/list.o b/list.o index 508336c..93dc507 100644 Binary files a/list.o and b/list.o differ diff --git a/map_conversion/41.svg.REMOVED.git-id b/map_conversion/41.svg.REMOVED.git-id new file mode 100644 index 0000000..29f48d8 --- /dev/null +++ b/map_conversion/41.svg.REMOVED.git-id @@ -0,0 +1 @@ +f94cfbe36f64a1d81f38c7a21ed5ea789092d0b2 \ No newline at end of file diff --git a/map_conversion/all.svg.REMOVED.git-id b/map_conversion/all.svg.REMOVED.git-id new file mode 100644 index 0000000..a7a0dd6 --- /dev/null +++ b/map_conversion/all.svg.REMOVED.git-id @@ -0,0 +1 @@ +15dc88c67daedfe75f3e5ac04fe1cb6b96908c09 \ No newline at end of file diff --git a/map_conversion/mapconverter.py b/map_conversion/mapconverter.py new file mode 100644 index 0000000..a310306 --- /dev/null +++ b/map_conversion/mapconverter.py @@ -0,0 +1,14 @@ +from lxml import etree as ElementTree + +parser = ElementTree.XMLParser(recover=True) +tree = ElementTree.parse('all.svg', parser) +polys = tree.xpath('//polygon') + +text_file = open("test.txt", "wt") + +for p in polys: + currentPoints = p.attrib['points'] + currentPoints = currentPoints.replace(" ", ",") + text_file.write(currentPoints + ",0,0") + +text_file.close() diff --git a/mapdata.c.REMOVED.git-id b/mapdata.c.REMOVED.git-id index 0d655a8..baee0a1 100644 --- a/mapdata.c.REMOVED.git-id +++ b/mapdata.c.REMOVED.git-id @@ -1 +1 @@ -1392d6dd9fcc07ddac1768bd620a3355a2f836eb \ No newline at end of file +1420a2ee0d38618a03222daea18788de0178f471 \ No newline at end of file diff --git a/mapdata.o b/mapdata.o new file mode 100644 index 0000000..3d33044 Binary files /dev/null and b/mapdata.o differ diff --git a/mapdata.o.REMOVED.git-id b/mapdata.o.REMOVED.git-id deleted file mode 100644 index d3d8c64..0000000 --- a/mapdata.o.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -76782b1a281904545022bc5880c90dcc50d20ec5 \ No newline at end of file diff --git a/monokai.o b/monokai.o index 03c4bd0..5981be1 100644 Binary files a/monokai.o and b/monokai.o differ diff --git a/planeObj.o b/planeObj.o index 44e6d26..07195dc 100644 Binary files a/planeObj.o and b/planeObj.o differ diff --git a/status.o.REMOVED.git-id b/status.o.REMOVED.git-id index 135328c..4454ba8 100644 --- a/status.o.REMOVED.git-id +++ b/status.o.REMOVED.git-id @@ -1 +1 @@ -ad8dd0e24a66f4d0d8df1297c6b9d65e3e429797 \ No newline at end of file +b1eb5d50ff478da938172f368ef72d8de4100ceb \ No newline at end of file diff --git a/view1090.REMOVED.git-id b/view1090.REMOVED.git-id index e724a1e..93377fb 100644 --- a/view1090.REMOVED.git-id +++ b/view1090.REMOVED.git-id @@ -1 +1 @@ -4a7d01d6e64697656eef39194bc58105fdcba550 \ No newline at end of file +53b830e927a180703148d0394461fe22fe54dc54 \ No newline at end of file