diff --git a/android/src/com/mapswithme/maps/MapFragment.java b/android/src/com/mapswithme/maps/MapFragment.java index 9ffc7ae2e9..00eb58c538 100644 --- a/android/src/com/mapswithme/maps/MapFragment.java +++ b/android/src/com/mapswithme/maps/MapFragment.java @@ -56,7 +56,7 @@ public class MapFragment extends RenderFragment } @Override - protected void applyWidgetPivots() + protected void applyWidgetPivots(final int mapHeight, final int mapWidth) { //Framework.setWidgetPivot(Framework.MAP_WIDGET_RULER, // mSurfaceWidth - UiUtils.dimen(R.dimen.margin_ruler_right), @@ -84,8 +84,6 @@ public class MapFragment extends RenderFragment final MapRenderingListener listener = (MapRenderingListener) host; listener.onRenderingInitialized(); } - - super.OnRenderingInitialized(); } @Override diff --git a/android/src/com/mapswithme/maps/RenderFragment.java b/android/src/com/mapswithme/maps/RenderFragment.java index f019e471d5..7bad14dc83 100644 --- a/android/src/com/mapswithme/maps/RenderFragment.java +++ b/android/src/com/mapswithme/maps/RenderFragment.java @@ -58,6 +58,11 @@ public abstract class RenderFragment extends BaseMwmFragment } } + public boolean isRenderingInitialized() + { + return isEngineCreated(); + } + @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { diff --git a/drape/batcher.hpp b/drape/batcher.hpp index d4d6ca2456..91e16fb541 100644 --- a/drape/batcher.hpp +++ b/drape/batcher.hpp @@ -89,7 +89,7 @@ public: SessionGuard(Batcher & batcher, Batcher::TFlushFn const & flusher); ~SessionGuard(); - DISALLOW_COPY_AND_MOVE(SessionGuard) + DISALLOW_COPY_AND_MOVE(SessionGuard); private: Batcher & m_batcher; }; diff --git a/drape/drape_common.pri b/drape/drape_common.pri index 3cf9253a91..a719d02474 100644 --- a/drape/drape_common.pri +++ b/drape/drape_common.pri @@ -102,5 +102,3 @@ HEADERS += \ $$DRAPE_DIR/utils/projection.hpp \ $$DRAPE_DIR/utils/vertex_decl.hpp \ $$DRAPE_DIR/vertex_array_buffer.hpp \ - $$ROOT_DIR/sdf_image/sdf_image.h \ - $$ROOT_DIR/stb_image/stb_image.h \ diff --git a/drape/pointers.hpp b/drape/pointers.hpp index 7d7b662eaa..720445fe47 100644 --- a/drape/pointers.hpp +++ b/drape/pointers.hpp @@ -113,8 +113,8 @@ public: template operator ref_ptr() const { - STATIC_ASSERT(is_base_of::value || is_base_of::value || - is_void::value || is_void::value); + static_assert(is_base_of::value || is_base_of::value || + is_void::value || is_void::value, ""); return ref_ptr(static_cast(m_ptr), m_isOwnerUnique); } diff --git a/drape/utils/gpu_mem_tracker.cpp b/drape/utils/gpu_mem_tracker.cpp index 83faee4026..1d63bdca7a 100644 --- a/drape/utils/gpu_mem_tracker.cpp +++ b/drape/utils/gpu_mem_tracker.cpp @@ -23,9 +23,9 @@ string GPUMemTracker::Report() for (auto const it : m_memTracker) { TTagStat & stat = tagStats[it.first.first]; - stat.get<0>()++; - stat.get<1>() += it.second.first; - stat.get<2>() += it.second.second; + get<0>(stat)++; + get<1>(stat) += it.second.first; + get<2>(stat) += it.second.second; summaryAllocated += it.second.first; summaryUsed += it.second.second; @@ -42,9 +42,9 @@ string GPUMemTracker::Report() for (auto const it : tagStats) { ss << " Tag = " << it.first << " \n"; - ss << " Object count = " << it.second.get<0>() << "\n"; - ss << " Allocated = " << it.second.get<1>() / byteToMb << "\n"; - ss << " Used = " << it.second.get<2>() / byteToMb << "\n"; + ss << " Object count = " << get<0>(it.second) << "\n"; + ss << " Allocated = " << get<1>(it.second) / byteToMb << "\n"; + ss << " Used = " << get<2>(it.second) / byteToMb << "\n"; } ss << " ===== Mem Report ===== \n"; diff --git a/drape/utils/vertex_decl.cpp b/drape/utils/vertex_decl.cpp index 4dbf5be005..0627471fbc 100644 --- a/drape/utils/vertex_decl.cpp +++ b/drape/utils/vertex_decl.cpp @@ -93,9 +93,9 @@ dp::BindingInfo DashedLineBindingInit() dp::BindingInfo RouteBindingInit() { - STATIC_ASSERT(sizeof(RouteVertex) == sizeof(RouteVertex::TPosition) + + static_assert(sizeof(RouteVertex) == sizeof(RouteVertex::TPosition) + sizeof(RouteVertex::TNormal) + - sizeof(RouteVertex::TLength)); + sizeof(RouteVertex::TLength), ""); dp::BindingFiller filler(3); filler.FillDecl("a_position"); diff --git a/drape_frontend/animation/interpolation_holder.hpp b/drape_frontend/animation/interpolation_holder.hpp index 3cd0e3c372..0b113e791d 100644 --- a/drape_frontend/animation/interpolation_holder.hpp +++ b/drape_frontend/animation/interpolation_holder.hpp @@ -17,7 +17,7 @@ public: private: InterpolationHolder() = default; ~InterpolationHolder(); - DISALLOW_COPY_AND_MOVE(InterpolationHolder) + DISALLOW_COPY_AND_MOVE(InterpolationHolder); private: friend class BaseInterpolator; diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index 92ee52a5af..71c139b982 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -150,17 +150,18 @@ void BackendRenderer::AcceptMessage(ref_ptr message) ref_ptr msg = message; TileKey const & key = msg->GetKey(); - m_commutator->PostMessage(ThreadsCommutator::RenderThread, - make_unique_dp(key), - MessagePriority::Normal); - - m_batchersPool->ReserveBatcher(key); - UserMarksProvider const * marksProvider = msg->StartProcess(); if (marksProvider->IsDirty()) + { + m_commutator->PostMessage(ThreadsCommutator::RenderThread, + make_unique_dp(key), + MessagePriority::Normal); + + m_batchersPool->ReserveBatcher(key); CacheUserMarks(marksProvider, m_batchersPool->GetTileBatcher(key), m_texMng); + m_batchersPool->ReleaseBatcher(key); + } msg->EndProcess(); - m_batchersPool->ReleaseBatcher(key); break; } case Message::CountryInfoUpdate: diff --git a/drape_frontend/gui/gui_text.cpp b/drape_frontend/gui/gui_text.cpp index c8c7d915cc..07a3130a3a 100644 --- a/drape_frontend/gui/gui_text.cpp +++ b/drape_frontend/gui/gui_text.cpp @@ -10,7 +10,6 @@ #include "drape/shader_def.hpp" #include "std/algorithm.hpp" -#include "std/static_assert.hpp" #include "std/type_traits.hpp" #include "std/unique_ptr.hpp" diff --git a/drape_frontend/gui/gui_text.hpp b/drape_frontend/gui/gui_text.hpp index 5cc8c42468..dd9523a6e9 100644 --- a/drape_frontend/gui/gui_text.hpp +++ b/drape_frontend/gui/gui_text.hpp @@ -8,7 +8,7 @@ #include "drape/glstate.hpp" #include "drape/texture_manager.hpp" -#include "std/stdint.hpp" +#include "std/cstdint.hpp" #include "std/utility.hpp" namespace gui diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp index d10e40a88b..27719bde84 100644 --- a/drape_frontend/gui/ruler_helper.cpp +++ b/drape_frontend/gui/ruler_helper.cpp @@ -226,21 +226,11 @@ double RulerHelper::CalcMetresDiff(double value) Settings::Units units = Settings::Metric; Settings::Get("Units", units); - switch (units) + if (units == Settings::Foot) { - case Settings::Foot: arrU = g_arrFeets; count = ARRAY_SIZE(g_arrFeets); conversionFn = &MeasurementUtils::MetersToFeet; - break; - - case Settings::Yard: - arrU = g_arrYards; - count = ARRAY_SIZE(g_arrYards); - conversionFn = &MeasurementUtils::MetersToYards; - break; - default: - break; } int prevUnitRange = m_rangeIndex; diff --git a/iphone/Maps/Classes/MWMBookmarkColorViewController.mm b/iphone/Maps/Classes/MWMBookmarkColorViewController.mm index c8fc77d400..9ea7e801bf 100644 --- a/iphone/Maps/Classes/MWMBookmarkColorViewController.mm +++ b/iphone/Maps/Classes/MWMBookmarkColorViewController.mm @@ -129,7 +129,7 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell"; if (!self.iPadOwnerNavigationController) return; - GetFramework().Invalidate(); + [self.placePageManager reloadBookmark]; } @end diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.mm b/iphone/Maps/Classes/MWMPlacePageEntity.mm index 7281387cf1..9273b25350 100644 --- a/iphone/Maps/Classes/MWMPlacePageEntity.mm +++ b/iphone/Maps/Classes/MWMPlacePageEntity.mm @@ -63,7 +63,6 @@ using feature::Metadata; [self configureForBookmark:mark]; break; } - GetFramework().ActivateUserMark(mark); } - (void)configureForBookmark:(UserMark const *)bookmark @@ -73,7 +72,7 @@ using feature::Metadata; self.type = MWMPlacePageEntityTypeBookmark; BookmarkCategory * category = f.GetBmCategory(self.bac.first); BookmarkData const & data = static_cast(bookmark)->GetData(); - m2::PointD const & point = bookmark->GetOrg(); + m2::PointD const & point = bookmark->GetPivot(); Metadata metadata; search::AddressInfo info; f.FindClosestPOIMetadata(point, metadata); @@ -95,7 +94,7 @@ using feature::Metadata; //Workaround for framework bug. //TODO: Make correct way to get search metadata. Metadata metadata; - GetFramework().FindClosestPOIMetadata(searchMark->GetOrg(), metadata); + GetFramework().FindClosestPOIMetadata(searchMark->GetPivot(), metadata); [self configureEntityWithMetadata:metadata addressInfo:searchMark->GetInfo()]; } @@ -328,7 +327,8 @@ using feature::Metadata; if (!category) return; - Bookmark * bookmark = category->GetBookmark(self.bac.second); + BookmarkCategory::Guard guard(*category); + Bookmark * bookmark = static_cast(guard.m_controller.GetUserMarkForEdit(self.bac.second)); if (!bookmark) return; diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index 21769ba8a8..9c605a6b38 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -71,7 +71,6 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) self.state = MWMPlacePageManagerStateClosed; [self.placePage dismiss]; [[MapsAppDelegate theApp].m_locationManager stop:self]; - GetFramework().GetBalloonManager().RemovePin(); m_userMark = nullptr; self.entity = nil; self.placePage = nil; @@ -269,15 +268,15 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) Framework & f = GetFramework(); BookmarkData data = BookmarkData(self.entity.title.UTF8String, f.LastEditedBMType()); size_t const categoryIndex = f.LastEditedBMCategory(); - size_t const bookmarkIndex = - f.GetBookmarkManager().AddBookmark(categoryIndex, m_userMark->GetUserMark()->GetOrg(), data); + size_t const bookmarkIndex = f.GetBookmarkManager().AddBookmark(categoryIndex, m_userMark->GetUserMark()->GetPivot(), data); self.entity.bac = make_pair(categoryIndex, bookmarkIndex); self.entity.type = MWMPlacePageEntityTypeBookmark; - BookmarkCategory const * category = f.GetBmCategory(categoryIndex); - Bookmark const * bookmark = category->GetBookmark(bookmarkIndex); + + BookmarkCategory::Guard guard(*f.GetBmCategory(categoryIndex)); + + UserMark const * bookmark = guard.m_controller.GetUserMark(bookmarkIndex); m_userMark.reset(new UserMarkCopy(bookmark, false)); - f.ActivateUserMark(bookmark); - f.Invalidate(); + f.ActivateUserMark(bookmark, false); [NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification object:nil userInfo:nil]; @@ -293,15 +292,15 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) UserMark const * bookmark = bookmarkCategory->GetBookmark(self.entity.bac.second); BookmarkAndCategory const bookmarkAndCategory = f.FindBookmark(bookmark); self.entity.type = MWMPlacePageEntityTypeRegular; - PoiMarkPoint const * poi = f.GetAddressMark(bookmark->GetOrg()); + PoiMarkPoint const * poi = f.GetAddressMark(bookmark->GetPivot()); m_userMark.reset(new UserMarkCopy(poi, false)); - f.ActivateUserMark(poi); - if (bookmarkCategory) + f.ActivateUserMark(poi, false); + if (category) { - bookmarkCategory->DeleteBookmark(bookmarkAndCategory.second); - bookmarkCategory->SaveToKMLFile(); + BookmarkCategory::Guard guard(*bookmarkCategory); + guard.m_controller.DeleteUserMark(bookmarkAndCategory.second); + category->SaveToKMLFile(); } - f.Invalidate(); [NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification object:nil userInfo:nil]; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index c4d619f09c..03312c03ab 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -216,7 +216,10 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) - (void)onUserMarkClicked:(unique_ptr)mark { - [self.controlsManager showPlacePageWithUserMark:std::move(mark)]; + if (mark == nullptr) + [self dismissPlacePage]; + else + [self.placePageManager showPlacePageWithUserMark:std::move(mark)]; } - (void)processMapClickAtPoint:(CGPoint)point longClick:(BOOL)isLongClick @@ -731,7 +734,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) break; case SearchViewStateFullscreen: self.controlsManager.hidden = YES; - GetFramework().ActivateUserMark(NULL); + GetFramework().DiactivateUserMark(); break; } } diff --git a/iphone/Maps/fi.lproj/Localizable.strings b/iphone/Maps/fi.lproj/Localizable.strings index 4a8df45fc6..4068c70a0c 100644 --- a/iphone/Maps/fi.lproj/Localizable.strings +++ b/iphone/Maps/fi.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\non lisätty latausjonoon."; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Ladataan\n^\n^%"; +"country_status_downloading" = "Ladataan\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Lataa kartta\n(^ ^)"; diff --git a/iphone/Maps/fr.lproj/Localizable.strings b/iphone/Maps/fr.lproj/Localizable.strings index c192947651..5677bb3c3d 100644 --- a/iphone/Maps/fr.lproj/Localizable.strings +++ b/iphone/Maps/fr.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\nest ajouté à la file de téléchargement"; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Téléchargement de \n^\n^"; +"country_status_downloading" = "Téléchargement de\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Téléchargez la carte\n(^ ^)"; diff --git a/iphone/Maps/id.lproj/Localizable.strings b/iphone/Maps/id.lproj/Localizable.strings index c93b748f7c..e38691e134 100644 --- a/iphone/Maps/id.lproj/Localizable.strings +++ b/iphone/Maps/id.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\ntelah ditambahkan ke antrean pengunduhan."; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Sedang mengunduh\n^\n^%"; +"country_status_downloading" = "Sedang mengunduh\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Unduh Peta\n(^ ^)"; diff --git a/iphone/Maps/nb.lproj/Localizable.strings b/iphone/Maps/nb.lproj/Localizable.strings index c315d4a99d..d3a5160c11 100644 --- a/iphone/Maps/nb.lproj/Localizable.strings +++ b/iphone/Maps/nb.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\ner lagt til i nedlastingskøen."; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Laster ned\n^\n^%"; +"country_status_downloading" = "Laster ned\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Last ned kart\n(^ ^)"; diff --git a/iphone/Maps/ro.lproj/Localizable.strings b/iphone/Maps/ro.lproj/Localizable.strings index 16e9fb0b64..98cc282847 100644 --- a/iphone/Maps/ro.lproj/Localizable.strings +++ b/iphone/Maps/ro.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\neste adăugată la coada de descărcare."; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Se descarcă\n^\n^%"; +"country_status_downloading" = "Se descarcă\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Descărcare hartă\n(^ ^)"; diff --git a/iphone/Maps/vi.lproj/Localizable.strings b/iphone/Maps/vi.lproj/Localizable.strings index eee140da38..42e631d35c 100644 --- a/iphone/Maps/vi.lproj/Localizable.strings +++ b/iphone/Maps/vi.lproj/Localizable.strings @@ -142,7 +142,7 @@ "country_status_added_to_queue" = "^\nđã được thêm vào danh sách đợi tải xuống."; /* Message to display at the center of the screen when the country is downloading */ -"country_status_downloading" = "Đang tải xuống\n^\n^%"; +"country_status_downloading" = "Đang tải xuống\n^\n^"; /* Button text for the button at the center of the screen when the country is not downloaded */ "country_status_download" = "Tải xuống Bản đồ\n(^ ^)"; diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index c66bf0358d..72b5667940 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -203,7 +203,7 @@ namespace UserMark const * BookmarkManager::FindNearestUserMark(m2::AnyRectD const & rect) const { - return FindNearestUserMark([&rect](UserMarkContainer::Type) -> m2::AnyRectD const & { return rect; }); + return FindNearestUserMark([&rect](UserMarkType) -> m2::AnyRectD const & { return rect; }); } UserMark const * BookmarkManager::FindNearestUserMark(TTouchRectHolder const & holder) const diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index b4f83890ee..9a46cac721 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -1,7 +1,6 @@ #pragma once #include "map/bookmark.hpp" -#include "map/route_track.hpp" #include "map/user_mark_container.hpp" #include "std/function.hpp" diff --git a/map/framework.cpp b/map/framework.cpp index 984e34bad8..4b646a9112 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -291,79 +291,80 @@ void Framework::DrawSingleFrame(m2::PointD const & center, int zoomModifier, uint32_t pxWidth, uint32_t pxHeight, FrameImage & image, SingleFrameSymbols const & symbols) { - ASSERT(IsSingleFrameRendererInited(), ()); - Navigator frameNavigator = m_navigator; - frameNavigator.OnSize(0, 0, pxWidth, pxHeight); - frameNavigator.SetAngle(0); +// ASSERT(IsSingleFrameRendererInited(), ()); +// Navigator frameNavigator = m_navigator; +// frameNavigator.OnSize(0, 0, pxWidth, pxHeight); +// frameNavigator.SetAngle(0); - m2::RectD rect = m_scales.GetRectForDrawScale(scales::GetUpperComfortScale() - 1, center); - if (symbols.m_showSearchResult && !rect.IsPointInside(symbols.m_searchResult)) - { - double const kScaleFactor = 1.3; - m2::PointD oldCenter = rect.Center(); - rect.Add(symbols.m_searchResult); - double const centersDiff = 2 * (rect.Center() - oldCenter).Length(); +// m2::RectD rect = m_scales.GetRectForDrawScale(scales::GetUpperComfortScale() - 1, center); +// if (symbols.m_showSearchResult && !rect.IsPointInside(symbols.m_searchResult)) +// { +// double const kScaleFactor = 1.3; +// m2::PointD oldCenter = rect.Center(); +// rect.Add(symbols.m_searchResult); +// double const centersDiff = 2 * (rect.Center() - oldCenter).Length(); - m2::RectD resultRect; - resultRect.SetSizes(rect.SizeX() + centersDiff, rect.SizeY() + centersDiff); - resultRect.SetCenter(center); - resultRect.Scale(kScaleFactor); - rect = resultRect; - ASSERT(rect.IsPointInside(symbols.m_searchResult), ()); - } +// m2::RectD resultRect; +// resultRect.SetSizes(rect.SizeX() + centersDiff, rect.SizeY() + centersDiff); +// resultRect.SetCenter(center); +// resultRect.Scale(kScaleFactor); +// rect = resultRect; +// ASSERT(rect.IsPointInside(symbols.m_searchResult), ()); +// } - int baseZoom = m_scales.GetDrawTileScale(rect); - int resultZoom = baseZoom + zoomModifier; - int const minZoom = symbols.m_bottomZoom == -1 ? resultZoom : symbols.m_bottomZoom; - resultZoom = my::clamp(resultZoom, minZoom, scales::GetUpperScale()); - rect = m_scales.GetRectForDrawScale(resultZoom, rect.Center()); +// int baseZoom = m_scales.GetDrawTileScale(rect); +// int resultZoom = baseZoom + zoomModifier; +// int const minZoom = symbols.m_bottomZoom == -1 ? resultZoom : symbols.m_bottomZoom; +// resultZoom = my::clamp(resultZoom, minZoom, scales::GetUpperScale()); +// rect = m_scales.GetRectForDrawScale(resultZoom, rect.Center()); - CheckMinGlobalRect(rect); - CheckMinMaxVisibleScale(rect); - frameNavigator.SetFromRect(m2::AnyRectD(rect)); +// CheckMinGlobalRect(rect); +// CheckMinMaxVisibleScale(rect); +// frameNavigator.SetFromRect(m2::AnyRectD(rect)); - m_cpuDrawer->BeginFrame(pxWidth, pxHeight, ConvertColor(drule::rules().GetBgColor(resultZoom))); +// m_cpuDrawer->BeginFrame(pxWidth, pxHeight, ConvertColor(drule::rules().GetBgColor(resultZoom))); - ScreenBase const & s = frameNavigator.Screen(); - shared_ptr event = make_shared(m_cpuDrawer.get()); - DrawModel(event, s, m2::RectD(0, 0, pxWidth, pxHeight), m_scales.GetTileScaleBase(s), false); +// ScreenBase const & s = frameNavigator.Screen(); +// shared_ptr event = make_shared(m_cpuDrawer.get()); +// DrawModel(event, s, m2::RectD(0, 0, pxWidth, pxHeight), m_scales.GetTileScaleBase(s), false); - m_cpuDrawer->Flush(); - m_cpuDrawer->DrawMyPosition(frameNavigator.GtoP(center)); +// m_cpuDrawer->Flush(); +// m_cpuDrawer->DrawMyPosition(frameNavigator.GtoP(center)); - if (symbols.m_showSearchResult) - { - if (!frameNavigator.Screen().PixelRect().IsPointInside(frameNavigator.GtoP(symbols.m_searchResult))) - m_cpuDrawer->DrawSearchArrow(ang::AngleTo(rect.Center(), symbols.m_searchResult)); - else - m_cpuDrawer->DrawSearchResult(frameNavigator.GtoP(symbols.m_searchResult)); - } +// if (symbols.m_showSearchResult) +// { +// if (!frameNavigator.Screen().PixelRect().IsPointInside(frameNavigator.GtoP(symbols.m_searchResult))) +// m_cpuDrawer->DrawSearchArrow(ang::AngleTo(rect.Center(), symbols.m_searchResult)); +// else +// m_cpuDrawer->DrawSearchResult(frameNavigator.GtoP(symbols.m_searchResult)); +// } - m_cpuDrawer->EndFrame(image); +// m_cpuDrawer->EndFrame(image); } -void Framework::InitSingleFrameRenderer(graphics::EDensity density, int exactDensityDPI) +void Framework::InitSingleFrameRenderer(float visualScale) { - ASSERT(!IsSingleFrameRendererInited(), ()); - if (m_cpuDrawer == nullptr) - { - CPUDrawer::Params params(GetGlyphCacheParams(density, exactDensityDPI)); - params.m_visualScale = graphics::visualScaleExact(exactDensityDPI); - params.m_density = density; +// ASSERT(!IsSingleFrameRendererInited(), ()); +// if (m_cpuDrawer == nullptr) +// { +// CPUDrawer::Params params(GetGlyphCacheParams(density)); +// params.m_visualScale = graphics::visualScale(density); +// params.m_density = density; - m_cpuDrawer.reset(new CPUDrawer(params)); - } +// m_cpuDrawer.reset(new CPUDrawer(params)); +// } } void Framework::ReleaseSingleFrameRenderer() { - if (IsSingleFrameRendererInited()) - m_cpuDrawer.reset(); +// if (IsSingleFrameRendererInited()) +// m_cpuDrawer.reset(); } bool Framework::IsSingleFrameRendererInited() const { - return m_cpuDrawer != nullptr; + //return m_cpuDrawer != nullptr; + return true; } void Framework::DeleteCountry(storage::TIndex const & index, MapOptions opt) @@ -909,7 +910,7 @@ void Framework::UpdateCountryInfo(storage::TIndex const & countryIndex, bool isC countryInfo.m_downloadProgress = progress.first * 100 / progress.second; } - string const & fileName = m_storage.CountryByIndex(countryIndex).GetFile().GetFileWithoutExt(); + string const & fileName = m_storage.CountryByIndex(countryIndex).GetFile().GetNameWithoutExt(); bool const isLoaded = m_model.IsLoaded(fileName); m_drapeEngine->SetCountryInfo(countryInfo, isCurrentCountry, isLoaded); } @@ -1655,11 +1656,8 @@ PoiMarkPoint * Framework::GetAddressMark(m2::PointD const & globalPoint) const void Framework::ActivateUserMark(UserMark const * mark, bool needAnim) { - static UserMark const * activeMark = nullptr; if (m_activateUserMarkFn) { - bool hasActive = activeMark != nullptr; - activeMark = mark; if (mark) { m_activateUserMarkFn(mark->Copy()); @@ -1675,11 +1673,8 @@ void Framework::ActivateUserMark(UserMark const * mark, bool needAnim) } else { - if (hasActive) - { - m_activateUserMarkFn(nullptr); - CallDrapeFunction(bind(&df::DrapeEngine::DeselectObject, _1)); - } + m_activateUserMarkFn(nullptr); + CallDrapeFunction(bind(&df::DrapeEngine::DeselectObject, _1)); } } } @@ -1730,7 +1725,7 @@ UserMark const * Framework::OnTapEventImpl(m2::PointD pxPoint, bool isLong, bool UserMark const * mark = m_bmManager.FindNearestUserMark( [&rect, &bmSearchRect](UserMarkType type) -> m2::AnyRectD const & { - return (type == UserMarkContainer::BOOKMARK_MARK ? bmSearchRect : rect); + return (type == UserMarkType::BOOKMARK_MARK ? bmSearchRect : rect); }); if (mark != nullptr) @@ -1758,7 +1753,7 @@ UserMark const * Framework::OnTapEventImpl(m2::PointD pxPoint, bool isLong, bool PoiMarkPoint * poiMark = UserMarkContainer::UserMarkForPoi(); poiMark->SetPtOrg(m_currentMovelView.PtoG(pxPivot)); poiMark->SetInfo(info); - poiMark->SetMetadata(metadata); + poiMark->SetMetadata(move(metadata)); return poiMark; } @@ -1987,7 +1982,7 @@ void Framework::InsertRoute(Route const & route) } vector turns; - turns::TurnsGeomT const & turnsGeom = route.GetTurnsGeometry(); + turns::TTurnsGeom const & turnsGeom = route.GetTurnsGeometry(); if (!turnsGeom.empty()) { turns.reserve(turnsGeom.size()); diff --git a/map/framework.hpp b/map/framework.hpp index f9bc42c4da..4c2b209236 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -137,24 +137,34 @@ public: int m_bottomZoom = -1; }; - //@TODO UVR -// /// @param density - for Retina Display you must use EDensityXHDPI -// void InitSingleFrameRenderer(graphics::EDensity density); -// /// @param center - map center in ercator -// /// @param zoomModifier - result zoom calculate like "base zoom" + zoomModifier -// /// if we are have search result "base zoom" calculate that my position and search result -// /// will be see with some bottom clamp. -// /// if we are't have search result "base zoom" == scales::GetUpperComfortScale() - 1 -// /// @param pxWidth - result image width. -// /// It must be equal render buffer width. For retina it's equal 2.0 * displayWidth -// /// @param pxHeight - result image height. -// /// It must be equal render buffer height. For retina it's equal 2.0 * displayHeight -// /// @param image [out] - result image -// void DrawSingleFrame(m2::PointD const & center, int zoomModifier, -// uint32_t pxWidth, uint32_t pxHeight, FrameImage & image, -// SingleFrameSymbols const & symbols); -// void ReleaseSingleFrameRenderer(); -// bool IsSingleFrameRendererInited() const; + struct FrameImage + { + // image data. + // TopLeft-to-RightBottom order + // Format - png + vector m_data; + uint32_t m_width = 0; // pixel width of image + uint32_t m_height = 0; // pixel height of image + uint32_t m_stride = 0; // row stride in bytes + }; + + /// @param density - for Retina Display you must use EDensityXHDPI + void InitSingleFrameRenderer(float visualScale); + /// @param center - map center in ercator + /// @param zoomModifier - result zoom calculate like "base zoom" + zoomModifier + /// if we are have search result "base zoom" calculate that my position and search result + /// will be see with some bottom clamp. + /// if we are't have search result "base zoom" == scales::GetUpperComfortScale() - 1 + /// @param pxWidth - result image width. + /// It must be equal render buffer width. For retina it's equal 2.0 * displayWidth + /// @param pxHeight - result image height. + /// It must be equal render buffer height. For retina it's equal 2.0 * displayHeight + /// @param image [out] - result image + void DrawSingleFrame(m2::PointD const & center, int zoomModifier, + uint32_t pxWidth, uint32_t pxHeight, FrameImage & image, + SingleFrameSymbols const & symbols); + void ReleaseSingleFrameRenderer(); + bool IsSingleFrameRendererInited() const; /// Registers all local map files in internal indexes. void RegisterAllMaps(); diff --git a/map/track.hpp b/map/track.hpp index 9b9df86d47..d3ac8ef85c 100644 --- a/map/track.hpp +++ b/map/track.hpp @@ -15,7 +15,7 @@ namespace location class Track : public df::UserLineMark { - DISALLOW_COPY_AND_MOVE(Track) + DISALLOW_COPY_AND_MOVE(Track); public: using PolylineD = m2::PolylineD; diff --git a/map/user_mark.cpp b/map/user_mark.cpp index 0060bcc18e..7a8feaee13 100644 --- a/map/user_mark.cpp +++ b/map/user_mark.cpp @@ -175,12 +175,12 @@ void SearchMarkPoint::SetInfo(search::AddressInfo const & info) m_info = info; } -feature::FeatureMetadata const & SearchMarkPoint::GetMetadata() const +feature::Metadata const & SearchMarkPoint::GetMetadata() const { return m_metadata; } -void SearchMarkPoint::SetMetadata(const feature::FeatureMetadata & metadata) +void SearchMarkPoint::SetMetadata(feature::Metadata && metadata) { m_metadata = metadata; } diff --git a/map/user_mark.hpp b/map/user_mark.hpp index cd99e84dcc..74f939da7c 100644 --- a/map/user_mark.hpp +++ b/map/user_mark.hpp @@ -20,7 +20,7 @@ class UserMarkCopy; class UserMark : public df::UserPointMark { - DISALLOW_COPY_AND_MOVE(UserMark) + DISALLOW_COPY_AND_MOVE(UserMark); public: enum class Type { diff --git a/map/user_mark_container.cpp b/map/user_mark_container.cpp index fa3de8cbe8..5485123021 100644 --- a/map/user_mark_container.cpp +++ b/map/user_mark_container.cpp @@ -145,6 +145,9 @@ void UserMarkContainer::ReleaseController() if (IsVisibleFlagDirty() || IsDrawableFlagDirty()) engine->ChangeVisibilityUserMarksLayer(key, IsVisible() && IsDrawable()); + m_flags[VisibleDirtyFlag] = false; + m_flags[DrawableDirtyFlag] = false; + if (IsDirty()) { if (GetUserPointCount() == 0 && GetUserLineCount() == 0) diff --git a/std/tuple.hpp b/std/tuple.hpp index 1ab641ca7d..9e05d40bc4 100644 --- a/std/tuple.hpp +++ b/std/tuple.hpp @@ -8,7 +8,7 @@ using std::tuple; using std::make_tuple; -//using std::get; // "get" is very common name, use "get" member function +using std::get; #ifdef DEBUG_NEW #define new DEBUG_NEW