mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-19 01:13:49 +00:00
initial attempt at panoramax layer
Signed-off-by: zyphlar <zyphlar@gmail.com>
This commit is contained in:
@@ -706,6 +706,7 @@ void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & inf
|
||||
info.SetFromFeatureType(ft);
|
||||
|
||||
FillDescription(ft, info);
|
||||
CheckPanoramaxImagery(info);
|
||||
|
||||
auto const mwmInfo = ft.GetID().m_mwmId.GetInfo();
|
||||
bool const isMapVersionEditable = CanEditMapForPosition(info.GetMercator());
|
||||
@@ -3263,6 +3264,43 @@ void Framework::FillDescription(FeatureType & ft, place_page::Info & info) const
|
||||
}
|
||||
}
|
||||
|
||||
void Framework::CheckPanoramaxImagery(place_page::Info & info) const
|
||||
{
|
||||
// Query features within 50m radius
|
||||
auto constexpr radiusM = 50.0;
|
||||
auto const center = info.GetMercator();
|
||||
auto const rect = mercator::RectByCenterXYAndSizeInMeters(center, radiusM);
|
||||
|
||||
auto const panoramaxType = classif().GetTypeByPath({"panoramax", "image"});
|
||||
|
||||
bool hasPanoramax = false;
|
||||
std::string panoramaxImageId;
|
||||
std::string panoramaxUrl;
|
||||
|
||||
m_featuresFetcher.GetDataSource().ForEachInRect([&](FeatureType & ft)
|
||||
{
|
||||
if (ft.GetTypes().Has(panoramaxType))
|
||||
{
|
||||
auto const imageId = ft.GetMetadata(feature::Metadata::FMD_PANORAMAX);
|
||||
if (!imageId.empty())
|
||||
{
|
||||
hasPanoramax = true;
|
||||
panoramaxImageId = std::string(imageId);
|
||||
panoramaxUrl = "https://panoramax.openstreetmap.fr/#focus=pic:" + panoramaxImageId;
|
||||
return base::ControlFlow::Break; // Found one, stop searching
|
||||
}
|
||||
}
|
||||
return base::ControlFlow::Continue;
|
||||
}, rect, df::GetDrawTileScale(rect));
|
||||
|
||||
if (hasPanoramax)
|
||||
{
|
||||
info.m_hasPanoramax = true;
|
||||
info.m_panoramaxImageId = std::move(panoramaxImageId);
|
||||
info.m_panoramaxUrl = std::move(panoramaxUrl);
|
||||
}
|
||||
}
|
||||
|
||||
void Framework::OnPowerFacilityChanged(power_management::Facility const facility, bool enabled)
|
||||
{
|
||||
if (facility == power_management::Facility::PerspectiveView || facility == power_management::Facility::Buildings3d)
|
||||
|
||||
@@ -640,6 +640,7 @@ private:
|
||||
void FillTrackInfo(Track const & track, m2::PointD const & trackPoint, place_page::Info & info) const;
|
||||
void SetPlacePageLocation(place_page::Info & info);
|
||||
void FillDescription(FeatureType & ft, place_page::Info & info) const;
|
||||
void CheckPanoramaxImagery(place_page::Info & info) const;
|
||||
|
||||
public:
|
||||
search::ReverseGeocoder::Address GetAddressAtPoint(m2::PointD const & pt) const;
|
||||
|
||||
@@ -114,6 +114,9 @@ public:
|
||||
bool HasApiUrl() const { return !m_apiUrl.empty(); }
|
||||
/// TODO: Support all possible Internet types in UI. @See MapObject::GetInternet().
|
||||
bool HasWifi() const { return GetInternet() == feature::Internet::Wlan; }
|
||||
/// @returns true if Panoramax imagery is available within 50m.
|
||||
bool HasPanoramax() const { return m_hasPanoramax; }
|
||||
std::string const & GetPanoramaxUrl() const { return m_panoramaxUrl; }
|
||||
/// Should be used by UI code to generate cool name for new bookmarks.
|
||||
// TODO: Tune new bookmark name. May be add address or some other data.
|
||||
kml::LocalizableString FormatNewBookmarkName() const;
|
||||
@@ -258,6 +261,11 @@ private:
|
||||
/// Formatted feature address for inner using.
|
||||
std::string m_address;
|
||||
|
||||
/// Panoramax
|
||||
bool m_hasPanoramax = false;
|
||||
std::string m_panoramaxImageId;
|
||||
std::string m_panoramaxUrl;
|
||||
|
||||
/// Routing
|
||||
RouteMarkType m_routeMarkType;
|
||||
size_t m_intermediateIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user