From f24e92fa57a603b0c32181bb3a454c1e698d2e47 Mon Sep 17 00:00:00 2001 From: map-per Date: Tue, 9 Dec 2025 16:27:43 +0100 Subject: [PATCH] saving Signed-off-by: map-per --- .../editor_tests/feature_type_to_osm_test.cpp | 18 +++++++++++++++++- libs/editor/feature_type_to_osm.cpp | 17 ++++++++++++++--- libs/editor/feature_type_to_osm.hpp | 17 +++++++++++++++-- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/libs/editor/editor_tests/feature_type_to_osm_test.cpp b/libs/editor/editor_tests/feature_type_to_osm_test.cpp index 8e622d53b..f0ab0fde5 100644 --- a/libs/editor/editor_tests/feature_type_to_osm_test.cpp +++ b/libs/editor/editor_tests/feature_type_to_osm_test.cpp @@ -2,7 +2,23 @@ #include "editor/feature_type_to_osm.hpp" +#include "indexer/classificator.hpp" +#include "indexer/classificator_loader.hpp" + +using namespace editor; + UNIT_TEST(testIfTestRuns) { - LOG(LINFO, ("New Test ran!")); + LOG(LINFO, ("Hello from type to osm test!")); + + classificator::Load(); + + FeatureTypeToOSM typeToOsm; + uint32_t type = classif().GetTypeByReadableObjectName("amenity-restaurant"); + std::vector resultVector = typeToOsm.typeToOSM(type); + + TEST_EQUAL(resultVector.size(), 1, ()); + OSMTag const & result = resultVector.front(); + TEST_EQUAL(result.key, "amenity", ()); + TEST_EQUAL(result.value, "restaurant", ()); } diff --git a/libs/editor/feature_type_to_osm.cpp b/libs/editor/feature_type_to_osm.cpp index 06bac08a9..908203fa1 100644 --- a/libs/editor/feature_type_to_osm.cpp +++ b/libs/editor/feature_type_to_osm.cpp @@ -1,11 +1,22 @@ #include "editor/feature_type_to_osm.hpp" #include "base/logging.hpp" +#include "indexer/classificator.hpp" -namespace OSM +namespace editor { -void OSM::FeatureTypeToOSM::typeToOSM(uint32_t type) +void FeatureTypeToOSM::loadConfigFile() { + LOG(LINFO, ("Hello from loadConfigFile")); +} + +std::vector FeatureTypeToOSM::typeToOSM(uint32_t type) { - LOG(LDEBUG, ("Computing typeToOSM for Type: ", type, "/ ")); + LOG(LINFO, ("Computing typeToOSM for Type: ", type, "/ " , classif().GetReadableObjectName(type))); + + std::vector result; + + result.push_back(OSMTag{"amenity", "restaurant"}); + + return result; } } // namespace osm \ No newline at end of file diff --git a/libs/editor/feature_type_to_osm.hpp b/libs/editor/feature_type_to_osm.hpp index 773188b65..b68c5ce20 100644 --- a/libs/editor/feature_type_to_osm.hpp +++ b/libs/editor/feature_type_to_osm.hpp @@ -1,13 +1,26 @@ #pragma once #include +#include -namespace OSM +namespace editor { +struct OSMTag +{ + std::string key; + std::string value; +}; + class FeatureTypeToOSM { public: - static void typeToOSM(uint32_t type); + void loadConfigFile(); + //static void typeToOSM(uint32_t type); + std::vector typeToOSM(uint32_t type); + +private: + //std::vector storage; + }; } // namespace osm \ No newline at end of file