From 769a822fec2090fc37e00344dc63d5a1c2e32ac2 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Thu, 16 Jan 2020 12:05:11 +0200 Subject: [core] Pass UpdateParameters to Placement constructor --- src/mbgl/text/placement.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/mbgl/text/placement.cpp') diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index f3917a8fdb..5673ff5041 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -1,11 +1,12 @@ #include #include +#include +#include #include #include +#include #include -#include -#include #include #include @@ -60,9 +61,7 @@ const CollisionGroups::CollisionGroup& CollisionGroups::get(const std::string& s // PlacementController implemenation -PlacementController::PlacementController() - : placement(makeMutable( - TransformState{}, MapMode::Static, style::TransitionOptions{}, true, TimePoint(), nullopt)) {} +PlacementController::PlacementController() : placement(makeMutable()) {} void PlacementController::setPlacement(Immutable placement_) { placement = std::move(placement_); @@ -91,18 +90,15 @@ bool PlacementController::hasTransitions(TimePoint now) const { // Placement implementation -Placement::Placement(const TransformState& state_, - MapMode mapMode_, - style::TransitionOptions transitionOptions_, - const bool crossSourceCollisions, - TimePoint commitTime_, +Placement::Placement(std::shared_ptr updateParameters_, optional> prevPlacement_) - : collisionIndex(state_, mapMode_), - mapMode(mapMode_), - transitionOptions(std::move(transitionOptions_)), - commitTime(commitTime_), - placementZoom(state_.getZoom()), - collisionGroups(crossSourceCollisions), + : updateParameters(std::move(updateParameters_)), + collisionIndex(updateParameters->transformState, updateParameters->mode), + mapMode(updateParameters->mode), + transitionOptions(updateParameters->transitionOptions), + commitTime(updateParameters->timePoint), + placementZoom(updateParameters->transformState.getZoom()), + collisionGroups(updateParameters->crossSourceCollisions), prevPlacement(std::move(prevPlacement_)) { assert(prevPlacement || mapMode != MapMode::Continuous); if (prevPlacement) { @@ -110,6 +106,8 @@ Placement::Placement(const TransformState& state_, } } +Placement::Placement() : collisionIndex({}, MapMode::Static), collisionGroups(true) {} + void Placement::placeLayer(const RenderLayer& layer, const mat4& projMatrix, bool showCollisionBoxes) { std::set seenCrossTileIDs; for (const auto& item : layer.getPlacementData()) { -- cgit v1.2.1