Check if text_symbolizer has 'placement finder'(keys::text_placements) before any text processing

This commit is contained in:
Artem Pavlenko 2024-06-04 12:15:10 +01:00
parent d7a8f1d04a
commit 61cb187dbb
6 changed files with 16 additions and 1 deletions

View file

@ -42,6 +42,8 @@ void agg_renderer<T0, T1>::process(shield_symbolizer const& sym,
const auto transform = get_optional<transform_type>(sym, keys::geometry_transform); const auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
const text_symbolizer_helper helper(sym, const text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,

View file

@ -42,6 +42,8 @@ void agg_renderer<T0, T1>::process(text_symbolizer const& sym,
const auto transform = get_optional<transform_type>(sym, keys::geometry_transform); const auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
const text_symbolizer_helper helper(sym, const text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,

View file

@ -43,6 +43,8 @@ void cairo_renderer<T>::process(shield_symbolizer const& sym,
auto transform = get_optional<transform_type>(sym, keys::geometry_transform); auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
text_symbolizer_helper helper(sym, text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,
@ -86,6 +88,8 @@ void cairo_renderer<T>::process(text_symbolizer const& sym,
auto transform = get_optional<transform_type>(sym, keys::geometry_transform); auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
text_symbolizer_helper helper(sym, text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,

View file

@ -51,7 +51,8 @@ void grid_renderer<T>::process(shield_symbolizer const& sym,
auto transform = get_optional<transform_type>(sym, keys::geometry_transform); auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
text_symbolizer_helper helper(sym, text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,

View file

@ -43,6 +43,8 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
auto transform = get_optional<transform_type>(sym, keys::geometry_transform); auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) if (transform)
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
text_symbolizer_helper helper(sym, text_symbolizer_helper helper(sym,
feature, feature,
common_.vars_, common_.vars_,

View file

@ -98,6 +98,8 @@ void render_thunk_extractor::operator()(markers_symbolizer const& sym) const
void render_thunk_extractor::operator()(text_symbolizer const& sym) const void render_thunk_extractor::operator()(text_symbolizer const& sym) const
{ {
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
auto helper = std::make_unique<text_symbolizer_helper>(sym, auto helper = std::make_unique<text_symbolizer_helper>(sym,
feature_, feature_,
vars_, vars_,
@ -116,6 +118,8 @@ void render_thunk_extractor::operator()(text_symbolizer const& sym) const
void render_thunk_extractor::operator()(shield_symbolizer const& sym) const void render_thunk_extractor::operator()(shield_symbolizer const& sym) const
{ {
if (!mapnik::get<text_placements_ptr>(sym, keys::text_placements_))
return;
auto helper = std::make_unique<text_symbolizer_helper>(sym, auto helper = std::make_unique<text_symbolizer_helper>(sym,
feature_, feature_,
vars_, vars_,