Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per
2025-12-09 16:27:43 +01:00
parent 0893b221bc
commit f24e92fa57
3 changed files with 46 additions and 6 deletions

View File

@@ -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<OSMTag> resultVector = typeToOsm.typeToOSM(type);
TEST_EQUAL(resultVector.size(), 1, ());
OSMTag const & result = resultVector.front();
TEST_EQUAL(result.key, "amenity", ());
TEST_EQUAL(result.value, "restaurant", ());
}

View File

@@ -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<OSMTag> FeatureTypeToOSM::typeToOSM(uint32_t type)
{
LOG(LDEBUG, ("Computing typeToOSM for Type: ", type, "/ "));
LOG(LINFO, ("Computing typeToOSM for Type: ", type, "/ " , classif().GetReadableObjectName(type)));
std::vector<OSMTag> result;
result.push_back(OSMTag{"amenity", "restaurant"});
return result;
}
} // namespace osm

View File

@@ -1,13 +1,26 @@
#pragma once
#include <cstdint>
#include <vector>
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<OSMTag> typeToOSM(uint32_t type);
private:
//std::vector<OSMTag> storage;
};
} // namespace osm