Skip to content

Commit

Permalink
feat(vectormap): Add waypoint mark in vectorized map
Browse files Browse the repository at this point in the history
  • Loading branch information
jgauchia committed Dec 7, 2024
1 parent c2787c2 commit dcc59e6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions lib/maps/src/globalMapsDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,11 @@ struct tileBounds
*/
extern tileBounds totalBounds;

/**
* @brief Waypoint destination latitude and longitude
*
*/
extern double destLat;
extern double destLon;

#endif
3 changes: 3 additions & 0 deletions lib/maps/src/mapsDrawFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ static void displayMap(uint16_t tileSize)
}

if (tileSize == VECTOR_TILE_SIZE)
{
mapTempSprite.pushImage(wptPosX-8, wptPosY-8, 16 ,16 ,(uint16_t*)waypoint, TFT_BLACK);
mapTempSprite.setPivot(tileSize , tileSize );
}

mapTempSprite.pushRotated(&mapSprite, 360 - mapHeading, TFT_TRANSPARENT);
//mapTempSprite.pushRotated(&mapSprite, 0, TFT_TRANSPARENT);
Expand Down
3 changes: 0 additions & 3 deletions lib/maps/src/renderMaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ extern MapTile oldMapTile; // Old Map tile coordinates and zoom
extern MapTile currentMapTile; // Current Map tile coordinates and zoom
extern MapTile roundMapTile; // Boundaries Map tiles

extern double destLat;
extern double destLon;

uint32_t lon2tilex(double f_lon, uint8_t zoom);
uint32_t lat2tiley(double f_lat, uint8_t zoom);
double tilex2lon(uint32_t tileX, uint8_t zoom);
Expand Down
10 changes: 9 additions & 1 deletion lib/maps/src/vectorMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,17 @@ void generateVectorMap(ViewPort &viewPort, MemCache &memCache, TFT_eSprite &map)
totalBounds.lat_max = mercatorY2lat(viewPort.bbox.max.y);
totalBounds.lon_min = mercatorX2lon(viewPort.bbox.min.x);
totalBounds.lon_max = mercatorX2lon(viewPort.bbox.max.x);

log_i("Total Bounds: Lat Min: %f, Lat Max: %f, Lon Min: %f, Lon Max: %f",
totalBounds.lat_min, totalBounds.lat_max, totalBounds.lon_min, totalBounds.lon_max);

if(isCoordInBounds(destLat,destLon,totalBounds))
coords2map(destLat, destLon, totalBounds, &wptPosX, &wptPosY);
else
{
wptPosX = -1;
wptPosY = -1;
}
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion lib/maps/src/vectorMaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <vector>
#include <map>
#include "globalMapsDef.h"
#include "renderMaps.hpp"
#include "gpsMath.hpp"
#include "settings.hpp"

Expand Down Expand Up @@ -182,7 +183,7 @@ struct MemBlocks
};

/**
* @brief Point in geografic (lat,lon) coordinates and other gps data
* @brief Point in geographic (lat,lon) coordinates and other gps data
*
*/
struct Coord
Expand Down

0 comments on commit dcc59e6

Please sign in to comment.