[core] Pass fully-evaluated layout properties to SymbolInstance and quad methods
This commit is contained in:
@@ -9,7 +9,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor,
|
||||
const GeometryCoordinates& line,
|
||||
const std::pair<Shaping, Shaping>& shapedTextOrientations,
|
||||
const PositionedIcon& shapedIcon,
|
||||
const SymbolLayoutProperties::PossiblyEvaluated& layout,
|
||||
const SymbolLayoutProperties::Evaluated& layout,
|
||||
const bool addToBuffers,
|
||||
const uint32_t index_,
|
||||
const float textBoxScale,
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
const GeometryCoordinates& line,
|
||||
const std::pair<Shaping, Shaping>& shapedTextOrientations,
|
||||
const PositionedIcon& shapedIcon,
|
||||
const style::SymbolLayoutProperties::PossiblyEvaluated&,
|
||||
const style::SymbolLayoutProperties::Evaluated&,
|
||||
const bool inside,
|
||||
const uint32_t index,
|
||||
const float textBoxScale,
|
||||
|
||||
@@ -347,7 +347,7 @@ void SymbolLayout::addFeature(const std::size_t index,
|
||||
|
||||
const bool addToBuffers = mode == MapMode::Still || withinPlus0;
|
||||
|
||||
symbolInstances.emplace_back(anchor, line, shapedTextOrientations, shapedIcon, layout, addToBuffers, symbolInstances.size(),
|
||||
symbolInstances.emplace_back(anchor, line, shapedTextOrientations, shapedIcon, layout.evaluate(zoom, feature), addToBuffers, symbolInstances.size(),
|
||||
textBoxScale, textPadding, textPlacement,
|
||||
iconBoxScale, iconPadding, iconPlacement,
|
||||
face, indexedFeature, index);
|
||||
|
||||
@@ -18,7 +18,7 @@ const float globalMinScale = 0.5f; // underscale by 1 zoom level
|
||||
SymbolQuad getIconQuad(const Anchor& anchor,
|
||||
const PositionedIcon& shapedIcon,
|
||||
const GeometryCoordinates& line,
|
||||
const SymbolLayoutProperties::PossiblyEvaluated& layout,
|
||||
const SymbolLayoutProperties::Evaluated& layout,
|
||||
const style::SymbolPlacementType placement,
|
||||
const Shaping& shapedText) {
|
||||
auto image = *(shapedIcon.image);
|
||||
@@ -292,7 +292,7 @@ SymbolQuads getGlyphQuads(Anchor& anchor,
|
||||
const Shaping& shapedText,
|
||||
const float boxScale,
|
||||
const GeometryCoordinates& line,
|
||||
const SymbolLayoutProperties::PossiblyEvaluated& layout,
|
||||
const SymbolLayoutProperties::Evaluated& layout,
|
||||
const style::SymbolPlacementType placement,
|
||||
const GlyphPositions& face) {
|
||||
const float textRotate = layout.get<TextRotate>() * util::DEG2RAD;
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef std::vector<SymbolQuad> SymbolQuads;
|
||||
SymbolQuad getIconQuad(const Anchor& anchor,
|
||||
const PositionedIcon& shapedIcon,
|
||||
const GeometryCoordinates& line,
|
||||
const style::SymbolLayoutProperties::PossiblyEvaluated&,
|
||||
const style::SymbolLayoutProperties::Evaluated&,
|
||||
style::SymbolPlacementType placement,
|
||||
const Shaping& shapedText);
|
||||
|
||||
@@ -62,7 +62,7 @@ SymbolQuads getGlyphQuads(Anchor& anchor,
|
||||
const Shaping& shapedText,
|
||||
const float boxScale,
|
||||
const GeometryCoordinates& line,
|
||||
const style::SymbolLayoutProperties::PossiblyEvaluated&,
|
||||
const style::SymbolLayoutProperties::Evaluated&,
|
||||
style::SymbolPlacementType placement,
|
||||
const GlyphPositions& face);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using namespace mbgl;
|
||||
using namespace mbgl::style;
|
||||
|
||||
TEST(getIconQuads, normal) {
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
Anchor anchor(2.0, 3.0, 0.0, 0.5f, 0);
|
||||
SpriteAtlasElement image = {
|
||||
Rect<uint16_t>( 0, 0, 15, 11 ),
|
||||
@@ -59,7 +59,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// none
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
SymbolQuad quad =
|
||||
getIconQuad(anchor, shapedIcon, line, layout, SymbolPlacementType::Point, shapedText);
|
||||
|
||||
@@ -80,7 +80,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 24.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Width;
|
||||
SymbolQuad quad =
|
||||
@@ -98,7 +98,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width x textSize
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Width;
|
||||
SymbolQuad quad =
|
||||
@@ -116,7 +116,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width x textSize + padding
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Width;
|
||||
layout.get<IconTextFitPadding>()[0] = 5.0f;
|
||||
@@ -138,7 +138,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// height
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 24.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Height;
|
||||
SymbolQuad quad =
|
||||
@@ -156,7 +156,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// height x textSize
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Height;
|
||||
SymbolQuad quad =
|
||||
@@ -174,7 +174,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// height x textSize + padding
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Height;
|
||||
layout.get<IconTextFitPadding>()[0] = 5.0f;
|
||||
@@ -196,7 +196,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 24.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Both;
|
||||
SymbolQuad quad =
|
||||
@@ -214,7 +214,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both x textSize
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Both;
|
||||
SymbolQuad quad =
|
||||
@@ -232,7 +232,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both x textSize + padding
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Both;
|
||||
layout.get<IconTextFitPadding>()[0] = 5.0f;
|
||||
@@ -254,7 +254,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both x textSize + padding t/r/b/l
|
||||
{
|
||||
SymbolLayoutProperties::PossiblyEvaluated layout;
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
layout.get<IconTextFit>() = IconTextFitType::Both;
|
||||
layout.get<IconTextFitPadding>()[0] = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user