Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Oct 22, 2019
1 parent 36e9a29 commit 0fe6136
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/mbgl/text/placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,12 @@ void Placement::placeBucket(
}
}

const bool doVariableIconPlacement = hasIconTextFit && !iconAllowOverlap && symbolInstance.placedIconIndex;
const bool doVariableIconPlacement =
hasIconTextFit && !iconAllowOverlap && symbolInstance.placedIconIndex;

const auto placeFeatureForVariableAnchors = [&] (const CollisionFeature& collisionFeature, style::TextWritingModeType orientation, const CollisionFeature& iconCollisionFeature) {
const auto placeFeatureForVariableAnchors = [&](const CollisionFeature& collisionFeature,
style::TextWritingModeType orientation,
const CollisionFeature& iconCollisionFeature) {
const CollisionBox& textBox = collisionFeature.boxes[0];
const float width = textBox.x2 - textBox.x1;
const float height = textBox.y2 - textBox.y1;
Expand All @@ -333,9 +336,20 @@ void Placement::placeBucket(
params.showCollisionBoxes, avoidEdges, collisionGroup.second, textBoxes);

if (doVariableIconPlacement) {
auto placedIconFeature = collisionIndex.placeFeature(iconCollisionFeature, shift,
posMatrix, iconLabelPlaneMatrix, pixelRatio, placedSymbol, scale, fontSize, iconAllowOverlap, pitchWithMap,
params.showCollisionBoxes, avoidEdges, collisionGroup.second, iconBoxes);
auto placedIconFeature = collisionIndex.placeFeature(iconCollisionFeature,
shift,
posMatrix,
iconLabelPlaneMatrix,
pixelRatio,
placedSymbol,
scale,
fontSize,
iconAllowOverlap,
pitchWithMap,
params.showCollisionBoxes,
avoidEdges,
collisionGroup.second,
iconBoxes);
iconBoxes.clear();
if (!placedIconFeature.first) continue;
}
Expand Down Expand Up @@ -377,13 +391,18 @@ void Placement::placeBucket(
};

const auto placeHorizontal = [&] {
return placeFeatureForVariableAnchors(symbolInstance.textCollisionFeature, style::TextWritingModeType::Horizontal, symbolInstance.iconCollisionFeature);
return placeFeatureForVariableAnchors(symbolInstance.textCollisionFeature,
style::TextWritingModeType::Horizontal,
symbolInstance.iconCollisionFeature);
};

const auto placeVertical = [&] {
if (bucket.allowVerticalPlacement && !placed.first && symbolInstance.verticalTextCollisionFeature) {
return placeFeatureForVariableAnchors(*symbolInstance.verticalTextCollisionFeature, style::TextWritingModeType::Vertical,
symbolInstance.verticalIconCollisionFeature ? *symbolInstance.verticalIconCollisionFeature : symbolInstance.iconCollisionFeature);
return placeFeatureForVariableAnchors(*symbolInstance.verticalTextCollisionFeature,
style::TextWritingModeType::Vertical,
symbolInstance.verticalIconCollisionFeature
? *symbolInstance.verticalIconCollisionFeature
: symbolInstance.iconCollisionFeature);
}
return std::pair<bool, bool>{false, false};
};
Expand Down

0 comments on commit 0fe6136

Please sign in to comment.