[core] always add labels to buffers in MapMode::Still

To minimize label clipping.
This commit is contained in:
Mike Morris
2015-10-27 17:46:19 -04:00
committed by Ansis Brammanis
parent 9d6cb1361c
commit dc1630f50d
11 changed files with 33 additions and 12 deletions

View File

@@ -114,7 +114,8 @@ bool SymbolLayer::recalculate(const StyleCalculationParameters& parameters) {
std::unique_ptr<Bucket> SymbolLayer::createBucket(StyleBucketParameters& parameters) const {
auto bucket = std::make_unique<SymbolBucket>(parameters.tileID.overscaling,
parameters.tileID.z);
parameters.tileID.z,
parameters.mode);
bucket->layout = layout;

View File

@@ -330,6 +330,7 @@ TileData::State Source::addTile(const TileID& id, const StyleUpdateParameters& p
std::move(monitor),
info.source_id,
parameters.style,
parameters.mode,
callback);
}

View File

@@ -21,13 +21,15 @@ TileWorker::TileWorker(TileID id_,
SpriteStore& spriteStore_,
GlyphAtlas& glyphAtlas_,
GlyphStore& glyphStore_,
const std::atomic<TileData::State>& state_)
const std::atomic<TileData::State>& state_,
const MapMode mode_)
: id(id_),
sourceID(std::move(sourceID_)),
spriteStore(spriteStore_),
glyphAtlas(glyphAtlas_),
glyphStore(glyphStore_),
state(state_) {
state(state_),
mode(mode_) {
}
TileWorker::~TileWorker() {
@@ -140,7 +142,8 @@ void TileWorker::parseLayer(const StyleLayer* layer, const GeometryTile& geometr
spriteStore,
glyphAtlas,
glyphStore,
*collisionTile);
*collisionTile,
mode);
std::unique_ptr<Bucket> bucket = layer->createBucket(parameters);

View File

@@ -3,6 +3,7 @@
#include <mapbox/variant.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/map/tile_data.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/ptr.hpp>
@@ -44,7 +45,8 @@ public:
SpriteStore&,
GlyphAtlas&,
GlyphStore&,
const std::atomic<TileData::State>&);
const std::atomic<TileData::State>&,
const MapMode);
~TileWorker();
TileParseResult parseAllLayers(std::vector<std::unique_ptr<StyleLayer>>,
@@ -67,6 +69,7 @@ private:
GlyphAtlas& glyphAtlas;
GlyphStore& glyphStore;
const std::atomic<TileData::State>& state;
const MapMode mode;
bool partialParse = false;

View File

@@ -12,6 +12,7 @@ VectorTileData::VectorTileData(const TileID& id_,
std::unique_ptr<GeometryTileMonitor> monitor_,
std::string sourceID,
Style& style_,
const MapMode mode_,
const std::function<void()>& callback)
: TileData(id_),
style(style_),
@@ -21,7 +22,8 @@ VectorTileData::VectorTileData(const TileID& id_,
*style_.spriteStore,
*style_.glyphAtlas,
*style_.glyphStore,
state),
state,
mode_),
monitor(std::move(monitor_))
{
state = State::loading;

View File

@@ -22,6 +22,7 @@ public:
std::unique_ptr<GeometryTileMonitor> monitor,
std::string sourceID,
Style&,
const MapMode,
const std::function<void()>& callback);
~VectorTileData();

View File

@@ -53,8 +53,8 @@ SymbolInstance::SymbolInstance(Anchor& anchor, const std::vector<Coordinate>& li
iconCollisionFeature(line, anchor, shapedIcon, iconBoxScale, iconPadding, iconAlongLine) {};
SymbolBucket::SymbolBucket(float overscaling_, float zoom_)
: overscaling(overscaling_), zoom(zoom_), tileSize(512 * overscaling_), tilePixelRatio(tileExtent / tileSize) {
SymbolBucket::SymbolBucket(float overscaling_, float zoom_, const MapMode mode_)
: overscaling(overscaling_), zoom(zoom_), tileSize(512 * overscaling_), tilePixelRatio(tileExtent / tileSize), mode(mode_) {
}
SymbolBucket::~SymbolBucket() {
@@ -329,7 +329,7 @@ void SymbolBucket::addFeature(const std::vector<std::vector<Coordinate>> &lines,
// the buffers for both tiles and clipped to tile boundaries at draw time.
//
// TODO remove the `&& false` when is #1673 implemented
const bool addToBuffers = inside || (mayOverlap && false);
const bool addToBuffers = (mode == MapMode::Still) || inside || (mayOverlap && false);
symbolInstances.emplace_back(anchor, line, shapedText, shapedIcon, layout, addToBuffers,
textBoxScale, textPadding, textAlongLine,

View File

@@ -3,6 +3,7 @@
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/map/geometry_tile.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/geometry/vao.hpp>
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/geometry/text_buffer.hpp>
@@ -65,7 +66,7 @@ class SymbolBucket : public Bucket {
typedef ElementGroup<1> CollisionBoxElementGroup;
public:
SymbolBucket(float overscaling, float zoom);
SymbolBucket(float overscaling, float zoom, const MapMode);
~SymbolBucket() override;
void upload() override;
@@ -119,6 +120,7 @@ private:
const float tileSize;
const float tileExtent = 4096.0f;
const float tilePixelRatio;
const MapMode mode;
std::set<GlyphRange> ranges;
std::vector<SymbolInstance> symbolInstances;

View File

@@ -132,6 +132,7 @@ void Style::update(const TransformState& transform,
workers,
texturePool,
shouldReparsePartialTiles,
data.mode,
data,
*this);

View File

@@ -1,6 +1,7 @@
#ifndef STYLE_BUCKET_PARAMETERS
#define STYLE_BUCKET_PARAMETERS
#include <mbgl/map/mode.hpp>
#include <mbgl/style/filter_expression.hpp>
#include <mbgl/map/tile_data.hpp>
@@ -26,7 +27,8 @@ public:
SpriteStore& spriteStore_,
GlyphAtlas& glyphAtlas_,
GlyphStore& glyphStore_,
CollisionTile& collisionTile_)
CollisionTile& collisionTile_,
const MapMode mode_)
: tileID(tileID_),
layer(layer_),
state(state_),
@@ -35,7 +37,8 @@ public:
spriteStore(spriteStore_),
glyphAtlas(glyphAtlas_),
glyphStore(glyphStore_),
collisionTile(collisionTile_) {}
collisionTile(collisionTile_),
mode(mode_) {}
bool cancelled() const {
return state == TileData::State::obsolete;
@@ -52,6 +55,7 @@ public:
GlyphAtlas& glyphAtlas;
GlyphStore& glyphStore;
CollisionTile& collisionTile;
const MapMode mode;
};
} // namespace mbgl

View File

@@ -20,6 +20,7 @@ public:
Worker& worker_,
TexturePool& texturePool_,
bool shouldReparsePartialTiles_,
const MapMode mode_,
MapData& data_,
Style& style_)
: pixelRatio(pixelRatio_),
@@ -29,6 +30,7 @@ public:
worker(worker_),
texturePool(texturePool_),
shouldReparsePartialTiles(shouldReparsePartialTiles_),
mode(mode_),
data(data_),
style(style_) {}
@@ -39,6 +41,7 @@ public:
Worker& worker;
TexturePool& texturePool;
bool shouldReparsePartialTiles;
const MapMode mode;
// TODO: remove
MapData& data;