diff --git a/generator/srtm_parser.cpp b/generator/srtm_parser.cpp index 962587a7e6..274f7e46d3 100644 --- a/generator/srtm_parser.cpp +++ b/generator/srtm_parser.cpp @@ -13,7 +13,6 @@ namespace generator { namespace { -double constexpr kTileSizeInDegree = 1.0; size_t constexpr kArcSecondsInDegree = 60 * 60; size_t constexpr kSrtmTileSize = (kArcSecondsInDegree + 1) * (kArcSecondsInDegree + 1) * 2; @@ -131,8 +130,7 @@ std::string SrtmTile::GetPath(std::string const & dir, std::string const & base) // static ms::LatLon SrtmTile::GetCenter(ms::LatLon const & coord) { - return {floor(coord.m_lat) + kTileSizeInDegree / 2.0, - floor(coord.m_lon) + kTileSizeInDegree / 2.0}; + return {floor(coord.m_lat) + 0.5, floor(coord.m_lon) + 0.5}; } // static diff --git a/topography_generator/generator.cpp b/topography_generator/generator.cpp index b82be52c18..6fa171c920 100644 --- a/topography_generator/generator.cpp +++ b/topography_generator/generator.cpp @@ -18,7 +18,6 @@ namespace topography_generator { double const kEps = 1e-7; -double constexpr kTileSizeInDegree = 1.0; size_t constexpr kArcSecondsInDegree = 60 * 60; int constexpr kAsterTilesLatTop = 60; int constexpr kAsterTilesLatBottom = -60; @@ -55,11 +54,8 @@ private: // Try to prevent loading a new tile if the position can be found in the loaded one. auto const latDist = pos.m_lat - m_leftBottomOfPreferredTile.m_lat; auto const lonDist = pos.m_lon - m_leftBottomOfPreferredTile.m_lon; - if (latDist >= 0.0 && latDist <= kTileSizeInDegree && - lonDist >= 0.0 && lonDist <= kTileSizeInDegree) - { + if (latDist >= 0.0 && latDist <= 1.0 && lonDist >= 0.0 && lonDist <= 1.0) return m_preferredTile->GetHeight(pos); - } } return m_srtmManager.GetHeight(pos); @@ -72,7 +68,7 @@ private: // Look around the position with invalid altitude // and return median of surrounding valid altitudes. - double const step = kTileSizeInDegree / kArcSecondsInDegree; + double const step = 1.0 / kArcSecondsInDegree; int const kMaxKernelRadius = 3; std::vector kernel; int kernelRadius = 0; @@ -216,7 +212,7 @@ private: LOG(LINFO, ("Begin generating isolines for tile", tileName)); - m_srtmProvider.SetPrefferedTile({lat + kTileSizeInDegree / 2.0, lon + kTileSizeInDegree / 2.0}); + m_srtmProvider.SetPrefferedTile({lat + 0.5, lon + 0.5}); Contours contours; if (!m_params.m_filters.empty() && (lat >= kAsterTilesLatTop || lat < kAsterTilesLatBottom)) @@ -282,8 +278,8 @@ private: Contours & contours) { auto const leftBottom = ms::LatLon(lat, lon); - auto const rightTop = ms::LatLon(lat + kTileSizeInDegree, lon + kTileSizeInDegree); - auto const squaresStep = kTileSizeInDegree / kArcSecondsInDegree * m_params.m_latLonStepFactor; + auto const rightTop = ms::LatLon(lat + 1.0, lon + 1.0); + auto const squaresStep = 1.0 / kArcSecondsInDegree * m_params.m_latLonStepFactor; MarchingSquares squares(leftBottom, rightTop, squaresStep, m_params.m_alitudesStep, diff --git a/topography_generator/generator.hpp b/topography_generator/generator.hpp index f8a2d7fa9c..5827b0df55 100644 --- a/topography_generator/generator.hpp +++ b/topography_generator/generator.hpp @@ -17,7 +17,7 @@ struct TileIsolinesParams { Altitude m_alitudesStep = 10; size_t m_latLonStepFactor = 1; - int m_simplificationZoom = 17; + int m_simplificationZoom = 17; // Value == 0 disables simplification. FiltersSequence m_filters; std::string m_outputDir; }; @@ -25,7 +25,7 @@ struct TileIsolinesParams struct CountryIsolinesParams { size_t m_maxIsolineLength = 1000; - int m_simplificationZoom = 17; + int m_simplificationZoom = 17; // Value == 0 disables simplification. size_t m_alitudesStepFactor = 1; std::string m_isolinesTilesPath; };