From ea71232b66acbe50adc00e20c94ceb7919ac1b8b Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 17 Jan 2024 03:12:41 -0700 Subject: [PATCH] Use std::array over raw array for transforms (#48) Signed-off-by: Ryan Friedman --- src/grid_map_geo.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/grid_map_geo.cpp b/src/grid_map_geo.cpp index 6e31e2f..e5e0121 100644 --- a/src/grid_map_geo.cpp +++ b/src/grid_map_geo.cpp @@ -39,6 +39,7 @@ #include "grid_map_geo/grid_map_geo.hpp" +#include #include #include #include @@ -66,8 +67,8 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path, bool align_terra std::cout << std::endl << "Loading GeoTIFF file for gridmap" << std::endl; double originX, originY, pixelSizeX, pixelSizeY; - double geoTransform[6]; - if (dataset->GetGeoTransform(geoTransform) == CE_None) { + std::array geoTransform; + if (dataset->GetGeoTransform(geoTransform.data()) == CE_None) { originX = geoTransform[0]; originY = geoTransform[3]; pixelSizeX = geoTransform[1]; @@ -164,8 +165,8 @@ bool GridMapGeo::addColorFromGeotiff(const std::string &path) { std::cout << std::endl << "Loading color layer from GeoTIFF file for gridmap" << std::endl; double originX, originY, pixelSizeX, pixelSizeY; - double geoTransform[6]; - if (dataset->GetGeoTransform(geoTransform) == CE_None) { + std::array geoTransform; + if (dataset->GetGeoTransform(geoTransform.data()) == CE_None) { originX = geoTransform[0]; originY = geoTransform[3]; pixelSizeX = geoTransform[1]; @@ -225,8 +226,8 @@ bool GridMapGeo::addLayerFromGeotiff(const std::string &layer_name, const std::s std::cout << std::endl << "Loading color layer from GeoTIFF file for gridmap" << std::endl; double originX, originY, pixelSizeX, pixelSizeY; - double geoTransform[6]; - if (dataset->GetGeoTransform(geoTransform) == CE_None) { + std::array geoTransform; + if (dataset->GetGeoTransform(geoTransform.data()) == CE_None) { originX = geoTransform[0]; originY = geoTransform[3]; pixelSizeX = geoTransform[1];