Skip to content

Commit ac08766

Browse files
author
KhalilSelyan
committed
feat: Draw latitude and longitude on the tile image
Signed-off-by: KhalilSelyan <khalil@leodrive.ai>
1 parent 2640ee0 commit ac08766

File tree

1 file changed

+7
-2
lines changed
  • common/autoware_overlay_rviz_plugin/autoware_minimap_overlay_rviz_plugin/src

1 file changed

+7
-2
lines changed

common/autoware_overlay_rviz_plugin/autoware_minimap_overlay_rviz_plugin/src/tile_field.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ QImage TileField::getTileFieldImage()
9494

9595
auto tile_key = QString("%1/%2/%3.png").arg(zoom_).arg(x_tile).arg(y_tile).toStdString();
9696

97+
float lon = tilex2long(x_tile, zoom_);
98+
float lat = tiley2lat(y_tile, zoom_);
99+
97100
auto tile_it = tiles_.find(tile_key);
98101
if (tile_it != tiles_.end() && !tile_it->second->getImage().isNull()) {
99102
QRectF target((dx + 1) * 256, (dy + 1) * 256, 256, 256);
100103
QRectF source(0, 0, 256, 256);
101104
painter.drawImage(target, tile_it->second->getImage(), source);
102-
// Draw the tile key as text for debugging
103-
painter.drawText(target, Qt::AlignCenter, QString::fromStdString(tile_key));
105+
// Draw the latitude and longitude on the tile
106+
painter.drawText(
107+
target, Qt::AlignCenter,
108+
QString::fromStdString(std::to_string(lat) + ", " + std::to_string(lon)));
104109
}
105110
}
106111
}

0 commit comments

Comments
 (0)