mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
# Conflicts: # CMakeLists.txt # android/app/src/main/java/app/organicmaps/settings/SettingsPrefsFragment.java # android/sdk/src/main/cpp/app/organicmaps/sdk/Framework.hpp # android/sdk/src/main/cpp/app/organicmaps/sdk/OrganicMaps.cpp # android/sdk/src/main/cpp/app/organicmaps/sdk/util/Config.cpp # libs/indexer/data_source.hpp # libs/indexer/feature.hpp # libs/indexer/ftypes_matcher.hpp # libs/map/framework.cpp # libs/map/traffic_manager.cpp # libs/routing/absent_regions_finder.cpp # libs/routing/edge_estimator.hpp # libs/routing/index_router.cpp # libs/routing/index_router.hpp # libs/routing/routing_session.hpp # libs/routing_common/num_mwm_id.hpp # libs/traffic/traffic_info.cpp # qt/mainwindow.hpp # qt/preferences_dialog.cpp # tools/openlr/helpers.hpp # tools/openlr/openlr_decoder.cpp # tools/openlr/openlr_decoder.hpp # tools/openlr/openlr_stat/openlr_stat.cpp # tools/openlr/router.hpp # tools/openlr/score_candidate_paths_getter.cpp # tools/openlr/score_candidate_paths_getter.hpp # xcode/CoMaps.xcworkspace/contents.xcworkspacedata
64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
#include "std/boost_container_hash.hpp"
|
|
|
|
namespace routing
|
|
{
|
|
/**
|
|
* @brief A unique identifier for any point on a road in an mwm file.
|
|
*
|
|
* It contains a feature id and point id. The point id is the ordinal number of the point in the road.
|
|
*/
|
|
class RoadPoint final
|
|
{
|
|
public:
|
|
RoadPoint() : m_featureId(0), m_pointId(0) {}
|
|
|
|
RoadPoint(uint32_t featureId, uint32_t pointId) : m_featureId(featureId), m_pointId(pointId) {}
|
|
|
|
uint32_t GetFeatureId() const { return m_featureId; }
|
|
|
|
uint32_t GetPointId() const { return m_pointId; }
|
|
|
|
bool operator<(RoadPoint const & rp) const
|
|
{
|
|
if (m_featureId != rp.m_featureId)
|
|
return m_featureId < rp.m_featureId;
|
|
return m_pointId < rp.m_pointId;
|
|
}
|
|
|
|
bool operator==(RoadPoint const & rp) const { return m_featureId == rp.m_featureId && m_pointId == rp.m_pointId; }
|
|
|
|
bool operator!=(RoadPoint const & rp) const { return !(*this == rp); }
|
|
|
|
struct Hash
|
|
{
|
|
size_t operator()(RoadPoint const & roadPoint) const
|
|
{
|
|
size_t seed = 0;
|
|
boost::hash_combine(seed, roadPoint.m_featureId);
|
|
boost::hash_combine(seed, roadPoint.m_pointId);
|
|
return seed;
|
|
}
|
|
};
|
|
|
|
void SetPointId(uint32_t pointId) { m_pointId = pointId; }
|
|
|
|
private:
|
|
uint32_t m_featureId;
|
|
uint32_t m_pointId;
|
|
};
|
|
|
|
inline std::string DebugPrint(RoadPoint const & rp)
|
|
{
|
|
std::ostringstream out;
|
|
out << "RoadPoint{" << rp.GetFeatureId() << ", " << rp.GetPointId() << "}";
|
|
return out.str();
|
|
}
|
|
} // namespace routing
|