Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -20,7 +20,7 @@ namespace
{
std::string_view constexpr kLocationStateMode = "LastLocationStateMode";
std::string_view constexpr kLastEnterBackground = "LastEnterBackground";
}
} // namespace
DrapeEngine::DrapeEngine(Params && params)
: m_myPositionModeChanged(std::move(params.m_myPositionModeChanged))
@@ -54,48 +54,34 @@ DrapeEngine::DrapeEngine(Params && params)
std::vector<PostprocessRenderer::Effect> effects;
// bool enabledAntialiasing;
// if (!settings::Get(dp::kSupportedAntialiasing, enabledAntialiasing))
// enabledAntialiasing = false;
// bool enabledAntialiasing;
// if (!settings::Get(dp::kSupportedAntialiasing, enabledAntialiasing))
// enabledAntialiasing = false;
// Turn off AA for a while by energy-saving issues.
//if (enabledAntialiasing)
// if (enabledAntialiasing)
//{
// LOG(LINFO, ("Antialiasing is enabled"));
// effects.push_back(PostprocessRenderer::Antialiasing);
//}
MyPositionController::Params mpParams(mode,
base::Timer::LocalTime() - m_startBackgroundTime,
params.m_hints,
params.m_isRoutingActive,
params.m_isAutozoomEnabled,
MyPositionController::Params mpParams(mode, base::Timer::LocalTime() - m_startBackgroundTime, params.m_hints,
params.m_isRoutingActive, params.m_isAutozoomEnabled,
std::bind(&DrapeEngine::MyPositionModeChanged, this, _1, _2));
FrontendRenderer::Params frParams(params.m_apiVersion,
make_ref(m_threadCommutator),
params.m_factory,
make_ref(m_textureManager),
std::move(mpParams),
m_viewport,
std::bind(&DrapeEngine::ModelViewChanged, this, _1),
std::bind(&DrapeEngine::TapEvent, this, _1),
std::bind(&DrapeEngine::UserPositionChanged, this, _1, _2),
make_ref(m_requestedTiles),
std::move(params.m_overlaysShowStatsCallback),
params.m_allow3dBuildings,
params.m_trafficEnabled,
params.m_blockTapEvents,
std::move(effects),
params.m_onGraphicsContextInitialized,
std::move(params.m_renderInjectionHandler));
FrontendRenderer::Params frParams(
params.m_apiVersion, make_ref(m_threadCommutator), params.m_factory, make_ref(m_textureManager),
std::move(mpParams), m_viewport, std::bind(&DrapeEngine::ModelViewChanged, this, _1),
std::bind(&DrapeEngine::TapEvent, this, _1), std::bind(&DrapeEngine::UserPositionChanged, this, _1, _2),
make_ref(m_requestedTiles), std::move(params.m_overlaysShowStatsCallback), params.m_allow3dBuildings,
params.m_trafficEnabled, params.m_blockTapEvents, std::move(effects), params.m_onGraphicsContextInitialized,
std::move(params.m_renderInjectionHandler));
BackendRenderer::Params brParams(
params.m_apiVersion, frParams.m_commutator, frParams.m_oglContextFactory, frParams.m_texMng,
params.m_model, params.m_model.UpdateCurrentCountryFn(), make_ref(m_requestedTiles),
params.m_allow3dBuildings, params.m_trafficEnabled, params.m_isolinesEnabled,
params.m_simplifiedTrafficColors, std::move(params.m_arrow3dCustomDecl),
params.m_onGraphicsContextInitialized);
BackendRenderer::Params brParams(params.m_apiVersion, frParams.m_commutator, frParams.m_oglContextFactory,
frParams.m_texMng, params.m_model, params.m_model.UpdateCurrentCountryFn(),
make_ref(m_requestedTiles), params.m_allow3dBuildings, params.m_trafficEnabled,
params.m_isolinesEnabled, params.m_simplifiedTrafficColors,
std::move(params.m_arrow3dCustomDecl), params.m_onGraphicsContextInitialized);
m_backend = make_unique_dp<BackendRenderer>(std::move(brParams));
m_frontend = make_unique_dp<FrontendRenderer>(std::move(frParams));
@@ -135,8 +121,7 @@ void DrapeEngine::RecoverSurface(int w, int h, bool recreateContextDependentReso
if (m_choosePositionMode)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ShowChoosePositionMarkMessage>(),
MessagePriority::Normal);
make_unique_dp<ShowChoosePositionMarkMessage>(), MessagePriority::Normal);
}
if (recreateContextDependentResources)
@@ -144,8 +129,7 @@ void DrapeEngine::RecoverSurface(int w, int h, bool recreateContextDependentReso
RecacheGui(false);
RecacheMapShapes();
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<RecoverContextDependentResourcesMessage>(),
MessagePriority::Normal);
make_unique_dp<RecoverContextDependentResourcesMessage>(), MessagePriority::Normal);
}
ResizeImpl(w, h);
@@ -155,22 +139,19 @@ void DrapeEngine::Resize(int w, int h)
{
ASSERT_GREATER(w, 0, ());
ASSERT_GREATER(h, 0, ());
if (m_viewport.GetHeight() != static_cast<uint32_t>(h) ||
m_viewport.GetWidth() != static_cast<uint32_t>(w))
if (m_viewport.GetHeight() != static_cast<uint32_t>(h) || m_viewport.GetWidth() != static_cast<uint32_t>(w))
ResizeImpl(w, h);
}
void DrapeEngine::SetVisibleViewport(m2::RectD const & rect) const
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SetVisibleViewportMessage>(rect),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<SetVisibleViewportMessage>(rect),
MessagePriority::Normal);
}
void DrapeEngine::Invalidate()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<InvalidateMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<InvalidateMessage>(),
MessagePriority::High);
}
@@ -207,23 +188,21 @@ void DrapeEngine::MakeFrameActive()
void DrapeEngine::ScaleAndSetCenter(m2::PointD const & centerPt, double scaleFactor, bool isAnim,
bool trackVisibleViewport)
{
PostUserEvent(make_unique_dp<SetCenterEvent>(scaleFactor, centerPt, isAnim,
trackVisibleViewport,
PostUserEvent(make_unique_dp<SetCenterEvent>(scaleFactor, centerPt, isAnim, trackVisibleViewport,
nullptr /* parallelAnimCreator */));
}
void DrapeEngine::SetModelViewCenter(m2::PointD const & centerPt, int zoom, bool isAnim,
bool trackVisibleViewport)
void DrapeEngine::SetModelViewCenter(m2::PointD const & centerPt, int zoom, bool isAnim, bool trackVisibleViewport)
{
PostUserEvent(make_unique_dp<SetCenterEvent>(centerPt, zoom, isAnim, trackVisibleViewport,
nullptr /* parallelAnimCreator */));
PostUserEvent(
make_unique_dp<SetCenterEvent>(centerPt, zoom, isAnim, trackVisibleViewport, nullptr /* parallelAnimCreator */));
}
void DrapeEngine::SetModelViewRect(m2::RectD const & rect, bool applyRotation, int zoom, bool isAnim,
bool useVisibleViewport)
{
PostUserEvent(make_unique_dp<SetRectEvent>(rect, applyRotation, zoom, isAnim, useVisibleViewport,
nullptr /* parallelAnimCreator */ ));
nullptr /* parallelAnimCreator */));
}
void DrapeEngine::SetModelViewAnyRect(m2::AnyRectD const & rect, bool isAnim, bool useVisibleViewport)
@@ -234,8 +213,7 @@ void DrapeEngine::SetModelViewAnyRect(m2::AnyRectD const & rect, bool isAnim, bo
void DrapeEngine::ClearUserMarksGroup(kml::MarkGroupId groupId)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ClearUserMarkGroupMessage>(groupId),
MessagePriority::Normal);
make_unique_dp<ClearUserMarkGroupMessage>(groupId), MessagePriority::Normal);
}
void DrapeEngine::ChangeVisibilityUserMarksGroup(kml::MarkGroupId groupId, bool isVisible)
@@ -247,15 +225,13 @@ void DrapeEngine::ChangeVisibilityUserMarksGroup(kml::MarkGroupId groupId, bool
void DrapeEngine::InvalidateUserMarks()
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<InvalidateUserMarksMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, make_unique_dp<InvalidateUserMarksMessage>(),
MessagePriority::Normal);
}
void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
{
auto const updatedGroupIds = firstTime ? provider->GetAllGroupIds()
: provider->GetUpdatedGroupIds();
auto const updatedGroupIds = firstTime ? provider->GetAllGroupIds() : provider->GetUpdatedGroupIds();
if (updatedGroupIds.empty())
return;
@@ -267,10 +243,7 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
std::unordered_map<kml::MarkGroupId, drape_ptr<IDCollections>> groupsVisibleIds;
auto const groupFilter = [&](kml::MarkGroupId groupId)
{
return provider->IsGroupVisible(groupId) &&
(provider->GetBecameVisibleGroupIds().count(groupId) == 0);
};
{ return provider->IsGroupVisible(groupId) && (provider->GetBecameVisibleGroupIds().count(groupId) == 0); };
using GroupFilter = std::function<bool(kml::MarkGroupId groupId)>;
@@ -278,20 +251,16 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
GroupFilter const & filter, IDCollections & collection)
{
for (auto const markId : markIds)
{
if (filter == nullptr || filter(provider->GetUserPointMark(markId)->GetGroupId()))
collection.m_markIds.push_back(markId);
}
for (auto const lineId : lineIds)
{
if (filter == nullptr || filter(provider->GetUserLineMark(lineId)->GetGroupId()))
collection.m_lineIds.push_back(lineId);
}
};
auto const collectRenderData = [&](kml::MarkIdSet const & markIds, kml::TrackIdSet const & lineIds,
GroupFilter const & filter)
auto const collectRenderData =
[&](kml::MarkIdSet const & markIds, kml::TrackIdSet const & lineIds, GroupFilter const & filter)
{
for (auto const markId : markIds)
{
@@ -316,8 +285,8 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
if (provider->IsGroupVisible(groupId))
{
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId),
nullptr /* filter */, *visibleIdCollection);
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId), nullptr /* filter */,
*visibleIdCollection);
collectRenderData(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId),
nullptr /* filter */);
}
@@ -331,51 +300,43 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
auto visibleIdCollection = make_unique_dp<IDCollections>();
if (provider->IsGroupVisible(groupId))
{
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId),
nullptr /* filter */, *visibleIdCollection);
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId), nullptr /* filter */,
*visibleIdCollection);
}
groupsVisibleIds.emplace(groupId, std::move(visibleIdCollection));
}
collectIds(provider->GetCreatedMarkIds(), provider->GetCreatedLineIds(),
groupFilter, *justCreatedIdCollection);
collectIds(provider->GetRemovedMarkIds(), provider->GetRemovedLineIds(),
nullptr /* filter */, *removedIdCollection);
collectIds(provider->GetCreatedMarkIds(), provider->GetCreatedLineIds(), groupFilter, *justCreatedIdCollection);
collectIds(provider->GetRemovedMarkIds(), provider->GetRemovedLineIds(), nullptr /* filter */,
*removedIdCollection);
collectRenderData(provider->GetCreatedMarkIds(), provider->GetCreatedLineIds(), groupFilter);
collectRenderData(provider->GetUpdatedMarkIds(), provider->GetUpdatedLineIds(), groupFilter);
for (auto const groupId : provider->GetBecameVisibleGroupIds())
{
collectRenderData(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId),
nullptr /* filter */);
}
collectRenderData(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId), nullptr /* filter */);
for (auto const groupId : provider->GetBecameInvisibleGroupIds())
{
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId),
nullptr /* filter */, *removedIdCollection);
collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId), nullptr /* filter */,
*removedIdCollection);
}
}
if (!marksRenderCollection->empty() || !linesRenderCollection->empty() ||
!removedIdCollection->IsEmpty() || !justCreatedIdCollection->IsEmpty())
if (!marksRenderCollection->empty() || !linesRenderCollection->empty() || !removedIdCollection->IsEmpty() ||
!justCreatedIdCollection->IsEmpty())
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateUserMarksMessage>(
std::move(justCreatedIdCollection),
std::move(removedIdCollection),
std::move(marksRenderCollection),
std::move(linesRenderCollection)),
MessagePriority::Normal);
m_threadCommutator->PostMessage(
ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateUserMarksMessage>(std::move(justCreatedIdCollection), std::move(removedIdCollection),
std::move(marksRenderCollection), std::move(linesRenderCollection)),
MessagePriority::Normal);
}
for (auto & v : groupsVisibleIds)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateUserMarkGroupMessage>(
v.first,
std::move(v.second)),
make_unique_dp<UpdateUserMarkGroupMessage>(v.first, std::move(v.second)),
MessagePriority::Normal);
}
}
@@ -398,22 +359,19 @@ void DrapeEngine::SetRenderingDisabled(bool const destroySurface)
void DrapeEngine::InvalidateRect(m2::RectD const & rect)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<InvalidateRectMessage>(rect),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<InvalidateRectMessage>(rect),
MessagePriority::High);
}
void DrapeEngine::UpdateMapStyle()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<UpdateMapStyleMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<UpdateMapStyleMessage>(),
MessagePriority::High);
}
void DrapeEngine::RecacheMapShapes()
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<MapShapesRecacheMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, make_unique_dp<MapShapesRecacheMessage>(),
MessagePriority::Normal);
}
@@ -431,8 +389,7 @@ void DrapeEngine::RecacheGui(bool needResetOldGui)
void DrapeEngine::PostUserEvent(drape_ptr<UserEvent> && e)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<PostUserEventMessage>(std::move(e)),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<PostUserEventMessage>(std::move(e)),
MessagePriority::Normal);
}
@@ -480,8 +437,7 @@ void DrapeEngine::ResizeImpl(int w, int h)
void DrapeEngine::SetCompassInfo(location::CompassInfo const & info)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<CompassInfoMessage>(info),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<CompassInfoMessage>(info),
MessagePriority::Normal);
}
@@ -517,13 +473,11 @@ void DrapeEngine::StopLocationFollow()
MessagePriority::Normal);
}
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom,
bool isArrowGlued)
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued)
{
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d, enableAutoZoom,
isArrowGlued),
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d, enableAutoZoom, isArrowGlued),
MessagePriority::Normal);
}
@@ -551,30 +505,27 @@ void DrapeEngine::SetUserPositionListener(UserPositionChangedHandler && fn)
m_userPositionChangedHandler = std::move(fn);
}
void DrapeEngine::SelectObject(SelectionShape::ESelectedObject obj, m2::PointD const & pt,
FeatureID const & featureId, bool isAnim,
bool isGeometrySelectionAllowed, bool isSelectionShapeVisible)
void DrapeEngine::SelectObject(SelectionShape::ESelectedObject obj, m2::PointD const & pt, FeatureID const & featureId,
bool isAnim, bool isGeometrySelectionAllowed, bool isSelectionShapeVisible)
{
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<SelectObjectMessage>(obj, pt, featureId, isAnim, isGeometrySelectionAllowed,
isSelectionShapeVisible),
MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SelectObjectMessage>(
obj, pt, featureId, isAnim, isGeometrySelectionAllowed, isSelectionShapeVisible),
MessagePriority::Normal);
}
void DrapeEngine::DeselectObject(bool restoreViewport)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SelectObjectMessage>(SelectObjectMessage::DismissTag(), restoreViewport),
MessagePriority::Normal);
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<SelectObjectMessage>(SelectObjectMessage::DismissTag(), restoreViewport), MessagePriority::Normal);
}
dp::DrapeID DrapeEngine::AddSubroute(SubrouteConstPtr subroute)
{
dp::DrapeID const id = GenerateDrapeID();
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<AddSubrouteMessage>(id, subroute),
MessagePriority::Normal);
make_unique_dp<AddSubrouteMessage>(id, subroute), MessagePriority::Normal);
return id;
}
@@ -587,8 +538,7 @@ void DrapeEngine::RemoveSubroute(dp::DrapeID subrouteId, bool deactivateFollowin
void DrapeEngine::DeactivateRouteFollowing()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<DeactivateRouteFollowingMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<DeactivateRouteFollowingMessage>(),
MessagePriority::Normal);
}
@@ -611,14 +561,12 @@ dp::DrapeID DrapeEngine::AddRoutePreviewSegment(m2::PointD const & startPt, m2::
void DrapeEngine::RemoveRoutePreviewSegment(dp::DrapeID segmentId)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<RemoveRoutePreviewSegmentMessage>(segmentId),
MessagePriority::Normal);
make_unique_dp<RemoveRoutePreviewSegmentMessage>(segmentId), MessagePriority::Normal);
}
void DrapeEngine::RemoveAllRoutePreviewSegments()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<RemoveRoutePreviewSegmentMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<RemoveRoutePreviewSegmentMessage>(),
MessagePriority::Normal);
}
@@ -632,60 +580,50 @@ void DrapeEngine::SetWidgetLayout(gui::TWidgetsLayoutInfo && info)
itInfo->second.m_pixelPivot = layout.second;
}
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout),
MessagePriority::Normal);
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout), MessagePriority::Normal);
}
void DrapeEngine::AllowAutoZoom(bool allowAutoZoom)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<AllowAutoZoomMessage>(allowAutoZoom),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<AllowAutoZoomMessage>(allowAutoZoom),
MessagePriority::Normal);
}
void DrapeEngine::Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<Allow3dBuildingsMessage>(allow3dBuildings),
MessagePriority::Normal);
make_unique_dp<Allow3dBuildingsMessage>(allow3dBuildings), MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<Allow3dModeMessage>(allowPerspectiveInNavigation,
allow3dBuildings),
make_unique_dp<Allow3dModeMessage>(allowPerspectiveInNavigation, allow3dBuildings),
MessagePriority::Normal);
}
void DrapeEngine::SetMapLangIndex(int8_t mapLangIndex)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<SetMapLangIndexMessage>(mapLangIndex),
MessagePriority::Normal);
make_unique_dp<SetMapLangIndexMessage>(mapLangIndex), MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SetMapLangIndexMessage>(mapLangIndex),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<SetMapLangIndexMessage>(mapLangIndex),
MessagePriority::Normal);
}
void DrapeEngine::EnablePerspective()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<EnablePerspectiveMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<EnablePerspectiveMessage>(),
MessagePriority::Normal);
}
void DrapeEngine::UpdateGpsTrackPoints(std::vector<df::GpsTrackPoint> && toAdd,
std::vector<uint32_t> && toRemove)
void DrapeEngine::UpdateGpsTrackPoints(std::vector<df::GpsTrackPoint> && toAdd, std::vector<uint32_t> && toRemove)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<UpdateGpsTrackPointsMessage>(std::move(toAdd),
std::move(toRemove)),
make_unique_dp<UpdateGpsTrackPointsMessage>(std::move(toAdd), std::move(toRemove)),
MessagePriority::Normal);
}
void DrapeEngine::ClearGpsTrackPoints()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<ClearGpsTrackPointsMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<ClearGpsTrackPointsMessage>(),
MessagePriority::Normal);
}
@@ -698,24 +636,22 @@ void DrapeEngine::EnableChoosePositionMode(bool enable, std::vector<m2::Triangle
{
StopLocationFollow();
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ShowChoosePositionMarkMessage>(),
MessagePriority::Normal);
make_unique_dp<ShowChoosePositionMarkMessage>(), MessagePriority::Normal);
kineticScroll = false;
}
else
{
RecacheGui(true);
}
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SetAddNewPlaceModeMessage>(enable, std::move(boundAreaTriangles),
kineticScroll, optionalPosition),
MessagePriority::Normal);
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<SetAddNewPlaceModeMessage>(enable, std::move(boundAreaTriangles), kineticScroll, optionalPosition),
MessagePriority::Normal);
}
void DrapeEngine::BlockTapEvents(bool block)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<BlockTapEventsMessage>(block),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<BlockTapEventsMessage>(block),
MessagePriority::Normal);
}
@@ -734,8 +670,7 @@ void DrapeEngine::OnEnterForeground()
{
double const backgroundTime = base::Timer::LocalTime() - m_startBackgroundTime;
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<OnEnterForegroundMessage>(backgroundTime),
MessagePriority::High);
make_unique_dp<OnEnterForegroundMessage>(backgroundTime), MessagePriority::High);
}
void DrapeEngine::OnEnterBackground()
@@ -752,9 +687,9 @@ void DrapeEngine::OnEnterBackground()
/// especially Android with its AppBackgroundTracker.
m_frontend->OnEnterBackground();
// m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
// make_unique_dp<OnEnterBackgroundMessage>(),
// MessagePriority::High);
// m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
// make_unique_dp<OnEnterBackgroundMessage>(),
// MessagePriority::High);
}
void DrapeEngine::RequestSymbolsSize(std::vector<std::string> const & symbols,
@@ -768,8 +703,7 @@ void DrapeEngine::RequestSymbolsSize(std::vector<std::string> const & symbols,
void DrapeEngine::EnableTraffic(bool trafficEnabled)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<EnableTrafficMessage>(trafficEnabled),
MessagePriority::Normal);
make_unique_dp<EnableTrafficMessage>(trafficEnabled), MessagePriority::Normal);
}
void DrapeEngine::UpdateTraffic(traffic::TrafficInfo const & info)
@@ -793,8 +727,7 @@ void DrapeEngine::UpdateTraffic(traffic::TrafficInfo const & info)
void DrapeEngine::ClearTrafficCache(MwmSet::MwmId const & mwmId)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ClearTrafficDataMessage>(mwmId),
MessagePriority::Normal);
make_unique_dp<ClearTrafficDataMessage>(mwmId), MessagePriority::Normal);
}
void DrapeEngine::SetSimplifiedTrafficColors(bool simplified)
@@ -807,22 +740,19 @@ void DrapeEngine::SetSimplifiedTrafficColors(bool simplified)
void DrapeEngine::EnableTransitScheme(bool enable)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<EnableTransitSchemeMessage>(enable),
MessagePriority::Normal);
make_unique_dp<EnableTransitSchemeMessage>(enable), MessagePriority::Normal);
}
void DrapeEngine::ClearTransitSchemeCache(MwmSet::MwmId const & mwmId)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ClearTransitSchemeDataMessage>(mwmId),
MessagePriority::Normal);
make_unique_dp<ClearTransitSchemeDataMessage>(mwmId), MessagePriority::Normal);
}
void DrapeEngine::ClearAllTransitSchemeCache()
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<ClearAllTransitSchemeDataMessage>(),
MessagePriority::Normal);
make_unique_dp<ClearAllTransitSchemeDataMessage>(), MessagePriority::Normal);
}
void DrapeEngine::UpdateTransitScheme(TransitDisplayInfos && transitDisplayInfos)
@@ -835,8 +765,7 @@ void DrapeEngine::UpdateTransitScheme(TransitDisplayInfos && transitDisplayInfos
void DrapeEngine::EnableIsolines(bool enable)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<EnableIsolinesMessage>(enable),
MessagePriority::Normal);
make_unique_dp<EnableIsolinesMessage>(enable), MessagePriority::Normal);
}
void DrapeEngine::SetFontScaleFactor(double scaleFactor)
@@ -856,22 +785,19 @@ void DrapeEngine::RunScenario(ScenarioManager::ScenarioData && scenarioData,
void DrapeEngine::SetCustomFeatures(df::CustomFeatures && ids)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<SetCustomFeaturesMessage>(std::move(ids)),
MessagePriority::Normal);
make_unique_dp<SetCustomFeaturesMessage>(std::move(ids)), MessagePriority::Normal);
}
void DrapeEngine::RemoveCustomFeatures(MwmSet::MwmId const & mwmId)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<RemoveCustomFeaturesMessage>(mwmId),
MessagePriority::Normal);
make_unique_dp<RemoveCustomFeaturesMessage>(mwmId), MessagePriority::Normal);
}
void DrapeEngine::RemoveAllCustomFeatures()
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<RemoveCustomFeaturesMessage>(),
MessagePriority::Normal);
make_unique_dp<RemoveCustomFeaturesMessage>(), MessagePriority::Normal);
}
void DrapeEngine::SetPosteffectEnabled(PostprocessRenderer::Effect effect, bool enabled)
@@ -889,23 +815,20 @@ void DrapeEngine::SetPosteffectEnabled(PostprocessRenderer::Effect effect, bool
void DrapeEngine::RunFirstLaunchAnimation()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<RunFirstLaunchAnimationMessage>(),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<RunFirstLaunchAnimationMessage>(),
MessagePriority::Normal);
}
void DrapeEngine::ShowDebugInfo(bool shown)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<ShowDebugInfoMessage>(shown),
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp<ShowDebugInfoMessage>(shown),
MessagePriority::Normal);
}
void DrapeEngine::EnableDebugRectRendering(bool enabled)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<EnableDebugRectRenderingMessage>(enabled),
MessagePriority::Normal);
make_unique_dp<EnableDebugRectRenderingMessage>(enabled), MessagePriority::Normal);
}
drape_ptr<UserMarkRenderParams> DrapeEngine::GenerateMarkRenderInfo(UserPointMark const * mark)
@@ -952,15 +875,12 @@ drape_ptr<UserLineRenderParams> DrapeEngine::GenerateLineRenderInfo(UserLineMark
renderInfo->m_depthLayer = mark->GetDepthLayer();
mark->ForEachGeometry([&renderInfo](std::vector<m2::PointD> && points)
{
renderInfo->m_splines.emplace_back(std::move(points));
});
{ renderInfo->m_splines.emplace_back(std::move(points)); });
renderInfo->m_layers.reserve(mark->GetLayerCount());
for (size_t layerIndex = 0, layersCount = mark->GetLayerCount(); layerIndex < layersCount; ++layerIndex)
{
renderInfo->m_layers.emplace_back(mark->GetColor(layerIndex),
mark->GetWidth(layerIndex),
renderInfo->m_layers.emplace_back(mark->GetColor(layerIndex), mark->GetWidth(layerIndex),
mark->GetDepth(layerIndex));
}
return renderInfo;
@@ -979,8 +899,7 @@ void DrapeEngine::UpdateVisualScale(double vs, bool needStopRendering)
RecacheGui(false);
RecacheMapShapes();
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<RecoverContextDependentResourcesMessage>(),
MessagePriority::Normal);
make_unique_dp<RecoverContextDependentResourcesMessage>(), MessagePriority::Normal);
}
void DrapeEngine::UpdateMyPositionRoutingOffset(bool useDefault, int offsetY)
@@ -992,8 +911,8 @@ void DrapeEngine::UpdateMyPositionRoutingOffset(bool useDefault, int offsetY)
void DrapeEngine::SetCustomArrow3d(std::optional<Arrow3dCustomDecl> arrow3dCustomDecl)
{
m_threadCommutator->PostMessage(
ThreadsCommutator::ResourceUploadThread,
make_unique_dp<Arrow3dRecacheMessage>(std::move(arrow3dCustomDecl)), MessagePriority::High);
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<Arrow3dRecacheMessage>(std::move(arrow3dCustomDecl)),
MessagePriority::High);
}
} // namespace df