Compare commits

..

12 Commits

Author SHA1 Message Date
Erwin Ried 9e5068180b Merge pull request #12 from eried/world-map-mercator
World map mercator
2020-05-02 16:36:47 +02:00
Erwin Ried 07d746feb5 Merge branch 'world-map-mercator' of https://github.com/eried/portapack-havoc into world-map-mercator 2020-05-02 16:27:33 +02:00
Erwin Ried 3e0be7979c Small styling change 2020-05-02 16:27:29 +02:00
Erwin Ried 3947a0bfea Update world_map.jpg
Based on openseamaps + openstreetmaps
2020-05-02 15:59:57 +02:00
Erwin Ried 24f060906e Update ui_geomap.cpp 2020-05-02 15:50:29 +02:00
Erwin Ried b98e87284e Adjust for header 2020-05-02 15:42:54 +02:00
Erwin Ried 6a22fbf7a3 Merge pull request #11 from eried/world_map.py
Update world_map.py
2020-05-02 13:42:08 +02:00
Erwin Ried f4461c4eda For bigger pictures 2020-05-02 13:03:54 +02:00
Erwin Ried 018bbdc190 Mercator projection 2020-05-02 13:01:23 +02:00
Erwin Ried 76de12852e Merge pull request #10 from eried/gps-test-files
GPS sim test files
2020-05-02 12:28:02 +02:00
Erwin Ried 444d4f9ff3 GPS sim test files 2020-05-02 11:58:11 +02:00
Erwin Ried 31a04f47de Update world_map.py 2020-05-02 11:42:36 +02:00
7 changed files with 21 additions and 15 deletions
+8 -8
View File
@@ -147,7 +147,7 @@ GeoMap::GeoMap(
}
void GeoMap::paint(Painter& painter) {
Coord line;
u_int16_t line;
std::array<ui::Color, 240> map_line_buffer;
const auto r = screen_rect();
@@ -168,7 +168,7 @@ void GeoMap::paint(Painter& painter) {
display.fill_rectangle({ r.center() - Point(16, 1), { 32, 2 } }, Color::red());
display.fill_rectangle({ r.center() - Point(1, 16), { 2, 32 } }, Color::red());
} else {
draw_bearing({ 120, 32 + 144 }, angle_, 16, Color::red());
draw_bearing({ 120, 32 + 144 }, angle_, 10, Color::red());
painter.draw_string({ 120 - ((int)tag_.length() * 8 / 2), 32 + 144 - 32 }, style(), tag_);
}
}
@@ -191,10 +191,10 @@ void GeoMap::move(const float lon, const float lat) {
Rect map_rect = screen_rect();
// Map is in Equidistant "Plate Carrée" projection
x_pos = map_center_x - (map_rect.width() / 2) + (lon_ / lon_ratio);
y_pos = map_center_y - (map_rect.height() / 2) + (lat_ / lat_ratio) + 16;
// Using WGS 84/Pseudo-Mercator projection
x_pos = map_width * (lon_+180)/360 - (map_rect.width() / 2);
y_pos = (0.5-lat_/(340.1206913+-4.21807e-5*pow((double)abs(lat_),3.4198394))) * map_height -(map_rect.height() / 1) + 32;
// Cap position
if (x_pos > (map_width - map_rect.width()))
x_pos = map_width - map_rect.width();
@@ -228,8 +228,8 @@ void GeoMap::draw_bearing(const Point origin, const uint32_t angle, uint32_t siz
for (size_t thickness = 0; thickness < 3; thickness++) {
arrow_a = polar_to_point(angle, size) + origin;
arrow_b = polar_to_point(angle + 180 - 30, size) + origin;
arrow_c = polar_to_point(angle + 180 + 30, size) + origin;
arrow_b = polar_to_point(angle + 180 - 35, size) + origin;
arrow_c = polar_to_point(angle + 180 + 35, size) + origin;
display.draw_line(arrow_a, arrow_b, color);
display.draw_line(arrow_b, arrow_c, color);
+9 -7
View File
@@ -25,6 +25,8 @@ from PIL import Image
outfile = open('../../sdcard/world_map.bin', 'wb')
# Allow for bigger images
Image.MAX_IMAGE_PIXELS = 1933120000
im = Image.open("../../sdcard/world_map.jpg")
pix = im.load()
@@ -35,14 +37,14 @@ for y in range (0, im.size[1]):
line = ''
for x in range (0, im.size[0]):
# RRRRRGGGGGGBBBBB
#pixel_lcd = (pix[x, y][0] >> 3) << 11
#pixel_lcd |= (pix[x, y][1] >> 2) << 5
#pixel_lcd |= (pix[x, y][2] >> 3)
pixel_lcd = (pix[x, y][0] >> 3) << 11
pixel_lcd |= (pix[x, y][1] >> 2) << 5
pixel_lcd |= (pix[x, y][2] >> 3)
# RRRGGGBB to
# RRR00GGG000BB000
pixel_lcd = (pix[x, y][0] >> 5) << 5
pixel_lcd |= (pix[x, y][1] >> 5) << 2
pixel_lcd |= (pix[x, y][2] >> 6)
line += struct.pack('B', pixel_lcd)
# pixel_lcd = (pix[x, y][0] >> 5) << 5
# pixel_lcd |= (pix[x, y][1] >> 5) << 2
# pixel_lcd |= (pix[x, y][2] >> 6)
line += struct.pack('H', pixel_lcd)
outfile.write(line)
print(str(y) + '/' + str(im.size[1]) + '\r', end="")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 MiB

After

Width:  |  Height:  |  Size: 90 MiB

Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
sample_rate=2600000
center_frequency=1575420000
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
sample_rate=2600000
center_frequency=1575420000