summaryrefslogtreecommitdiff
path: root/src/mbgl/text/placement.cpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-01-16 12:05:11 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-01-22 14:30:26 +0200
commit769a822fec2090fc37e00344dc63d5a1c2e32ac2 (patch)
tree83fbd610bd9498b4032077c03592fbcd3d2f930a /src/mbgl/text/placement.cpp
parentd24c1d625af61328b8ada2d005ab3f9e659a2c69 (diff)
downloadqtlocation-mapboxgl-769a822fec2090fc37e00344dc63d5a1c2e32ac2.tar.gz
[core] Pass UpdateParameters to Placement constructor
Diffstat (limited to 'src/mbgl/text/placement.cpp')
-rw-r--r--src/mbgl/text/placement.cpp30
1 files changed, 14 insertions, 16 deletions
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 <mbgl/text/placement.hpp>
#include <mbgl/layout/symbol_layout.hpp>
+#include <mbgl/renderer/bucket.hpp>
+#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/renderer/update_parameters.hpp>
#include <mbgl/tile/geometry_tile.hpp>
-#include <mbgl/renderer/buckets/symbol_bucket.hpp>
-#include <mbgl/renderer/bucket.hpp>
#include <mbgl/util/math.hpp>
#include <utility>
@@ -60,9 +61,7 @@ const CollisionGroups::CollisionGroup& CollisionGroups::get(const std::string& s
// PlacementController implemenation
-PlacementController::PlacementController()
- : placement(makeMutable<Placement>(
- TransformState{}, MapMode::Static, style::TransitionOptions{}, true, TimePoint(), nullopt)) {}
+PlacementController::PlacementController() : placement(makeMutable<Placement>()) {}
void PlacementController::setPlacement(Immutable<Placement> 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<const UpdateParameters> updateParameters_,
optional<Immutable<Placement>> 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<uint32_t> seenCrossTileIDs;
for (const auto& item : layer.getPlacementData()) {