Skip to content

Commit

Permalink
Make tile map extent selectable
Browse files Browse the repository at this point in the history
  • Loading branch information
Aang23 committed May 10, 2024
1 parent 326e96d commit cbbbd77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src-core/common/tile_map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ image::Image downloadTileMap(std::string url_source, double lat0, double lon0, d
int x_size = bbox[2] - bbox[0]; // xy1.first - xy0.first;
int y_size = bbox[3] - bbox[1]; // xy1.second - xy0.second;

logger->trace("Tile map will be of size %dx%d (%d, %d => %d, %d)",
logger->trace("Tile map will be of size %dx%d (%f, %f => %f, %f)",
x_size, y_size,
xy0.first, xy0.second,
xy1.first, xy1.second);
Expand Down
4 changes: 4 additions & 0 deletions src-interface/viewer/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ namespace satdump
void drawProjectionPanel();

int projection_osm_zoom = 3;
double projection_osm_lat1 = -85.0511;
double projection_osm_lon1 = -180.0;
double projection_osm_lat2 = 85.0511;
double projection_osm_lon2 = 180.0;
bool is_opening_layer = false;

std::deque<ProjectionLayer> projection_layers;
Expand Down
6 changes: 5 additions & 1 deletion src-interface/viewer/viewer_projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ namespace satdump
}
else if (selected_external_type == 1)
{
ImGui::InputDouble("Lat1##osmlat1", &projection_osm_lat1);
ImGui::InputDouble("Lon1##osmlat1", &projection_osm_lon1);
ImGui::InputDouble("Lat2##osmlat1", &projection_osm_lat2);
ImGui::InputDouble("Lon2##osmlat1", &projection_osm_lon2);
ImGui::SliderInt("Zoom##osmsliderzoom", &projection_osm_zoom, 0, 6);
if (!urlgood)
ImGui::PushStyleColor(ImGuiCol_Text, style::theme.red.Value);
Expand Down Expand Up @@ -262,7 +266,7 @@ namespace satdump
try
{
logger->info("Generating tile map");
image::Image timemap = downloadTileMap(mapurl, -85.0511, -180, 85.0511, 180, projection_osm_zoom);
image::Image timemap = downloadTileMap(mapurl, projection_osm_lat1, projection_osm_lon1, projection_osm_lat2, projection_osm_lon2, projection_osm_zoom);

projection_layers.push_front({"Tile Map", timemap});
}
Expand Down

0 comments on commit cbbbd77

Please sign in to comment.